I use alias lvim='vim -c "normal '\''0"'
for reopen last files in my vim. But the questions is how exit vim
without close any tabs or files, When I use :wq
it close tab or files.
This code restores the exact state you were in on a newly opened vim (no arguments). That is if you remembered to exit vim using SQ(a newly defined key sequence). It also saves the files you were working on.
You might want to add this to your .vimrc:
nmap SQ <ESC>:mksession! ~/.vim/Session.vim<CR>:wqa<CR>
function! RestoreSession()
if argc() == 0 && filereadable($HOME . '/.vim/Session.vim') "vim called without arguments
execute 'source ~/.vim/Session.vim'
endif
endfunction
autocmd VimEnter * call RestoreSession()
Taken from here with a minor change https://askubuntu.com/questions/28614/gvim-configuration-does-not-work-like-it-should
I hope this is the answer you were looking for.
:h views-sessions
to preserve your views and open files? – statox♦ Oct 2 '18 at 14:42:suspend
ing vim? – D. Ben Knoble♦ Oct 2 '18 at 16:39