雨中的高速公路 - bluetent的个人主页

我的电脑,最近新歌,欧美音乐,酷讯,电脑技术

如何让vim定位到上次编辑过的位置

8月 10th, 2004 · No Comments

将以下加入 .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”)

Tags: 电脑技术

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment