标签:类型 value work 方式 asi 分割 created ndt 文本
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 on endif " 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 autoindent set smartindent "set cindent set nu set tabstop=4 set shiftwidth=4 set backspace=2 set cursorline set clipboard=unnamedplus "hi CursorLine cterm=NONE ctermfg=blue hi String ctermfg=white hi Number ctermfg=white hi Constant ctermfg=white hi Comment ctermfg=yellow inoremap ( ()<ESC>i inoremap {<CR> {<CR>}<ESC>kA<CR> inoremap [ []<ESC>i inoremap ‘ ‘‘<ESC>i inoremap " ""<ESC>i " Source a global configuration file if available if filereadable("/etc/vim/vimrc.local") source /etc/vim/vimrc.local endif
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 :tabedit 110 " map tc :tabclose<cr> 111 112 "窗口分割时,进行切换的按键热键需要连接两次,比如从下方窗口移动 113 "光标到上方窗口,需要<c-w><c-w>k,非常麻烦,现在重映射为<c-k>,切换的 114 "时候会变得非常方便. 115 nnoremap <C-h> <C-w>h 116 nnoremap <C-j> <C-w>j 117 nnoremap <C-k> <C-w>k 118 nnoremap <C-l> <C-w>l 119 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,mac 127 " 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 result 131 " 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 语法的 html 138 " syntax/2html.vim,可以用:runtime! syntax/2html.vim 139 let html_use_css=1 140 141 " Python 文件的一般设置,比如不要 tab 等 142 autocmd FileType python set tabstop=4 shiftwidth=4 expandtab 143 autocmd FileType python map <F12> :!python %<CR> 144 145 " 选中状态下 Ctrl+c 复制 146 vmap <C-c> "+y 147 148 " 打开javascript折叠 149 let b:javascript_fold=1 150 " 打开javascript对dom、html和css的支持 151 let javascript_enable_domhtmlcss=1 152 " 设置字典 ~/.vim/dict/文件的路径 153 autocmd filetype javascript set dictionary=$VIMFILES/dict/javascript.dict 154 autocmd filetype css set dictionary=$VIMFILES/dict/css.dict 155 autocmd filetype php set dictionary=$VIMFILES/dict/php.dict 156 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 endif 173 nnoremap <silent><F4> :TlistToggle<CR> 174 let Tlist_Show_One_File = 1 " 不同时显示多个文件的tag,只显示当前文件的 175 let Tlist_Exit_OnlyWindow = 1 " 如果taglist窗口是最后一个窗口,则退出vim 176 let Tlist_Use_Right_Window = 1 " 在右侧窗口中显示taglist窗口 177 let Tlist_File_Fold_Auto_Close=1 " 自动折叠当前非编辑文件的方法列表 178 let Tlist_Auto_Open = 0 179 let Tlist_Auto_Update = 1 180 let Tlist_Hightlight_Tag_On_BufEnter = 1 181 let Tlist_Enable_Fold_Column = 0 182 let Tlist_Process_File_Always = 1 183 let Tlist_Display_Prototype = 0 184 let Tlist_Compact_Format = 1 185 186 187 "----------------------------------------------------------------- 188 " plugin - mark.vim 给各种tags标记不同的颜色,便于观看调式的插件。 189 " \m mark or unmark the word under (or before) the cursor 190 " \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_tree 200 " 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-vim 238 " 常用命令可看:http://nootn.com/blog/Tool/23/ 239 "----------------------------------------------------------------- 240 241 242 "----------------------------------------------------------------- 243 " plugin – checksyntax.vim JavaScript常见语法错误检查 244 " 默认快捷方式为 F5 245 "----------------------------------------------------------------- 246 let g:checksyntax_auto = 0 " 不自动检查 247 248 249 "----------------------------------------------------------------- 250 " plugin - NeoComplCache.vim 自动补全插件 251 "----------------------------------------------------------------- 252 let g:AutoComplPop_NotEnableAtStartup = 1 253 let g:NeoComplCache_EnableAtStartup = 1 254 let g:NeoComplCache_SmartCase = 1 255 let g:NeoComplCache_TagsAutoUpdate = 1 256 let g:NeoComplCache_EnableInfo = 1 257 let g:NeoComplCache_EnableCamelCaseCompletion = 1 258 let g:NeoComplCache_MinSyntaxLength = 3 259 let g:NeoComplCache_EnableSkipCompletion = 1 260 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 key 265 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.vim 284 "-----------------------------------------------------------------
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="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="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 endif 116 endfunc 117 "C,C++的调试 118 map <F8> :call Rungdb()<CR> 119 func! Rungdb() 120 exec "w" 121 exec "!g++ % -g -o %<" 122 exec "!gdb ./%<" 123 endfunc 124 """""""""""""""""""""""" 125 ""实用设置 126 """""""""""""""""""""""" 127 " 设置当文件被改动时自动载入 128 set autoread 129 " quickfix模式 130 autocmd FileType c,cpp map <buffer> <leader><space> :w<cr>:make<cr> 131 "代码补全 132 set completeopt=preview,menu 133 "允许插件 134 filetype plugin on 135 "共享剪贴板 136 set clipboard+=unnamed 137 "从不备份 138 set nobackup 139 "make 运行 140 :set makeprg=g++\ -Wall\ \ % 141 "自动保存 142 set autowrite 143 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=0 151 set foldmethod=indent 152 set foldlevel=3 153 set foldenable " 开始折叠 154 " 不要使用vi的键盘模式,而是vim自己的 155 set nocompatible 156 " 语法高亮 157 set syntax=on 158 " 去掉输入错误的提示声音 159 set noeb 160 " 在处理未保存或只读文件的时候,弹出确认 161 set confirm 162 " 自动缩进 163 set autoindent 164 set cindent 165 " Tab键的宽度 166 set tabstop=4 167 " 统一缩进为4 168 set softtabstop=4 169 set shiftwidth=4 170 " 不要用空格代替制表符 171 set noexpandtab 172 " 在行和段开始处使用制表符 173 set smarttab 174 " 显示行号 175 set number 176 " 历史记录数 177 set history=1000 178 "禁止生成临时文件 179 set nobackup 180 set noswapfile 181 "搜索忽略大小写 182 set ignorecase 183 "搜索逐字符高亮 184 set hlsearch 185 set incsearch 186 "行内替换 187 set gdefault 188 "编码设置 189 set enc=utf-8 190 set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936 191 "语言设置 192 set langmenu=zh_CN.UTF-8 193 set helplang=cn 194 " 我的状态行显示的内容(包括文件类型和解码) 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=2 199 " 命令行(在状态行下)的高度,默认为1,这里是2 200 set cmdheight=2 201 " 侦测文件类型 202 filetype on 203 " 载入文件类型插件 204 filetype plugin on 205 " 为特定文件类型载入相关缩进文件 206 filetype indent on 207 " 保存全局变量 208 set viminfo+=! 209 " 带有如下符号的单词不要被换行分割 210 set iskeyword+=_,$,@,%,#,- 211 " 字符间插入的像素行数目 212 set linespace=0 213 " 增强模式中的命令行自动完成操作 214 set wildmenu 215 " 使回格键(backspace)正常处理indent, eol, start等 216 set backspace=2 217 " 允许backspace和光标键跨越行边界 218 set whichwrap+=<,>,h,l 219 " 可以在buffer的任何地方使用鼠标(类似office中在工作区双击鼠标定位) 220 set mouse=a 221 set selection=exclusive 222 set selectmode=mouse,key 223 " 通过使用: commands命令,告诉我们文件的哪一行被改变过 224 set report=0 225 " 在被分割的窗口间显示空白,便于阅读 226 set fillchars=vert:\ ,stl:\ ,stlnc:227 " 高亮显示匹配的括号 228 set showmatch 229 " 匹配括号高亮的时间(单位是十分之一秒) 230 set matchtime=1 231 " 光标移动到buffer的顶部和底部时保持3行距离 232 set scrolloff=3 233 " 为C程序提供自动缩进 234 set smartindent 235 " 高亮显示普通txt文件(需要txt.vim脚本) 236 au BufRead,BufNewFile * setfiletype txt 237 "自动补全 238 :inoremap ( ()<ESC>i 239 :inoremap ) <c-r>=ClosePair(‘)‘)<CR> 240 :inoremap { {<CR>}<ESC>O 241 :inoremap } <c-r>=ClosePair(‘}‘)<CR> 242 :inoremap [ []<ESC>i 243 :inoremap ] <c-r>=ClosePair(‘]‘)<CR> 244 :inoremap " ""<ESC>i 245 :inoremap ‘ ‘‘<ESC>i 246 function! ClosePair(char) 247 if getline(‘.‘)[col(‘.‘) - 1] == a:char 248 return "\<Right>" 249 else 250 return a:char 251 endif 252 endfunction 253 filetype plugin indent on 254 "打开文件类型检测, 加了这句才可以用智能补全 255 set completeopt=longest,menu 256 """""""""""""""""""""""""""""""" 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 autochdir 271 """"""""""""""""""""""""" 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 = 1 285 let g:miniBufExplMapWindowNavArrows = 1 286 let g:miniBufExplMapCTabSwitchBufs = 1 287 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.vim 11 12 " Uncomment the next line to make Vim more Vi-compatible 13 " NOTE: debian.vim sets ‘nocompatible‘. Setting ‘compatible‘ changes numerous 14 " options, so any other options should be set AFTER setting ‘compatible‘. 15 "set compatible 16 17 " Vim5 and later versions support syntax highlighting. Uncommenting the next 18 " line enables syntax highlighting by default. 19 if has("syntax") 20 syntax on 21 endif 22 23 " If using a dark background within the editing area and syntax highlighting 24 " turn on this option as well 25 "set background=dark 26 27 " Uncomment the following to have Vim jump to the last position when 28 " reopening a file 29 "if has("autocmd") 30 " au BufReadPost * if line("‘\"") > 1 && line("‘\"") <= line("$") | exe "normal! g‘\"" | endif 31 "endif 32 33 " Uncomment the following to have Vim load indentation rules and plugins 34 " according to the detected filetype. 35 "if has("autocmd") 36 " filetype plugin indent on 37 "endif 38 39 " The following are commented out as they cause vim to behave a lot 40 " 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 matching 44 "set smartcase " Do smart case matching 45 "set incsearch " Incremental search 46 "set autowrite " Automatically save before commands like :next and :make 47 "set hidden " Hide buffers when they are abandoned 48 "set mouse=a " Enable mouse usage (all modes) 49 set nu 50 set tabstop=4 51 set shiftwidth=4 52 set autoindent 53 set smartindent 54 set cindent 55 set cursorline 56 set clipboard=unnamedplus 57 hi CursorLine cterm=NONE ctermfg=yellow 58 highlight LineNr ctermfg=white 59 60 hi String ctermfg=white 61 hi Number ctermfg=white 62 hi Constant ctermfg=white 63 hi Comment ctermfg=yellow 64 65 inoremap ( ()<ESC>i 66 inoremap {<CR> {<CR>}<ESC>kA<CR> 67 inoremap [ []<ESC>i 68 inoremap ‘ ‘‘<ESC>i 69 inoremap " ""<ESC>i 70 71 " Source a global configuration file if available 72 if filereadable("/etc/vim/vimrc.local") 73 source /etc/vim/vimrc.local 74 endif
下载: https://pan.baidu.com/s/1nvTjAnZ
只有不断学习才能进步!
标签:类型 value work 方式 asi 分割 created ndt 文本
原文地址:http://www.cnblogs.com/wenbao/p/5831510.html