Re: 那如何讓vim自動定鴩鴗憟韝W次編輯過漲鼽m呢
高超 wrote:
> 果然很好用,謝謝。
>
> 那如何讓vim自動定位到文件上次編輯過的位置呢?用redhat的時候,
> vim就是這樣的,一個很方便的設計,但是裝了debian/sid之後,這個
> 功能默認沒有打開,怎麼開啟呢?
>
> 在用戶目錄下存在.viminfo這個文件,並且vim的歷史記錄都保存在裡
> 面了。
>
將以下加入 .vimrc
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependentindenting.
filetype plugin indent on
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" 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")
--
-Rex, geek by nature linux by choice
1024D/E3F86E4C = 36CE D9DD 46F4 2187 3C5C 927D D5D9 4B51 E3F8 6E4C
Reply to: