vim 删除所有空格:%s@\n@@gvim 将[, ]替换为换行,:%s@, @\r@g
2017-09-23 VIM 配置
[root@CentOS ~]# cat ~/.vimrc "按q快速退出map q :q"按w保存当前文件map w :w "按make执行当前文件路径的Makefile文件map make :! clear; make clean; make "高亮行尾的空格highlight ExtraWhitespace ctermbg=red guibg=redautocmd BufWinEnter * match ExtraWhitespace /\s\+$\| \+\ze\t\+\|\t\+\zs \+/"设置ds按键为去除行尾空格map ds :%s/\s\+$//g "设置dm按键为去除行尾的^M标记map dm %s/\r//g "设置33按键为去清空以#开头的行map 33 :%s/^#.*$//g "设置按键将多个空行变为1个空行map dr :g/^\s*$\n\s*$/d " C 函数高亮 vim /usr/share/vim/vim74/syntax/c.vim" syn match cFunctions "\<[a-zA-Z_][a-zA-Z_0-9]*\>[^()]*)("me=e-2" syn match cFunctions "\<[a-zA-Z_][a-zA-Z_0-9]*\>\s*("me=e-1" hi cFunctions gui=NONE cterm=bold ctermfg=yellow"为Oracle 数据库开发 pro*C 程序高亮autocmd BufEnter *.pc set filetype=esqlc" 高亮显示当前行/列"set cursorline"set cursorcolumn"highlight CursorLine cterm=NONE ctermbg=lightblue"highlight CursorColumn cterm=NONE ctermbg=lightblueset mouse=a "允许在vim中鼠标复制文字内容set noswapfile "不生成.swp文件set bg=dark "字体高亮set paste "粘贴时 禁止自动缩进set completeopt=menu "关闭草稿set nonu "不显示行号set ruler "右下角显示光标当前位置set scrolloff=10 "光标到上下缓冲区边距set nobackup "禁止生成临时文件set nocindent "不使用C风格缩进set noautoindent "不使用自动缩进set shiftwidth=4 "自动缩进字符宽度set ts=4 "tab键宽度set expandtab "将tab符转为空格%retab! "对于已保存的文件,将tab转换为空格set ignorecase "搜索时 忽略大小写syntax on "语法高亮set hls "搜索高亮set nocompatible "去除兼容viset backspace=indent,eol,start "允许使用退格键set fileencodings=utf-8,GB18030 "打开文件 支持的字符集"vim 配色相关配置"set t_Co=256"colorscheme molokai"colorscheme corporation"colorscheme solarized"colorscheme morning" YouCompleteMe相关配置let g:ycm_server_python_interpreter='/usr/bin/python'let g:ycm_global_ycm_extra_conf='/root/.vim/.ycm_extra_conf.py'let g:ycm_show_diagnostics_ui = 1 " C/C++语法检查提示,1开 0关let g:ycm_complete_in_comments=1 " 补全功能在注释中同样有效let g:ycm_confirm_extra_conf=0 " 允许 vim 加载 .ycm_extra_conf.py 文件,不再提示let g:ycm_collect_identifiers_from_tags_files=1 " 开启 YCM 标签补全引擎let g:ycm_min_num_of_chars_for_completion=1 " 从第一个键入字符就开始罗列匹配项let g:ycm_cache_omnifunc=0 " 禁止缓存匹配项,每次都重新生成匹配项let g:ycm_seed_identifiers_with_syntax=1 " 语法关键字补全let g:ycm_goto_buffer_command = 'horizontal-split' " 跳转打开上下分屏map :YcmCompleter GoToDefinition map :YcmCompleter GoToDeclaration map :YcmCompleter GoToDefinitionElseDeclaration map ycm :YcmDiags "vundle 插件配置filetype offset rtp+=~/.vim/bundle/Vundle.vimcall vundle#begin()Plugin 'VundleVim/Vundle.vim'Plugin 'Valloric/YouCompleteMe'call vundle#end()filetype plugin indent on"NERDTree 文件浏览配置map :NERDTreeMirror map :NERDTreeToggle "NERD_commenter注释插件配置let mapleader = ","let NERDSpaceDelims=1 " 让注释符与语句之间留一个空格let NERDCompactSexyComs=1 " 多行注释时样子更好看let g:NERDDefaultAlign = 'left' "将行注释符左对齐[root@CentOS ~]#
2017-06-15 vim配置
"vim 属性设置map q :qmap w :w map w= :resize +1 map w- :resize -1 map w, :vertical resize -1 map w. :vertical resize +1 map make :! clear; make clean; make map er :%s/^#.*$//g map sp :g/^\s*$/d autocmd BufEnter *.i set filetype=cset noswapfile "不生成.swp文件set bg=dark "黑色背景set completeopt=menu "关闭草稿set nu "显示行号set paste "粘贴时 禁止自动缩进set ruler "右下角显示光标当前位置set scrolloff=10 "光标到上下缓冲区边距set nobackup "禁止生成临时文件set nocindent "不使用C风格缩进set noautoindent "不使用自动缩进set shiftwidth=4 "自动缩进字符宽度set ts=4 "tab键宽度set expandtab "将tab符转为空格%retab! "对于已保存的文件,执行expandtabset ignorecase "搜索时 忽略大小写syntax on "语法高亮set hls "搜索高亮set bg=dark "字体加亮set nocompatible "去除兼容viset backspace=indent,eol,start "允许使用退格键set fileencodings=utf-8,GB18030 "打开文件 支持的字符集" C 函数高亮" vim /usr/share/vim/vim74/syntax/c.vim " syn match cFunctions "\<[a-zA-Z_][a-zA-Z_0-9]*\>[^()]*)("me=e-2" syn match cFunctions "\<[a-zA-Z_][a-zA-Z_0-9]*\>\s*("me=e-1" hi cFunctions gui=NONE cterm=bold ctermfg=yellow" 高亮显示当前行/列"set cursorline"set cursorcolumn"highlight CursorLine cterm=NONE ctermbg=lightblue"highlight CursorColumn cterm=NONE ctermbg=lightblue"高亮行尾的空格highlight ExtraWhitespace ctermbg=red guibg=redautocmd BufWinEnter * match ExtraWhitespace /\s\+$\| \+\ze\t\+\|\t\+\zs \+/"设置ds按键为去除行尾空格map ds :%s/\s\+$//g "为Oracle 数据库开发 pro*C 程序高亮autocmd BufEnter *.pc set filetype=esqlc"vim 配色相关配置"set t_Co=256"colorscheme molokai"colorscheme corporation"colorscheme solarized"colorscheme morning" YouCompleteMe相关配置let g:ycm_server_python_interpreter='/usr/bin/python'let g:ycm_global_ycm_extra_conf='/root/.vim/.ycm_extra_conf.py'let g:ycm_show_diagnostics_ui = 0 " C/C++语法检查提示,1开 0关let g:ycm_complete_in_comments=1 " 补全功能在注释中同样有效let g:ycm_confirm_extra_conf=0 " 允许 vim 加载 .ycm_extra_conf.py 文件,不再提示let g:ycm_collect_identifiers_from_tags_files=1 " 开启 YCM 标签补全引擎let g:ycm_min_num_of_chars_for_completion=1 " 从第一个键入字符就开始罗列匹配项let g:ycm_cache_omnifunc=0 " 禁止缓存匹配项,每次都重新生成匹配项let g:ycm_seed_identifiers_with_syntax=1 " 语法关键字补全let g:ycm_goto_buffer_command = 'horizontal-split' " 跳转打开上下分屏map :YcmCompleter GoToDefinition map :YcmCompleter GoToDeclaration map :YcmCompleter GoToDefinitionElseDeclaration map ycm :YcmDiags "vundle 插件配置filetype offset rtp+=~/.vim/bundle/Vundle.vimcall vundle#begin()Plugin 'VundleVim/Vundle.vim'Plugin 'Valloric/YouCompleteMe'call vundle#end()filetype plugin indent on"NERDTree 文件浏览配置map :NERDTreeMirror map :NERDTreeToggle "NERD_commenter注释插件配置let mapleader = ","let NERDSpaceDelims=1 " 让注释符与语句之间留一个空格let NERDCompactSexyComs=1 " 多行注释时样子更好看let g:NERDDefaultAlign = 'left' "将行注释符左对齐
我的vim配置
chunli@CentOS~$ cat ~/.vimrc"vim 属性设置map q :qmap w :w map w= :resize +1 map w- :resize -1 map w, :vertical resize -1 map w. :vertical resize +1 set noswapfile "不生成.swp文件set bg=dark "黑色背景set completeopt=menu "关闭草稿set nonu "显示行号set paste "粘贴时 禁止自动缩进set ruler "右下角显示光标当前位置set scrolloff=10 "光标到上下缓冲区边距set nobackup "禁止生成临时文件set nocindent "不使用C风格缩进set noautoindent "不使用自动缩进set shiftwidth=4 "自动缩进字符宽度set ts=4 "tab键宽度set expandtab "将tab符转为空格%retab! "对于已保存的文件,执行expandtabset fencs=utf-8,GB2312 "支持的字符集set ignorecase "搜索时 忽略大小写syntax on "语法高亮set hls "搜索高亮set bg=dark "字体加亮set nocompatible "去除兼容viset backspace=indent,eol,start "允许使用退格键" 高亮显示当前行/列set cursorlineset cursorcolumnhighlight CursorLine cterm=NONE ctermbg=lightbluehighlight CursorColumn cterm=NONE ctermbg=lightblue"高亮行尾的空格highlight ExtraWhitespace ctermbg=red guibg=redautocmd BufWinEnter * match ExtraWhitespace /\s\+$\| \+\ze\t\+\|\t\+\zs \+/"设置ds按键为去除行尾空格map ds :%s/\s\+$//g "为Oracle 数据库开发 pro*C 程序高亮autocmd BufEnter *.pc set filetype=esqlc"vim 配色相关配置"set t_Co=256"colorscheme molokai"colorscheme corporation"colorscheme solarized"colorscheme morning" YouCompleteMe相关配置let g:ycm_server_python_interpreter='/usr/bin/python'let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py'let g:ycm_show_diagnostics_ui = 0 "关闭语法提示let g:ycm_complete_in_comments=1 " 补全功能在注释中同样有效let g:ycm_confirm_extra_conf=0 " 允许 vim 加载 .ycm_extra_conf.py 文件,不再提示let g:ycm_collect_identifiers_from_tags_files=1 " 开启 YCM 标签补全引擎let g:ycm_min_num_of_chars_for_completion=1 " 从第一个键入字符就开始罗列匹配项let g:ycm_cache_omnifunc=0 " 禁止缓存匹配项,每次都重新生成匹配项let g:ycm_seed_identifiers_with_syntax=1 " 语法关键字补全let g:ycm_goto_buffer_command = 'horizontal-split' " 跳转打开上下分屏map :YcmCompleter GoToDefinition map :YcmCompleter GoToDeclaration map :YcmCompleter GoToDefinitionElseDeclaration "vundle 插件配置filetype offset rtp+=~/.vim/bundle/Vundle.vimcall vundle#begin()Plugin 'VundleVim/Vundle.vim'Plugin 'Valloric/YouCompleteMe'call vundle#end()filetype plugin indent on"NERDTree 文件浏览配置map :NERDTreeMirror map :NERDTreeToggle chunli@CentOS~$