Otherwise, line2byte(1) will returns -1 when opening an empty file, and
an error will be produced when trying to jump to that non-existent
position. Just require the previous line to be >1 before trying to use
it, since changing position to line 1 is pointless anyway.
" Jump to last cursor position when editing a file.
autocmd BufReadPost *
- \ if line("'\"") > 0 && line("'\"") <= line("$") |
+ \ if line("'\"") > 1 && line("'\"") <= line("$") |
\ execute "goto" line2byte(line("'\"")) |
\ endif