vim配置文件的使用方式
- 将.vimrc文件拷贝到~下(linux放在~/.vimrc, windows放在~/_vimrc)
- 执行命令 git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
- vim .vimrc执行:PluginInstall
- 退出,重新打开即可.
插件版
"设置编码"
set encoding=utf-8
set fileencodings=utf-8,chinese,latin-1
if has("win32")
set fileencoding=chinese
else
set fileencoding=utf-8
endif
language messages zh_CN.utf-8
" 设置 gvim 显示字体
"set guifont=consolas:h16:b
"设置菜单不乱码"
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
"设置字体"
"set guifont=Consolas:h11:cDEFAULT
"设置折行"
set wrap
"设置自动缩进"
set autoindent
"设置tab为4个空格"
set ts=4
" 将制表符扩展为空格
set expandtab
" 设置编辑时制表符占用空格数
set tabstop=4
" 设置格式化时制表符占用空格数
set shiftwidth=4
" 让 vim 把连续数量的空格视为一个制表符
set softtabstop=4
"设置语法高亮"
syntax enable
syntax on
"设置换行符为windows的"
set ffs=dos
"设置自动加载被其他程序修改的文件,相当于执行了:e!"
set autoread
""设置ctrl+A为全选"
map <C-A> ggVG
map! <C-A> <Esc>ggVG
""设置键盘ctrl+C为复制"
vmap <C-c> "+y
"设置标尺"
set ruler
"设置光标当前行浅色高亮"
set cursorline
"高亮当前列
set cursorcolumn
"设置隐藏图标栏"
set guioptions-=T
"使回格键(backspace)正常处理indent, eol, start等"
set backspace=2
" 允许backspace和光标键跨越行边界"
set whichwrap+=<,>,h,l
"共享剪贴板
set clipboard+=unnamed
"设置启动时最大化"
if has('win32')
au GUIEnter * simalt ~x
else
au GUIEnter * call MaximizeWindow()
endif
function! MaximizeWindow()
silent !wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz
endfunction
"设置相对行号"
set number
set relativenumber
"搜索结果语法高亮"
set hlsearch
"设置前缀键
let mapleader="kj"
"定义快捷键到行首行尾
nmap LB 0
nmap LE $
"设置将选中的文本复制到系统剪贴板
vnoremap <Leader>y "+y
"设置快捷键将系统剪贴板内容粘贴到vim
nmap <Leader>p "+p
"定义快捷键关闭当前分割窗口
nmap <Leader>q :q<CR>
"定义快捷键保存当前窗口内容
nmap <Leader>w :w<R>
"定义快捷键保存所有窗口的内容并退出
nmap <Leader>WQ :wa<CR>:q<CR>
"不做任何保存直接退出vim
nmap <Leader>Q :qa!<CR>
"依次遍历子窗口
nnoremap nw <C-W><C-W>
"跳转到右方的窗口
nnoremap <Leader>lw <C-W>l
"跳转到左方的子窗口
nnoremap <Leader>hw <C-W>h
"跳转到上方的子窗口
nnoremap <Leader>kw <C-W>k
"跳转到上方的子窗口
nnoremap <Leader>jw <C-W>j
"定义快捷键在结对符之间跳转
nmap <Leader>M %
"让配置变更立即生效
autocmd BufWritePost $MYVIMRC source $MYVIMRC
"开启实时搜索功能
set incsearch
"搜索时大小写不敏感
set ignorecase
"关闭兼容模式
set nocompatible
"vim 自身命令行式补全
set wildmenu
" 禁止光标闪烁
"set gcr=a:block-blinkon0
" 全屏开/关快捷键
map <silent> <F11> :call ToggleFullscreen()<CR>
"设置自动侦测文件类型"
filetype on
"根据不同的类型加载不同的插件
filetype plugin on
"设置自动缩进"
filetype indent on
" 随 vim 自启动
let g:indent_guides_enable_on_vim_startup=1
" 从第二层开始可视化显示缩进
let g:indent_guides_start_level=2
" 色块宽度
let g:indent_guides_guide_size=1
" 快捷键 i 开/关缩进可视化
:nmap <silent> <Leader>i <Plug>IndentGuidesToggle
" 基于缩进或语法进行代码折叠
"set foldmethod=indent
set foldmethod=syntax
" 启动 vim 时关闭折叠代码
set nofoldenable
"colorscheme ron
"colorscheme zellner
set rtp+=D:\python36\Lib\site-packages\powerline\bindings\vim
" These lines setup the environment to show graphics and colors correctly.
set t_Co=256
let g:minBufExplForceSyntaxEnable = 1
"set laststatus=2 " Always display the
"statusline in all windows
"set guifont=Inconsolata\ for\ Powerline:h14
"set noshowmode " Hide the default mode text (e.g. -- INSERT -- below the statusline)
set nocompatible " required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
call vundle#end() " required
filetype plugin indent on " required
"代码折叠
"set foldmethod=indent
"au BufWinLeave * silent mkview " 保存文件的折叠状态
"au BufRead * silent loadview " 恢复文件的折叠状态
"nnoremap <space> za " 用空格来切换折叠状态
"智能折叠
"Plugin 'tmhedberg/SimpylFold'
"Plugin 'Valloric/YouCompleteMe'
Plugin 'scrooloose/nerdtree'
" 这个插件可以显示文件的Git增删状态
Plugin 'Xuyuanp/nerdtree-git-plugin'
" Ctrl+N 打开/关闭
map <C-n> :NERDTreeToggle<CR>
" 当不带参数打开Vim时自动加载项目树
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" 当所有文件关闭时关闭项目树窗格
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" 不显示这些文件
let NERDTreeIgnore=['\.pyc$', '\~$', 'node_modules'] "ignore files in NERDTree
" 不显示项目树上额外的信息,例如帮助、提示什么的
let NERDTreeMinimalUI=1
Plugin 'kien/ctrlp.vim'
let g:ctrlp_working_path_mode = 'ra'
set wildignore+=*/tmp/*,*/node_modules/*,*.so,*.swp,*.zip
let g:ctrlp_custom_ignore = {'dir': '\v[\/]\.(git|hg|svn)$', 'file': '\v\.(exe|so|dll)$'}
set clipboard=unnamed
"set pastetoggle=<F9>
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
set guifont=DejaVu\ Sans\ Mono\ for\ Powerline:h12
let g:Powerline_symbols = 'fancy'
set encoding=utf-8
set t_Co=256
set fillchars+=stl:\ ,stlnc:\
"set term=xterm-256color
set termencoding=utf-8
let mapleader=';'
"自动补全
Plugin 'davidhalter/jedi-vim'
"使用Tab进行自动补全
Plugin 'SuperTab'
"加载主题插件solarized
Plugin 'altercation/vim-colors-solarized'
"设置solarized主题
"colorscheme solarized
"colorscheme zellner
"set background=dark
let g:Powerline_colorscheme='solarized256'
hi Normal ctermbg=Black ctermfg=white
"加载主题插件grubbox
Plugin 'morhetz/gruvbox'
"设置主题颜色和背景分为dark或者light
colorscheme gruvbox
set background=dark " Setting dark mode
"set background=light
"设置背景色不出问题
if &term =~ '256color'
" disable Background Color Erase (BCE) so that color schemes
" render properly when inside 256-color tmux and GNU screen.
" see also http://snk.tuxfamily.org/log/vim-256color-bce.html
set t_ut=
endif
Plugin 'iamcco/mathjax-support-for-mkdp'
Plugin 'iamcco/markdown-preview.vim'
无插件版
"设置编码"
set encoding=utf-8
set fileencodings=utf-8,chinese,latin-1
if has("win32")
set fileencoding=chinese
language messages zh_CN.utf-8
else
set fileencoding=utf-8
endif
" 设置 gvim 显示字体
set guifont=consolas:h16:b
"设置菜单不乱码"
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
"设置字体"
set guifont=Consolas:h11:cDEFAULT
"设置折行"
set wrap
"设置自动缩进"
set autoindent
"设置tab为4个空格"
set ts=4
" 将制表符扩展为空格
set expandtab
" 设置编辑时制表符占用空格数
set tabstop=4
" 设置格式化时制表符占用空格数
set shiftwidth=4
" 让 vim 把连续数量的空格视为一个制表符
set softtabstop=4
"设置语法高亮"
syntax enable
syntax on
"设置换行符为windows的"
set ffs=dos
"设置自动加载被其他程序修改的文件,相当于执行了:e!"
set autoread
""设置ctrl+A为全选"
map <C-A> ggVG
map! <C-A> <Esc>ggVG
""设置键盘ctrl+C为复制"
vmap <C-c> "+y
"设置标尺"
set ruler
"设置光标当前行浅色高亮"
set cursorline
"高亮当前列
set cursorcolumn
"设置隐藏图标栏"
set guioptions-=T
"使回格键(backspace)正常处理indent, eol, start等"
set backspace=2
" 允许backspace和光标键跨越行边界"
set whichwrap+=<,>,h,l
"共享剪贴板
set clipboard+=unnamed
"设置启动时最大化"
if has('win32')
au GUIEnter * simalt ~x
else
au GUIEnter * call MaximizeWindow()
endif
function! MaximizeWindow()
silent !wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz
endfunction
"设置相对行号"
set number
set relativenumber
"搜索结果语法高亮"
set hlsearch
"设置前缀键
let mapleader="kj"
"定义快捷键到行首行尾
nmap LB 0
nmap LE $
"设置将选中的文本复制到系统剪贴板
vnoremap <Leader>y "+y
"设置快捷键将系统剪贴板内容粘贴到vim
nmap <Leader>p "+p
"定义快捷键关闭当前分割窗口
nmap <Leader>q :q<CR>
"定义快捷键保存当前窗口内容
nmap <Leader>w :w<R>
"定义快捷键保存所有窗口的内容并退出
nmap <Leader>WQ :wa<CR>:q<CR>
"不做任何保存直接退出vim
nmap <Leader>Q :qa!<CR>
"依次遍历子窗口
nnoremap nw <C-W><C-W>
"跳转到右方的窗口
nnoremap <Leader>lw <C-W>l
"跳转到左方的子窗口
nnoremap <Leader>hw <C-W>h
"跳转到上方的子窗口
nnoremap <Leader>kw <C-W>k
"跳转到上方的子窗口
nnoremap <Leader>jw <C-W>j
"定义快捷键在结对符之间跳转
nmap <Leader>M %
"让配置变更立即生效
autocmd BufWritePost $MYVIMRC source $MYVIMRC
"开启实时搜索功能
set incsearch
"搜索时大小写不敏感
set ignorecase
"关闭兼容模式
set nocompatible
"vim 自身命令行式补全
set wildmenu
" 禁止光标闪烁
"set gcr=a:block-blinkon0
" 全屏开/关快捷键
map <silent> <F11> :call ToggleFullscreen()<CR>
"设置自动侦测文件类型"
filetype on
"根据不同的类型加载不同的插件
filetype plugin on
"设置自动缩进"
filetype indent on
" 随 vim 自启动
let g:indent_guides_enable_on_vim_startup=1
" 从第二层开始可视化显示缩进
let g:indent_guides_start_level=2
" 色块宽度
let g:indent_guides_guide_size=1
" 快捷键 i 开/关缩进可视化
:nmap <silent> <Leader>i <Plug>IndentGuidesToggle
" 基于缩进或语法进行代码折叠
"set foldmethod=indent
set foldmethod=syntax
" 启动 vim 时关闭折叠代码
set nofoldenable
"colorscheme ron
colorscheme zellner
mac本机使用的.vimrc
set encoding=utf-8
set fileencodings=utf-8,chinese,latin-1
language messages zh_CN.utf-8
set guifont=consolas:h16:b
set wrap
"设置自动缩进"
set autoindent
"设置主题"
"colorscheme peachpuff
"colorscheme ron
"colorscheme zellner
set ts=4
set expandtab
set shiftwidth=4
"设置语法高亮"
syntax on
set autoread
""设置ctrl+A为全选"
map <C-A> ggVG
map! <C-A> <Esc>ggVG
""设置键盘ctrl+C为复制"
vmap <C-c> "+y
"设置标尺"
set ruler
""设置光标当前行浅色高亮"
set cursorline
"高亮当前列
set cursorcolumn
"设置自动侦测文件类型"
filetype on
""根据不同的类型加载不同的插件
filetype plugin on
"设置自动缩进"
filetype indent on
""使回格键(backspace)正常处理indent, eol, start等"
set backspace=2
" 允许backspace和光标键跨越行边界"
set whichwrap+=<,>,h,l
" "共享剪贴板
set clipboard+=unnamed
set number
set relativenumber
"搜索结果语法高亮"
set hlsearch
""设置前缀键
let mapleader="kj"
"定义快捷键到行首行尾
nmap LB 0
nmap LE $
""设置将选中的文本复制到系统剪贴板
vnoremap <Leader>y "+y
"设置快捷键将系统剪贴板内容粘贴到vim
nmap <Leader>p "+p
""定义快捷键关闭当前分割窗口
nmap <Leader>q :q<CR>
"定义快捷键保存当前窗口内容
nmap <Leader>w :w<R>
""定义快捷键保存所有窗口的内容并退出
nmap <Leader>WQ :wa<CR>:q<CR>
"不做任何保存直接退出vim
nmap <Leader>Q :qa!<CR>
""依次遍历子窗口
nnoremap nw <C-W><C-W>
"跳转到右方的窗口
nnoremap <Leader>lw <C-W>l
""跳转到左方的子窗口
nnoremap <Leader>hw <C-W>h
"跳转到上方的子窗口
nnoremap <Leader>kw <C-W>k
""跳转到上方的子窗口
nnoremap <Leader>jw <C-W>j
"定义快捷键在结对符之间跳转
nmap <Leader>M %
""让配置变更立即生效
autocmd BufWritePost $MYVIMRC source $MYVIMRC
"开启实时搜索功能
set incsearch
""搜索时大小写不敏感
set ignorecase
"关闭兼容模式
set nocompatible
""vim 自身命令行式补全
set wildmenu
"set rtp+=/usr/local/lib/python2.7/dist-packages/powerline/bindings/vim
" These lines setup the environment to show graphics and colors correctly.
set nocompatible
set t_Co=256
let g:minBufExplForceSyntaxEnable = 1
"python from powerline.vim import setup as powerline_setup
"python powerline_setup()
"python del powerline_setup
"if ! has('gui_running')
" set ttimeoutlen=10
" augroup FastEscape
" autocmd!
" au InsertEnter * set timeoutlen=0
" au InsertLeave * set timeoutlen=1000
" augroup END
"endif
"
"set laststatus=2 " Always display the
"statusline in all windows
"set guifont=Inconsolata\ for\ Powerline:h14
"set noshowmode " Hide the default mode text (e.g. -- INSERT -- below the statusline)
set nocompatible " required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
call vundle#end() " required
filetype plugin indent on " required
"代码折叠
"set foldmethod=indent
"au BufWinLeave * silent mkview " 保存文件的折叠状态
"au BufRead * silent loadview " 恢复文件的折叠状态
"nnoremap <space> za " 用空格来切换折叠状态
"智能折叠
"Plugin 'tmhedberg/SimpylFold'
"Plugin 'Valloric/YouCompleteMe'
"让完成补全之后preview窗口自动消失:
let g:SimpyIFold_docstring_preview=1
let g:ycm_server_python_interpreter='/usr/bin/python3'
let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py'
"set completeopt-=preview
"let g:ycm_autoclose_preview_window_after_completion=1
Plugin 'scrooloose/nerdtree'
" 这个插件可以显示文件的Git增删状态
Plugin 'Xuyuanp/nerdtree-git-plugin'
" Ctrl+N 打开/关闭
map <C-n> :NERDTreeToggle<CR>
" 当不带参数打开Vim时自动加载项目树
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" 当所有文件关闭时关闭项目树窗格
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" 不显示这些文件
let NERDTreeIgnore=['\.pyc$', '\~$', 'node_modules'] "ignore files in NERDTree
" 不显示项目树上额外的信息,例如帮助、提示什么的
let NERDTreeMinimalUI=1
Plugin 'kien/ctrlp.vim'
let g:ctrlp_working_path_mode = 'ra'
set wildignore+=*/tmp/*,*/node_modules/*,*.so,*.swp,*.zip
let g:ctrlp_custom_ignore = {'dir': '\v[\/]\.(git|hg|svn)$', 'file': '\v\.(exe|so|dll)$'}
set clipboard=unnamed
"set pastetoggle=<F9>
"Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
"set guifont=Inconsolata\ for\ Powerline:h15
"let g:Powerline_symbols = 'fancy'
set encoding=utf-8
set t_Co=256
set fillchars+=stl:\ ,stlnc:\
set term=xterm-256color
set termencoding=utf-8
let mapleader=';'
"自动补全
Plugin 'davidhalter/jedi-vim'
Plugin 'SuperTab'
Plugin 'altercation/vim-colors-solarized'
colorscheme solarized
set background=dark
"let g:Powerline_colorscheme='solarized256'
hi Normal ctermbg=Black ctermfg=white
"加载主题插件grubbox
Plugin 'morhetz/gruvbox'
"设置主题颜色和背景分为dark或者light
colorscheme gruvbox
set background=dark " Setting dark mode
"set background=light
Plugin 'iamcco/mathjax-support-for-mkdp'
Plugin 'iamcco/markdown-preview.vim'
主题 molokai.vim
" Vim color file
"
" Author: Tomas Restrepo <tomas@winterdom.com>
" https://github.com/tomasr/molokai
"
" Note: Based on the Monokai theme for TextMate
" by Wimer Hazenberg and its darker variant
" by Hamish Stuart Macpherson
"
hi clear
if version > 580
" no guarantees for version 5.8 and below, but this makes it stop
" complaining
hi clear
if exists("syntax_on")
syntax reset
endif
endif
let g:colors_name="molokai"
if exists("g:molokai_original")
let s:molokai_original = g:molokai_original
else
let s:molokai_original = 0
endif
hi Boolean guifg=#AE81FF
hi Character guifg=#E6DB74
hi Number guifg=#AE81FF
hi String guifg=#E6DB74
hi Conditional guifg=#F92672 gui=bold
hi Constant guifg=#AE81FF gui=bold
hi Cursor guifg=#000000 guibg=#F8F8F0
hi iCursor guifg=#000000 guibg=#F8F8F0
hi Debug guifg=#BCA3A3 gui=bold
hi Define guifg=#66D9EF
hi Delimiter guifg=#8F8F8F
hi DiffAdd guibg=#13354A
hi DiffChange guifg=#89807D guibg=#4C4745
hi DiffDelete guifg=#960050 guibg=#1E0010
hi DiffText guibg=#4C4745 gui=italic,bold
hi Directory guifg=#A6E22E gui=bold
hi Error guifg=#E6DB74 guibg=#1E0010
hi ErrorMsg guifg=#F92672 guibg=#232526 gui=bold
hi Exception guifg=#A6E22E gui=bold
hi Float guifg=#AE81FF
hi FoldColumn guifg=#465457 guibg=#000000
hi Folded guifg=#465457 guibg=#000000
hi Function guifg=#A6E22E
hi Identifier guifg=#FD971F
hi Ignore guifg=#808080 guibg=bg
hi IncSearch guifg=#C4BE89 guibg=#000000
hi Keyword guifg=#F92672 gui=bold
hi Label guifg=#E6DB74 gui=none
hi Macro guifg=#C4BE89 gui=italic
hi SpecialKey guifg=#66D9EF gui=italic
hi MatchParen guifg=#000000 guibg=#FD971F gui=bold
hi ModeMsg guifg=#E6DB74
hi MoreMsg guifg=#E6DB74
hi Operator guifg=#F92672
" complete menu
hi Pmenu guifg=#66D9EF guibg=#000000
hi PmenuSel guibg=#808080
hi PmenuSbar guibg=#080808
hi PmenuThumb guifg=#66D9EF
hi PreCondit guifg=#A6E22E gui=bold
hi PreProc guifg=#A6E22E
hi Question guifg=#66D9EF
hi Repeat guifg=#F92672 gui=bold
hi Search guifg=#000000 guibg=#FFE792
" marks
hi SignColumn guifg=#A6E22E guibg=#232526
hi SpecialChar guifg=#F92672 gui=bold
hi SpecialComment guifg=#7E8E91 gui=bold
hi Special guifg=#66D9EF guibg=bg gui=italic
if has("spell")
hi SpellBad guisp=#FF0000 gui=undercurl
hi SpellCap guisp=#7070F0 gui=undercurl
hi SpellLocal guisp=#70F0F0 gui=undercurl
hi SpellRare guisp=#FFFFFF gui=undercurl
endif
hi Statement guifg=#F92672 gui=bold
hi StatusLine guifg=#455354 guibg=fg
hi StatusLineNC guifg=#808080 guibg=#080808
hi StorageClass guifg=#FD971F gui=italic
hi Structure guifg=#66D9EF
hi Tag guifg=#F92672 gui=italic
hi Title guifg=#ef5939
hi Todo guifg=#FFFFFF guibg=bg gui=bold
hi Typedef guifg=#66D9EF
hi Type guifg=#66D9EF gui=none
hi Underlined guifg=#808080 gui=underline
hi VertSplit guifg=#808080 guibg=#080808 gui=bold
hi VisualNOS guibg=#403D3D
hi Visual guibg=#403D3D
hi WarningMsg guifg=#FFFFFF guibg=#333333 gui=bold
hi WildMenu guifg=#66D9EF guibg=#000000
hi TabLineFill guifg=#1B1D1E guibg=#1B1D1E
hi TabLine guibg=#1B1D1E guifg=#808080 gui=none
if s:molokai_original == 1
hi Normal guifg=#F8F8F2 guibg=#272822
hi Comment guifg=#75715E
hi CursorLine guibg=#3E3D32
hi CursorLineNr guifg=#FD971F gui=none
hi CursorColumn guibg=#3E3D32
hi ColorColumn guibg=#3B3A32
hi LineNr guifg=#BCBCBC guibg=#3B3A32
hi NonText guifg=#75715E
hi SpecialKey guifg=#75715E
else
hi Normal guifg=#F8F8F2 guibg=#1B1D1E
hi Comment guifg=#7E8E91
hi CursorLine guibg=#293739
hi CursorLineNr guifg=#FD971F gui=none
hi CursorColumn guibg=#293739
hi ColorColumn guibg=#232526
hi LineNr guifg=#465457 guibg=#232526
hi NonText guifg=#465457
hi SpecialKey guifg=#465457
end
"
" Support for 256-color terminal
"
if &t_Co > 255
if s:molokai_original == 1
hi Normal ctermbg=234
hi CursorLine ctermbg=235 cterm=none
hi CursorLineNr ctermfg=208 cterm=none
else
hi Normal ctermfg=252 ctermbg=233
hi CursorLine ctermbg=234 cterm=none
hi CursorLineNr ctermfg=208 cterm=none
endif
hi Boolean ctermfg=135
hi Character ctermfg=144
hi Number ctermfg=135
hi String ctermfg=144
hi Conditional ctermfg=161 cterm=bold
hi Constant ctermfg=135 cterm=bold
hi Cursor ctermfg=16 ctermbg=253
hi Debug ctermfg=225 cterm=bold
hi Define ctermfg=81
hi Delimiter ctermfg=241
hi DiffAdd ctermbg=24
hi DiffChange ctermfg=181 ctermbg=239
hi DiffDelete ctermfg=162 ctermbg=53
hi DiffText ctermbg=102 cterm=bold
hi Directory ctermfg=118 cterm=bold
hi Error ctermfg=219 ctermbg=89
hi ErrorMsg ctermfg=199 ctermbg=16 cterm=bold
hi Exception ctermfg=118 cterm=bold
hi Float ctermfg=135
hi FoldColumn ctermfg=67 ctermbg=16
hi Folded ctermfg=67 ctermbg=16
hi Function ctermfg=118
hi Identifier ctermfg=208 cterm=none
hi Ignore ctermfg=244 ctermbg=232
hi IncSearch ctermfg=193 ctermbg=16
hi keyword ctermfg=161 cterm=bold
hi Label ctermfg=229 cterm=none
hi Macro ctermfg=193
hi SpecialKey ctermfg=81
hi MatchParen ctermfg=233 ctermbg=208 cterm=bold
hi ModeMsg ctermfg=229
hi MoreMsg ctermfg=229
hi Operator ctermfg=161
" complete menu
hi Pmenu ctermfg=81 ctermbg=16
hi PmenuSel ctermfg=255 ctermbg=242
hi PmenuSbar ctermbg=232
hi PmenuThumb ctermfg=81
hi PreCondit ctermfg=118 cterm=bold
hi PreProc ctermfg=118
hi Question ctermfg=81
hi Repeat ctermfg=161 cterm=bold
hi Search ctermfg=0 ctermbg=222 cterm=NONE
" marks column
hi SignColumn ctermfg=118 ctermbg=235
hi SpecialChar ctermfg=161 cterm=bold
hi SpecialComment ctermfg=245 cterm=bold
hi Special ctermfg=81
if has("spell")
hi SpellBad ctermbg=52
hi SpellCap ctermbg=17
hi SpellLocal ctermbg=17
hi SpellRare ctermfg=none ctermbg=none cterm=reverse
endif
hi Statement ctermfg=161 cterm=bold
hi StatusLine ctermfg=238 ctermbg=253
hi StatusLineNC ctermfg=244 ctermbg=232
hi StorageClass ctermfg=208
hi Structure ctermfg=81
hi Tag ctermfg=161
hi Title ctermfg=166
hi Todo ctermfg=231 ctermbg=232 cterm=bold
hi Typedef ctermfg=81
hi Type ctermfg=81 cterm=none
hi Underlined ctermfg=244 cterm=underline
hi VertSplit ctermfg=244 ctermbg=232 cterm=bold
hi VisualNOS ctermbg=238
hi Visual ctermbg=235
hi WarningMsg ctermfg=231 ctermbg=238 cterm=bold
hi WildMenu ctermfg=81 ctermbg=16
hi Comment ctermfg=59
hi CursorColumn ctermbg=236
hi ColorColumn ctermbg=236
hi LineNr ctermfg=250 ctermbg=236
hi NonText ctermfg=59
hi SpecialKey ctermfg=59
if exists("g:rehash256") && g:rehash256 == 1
hi Normal ctermfg=252 ctermbg=234
hi CursorLine ctermbg=236 cterm=none
hi CursorLineNr ctermfg=208 cterm=none
hi Boolean ctermfg=141
hi Character ctermfg=222
hi Number ctermfg=141
hi String ctermfg=222
hi Conditional ctermfg=197 cterm=bold
hi Constant ctermfg=141 cterm=bold
hi DiffDelete ctermfg=125 ctermbg=233
hi Directory ctermfg=154 cterm=bold
hi Error ctermfg=222 ctermbg=233
hi Exception ctermfg=154 cterm=bold
hi Float ctermfg=141
hi Function ctermfg=154
hi Identifier ctermfg=208
hi Keyword ctermfg=197 cterm=bold
hi Operator ctermfg=197
hi PreCondit ctermfg=154 cterm=bold
hi PreProc ctermfg=154
hi Repeat ctermfg=197 cterm=bold
hi Statement ctermfg=197 cterm=bold
hi Tag ctermfg=197
hi Title ctermfg=203
hi Visual ctermbg=238
hi Comment ctermfg=244
hi LineNr ctermfg=239 ctermbg=235
hi NonText ctermfg=239
hi SpecialKey ctermfg=239
endif
end
" Must be at the end, because of ctermbg=234 bug.
" https://groups.google.com/forum/#!msg/vim_dev/afPqwAFNdrU/nqh6tOM87QUJ
set background=dark
.zshrc_chaomeng
export ZSH=~/.oh-my-zsh
#ZSH_THEME="agnoster"
ZSH_THEME="lambda-mod"
plugins=(git zsh-autosuggestions autojump)
source $ZSH/oh-my-zsh.sh
# 设置coreutils工具
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
# 修改Homebrew Bottles源
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
# zsh高亮插件
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# 添加coreutils的ls主题solarized
eval `dircolors ~/.dircolors`
alias ls="ls --color=auto"
# 解决screenfetch显示bug,替换readlink为coreutils
alias readlink=greadlink
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
VIRTUALENVWRAPPER_PYTHON=/Library/Frameworks/Python.framework/Versions/3.6/bin/python3
source /Library/Frameworks/Python.framework/Versions/3.6/bin/virtualenvwrapper.sh
export WORKON_HOME="/Users/cmdata/envs"
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
_COLUMNS=$(tput cols)
_MESSAGE=" FBI Warining "
y=$(( ( $_COLUMNS - ${#_MESSAGE} ) / 2 ))
spaces=$(printf "%-${y}s" " ")
echo " "
echo -e "${spaces}\033[41;37;5m FBI WARNING \033[0m"
echo " "
_COLUMNS=$(tput cols)
_MESSAGE="Ferderal Law provides severe civil and criminal penalties for"
y=$(( ( $_COLUMNS - ${#_MESSAGE} ) / 2 ))
spaces=$(printf "%-${y}s" " ")
echo -e "${spaces}${_MESSAGE}"
_COLUMNS=$(tput cols)
_MESSAGE="the unauthorized reproduction, distribution, or exhibition of"
y=$(( ( $_COLUMNS - ${#_MESSAGE} ) / 2 ))
spaces=$(printf "%-${y}s" " ")
echo -e "${spaces}${_MESSAGE}"
_COLUMNS=$(tput cols)
_MESSAGE="copyrighted motion pictures (Title 17, United States Code,"
y=$(( ( $_COLUMNS - ${#_MESSAGE} ) / 2 ))
spaces=$(printf "%-${y}s" " ")
echo -e "${spaces}${_MESSAGE}"
_COLUMNS=$(tput cols)
_MESSAGE="Sections 501 and 508). The Federal Bureau of Investigation"
y=$(( ( $_COLUMNS - ${#_MESSAGE} ) / 2 ))
spaces=$(printf "%-${y}s" " ")
echo -e "${spaces}${_MESSAGE}"
_COLUMNS=$(tput cols)
_MESSAGE="investigates allegations of criminal copyright infringement"
y=$(( ( $_COLUMNS - ${#_MESSAGE} ) / 2 ))
YouCompleteMe安装
YouCompleteMe(YCM)是一个功能非常强大的代码补全工具,可说是python开发的最佳搭档。
在安装YCM前,还需要先安装一些必须的软件:
sudo apt install python-dev python3-dev cmake
接着在~/.vimrc上文的空白处添加YCM配置:
Plugin 'Valloric/YouCompleteMe'
然后运行vim在normal模式下运行:PluginInstall
,系统即会将YCM安装到~/.vim/bundle/目录下。
这里需要特别提醒大家的是YCM的体积比较大,等待的时间会比较长,有时会出错退出安装,这时在运行vim时,在窗口下部会出现红色的YouCompleteMe unavailable: No module named 'future'
的提示。这是由于YCM没有下载完毕所造成的,这时可以换用Git来继续安装YCM:
在Shell下输入
cd ~/.vim/bundle/YouCompleteMe
进入YCM目录,然后输入
git submodule update --init --recursive
命令,如下载过程中又出现中断出错,就继续运行此命令。
在克隆完成之后,输入:
./install.py --clang-completer
然后再在文件夹里执行./install.py
安装,根据你的机器环境可能会提示你先执行一个Git命令克隆一些必须的库,按照提示运行就可以了。克隆完成之后再执行./install.py
。
运行完毕后可在.vimrc文件中添加以下配置来让完成补全之后preview窗口自动消失:
let g:SimpyIFold_docstring_preview=1
复制.ycm_extra_conf.py文件至~/.vim目录下
cp ~/.vim/bundle/YoucompleteMe/third_parth/ycmd/examples/.ycm_extra_conf.py ~/.vim/
在.vimrc中添加YCM配置,打开.vimrc文件,在文件最后加入:
let g:ycm_server_python_interpreter='/usr/bin/python3'
let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py'
此处要填写你自己机器上的python解释器的版本位置。
以下配置你可以根据自己需求进行配置:
set completeopt-=preview
补全内容不以分割子窗口形式出现,只显示补全列表
let g:ycm_autoclose_preview_window_after_completion=1
完成操作后自动补全窗口不消失
作者:zhengjie 链接:https://www.jianshu.com/p/d8ea4bbff59c 來源:简书 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。