首页 > 代码库 > wenbao与vim
wenbao与vim
vim是非常有逼格的编辑器,里面有非常强悍的功能。。。。学习中!!!!!!!!!!!!
常用指令
@清空整个文件:
(esc)首先执行 gg 这里是跳至文件首行 再执行:dG 这样就清空了整个文件! 还有一种方法就要退出VIM,然后使用echo >> file ,这样也能快速清空文件内容,当然你也可以删除了这个文件再新建一个就是了。
@复制整个文件(前提是配置好)
(esc)ggVG全选命令,y复制,(p是粘贴)
@撤销操作
(esc)u
@删除
(esc)
x(删除当前光标下的字符) dw(删除光标之后的单词剩余部分) d$(删除光标之后的该行剩余部分) dd(删除当前行)
c (功能和d相同,区别在于完成删除操作后进入INSERT MODE) cc(也是删除当前行,然后进入INSERT MODE)
@移动
(esc)
:n1,n2 m n3 移动n1-n2行(包括n1,n2)到n3行之下;
:n1,n2 co n3 复制n1-n2行(包括n1,n2)到n3行之下;
:n1,n2 d 删除n1-n2行(包括n1,n2)行;
贴一个vimrc
" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by" the call to :runtime you can find below. If you wish to change any of those" settings, you should do it in this file (/etc/vim/vimrc), since debian.vim" will be overwritten everytime an upgrade of the vim packages is performed." It is recommended to make changes after sourcing debian.vim since it alters" the value of the ‘compatible‘ option." This line should not be removed as it ensures that various options are" properly set to work with the Vim-related packages available in Debian.runtime! debian.vim" Uncomment the next line to make Vim more Vi-compatible" NOTE: debian.vim sets ‘nocompatible‘. Setting ‘compatible‘ changes numerous" options, so any other options should be set AFTER setting ‘compatible‘."set compatible" Vim5 and later versions support syntax highlighting. Uncommenting the next" line enables syntax highlighting by default.if has("syntax") syntax onendif" If using a dark background within the editing area and syntax highlighting" turn on this option as well"set background=dark" Uncomment the following to have Vim jump to the last position when" reopening a file"if has("autocmd")" au BufReadPost * if line("‘\"") > 1 && line("‘\"") <= line("$") | exe "normal! g‘\"" | endif"endif" Uncomment the following to have Vim load indentation rules and plugins" according to the detected filetype."if has("autocmd")" filetype plugin indent on"endif" The following are commented out as they cause vim to behave a lot" differently from regular Vi. They are highly recommended though."set showcmd " Show (partial) command in status line."set showmatch " Show matching brackets."set ignorecase " Do case insensitive matching"set smartcase " Do smart case matching"set incsearch " Incremental search"set autowrite " Automatically save before commands like :next and :make"set hidden " Hide buffers when they are abandoned"set mouse=a " Enable mouse usage (all modes)set autoindentset smartindent"set cindentset nuset tabstop=4set shiftwidth=4set backspace=2set cursorlineset clipboard=unnamedplus"hi CursorLine cterm=NONE ctermfg=bluehi String ctermfg=whitehi Number ctermfg=whitehi Constant ctermfg=whitehi Comment ctermfg=yellowinoremap ( ()<ESC>iinoremap {<CR> {<CR>}<ESC>kA<CR>inoremap [ []<ESC>iinoremap ‘ ‘‘<ESC>iinoremap " ""<ESC>i" Source a global configuration file if availableif filereadable("/etc/vim/vimrc.local") source /etc/vim/vimrc.localendif
1 "========================================================================= 2 " DesCRiption: 适合自己使用的vimrc文件,for Linux/Windows, GUI/Console 3 " 4 " Last Change: 2010年08月02日 15时13分 5 " 6 " Version: 1.80 7 " 8 "========================================================================= 9 10 set nocompatible " 关闭 vi 兼容模式 11 syntax on " 自动语法高亮 12 colorscheme molokai " 设定配色方案 13 set number " 显示行号 14 set cursorline " 突出显示当前行 15 set ruler " 打开状态栏标尺 16 set shiftwidth=4 " 设定 << 和 >> 命令移动时的宽度为 4 17 set softtabstop=4 " 使得按退格键时可以一次删掉 4 个空格 18 set tabstop=4 " 设定 tab 长度为 4 19 set nobackup " 覆盖文件时不备份 20 set autochdir " 自动切换当前目录为当前文件所在的目录 21 filetype plugin indent on " 开启插件 22 set backupcopy=yes " 设置备份时的行为为覆盖 23 set ignorecase smartcase " 搜索时忽略大小写,但在有一个或以上大写字母时仍保持对大小写敏感 24 set nowrapscan " 禁止在搜索到文件两端时重新搜索 25 set incsearch " 输入搜索内容时就显示搜索结果 26 set hlsearch " 搜索时高亮显示被找到的文本 27 set noerrorbells " 关闭错误信息响铃 28 set novisualbell " 关闭使用可视响铃代替呼叫 29 set t_vb= " 置空错误铃声的终端代码 30 " set showmatch " 插入括号时,短暂地跳转到匹配的对应括号 31 " set matchtime=2 " 短暂跳转到匹配括号的时间 32 set magic " 设置魔术 33 set hidden " 允许在有未保存的修改时切换缓冲区,此时的修改由 vim 负责保存 34 set guioptions-=T " 隐藏工具栏 35 set guioptions-=m " 隐藏菜单栏 36 set smartindent " 开启新行时使用智能自动缩进 37 set backspace=indent,eol,start 38 " 不设定在插入状态无法用退格键和 Delete 键删除回车符 39 set cmdheight=1 " 设定命令行的行数为 1 40 set laststatus=2 " 显示状态栏 (默认值为 1, 无法显示状态栏) 41 set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ %{&encoding}\ %c:%l/%L%)\ 42 " 设置在状态行显示的信息 43 set foldenable " 开始折叠 44 set foldmethod=syntax " 设置语法折叠 45 set foldcolumn=0 " 设置折叠区域的宽度 46 setlocal foldlevel=1 " 设置折叠层数为 47 " set foldclose=all " 设置为自动关闭折叠 48 " nnoremap <space> @=((foldclosed(line(‘.‘)) < 0) ? ‘zc‘ : ‘zo‘)<CR> 49 " 用空格键来开关折叠 50 51 52 " return OS type, eg: windows, or linux, mac, et.st.. 53 function! MySys() 54 if has("win16") || has("win32") || has("win64") || has("win95") 55 return "windows" 56 elseif has("unix") 57 return "linux" 58 endif 59 endfunction 60 61 " 用户目录变量$VIMFILES 62 if MySys() == "windows" 63 let $VIMFILES = $VIM.‘/vimfiles‘ 64 elseif MySys() == "linux" 65 let $VIMFILES = $HOME.‘/.vim‘ 66 endif 67 68 " 设定doc文档目录 69 let helptags=$VIMFILES.‘/doc‘ 70 71 " 设置字体 以及中文支持 72 if has("win32") 73 set guifont=Inconsolata:h12:cANSI 74 endif 75 76 " 配置多语言环境 77 if has("multi_byte") 78 " UTF-8 编码 79 set encoding=utf-8 80 set termencoding=utf-8 81 set formatoptions+=mM 82 set fencs=utf-8,gbk 83 84 if v:lang =~? ‘^\(zh\)\|\(ja\)\|\(ko\)‘ 85 set ambiwidth=double 86 endif 87 88 if has("win32") 89 source $VIMRUNTIME/delmenu.vim 90 source $VIMRUNTIME/menu.vim 91 language messages zh_CN.utf-8 92 endif 93 else 94 echoerr "Sorry, this version of (g)vim was not compiled with +multi_byte" 95 endif 96 97 " Buffers操作快捷方式! 98 nnoremap <C-RETURN> :bnext<CR> 99 nnoremap <C-S-RETURN> :bprevious<CR>100 101 " Tab操作快捷方式!102 nnoremap <C-TAB> :tabnext<CR>103 nnoremap <C-S-TAB> :tabprev<CR>104 105 "关于tab的快捷键106 " map tn :tabnext<cr>107 " map tp :tabprevious<cr>108 " map td :tabnew .<cr>109 " map te :tabedit110 " map tc :tabclose<cr>111 112 "窗口分割时,进行切换的按键热键需要连接两次,比如从下方窗口移动113 "光标到上方窗口,需要<c-w><c-w>k,非常麻烦,现在重映射为<c-k>,切换的114 "时候会变得非常方便.115 nnoremap <C-h> <C-w>h116 nnoremap <C-j> <C-w>j117 nnoremap <C-k> <C-w>k118 nnoremap <C-l> <C-w>l119 120 "一些不错的映射转换语法(如果在一个文件中混合了不同语言时有用)121 nnoremap <leader>1 :set filetype=xhtml<CR>122 nnoremap <leader>2 :set filetype=css<CR>123 nnoremap <leader>3 :set filetype=javascript<CR>124 nnoremap <leader>4 :set filetype=php<CR>125 126 " set fileformats=unix,dos,mac127 " nmap <leader>fd :se fileformat=dos<CR>128 " nmap <leader>fu :se fileformat=unix<CR>129 130 " use Ctrl+[l|n|p|cc] to list|next|previous|jump to count the result131 " map <C-x>l <ESC>:cl<CR>132 " map <C-x>n <ESC>:cn<CR>133 " map <C-x>p <ESC>:cp<CR>134 " map <C-x>c <ESC>:cc<CR>135 136 137 " 让 Tohtml 产生有 CSS 语法的 html138 " syntax/2html.vim,可以用:runtime! syntax/2html.vim139 let html_use_css=1140 141 " Python 文件的一般设置,比如不要 tab 等142 autocmd FileType python set tabstop=4 shiftwidth=4 expandtab143 autocmd FileType python map <F12> :!python %<CR>144 145 " 选中状态下 Ctrl+c 复制146 vmap <C-c> "+y147 148 " 打开javascript折叠149 let b:javascript_fold=1150 " 打开javascript对dom、html和css的支持151 let javascript_enable_domhtmlcss=1152 " 设置字典 ~/.vim/dict/文件的路径153 autocmd filetype javascript set dictionary=$VIMFILES/dict/javascript.dict154 autocmd filetype css set dictionary=$VIMFILES/dict/css.dict155 autocmd filetype php set dictionary=$VIMFILES/dict/php.dict156 157 "-----------------------------------------------------------------158 " plugin - bufexplorer.vim Buffers切换159 " \be 全屏方式查看全部打开的文件列表160 " \bv 左右方式查看 \bs 上下方式查看161 "-----------------------------------------------------------------162 163 164 "-----------------------------------------------------------------165 " plugin - taglist.vim 查看函数列表,需要ctags程序166 " F4 打开隐藏taglist窗口167 "-----------------------------------------------------------------168 if MySys() == "windows" " 设定windows系统中ctags程序的位置169 let Tlist_Ctags_Cmd = ‘"‘.$VIMRUNTIME.‘/ctags.exe"‘170 elseif MySys() == "linux" " 设定windows系统中ctags程序的位置171 let Tlist_Ctags_Cmd = ‘/usr/bin/ctags‘172 endif173 nnoremap <silent><F4> :TlistToggle<CR>174 let Tlist_Show_One_File = 1 " 不同时显示多个文件的tag,只显示当前文件的175 let Tlist_Exit_OnlyWindow = 1 " 如果taglist窗口是最后一个窗口,则退出vim176 let Tlist_Use_Right_Window = 1 " 在右侧窗口中显示taglist窗口177 let Tlist_File_Fold_Auto_Close=1 " 自动折叠当前非编辑文件的方法列表178 let Tlist_Auto_Open = 0179 let Tlist_Auto_Update = 1180 let Tlist_Hightlight_Tag_On_BufEnter = 1181 let Tlist_Enable_Fold_Column = 0182 let Tlist_Process_File_Always = 1183 let Tlist_Display_Prototype = 0184 let Tlist_Compact_Format = 1185 186 187 "-----------------------------------------------------------------188 " plugin - mark.vim 给各种tags标记不同的颜色,便于观看调式的插件。189 " \m mark or unmark the word under (or before) the cursor190 " \r manually input a regular expression. 用于搜索.191 " \n clear this mark (i.e. the mark under the cursor), or clear all highlighted marks .192 " \* 当前MarkWord的下一个 \# 当前MarkWord的上一个193 " \/ 所有MarkWords的下一个 \? 所有MarkWords的上一个194 "-----------------------------------------------------------------195 196 197 "-----------------------------------------------------------------198 " plugin - NERD_tree.vim 以树状方式浏览系统中的文件和目录199 " :ERDtree 打开NERD_tree :NERDtreeClose 关闭NERD_tree200 " o 打开关闭文件或者目录 t 在标签页中打开201 " T 在后台标签页中打开 ! 执行此文件202 " p 到上层目录 P 到根目录203 " K 到第一个节点 J 到最后一个节点204 " u 打开上层目录 m 显示文件系统菜单(添加、删除、移动操作)205 " r 递归刷新当前目录 R 递归刷新当前根目录206 "-----------------------------------------------------------------207 " F3 NERDTree 切换208 map <F3> :NERDTreeToggle<CR>209 imap <F3> <ESC>:NERDTreeToggle<CR>210 211 212 "-----------------------------------------------------------------213 " plugin - NERD_commenter.vim 注释代码用的,214 " [count],cc 光标以下count行逐行添加注释(7,cc)215 " [count],cu 光标以下count行逐行取消注释(7,cu)216 " [count],cm 光标以下count行尝试添加块注释(7,cm)217 " ,cA 在行尾插入 /* */,并且进入插入模式。 这个命令方便写注释。218 " 注:count参数可选,无则默认为选中行或当前行219 "-----------------------------------------------------------------220 let NERDSpaceDelims=1 " 让注释符与语句之间留一个空格221 let NERDCompactSexyComs=1 " 多行注释时样子更好看222 223 224 "-----------------------------------------------------------------225 " plugin - DoxygenToolkit.vim 由注释生成文档,并且能够快速生成函数标准注释226 "-----------------------------------------------------------------227 let g:DoxygenToolkit_authorName="Asins - asinsimple AT gmail DOT com"228 let g:DoxygenToolkit_briefTag_funcName="yes"229 map <leader>da :DoxAuthor<CR>230 map <leader>df :Dox<CR>231 map <leader>db :DoxBlock<CR>232 map <leader>dc a /* */<LEFT><LEFT><LEFT>233 234 235 "-----------------------------------------------------------------236 " plugin – ZenCoding.vim 很酷的插件,HTML代码生成237 " 插件最新版:http://github.com/mattn/zencoding-vim238 " 常用命令可看:http://nootn.com/blog/Tool/23/239 "-----------------------------------------------------------------240 241 242 "-----------------------------------------------------------------243 " plugin – checksyntax.vim JavaScript常见语法错误检查244 " 默认快捷方式为 F5245 "-----------------------------------------------------------------246 let g:checksyntax_auto = 0 " 不自动检查247 248 249 "-----------------------------------------------------------------250 " plugin - NeoComplCache.vim 自动补全插件251 "-----------------------------------------------------------------252 let g:AutoComplPop_NotEnableAtStartup = 1253 let g:NeoComplCache_EnableAtStartup = 1254 let g:NeoComplCache_SmartCase = 1255 let g:NeoComplCache_TagsAutoUpdate = 1256 let g:NeoComplCache_EnableInfo = 1257 let g:NeoComplCache_EnableCamelCaseCompletion = 1258 let g:NeoComplCache_MinSyntaxLength = 3259 let g:NeoComplCache_EnableSkipCompletion = 1260 let g:NeoComplCache_SkipInputTime = ‘0.5‘261 let g:NeoComplCache_SnippetsDir = $VIMFILES.‘/snippets‘262 " <TAB> completion.263 inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"264 " snippets expand key265 imap <silent> <C-e> <Plug>(neocomplcache_snippets_expand)266 smap <silent> <C-e> <Plug>(neocomplcache_snippets_expand)267 268 269 "-----------------------------------------------------------------270 " plugin - matchit.vim 对%命令进行扩展使得能在嵌套标签和语句之间跳转271 " % 正向匹配 g% 反向匹配272 " [% 定位块首 ]% 定位块尾273 "-----------------------------------------------------------------274 275 276 "-----------------------------------------------------------------277 " plugin - vcscommand.vim 对%命令进行扩展使得能在嵌套标签和语句之间跳转278 " SVN/git管理工具279 "-----------------------------------------------------------------280 281 282 "-----------------------------------------------------------------283 " plugin – a.vim284 "-----------------------------------------------------------------
1 """"""""""""""""""" 2 " 显示相关 3 """"""""""""""""""" 4 "set shortmess=atI " 启动的时候不显示那个援助乌干达儿童的提示 5 "winpos 5 5 " 设定窗口位置 6 "set lines=40 columns=155 " 设定窗口大小 7 "set nu " 显示行号 8 set go= " 不要图形按钮 9 "color asmanian2 " 设置背景主题 10 set guifont=Courier_New:h10:cANSI " 设置字体 11 "syntax on " 语法高亮 12 autocmd InsertLeave * se nocul " 用浅色高亮当前行 13 autocmd InsertEnter * se cul " 用浅色高亮当前行 14 "set ruler " 显示标尺 15 set showcmd " 输入的命令显示出来,看的清楚些 16 "set cmdheight=1 " 命令行(在状态行下)的高度,设置为1 17 "set whichwrap+=<,>,h,l " 允许backspace和光标键跨越行边界(不建议) 18 "set scrolloff=3 " 光标移动到buffer的顶部和底部时保持3行距离 19 set novisualbell " 不要闪烁(不明白) 20 set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ %{strftime(\"%d/%m/%y\ -\ %H:%M\")} "状态行显示的内容 21 set laststatus=1 " 启动显示状态行(1),总是显示状态行(2) 22 set foldenable " 允许折叠 23 set foldmethod=manual " 手动折叠 24 "set background=dark "背景使用黑色 25 set nocompatible "去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限 26 " 显示中文帮助 27 if version >= 603 28 set helplang=cn 29 set encoding=utf-8 30 endif 31 " 设置配色方案 32 "colorscheme murphy 33 "字体 34 "if (has("gui_running")) 35 " set guifont=Bitstream\ Vera\ Sans\ Mono\ 10 36 "endif 37 set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936 38 set termencoding=utf-8 39 set encoding=utf-8 40 set fileencodings=ucs-bom,utf-8,cp936 41 set fileencoding=utf-8 42 """"""""""""""""""""""""" 43 """""新文件标题"""""""""" 44 "新建.c,.h,.sh,.java文件,自动插入文件头 45 autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()" 46 ""定义函数SetTitle,自动插入文件头 47 func SetTitle() 48 "如果文件类型为.sh文件 49 if &filetype == ‘sh‘ 50 call setline(1,"\#########################################################################") 51 call append(line("."), "\# File Name: ".expand("%")) 52 call append(line(".")+1, "\# Author: test") 53 call append(line(".")+2, "\# mail: <a href=http://www.mamicode.com/"mailto:test@jbxue.com">test@jbxue.com</a>") 54 call append(line(".")+3, "\# Created Time: ".strftime("%c")) 55 call append(line(".")+4, "\#########################################################################") 56 call append(line(".")+5, "\#!/bin/bash") 57 call append(line(".")+6, "") 58 else 59 call setline(1, "/*************************************************************************") 60 call append(line("."), " > File Name: ".expand("%")) 61 call append(line(".")+1, " > Author: test") 62 call append(line(".")+2, " > Mail: <a href=http://www.mamicode.com/"mailto:test@jbxue.com">test@jbxue.com</a> ") 63 call append(line(".")+3, " > Created Time: ".strftime("%c")) 64 call append(line(".")+4, " ************************************************************************/") 65 call append(line(".")+5, "") 66 endif 67 if &filetype == ‘cpp‘ 68 call append(line(".")+6, "#include<iostream>") 69 call append(line(".")+7, "using namespace std;") 70 call append(line(".")+8, "") 71 endif 72 if &filetype == ‘c‘ 73 call append(line(".")+6, "#include<stdio.h>") 74 call append(line(".")+7, "") 75 endif 76 "新建文件后,自动定位到文件末尾 77 autocmd BufNewFile * normal G 78 endfunc 79 """"""""""""""""""""""""""""""" 80 "键盘命令 81 """"""""""""""""""""""""""""""" 82 nmap <leader>w :w!<cr> 83 nmap <leader>f :find<cr> 84 " 映射全选+复制 ctrl+a 85 map <C-A> ggVGY 86 map! <C-A> <Esc>ggVGY 87 map <F12> gg=G 88 " 选中状态下 Ctrl+c 复制 89 vmap <C-c> "+y 90 "去空行 91 nnoremap <F2> :g/^\s*$/d<CR> 92 "比较文件 93 nnoremap <C-F2> :vert diffsplit 94 "新建标签 95 map <M-F2> :tabnew<CR> 96 "列出当前目录文件 97 map <F3> :tabnew .<CR> 98 "打开树状文件目录 99 map <C-F3> \be 100 "C,C++ 按F5编译运行101 map <F5> :call CompileRunGcc()<CR>102 func! CompileRunGcc()103 exec "w"104 if &filetype == ‘c‘105 exec "!g++ % -o %<"106 exec "! ./%<"107 elseif &filetype == ‘cpp‘108 exec "!g++ % -o %<"109 exec "! ./%<"110 elseif &filetype == ‘java‘ 111 exec "!javac %" 112 exec "!java %<"113 elseif &filetype == ‘sh‘114 :!./%115 endif116 endfunc117 "C,C++的调试118 map <F8> :call Rungdb()<CR>119 func! Rungdb()120 exec "w"121 exec "!g++ % -g -o %<"122 exec "!gdb ./%<"123 endfunc124 """"""""""""""""""""""""125 ""实用设置126 """"""""""""""""""""""""127 " 设置当文件被改动时自动载入128 set autoread129 " quickfix模式130 autocmd FileType c,cpp map <buffer> <leader><space> :w<cr>:make<cr>131 "代码补全 132 set completeopt=preview,menu 133 "允许插件 134 filetype plugin on135 "共享剪贴板 136 set clipboard+=unnamed 137 "从不备份 138 set nobackup139 "make 运行140 :set makeprg=g++\ -Wall\ \ %141 "自动保存142 set autowrite143 set ruler " 打开状态栏标尺144 set cursorline " 突出显示当前行145 set magic " 设置魔术146 set guioptions-=T " 隐藏工具栏147 set guioptions-=m " 隐藏菜单栏148 "set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ %{&encoding}\ %c:%l/%L%)\149 " 设置在状态行显示的信息150 set foldcolumn=0151 set foldmethod=indent 152 set foldlevel=3 153 set foldenable " 开始折叠154 " 不要使用vi的键盘模式,而是vim自己的155 set nocompatible156 " 语法高亮157 set syntax=on158 " 去掉输入错误的提示声音159 set noeb160 " 在处理未保存或只读文件的时候,弹出确认161 set confirm162 " 自动缩进163 set autoindent164 set cindent165 " Tab键的宽度166 set tabstop=4167 " 统一缩进为4168 set softtabstop=4169 set shiftwidth=4170 " 不要用空格代替制表符171 set noexpandtab172 " 在行和段开始处使用制表符173 set smarttab174 " 显示行号175 set number176 " 历史记录数177 set history=1000178 "禁止生成临时文件179 set nobackup180 set noswapfile181 "搜索忽略大小写182 set ignorecase183 "搜索逐字符高亮184 set hlsearch185 set incsearch186 "行内替换187 set gdefault188 "编码设置189 set enc=utf-8190 set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936191 "语言设置192 set langmenu=zh_CN.UTF-8193 set helplang=cn194 " 我的状态行显示的内容(包括文件类型和解码)195 "set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ %{strftime(\"%d/%m/%y\ -\ %H:%M\")}196 "set statusline=[%F]%y%r%m%*%=[Line:%l/%L,Column:%c][%p%%]197 " 总是显示状态行198 set laststatus=2199 " 命令行(在状态行下)的高度,默认为1,这里是2200 set cmdheight=2201 " 侦测文件类型202 filetype on203 " 载入文件类型插件204 filetype plugin on205 " 为特定文件类型载入相关缩进文件206 filetype indent on207 " 保存全局变量208 set viminfo+=!209 " 带有如下符号的单词不要被换行分割210 set iskeyword+=_,$,@,%,#,-211 " 字符间插入的像素行数目212 set linespace=0213 " 增强模式中的命令行自动完成操作214 set wildmenu215 " 使回格键(backspace)正常处理indent, eol, start等216 set backspace=2217 " 允许backspace和光标键跨越行边界218 set whichwrap+=<,>,h,l219 " 可以在buffer的任何地方使用鼠标(类似office中在工作区双击鼠标定位)220 set mouse=a221 set selection=exclusive222 set selectmode=mouse,key223 " 通过使用: commands命令,告诉我们文件的哪一行被改变过224 set report=0225 " 在被分割的窗口间显示空白,便于阅读226 set fillchars=vert:\ ,stl:\ ,stlnc:227 " 高亮显示匹配的括号228 set showmatch229 " 匹配括号高亮的时间(单位是十分之一秒)230 set matchtime=1231 " 光标移动到buffer的顶部和底部时保持3行距离232 set scrolloff=3233 " 为C程序提供自动缩进234 set smartindent235 " 高亮显示普通txt文件(需要txt.vim脚本)236 au BufRead,BufNewFile * setfiletype txt237 "自动补全238 :inoremap ( ()<ESC>i239 :inoremap ) <c-r>=ClosePair(‘)‘)<CR>240 :inoremap { {<CR>}<ESC>O241 :inoremap } <c-r>=ClosePair(‘}‘)<CR>242 :inoremap [ []<ESC>i243 :inoremap ] <c-r>=ClosePair(‘]‘)<CR>244 :inoremap " ""<ESC>i245 :inoremap ‘ ‘‘<ESC>i246 function! ClosePair(char)247 if getline(‘.‘)[col(‘.‘) - 1] == a:char248 return "\<Right>"249 else250 return a:char251 endif252 endfunction253 filetype plugin indent on 254 "打开文件类型检测, 加了这句才可以用智能补全255 set completeopt=longest,menu256 """"""""""""""""""""""""""""""""257 " CTags的设定 258 """"""""""""""""""""""""""""""""259 let Tlist_Sort_Type = "name" " 按照名称排序 260 let Tlist_Use_Right_Window = 1 " 在右侧显示窗口 261 let Tlist_Compart_Format = 1 " 压缩方式 262 let Tlist_Exist_OnlyWindow = 1 " 如果只有一个buffer,kill窗口也kill掉buffer 263 let Tlist_File_Fold_Auto_Close = 0 " 不要关闭其他文件的tags 264 let Tlist_Enable_Fold_Column = 0 " 不要显示折叠树 265 autocmd FileType java set tags+=D:\tools\java\tags 266 "autocmd FileType h,cpp,cc,c set tags+=D:\tools\cpp\tags 267 "let Tlist_Show_One_File=1 "不同时显示多个文件的tag,只显示当前文件的268 "设置tags 269 set tags=tags 270 "set autochdir271 """""""""""""""""""""""""272 "其他东东273 """""""""""""""""""""""""274 "默认打开Taglist 275 let Tlist_Auto_Open=1 276 """""""""""""""""""""""""""""" 277 " Tag list (ctags) 278 """""""""""""""""""""""""""""""" 279 let Tlist_Ctags_Cmd = ‘/usr/bin/ctags‘ 280 let Tlist_Show_One_File = 1 "不同时显示多个文件的tag,只显示当前文件的 281 let Tlist_Exit_OnlyWindow = 1 "如果taglist窗口是最后一个窗口,则退出vim 282 let Tlist_Use_Right_Window = 1 "在右侧窗口中显示taglist窗口283 " minibufexpl插件的一般设置284 let g:miniBufExplMapWindowNavVim = 1285 let g:miniBufExplMapWindowNavArrows = 1286 let g:miniBufExplMapCTabSwitchBufs = 1287 let g:miniBufExplModSelTarget = 1
@ 小艾
1 " All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by 2 " the call to :runtime you can find below. If you wish to change any of those 3 " settings, you should do it in this file (/etc/vim/vimrc), since debian.vim 4 " will be overwritten everytime an upgrade of the vim packages is performed. 5 " It is recommended to make changes after sourcing debian.vim since it alters 6 " the value of the ‘compatible‘ option. 7 8 " This line should not be removed as it ensures that various options are 9 " properly set to work with the Vim-related packages available in Debian.10 runtime! debian.vim11 12 " Uncomment the next line to make Vim more Vi-compatible13 " NOTE: debian.vim sets ‘nocompatible‘. Setting ‘compatible‘ changes numerous14 " options, so any other options should be set AFTER setting ‘compatible‘.15 "set compatible16 17 " Vim5 and later versions support syntax highlighting. Uncommenting the next18 " line enables syntax highlighting by default.19 if has("syntax")20 syntax on21 endif22 23 " If using a dark background within the editing area and syntax highlighting24 " turn on this option as well25 "set background=dark26 27 " Uncomment the following to have Vim jump to the last position when28 " reopening a file29 "if has("autocmd")30 " au BufReadPost * if line("‘\"") > 1 && line("‘\"") <= line("$") | exe "normal! g‘\"" | endif31 "endif32 33 " Uncomment the following to have Vim load indentation rules and plugins34 " according to the detected filetype.35 "if has("autocmd")36 " filetype plugin indent on37 "endif38 39 " The following are commented out as they cause vim to behave a lot40 " differently from regular Vi. They are highly recommended though.41 "set showcmd " Show (partial) command in status line.42 "set showmatch " Show matching brackets.43 "set ignorecase " Do case insensitive matching44 "set smartcase " Do smart case matching45 "set incsearch " Incremental search46 "set autowrite " Automatically save before commands like :next and :make47 "set hidden " Hide buffers when they are abandoned48 "set mouse=a " Enable mouse usage (all modes)49 set nu50 set tabstop=451 set shiftwidth=452 set autoindent53 set smartindent54 set cindent55 set cursorline56 set clipboard=unnamedplus57 hi CursorLine cterm=NONE ctermfg=yellow58 highlight LineNr ctermfg=white59 60 hi String ctermfg=white61 hi Number ctermfg=white62 hi Constant ctermfg=white63 hi Comment ctermfg=yellow64 65 inoremap ( ()<ESC>i66 inoremap {<CR> {<CR>}<ESC>kA<CR>67 inoremap [ []<ESC>i68 inoremap ‘ ‘‘<ESC>i69 inoremap " ""<ESC>i70 71 " Source a global configuration file if available72 if filereadable("/etc/vim/vimrc.local")73 source /etc/vim/vimrc.local74 endif
下载: https://pan.baidu.com/s/1nvTjAnZ
只有不断学习才能进步!
wenbao与vim
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。