Skip to content

Commit

Permalink
auto restore cursor to last edit position when open file
Browse files Browse the repository at this point in the history
  • Loading branch information
e7h4n authored and spf13 committed Oct 12, 2013
1 parent 0e5414e commit 85909e3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,24 @@
" set it to the first line when editing a git commit message
au FileType gitcommit au! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0])

" http://vim.wikia.com/wiki/Restore_cursor_to_file_position_in_previous_editing_session
" Restore cursor to file position in previous editing session
" To disable this, add the following to your .vimrc.before.local file:
" let g:spf13_no_restore_cursor = 1
if !exists('g:spf13_no_restore_cursor')
function! ResCur()
if line("'\"") <= line("$")
normal! g`"
return 1
endif
endfunction

augroup resCur
autocmd!
autocmd BufWinEnter * call ResCur()
augroup END
endif

" Setting up the directories {
set backup " Backups are nice ...
if has('persistent_undo')
Expand Down

0 comments on commit 85909e3

Please sign in to comment.