传说是“史上最强.vimrc”:
我自己曾经的.vimrc
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
set fileencodings=utf-8,latin1endifset nocompatible " Use Vim defaults (much better!)set bs=indent,eol,start " allow backspacing over everything in insert modeset viminfo='20,\"50 " read/write a .viminfo file, don't store more " than 50 lines of registersset history=50 " keep 50 lines of command line historyset ruler " show the cursor position all the timeset smartindent " Judging former line's indent, smart select indent, for C-like languageset cindent " 传说是 C-like, 谁用谁知道" 设定默认解码set encoding=utf-8" set fileencodings=utf-8, chinese,latin-1" Environment { " Setup Bundle Support { " The next two lines ensure that the ~/.vim/bundle/ system worksruntime! autoload/pathogen.vimsilent! call pathogen#helptags()silent! call pathogen#runtime_append_all_bundles()" }" }" General { set background=dark " Background become darkfiletype plugin indent on " Automatically detect file types.syntax on " Highlight syntaxset mouse=a " automatically enable mouse usage(使用)set virtualedit=onemore " allow for cursor beyond last character" set spell " spell checking on. Amazing! I found this set is not as usefull as I think." Setting up the directoties { set backup " I saw...Someone said: backups are nice...so I set:)set backupdir=$HOME/.vimbackup// " but not when they clog .set directory=$HOME/.vimswap// " Same for swap filesset viewdir=$HOME/.vimviews// " same for view files" Creating directories if they don't existsilent execute '!mkdir -p $HVOME/.vimbackup'silent execute '!mkdir -p $HOME/.vimswap'silent execute '!mkdir -p $HOME/.vimviews'" set undofile " STFW, persistent undo. I do think this's not a good feature." set undodir=??? " Must, first, mkdir a directory, then replace ???" set undolevels=1000 "maximum number of changes that can be undone" }" } " Vim UI { colorscheme eveningset showmode " display the current modeset cursorline " highlight current linehi cursorline guibg=#333333 " highlight bg color of current linehi CursorColumn guibg=#333333 " highlight cursorset backspace=indent,eol,start " backspace for dummysset number " Show line numberset showmatch " 匹配模式,类似当输入一个"(" 时会匹配相应的")"set incsearch " find as you type searchset ignorecase " case insensitive search" }" Formatting { set autoindent " Auto-implement current line's indent to next lineautocmd FileType c,cpp,java,php,js,python,twig,xml,yml autocmd BufWritePre <buffer> :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))" }" Only do this part when compiled with support for autocommandsif has("autocmd") augroup redhat " In text files, always limit the width of text to 78 characters autocmd BufRead *.txt set tw=78 " When editing a file, always jump to the last cursor position autocmd BufReadPost * \ if line("'\"") > 0 && line ("'\"") <= line("$") | \ exe "normal! g'\"" | \ endif augroup ENDendifif has("cscope") && filereadable("/usr/bin/cscope") set csprg=/usr/bin/cscope set csto=0 set cst set nocsverb " add any database in current directory if filereadable("cscope.out") cs add cscope.out " else add database pointed to by environment elseif $CSCOPE_DB != "" cs add $CSCOPE_DB endif set csverbendif" Switch syntax highlighting on, when the terminal has colors" Also switch on highlighting the last used search pattern.if &t_Co > 2 || has("gui_running") syntax on set hlsearchendifif &term=="xterm" set t_Co=8 set t_Sb=[4%dm set t_Sf=[3%dmendifset tabstop=4 " Set tab is 4 * spaceset shiftwidth=4 " 当行之间交错时,使用4个空格set nocp " vim不再兼容模式下工作。不在模仿viset whichwrap=h,l " STFWset cin " /opt/curricula/2_vim_study_summaryset sw=4 " STFWset cino=:0g0t0(sus " STFWset mousemodel=popup " 当右键单击窗口的时候,弹出快捷菜单。" set paste " 设置粘贴时不自动使用格式:set nopaste 取消. :help autoindent 时发现,此选项与其冲突因此注释掉了
Vim,如果tab 和 space 混编会报错。
Please google:"vim tab用空格代替".
set expandtab " 使用空格代替tab.
set tabstop=4 " 空格数量是4。 set shiftwidth=4 " 自动缩进的宽度。
,
MORE,
add: set list
键盘 的 delay速度调到delay速度 调整到适合自己,键盘的speed直接调整到最大,非常的爽
这是比vim设定的一个更好的设定
真的
:help xxx, this is important.:wq
# vim ,这样就能编辑一个网页了
vimium,chrome插件,好用
ctrl+[可以代替Esc
现在唯一想做的,就是ctag,这个非常有用,我却不会。