|
|
@@ -1,36 +1,15 @@
|
|
|
-" Cursor Position - Modeline and Notes {{{
|
|
|
-" vim: set sw=2 ts=2 sts=2 et tw=78 foldmarker={{{,}}} foldlevel=0 foldmethod=marker spell:
|
|
|
-"
|
|
|
-" cinaeco/dotfiles Cursor Position from last editing session.
|
|
|
-"
|
|
|
-" Taken from spf13-vim.
|
|
|
-"
|
|
|
-" }}}
|
|
|
-
|
|
|
-" Cursor Autocommands {{{
|
|
|
if has("autocmd")
|
|
|
|
|
|
- " Restore Position {{{
|
|
|
- " http://vim.wikia.com/wiki/Restore_cursor_to_file_position_in_previous_editing_session
|
|
|
- " Restore cursor to file position in previous editing session
|
|
|
- function! ResCur()
|
|
|
- if line("'\"") <= line("$")
|
|
|
- normal! g`"
|
|
|
- return 1
|
|
|
- endif
|
|
|
- endfunction
|
|
|
-
|
|
|
- augroup resCur
|
|
|
- autocmd!
|
|
|
- autocmd BufWinEnter * call ResCur()
|
|
|
- augroup END
|
|
|
- " }}}
|
|
|
+ " Restore Position
|
|
|
+ " Based on the last-position mark '"'. Go to it if it is not the first line,
|
|
|
+ " and if it is valid i.e. within the number of lines in the file.
|
|
|
+ " From `:help line()`
|
|
|
+ au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
|
|
|
|
|
|
- " Git Commit Exception{{{
|
|
|
+ " Git Commit Exception
|
|
|
" Instead of reverting the cursor to the last position in the buffer, we
|
|
|
" 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])
|
|
|
- " }}}
|
|
|
|
|
|
endif
|
|
|
" }}}
|