VIM

快捷键

分屏

:split 或 :sp 水平分 上下
:vsplit 或 :vs垂直分屏 左右
关闭分屏 :quit或close
分屏跳转 Ctrl+w

Mac自带vim不支持复制到系统粘贴板

查看是否支持:vim --version 列表中 clipboard项目,+支持,-不支持
解决办法:重新编译安装vim
brew install macvim --HEAD --with-override-system-vim
会提示权限不够

插件

配色

solarized
官网:http://ethanschoonover.com/solarized
Github: https://github.com/altercation/solarized
Mac版本终端颜色主题:https://github.com/tomislav/osx-terminal.app-colors-solarized

vim配色代码
syntax enable
if has('gui_running')
set background=light
else
set background=dark
endif
colorscheme solarized

NERDTree

Github:https://github.com/scrooloose/nerdtree
vim配置代码
autocmd vimenter * NERDTree
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
设置展示 隐藏快捷键 Ctrl+n
map :NERDTreeToggle
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'

vim配置参考

set nocompatible " be iMproved, required
filetype off " required
set nu

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
Plugin 'vim-scripts/Command-T'
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}

" 配色方案
Plugin 'altercation/solarized'
" 文件浏览
Plugin 'scrooloose/nerdtree'
" CtrlIP
Plugin 'kien/ctrlp.vim'
" Taglist
Plugin 'vim-scripts/taglist.vim'
" Tagbar
Plugin 'majutsushi/tagbar'
" Ctags
Plugin 'szw/vim-tags'
" html提示 快捷键Ctrl+y+,
Plugin 'mattn/emmet-vim'
" webapi-vim
Plugin 'mattn/webapi-vim'
" Improved PHP omnicompletion
Plugin 'shawncplus/phpcomplete.vim'
" Multi-language DBGP debugger client for Vim (PHP, Python, Perl, Ruby, etc.)
Plugin 'joonty/vdebug'
" vim-go
Plugin 'fatih/vim-go'

call vundle#end() " required
filetype plugin indent on " required

" 配色
syntax enable
if has('gui_running')
set background=light
else
set background=dark
endif
colorscheme solarized

" NERDTree
autocmd vimenter * NERDTree
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
map :NERDTreeToggle
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'

" CtrlIP
let g:ctrlp_map = ''
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
set wildignore+=/tmp/,.so,.swp,.zip " MacOSX/Linux
" set wildignore+=
\tmp\,.swp,.zip,.exe " Windows
" let g:ctrlp_custom_ignore = '\v[/].(git|hg|svn)$'
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[/].(git|hg|svn)$',
\ 'file': '\v.(exe|so|dll)$',
\ 'link': 'some_bad_symbolic_links',
\ }
let g:ctrlp_user_command = 'find %s -type f' " MacOSX/Linux
" let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows

" Taglist
map :TlistToggle

" Tagbar
nmap :TagbarToggle

"Ctags
set exrc
set secure
let g:vim_tags_auto_generate = 1
let g:vim_tags_project_tags_command = "{CTAGS} -R {OPTIONS} {DIRECTORY} 2>/dev/null"
let g:vim_tags_gems_tags_command = "{CTAGS} -R {OPTIONS} bundle show --paths 2>/dev/null"
let g:vim_tags_use_vim_dispatch = 0
let g:vim_tags_use_language_field = 1
let g:vim_tags_ignore_files = ['.gitignore', '.svnignore', '.cvsignore']
let g:vim_tags_ignore_file_comment_pattern = '^[#"]'
let g:vim_tags_directories = [".git", ".hg", ".svn", ".bzr", "_darcs", "CVS"]
let g:vim_tags_main_file = 'tags'
let g:vim_tags_extension = '.tags'
let g:vim_tags_cache_dir = expand($HOME)

" html代码不全
let g:user_emmet_mode='a'
let g:user_emmet_install_global = 0
autocmd FileType html,css EmmetInstall
"let g:user_emmet_leader_key=''
"let g:user_emmet_settings = webapi#json#decode(join(readfile(expand('~/.snippets_custom.json')), "\n"))

vmap y :w !pbcopy
nmap yy :.w !pbcopy
nmap p :r !pbpaste

你可能感兴趣的:(VIM)