I want to get the whole buffer contents as a single string. Currently I'm doing this:
let line_ending = "\n"
let text = join(getline(1, '$'), line_ending).line_ending
But this assumes the line ending. If this is the best approach, how can I find out what the line ending actually is?
Or is there a better way to get the actual buffer contents?
fileformat
option looks like it gives me the buffer's line endings (assuming they are not mixed).