I added following to my init.vim in order to preserve the last opened file position:

if has("autocmd")
    au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | execute "normal! g'\"" | endif

However I can still enter into insert mode which is not desirable.

So I tried to use less.sh script instead, which is really like the less command. However this does not store file position.

Is there a way to have these two functions combined (less + save pos)?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.