Skip to content

Instantly share code, notes, and snippets.

@mojtabamarashee
Last active March 8, 2018 07:59
Show Gist options
  • Save mojtabamarashee/d471fc74a00323e966939a811823dc8d to your computer and use it in GitHub Desktop.
Save mojtabamarashee/d471fc74a00323e966939a811823dc8d to your computer and use it in GitHub Desktop.
Vim: jump to last saved file, even if the file is closed
au BufWrite * call BufWriteDo()
function! BufWriteDo()
let g:LAST_INSERT_FILE = expand('%:p')
let g:CURSOR_POS = getpos('.')
endfunction
nmap gii :execute "O ".g:LAST_INSERT_FILE<cr>:call cursor(CURSOR_POS[1], CURSOR_POS[2])<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment