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.