SDB:VIM 禁用行恢复

跳转到:导航搜索


情况

您希望 VIM 在打开文件时不要恢复您上次编辑的行,而是始终从第 0 行开始。


流程

删除 /etc/vimrc 中的以下行

" Only do this part when compiled with support for autocommands. 
if has("autocmd")
  " When editing a file, always jump to the last known cursor position. 
  " Don't do it when the position is invalid or when inside an event handler 
  " (happens when dropping a file on gvim). 
  autocmd BufReadPost *
    \ if line("'\"") > 0 && line("'\"") <= line("$") |
    \   exe "normal g`\"" |
    \ endif

endif " has("autocmd")