├── screenshot-1.png ├── screenshot-2.png ├── fonts ├── Menlo │ ├── Menlo-OldPowerline.otf │ └── Menlo for Powerline │ │ ├── Menlo Bold for Powerline.ttf │ │ ├── Menlo Italic for Powerline.ttf │ │ ├── Menlo Regular for Powerline.ttf │ │ └── Menlo Bold Italic for Powerline.ttf ├── San Francisco Mono │ ├── SF Mono │ │ ├── SFMono-Bold.otf │ │ ├── SFMono-Heavy.otf │ │ ├── SFMono-Light.otf │ │ ├── SFMono-Medium.otf │ │ ├── SFMono-Regular.otf │ │ ├── SFMono-BoldItalic.otf │ │ ├── SFMono-Semibold.otf │ │ ├── SFMono-HeavyItalic.otf │ │ ├── SFMono-LightItalic.otf │ │ ├── SFMono-MediumItalic.otf │ │ ├── SFMono-RegularItalic.otf │ │ └── SFMono-SemiboldItalic.otf │ ├── SF Mono for Powerline │ │ ├── SF Mono Bold for Powerline.otf │ │ ├── SF Mono Heavy for Powerline.otf │ │ ├── SF Mono Light for Powerline.otf │ │ ├── SF Mono Medium for Powerline.otf │ │ ├── SF Mono Regular for Powerline.otf │ │ ├── SF Mono Semibold for Powerline.otf │ │ ├── SF Mono BoldItalic for Powerline.otf │ │ ├── SF Mono HeavyItalic for Powerline.otf │ │ ├── SF Mono LightItalic for Powerline.otf │ │ ├── SF Mono MediumItalic for Powerline.otf │ │ ├── SF Mono RegularItalic for Powerline.otf │ │ └── SF Mono SemiboldItalic for Powerline.otf │ └── SFMono Nerd Font │ │ └── SF Mono Regular Nerd Font Complete.otf ├── Source Code Pro │ ├── SourceCodePro-Regular.otf │ └── SourceCodePro-Regular-Powerline.otf └── README.md ├── .gitignore ├── vimrc-completeplugin.vim ├── .tmux.conf ├── .gitmodules ├── .ycm_extra_conf.py ├── setup.sh ├── README.md ├── LICENSE └── vimrc /screenshot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/screenshot-1.png -------------------------------------------------------------------------------- /screenshot-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/screenshot-2.png -------------------------------------------------------------------------------- /fonts/Menlo/Menlo-OldPowerline.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/Menlo/Menlo-OldPowerline.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono/SFMono-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono/SFMono-Bold.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono/SFMono-Heavy.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono/SFMono-Heavy.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono/SFMono-Light.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono/SFMono-Light.otf -------------------------------------------------------------------------------- /fonts/Source Code Pro/SourceCodePro-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/Source Code Pro/SourceCodePro-Regular.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono/SFMono-Medium.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono/SFMono-Medium.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono/SFMono-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono/SFMono-Regular.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono/SFMono-BoldItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono/SFMono-BoldItalic.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono/SFMono-Semibold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono/SFMono-Semibold.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono/SFMono-HeavyItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono/SFMono-HeavyItalic.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono/SFMono-LightItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono/SFMono-LightItalic.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono/SFMono-MediumItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono/SFMono-MediumItalic.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono/SFMono-RegularItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono/SFMono-RegularItalic.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono/SFMono-SemiboldItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono/SFMono-SemiboldItalic.otf -------------------------------------------------------------------------------- /fonts/Source Code Pro/SourceCodePro-Regular-Powerline.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/Source Code Pro/SourceCodePro-Regular-Powerline.otf -------------------------------------------------------------------------------- /fonts/Menlo/Menlo for Powerline/Menlo Bold for Powerline.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/Menlo/Menlo for Powerline/Menlo Bold for Powerline.ttf -------------------------------------------------------------------------------- /fonts/Menlo/Menlo for Powerline/Menlo Italic for Powerline.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/Menlo/Menlo for Powerline/Menlo Italic for Powerline.ttf -------------------------------------------------------------------------------- /fonts/Menlo/Menlo for Powerline/Menlo Regular for Powerline.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/Menlo/Menlo for Powerline/Menlo Regular for Powerline.ttf -------------------------------------------------------------------------------- /fonts/Menlo/Menlo for Powerline/Menlo Bold Italic for Powerline.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/Menlo/Menlo for Powerline/Menlo Bold Italic for Powerline.ttf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono for Powerline/SF Mono Bold for Powerline.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono for Powerline/SF Mono Bold for Powerline.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono for Powerline/SF Mono Heavy for Powerline.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono for Powerline/SF Mono Heavy for Powerline.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono for Powerline/SF Mono Light for Powerline.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono for Powerline/SF Mono Light for Powerline.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono for Powerline/SF Mono Medium for Powerline.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono for Powerline/SF Mono Medium for Powerline.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono for Powerline/SF Mono Regular for Powerline.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono for Powerline/SF Mono Regular for Powerline.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono for Powerline/SF Mono Semibold for Powerline.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono for Powerline/SF Mono Semibold for Powerline.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SFMono Nerd Font/SF Mono Regular Nerd Font Complete.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SFMono Nerd Font/SF Mono Regular Nerd Font Complete.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono for Powerline/SF Mono BoldItalic for Powerline.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono for Powerline/SF Mono BoldItalic for Powerline.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono for Powerline/SF Mono HeavyItalic for Powerline.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono for Powerline/SF Mono HeavyItalic for Powerline.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono for Powerline/SF Mono LightItalic for Powerline.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono for Powerline/SF Mono LightItalic for Powerline.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono for Powerline/SF Mono MediumItalic for Powerline.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono for Powerline/SF Mono MediumItalic for Powerline.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono for Powerline/SF Mono RegularItalic for Powerline.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono for Powerline/SF Mono RegularItalic for Powerline.otf -------------------------------------------------------------------------------- /fonts/San Francisco Mono/SF Mono for Powerline/SF Mono SemiboldItalic for Powerline.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coolceph/vimrc/HEAD/fonts/San Francisco Mono/SF Mono for Powerline/SF Mono SemiboldItalic for Powerline.otf -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #tags 2 | tags 3 | *.taghl 4 | cscope.files 5 | 6 | # Compiled Object files 7 | *.slo 8 | *.lo 9 | *.o 10 | *.obj 11 | 12 | # Precompiled Headers 13 | *.gch 14 | *.pch 15 | 16 | # Compiled Dynamic libraries 17 | *.so 18 | *.dylib 19 | *.dll 20 | 21 | # Fortran module files 22 | *.mod 23 | 24 | # Compiled Static libraries 25 | *.lai 26 | *.la 27 | *.a 28 | *.lib 29 | 30 | # Executables 31 | *.exe 32 | *.out 33 | *.app 34 | 35 | # Interpret File 36 | *.pyc 37 | *.class 38 | 39 | # Mac tmpfile 40 | *.DS_Store 41 | 42 | # vim-clang 43 | .clang 44 | 45 | # nodejs 46 | package-lock.json 47 | 48 | -------------------------------------------------------------------------------- /fonts/README.md: -------------------------------------------------------------------------------- 1 | 字体说明: 2 | 3 | 字体包含原版字体和powerline字体,文件名带有powerline后缀的字体是支持powerline字符的字体。 4 | 其中Menlo-OldPowerline.otf字体只支持老式的powerline字符,其他的powerline字体都是只支持新的powerline字符。 5 | 另外一个特例是原版Source\ Code\ Pro字体也支持新的powerline字符。 6 | 7 | " Unicode字符 8 | " unicode symbols 9 | '»' 10 | '▶' 11 | '«' 12 | '◀' 13 | '🔒' 14 | '␊' 15 | '␤' 16 | '¶' 17 | '⎇' 18 | 'ρ' 19 | 'Þ' 20 | '∥' 21 | 'Ξ' 22 | " 新的Powerline字符(vim-airline插件使用) 23 | " new powerline symbols 24 | '' 25 | '' 26 | '' 27 | '' 28 | '' 29 | '' 30 | '' 31 | 32 | " 老的powerline字符(较老的powerline插件使用) 33 | " old vim-powerline symbols 34 | '⮀' 35 | '⮁' 36 | '⮂' 37 | '⮃' 38 | '⭠' 39 | '⭤' 40 | '⭡' 41 | 42 | -------------------------------------------------------------------------------- /vimrc-completeplugin.vim: -------------------------------------------------------------------------------- 1 | let g:my_complete_plugin = "YouCompleteMe" 2 | 3 | "YouCompleteMe 4 | let g:acp_enableAtStartup = 0 5 | "let g:ycm_global_ycm_extra_conf = "~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py" 6 | let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py' 7 | let g:ycm_extra_conf_globlist=['~/.vim/*'] 8 | let g:ycm_collect_identifiers_from_tags_files = 1 9 | let g:ycm_filetype_blacklist={ 10 | \ 'tagbar' : 1, 11 | \ 'qf' : 1, 12 | \ 'notes' : 1, 13 | \ 'unite' : 1, 14 | \ 'vimwiki' : 1, 15 | \ 'pandoc' : 1, 16 | \ 'infolog' : 1, 17 | \ 'objc' : 1, 18 | \ 'mail' : 1 19 | \} 20 | nnoremap yc :YcmCompleter GetDoc 21 | nnoremap yf :YcmCompleter FixIt 22 | nnoremap yg :YcmCompleter GoTo 23 | nnoremap yi :YcmCompleter GoToInclude 24 | nnoremap yt :YcmCompleter GetType 25 | nnoremap jd :YcmCompleter GoToDefinitionElseDeclaration 26 | 27 | " Enable omni completion. 28 | autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS 29 | autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags 30 | autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS 31 | autocmd FileType python setlocal omnifunc=pythoncomplete#Complete 32 | autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags 33 | autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete 34 | autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc 35 | 36 | " 回车键选中补全项(有冲突,关闭此设置) 37 | "inoremap pumvisible() ? '' : '\' 38 | -------------------------------------------------------------------------------- /.tmux.conf: -------------------------------------------------------------------------------- 1 | # ========================================== 2 | # Tmux conf 3 | # Last_modify: 2017-04-24 4 | # ========================================== 5 | 6 | # ========================================== 7 | # 注意:如果使用XShell, 需要设置终端的键盘为ASCII 127,否则backspace工作会异常 8 | # ========================================== 9 | 10 | # --------------------------- base config begin ------------------------------- 11 | # 全局设置 12 | set-window-option -g xterm-keys on 13 | set-window-option -g display-panes-time 1500 14 | set-option -g default-terminal "xterm-256color" # use 256 colors 15 | set-option -g history-limit 100000 # scrollback buffer n lines 16 | set-option -g display-time 5000 # 提示信息的持续时间;设置足够的时间以避免看不清提示,单位为毫秒 17 | 18 | set-option -g set-titles on # set-option terminal title 19 | set-option -g set-titles-string '#h ❐ #S ● #I #W' 20 | 21 | set-window-option -g monitor-activity on 22 | set-option -g visual-activity on 23 | 24 | # bind-key a reload key: prefix+r 25 | bind-key R source-file ~/.tmux.conf \; display-message "Config reloaded.." 26 | 27 | # -------------------------------- pane begin -------------------------------- 28 | # 窗口间切换 29 | # [prefix-hjkl] pane之间移动 30 | unbind-key h 31 | bind-key h select-pane -L 32 | unbind-key j 33 | bind-key j select-pane -D 34 | unbind-key k 35 | bind-key k select-pane -U 36 | unbind-key l 37 | bind-key l select-pane -R 38 | 39 | # smart pane switching with awareness of vim splits 40 | # [Ctrl-hjkl] pane之间移动 41 | bind-key -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-h) || tmux select-pane -L" 42 | bind-key -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-j) || tmux select-pane -D" 43 | bind-key -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-k) || tmux select-pane -U" 44 | bind-key -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-l) || tmux select-pane -R" 45 | 46 | # 窗口大小调整 47 | # resize panes using PREFIX H, J, K, L 48 | bind-key H resize-pane -L 5 49 | bind-key J resize-pane -D 5 50 | bind-key K resize-pane -U 5 51 | bind-key L resize-pane -R 5 52 | # -------------------------------- pane end -------------------------------- 53 | 54 | # -------------------------------- move/copy/paste begin -------------------------------- 55 | # use vi mode 56 | set-window-option -g mode-keys vi 57 | 58 | #Comment all of vi-copy binding because of Tmux 2.4 compatibility change. 59 | #Just use Space for begin-selection, use q for cancel. 60 | 61 | #for Tmux 2.3- 62 | #bind-key -t vi-copy v begin-selection 63 | #bind-key -t vi-copy C-v rectangle-toggle 64 | #bind-key -t vi-copy y copy-selection 65 | #bind-key -t vi-copy Escape cancel 66 | #bind-key -t vi-copy H start-of-line 67 | #bind-key -t vi-copy L end-of-line 68 | 69 | #for Tmux 2.4+ 70 | #bind-key -Tcopy-mode-vi v send -X begin-selection 71 | #bind-key -Tcopy-mode-vi C-v send -X rectangle-toggle 72 | #bind-key -Tcopy-mode-vi y send -X copy-selection 73 | #bind-key -Tcopy-mode-vi Escape send -X clear-selection 74 | #bind-key -Tcopy-mode-vi H send -X top-line 75 | #bind-key -Tcopy-mode-vi L send -X bottom-line 76 | # -------------------------------- move/copy/paste end -------------------------------- 77 | 78 | # -------------------------------- status line begin -------------------------------- 79 | # 窗口列表 80 | set-window-option -g automatic-rename on 81 | 82 | # powerline stype statusline 83 | set-option -g status-left-length 32 84 | set-option -g status-right-length 150 85 | 86 | set-option -g status-fg white 87 | set-option -g status-bg colour234 88 | set-option -g window-status-activity-attr bold 89 | set-option -g pane-border-fg colour245 90 | set-option -g pane-active-border-fg colour39 91 | set-option -g message-fg colour16 92 | set-option -g message-bg colour221 93 | set-option -g message-attr bold 94 | 95 | set-option -g status-left '#[fg=colour235,bg=colour252,bold] ❐ #S #[fg=colour252,bg=colour238,nobold]#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour238,bg=colour234,nobold]' 96 | set-option -g window-status-format "#[fg=white,bg=colour234] #I #W " 97 | set-option -g window-status-current-format "#[fg=colour234,bg=colour39]#[fg=colour25,bg=colour39,noreverse,bold] #I: #W #[fg=colour39,bg=colour234,nobold]" 98 | set-option -g status-right '#[fg=colour235,bg=colour252,bold] #H [%Y-%m-%d %H:%M]' 99 | # -------------------------------- status line end -------------------------------- 100 | 101 | # --------------------------- base config end ------------------------------- 102 | 103 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "bundle/vim-pathogen"] 2 | path = bundle/vim-pathogen 3 | url = https://github.com/tpope/vim-pathogen 4 | [submodule "bundle/ack.vim"] 5 | path = bundle/ack.vim 6 | url = https://github.com/mileszs/ack.vim 7 | [submodule "bundle/ag.vim"] 8 | path = bundle/ag.vim 9 | url = https://github.com/rking/ag.vim 10 | [submodule "bundle/jellybeans.vim"] 11 | path = bundle/jellybeans.vim 12 | url = https://github.com/nanotech/jellybeans.vim 13 | [submodule "bundle/nerdtree"] 14 | path = bundle/nerdtree 15 | url = https://github.com/scrooloose/nerdtree 16 | [submodule "bundle/tagbar"] 17 | path = bundle/tagbar 18 | url = https://github.com/majutsushi/tagbar 19 | [submodule "bundle/undotree"] 20 | path = bundle/undotree 21 | url = https://github.com/mbbill/undotree 22 | [submodule "bundle/vim-airline"] 23 | path = bundle/vim-airline 24 | url = https://github.com/vim-airline/vim-airline 25 | [submodule "bundle/vim-easymotion"] 26 | path = bundle/vim-easymotion 27 | url = https://github.com/easymotion/vim-easymotion 28 | [submodule "bundle/vim-fugitive"] 29 | path = bundle/vim-fugitive 30 | url = https://github.com/tpope/vim-fugitive 31 | [submodule "bundle/vim-go"] 32 | path = bundle/vim-go 33 | url = https://github.com/fatih/vim-go 34 | [submodule "bundle/vim-gitgutter"] 35 | path = bundle/vim-gitgutter 36 | url = https://github.com/airblade/vim-gitgutter 37 | [submodule "bundle/tabular"] 38 | path = bundle/tabular 39 | url = https://github.com/godlygeek/tabular 40 | [submodule "bundle/vim-airline-themes"] 41 | path = bundle/vim-airline-themes 42 | url = https://github.com/vim-airline/vim-airline-themes 43 | [submodule "bundle/vim-multiple-cursors"] 44 | path = bundle/vim-multiple-cursors 45 | url = https://github.com/terryma/vim-multiple-cursors 46 | [submodule "bundle/vim-expand-region"] 47 | path = bundle/vim-expand-region 48 | url = https://github.com/terryma/vim-expand-region 49 | [submodule "bundle/a.vim"] 50 | path = bundle/a.vim 51 | url = https://github.com/vim-scripts/a.vim 52 | [submodule "bundle/vim-better-whitespace"] 53 | path = bundle/vim-better-whitespace 54 | url = https://github.com/ntpeters/vim-better-whitespace 55 | [submodule "bundle/indentLine"] 56 | path = bundle/indentLine 57 | url = https://github.com/Yggdroot/indentLine 58 | [submodule "bundle/vim-surround"] 59 | path = bundle/vim-surround 60 | url = https://github.com/tpope/vim-surround 61 | [submodule "bundle/vim-repeat"] 62 | path = bundle/vim-repeat 63 | url = https://github.com/tpope/vim-repeat 64 | [submodule "bundle/vim-visual-star-search"] 65 | path = bundle/vim-visual-star-search 66 | url = https://github.com/bronson/vim-visual-star-search 67 | [submodule "bundle/hexmode"] 68 | path = bundle/hexmode 69 | url = https://github.com/fidian/hexmode 70 | [submodule "bundle/YankRing.vim"] 71 | path = bundle/YankRing.vim 72 | url = https://github.com/vim-scripts/YankRing.vim 73 | [submodule "bundle/vim-plist"] 74 | path = bundle/vim-plist 75 | url = https://github.com/darfink/vim-plist 76 | [submodule "bundle/vim-json"] 77 | path = bundle/vim-json 78 | url = https://github.com/elzr/vim-json 79 | [submodule "bundle/vim-exchange"] 80 | path = bundle/vim-exchange 81 | url = https://github.com/tommcdo/vim-exchange 82 | [submodule "bundle/molokai"] 83 | path = bundle/molokai 84 | url = https://github.com/tomasr/molokai 85 | [submodule "bundle/nerdtree-git-plugin"] 86 | path = bundle/nerdtree-git-plugin 87 | url = https://github.com/Xuyuanp/nerdtree-git-plugin 88 | [submodule "bundle/rainbow"] 89 | path = bundle/rainbow 90 | url = https://github.com/luochen1990/rainbow 91 | [submodule "bundle/vim-tmux-navigator"] 92 | path = bundle/vim-tmux-navigator 93 | url = https://github.com/christoomey/vim-tmux-navigator 94 | [submodule "bundle/vim-cpp-enhanced-highlight"] 95 | path = bundle/vim-cpp-enhanced-highlight 96 | url = https://github.com/octol/vim-cpp-enhanced-highlight 97 | [submodule "bundle/fzf.vim"] 98 | path = bundle/fzf.vim 99 | url = https://github.com/junegunn/fzf.vim 100 | [submodule "bundle/fzf"] 101 | path = bundle/fzf 102 | url = https://github.com/junegunn/fzf 103 | [submodule "bundle/gv.vim"] 104 | path = bundle/gv.vim 105 | url = https://github.com/junegunn/gv.vim 106 | [submodule "bundle/YouCompleteMe"] 107 | path = bundle/YouCompleteMe 108 | url = https://github.com/Valloric/YouCompleteMe 109 | [submodule "bundle/tern_for_vim"] 110 | path = bundle/tern_for_vim 111 | url = https://github.com/ternjs/tern_for_vim 112 | [submodule "bundle/ultisnips"] 113 | path = bundle/ultisnips 114 | url = https://github.com/SirVer/ultisnips 115 | [submodule "bundle/YCM-Generator"] 116 | path = bundle/YCM-Generator 117 | url = https://github.com/rdnetto/YCM-Generator 118 | branch = stable 119 | [submodule "bundle/vim-snippets"] 120 | path = bundle/vim-snippets 121 | url = https://github.com/honza/vim-snippets 122 | [submodule "bundle/vim-commentary"] 123 | path = bundle/vim-commentary 124 | url = https://github.com/tpope/vim-commentary 125 | -------------------------------------------------------------------------------- /.ycm_extra_conf.py: -------------------------------------------------------------------------------- 1 | # This file is NOT licensed under the GPLv3, which is the license for the rest 2 | # of YouCompleteMe. 3 | # 4 | # Here's the license text for this file: 5 | # 6 | # This is free and unencumbered software released into the public domain. 7 | # 8 | # Anyone is free to copy, modify, publish, use, compile, sell, or 9 | # distribute this software, either in source code form or as a compiled 10 | # binary, for any purpose, commercial or non-commercial, and by any 11 | # means. 12 | # 13 | # In jurisdictions that recognize copyright laws, the author or authors 14 | # of this software dedicate any and all copyright interest in the 15 | # software to the public domain. We make this dedication for the benefit 16 | # of the public at large and to the detriment of our heirs and 17 | # successors. We intend this dedication to be an overt act of 18 | # relinquishment in perpetuity of all present and future rights to this 19 | # software under copyright law. 20 | # 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | # IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 25 | # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 26 | # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | # OTHER DEALINGS IN THE SOFTWARE. 28 | # 29 | # For more information, please refer to 30 | 31 | import os 32 | import ycm_core 33 | 34 | # These are the compilation flags that will be used in case there's no 35 | # compilation database set (by default, one is not set). 36 | # CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR. 37 | flags = [ 38 | '-Wall', 39 | '-Wextra', 40 | '-Werror', 41 | '-Wno-long-long', 42 | '-Wno-variadic-macros', 43 | '-fexceptions', 44 | '-DNDEBUG', 45 | # You 100% do NOT need -DUSE_CLANG_COMPLETER in your flags; only the YCM 46 | # source code needs it. 47 | '-DUSE_CLANG_COMPLETER', 48 | # THIS IS IMPORTANT! Without a "-std=" flag, clang won't know which 49 | # language to use when compiling headers. So it will guess. Badly. So C++ 50 | # headers will be compiled as C headers. You don't want that so ALWAYS specify 51 | # a "-std=". 52 | # For a C project, you would set this to something like 'c99' instead of 53 | # 'c++11'. 54 | '-std=c++11', 55 | # ...and the same thing goes for the magic -x option which specifies the 56 | # language that the files to be compiled are written in. This is mostly 57 | # relevant for c++ headers. 58 | # For a C project, you would set this to 'c' instead of 'c++'. 59 | '-x', 60 | 'c++', 61 | '-isystem', 62 | '../BoostParts', 63 | '-isystem', 64 | # This path will only work on OS X, but extra paths that don't exist are not 65 | # harmful 66 | '/System/Library/Frameworks/Python.framework/Headers', 67 | '-isystem', 68 | '../llvm/include', 69 | '-isystem', 70 | '../llvm/tools/clang/include', 71 | '-I', 72 | '.', 73 | '-I', 74 | './ClangCompleter', 75 | '-I', 76 | './include', 77 | '-I', 78 | './src', 79 | '-I', 80 | '../include', 81 | '-I', 82 | '../src', 83 | '-isystem', 84 | './tests/gmock/gtest', 85 | '-isystem', 86 | './tests/gmock/gtest/include', 87 | '-isystem', 88 | './tests/gmock', 89 | '-isystem', 90 | './tests/gmock/include', 91 | ] 92 | 93 | 94 | # Set this to the absolute path to the folder (NOT the file!) containing the 95 | # compile_commands.json file to use that instead of 'flags'. See here for 96 | # more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html 97 | # 98 | # You can get CMake to generate this file for you by adding: 99 | # set( CMAKE_EXPORT_COMPILE_COMMANDS 1 ) 100 | # to your CMakeLists.txt file. 101 | # 102 | # Most projects will NOT need to set this to anything; you can just change the 103 | # 'flags' list of compilation flags. Notice that YCM itself uses that approach. 104 | compilation_database_folder = '' 105 | 106 | if os.path.exists( compilation_database_folder ): 107 | database = ycm_core.CompilationDatabase( compilation_database_folder ) 108 | else: 109 | database = None 110 | 111 | SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ] 112 | 113 | def DirectoryOfThisScript(): 114 | return os.path.dirname( os.path.abspath( __file__ ) ) 115 | 116 | 117 | def MakeRelativePathsInFlagsAbsolute( flags, working_directory ): 118 | if not working_directory: 119 | return list( flags ) 120 | new_flags = [] 121 | make_next_absolute = False 122 | path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ] 123 | for flag in flags: 124 | new_flag = flag 125 | 126 | if make_next_absolute: 127 | make_next_absolute = False 128 | if not flag.startswith( '/' ): 129 | new_flag = os.path.join( working_directory, flag ) 130 | 131 | for path_flag in path_flags: 132 | if flag == path_flag: 133 | make_next_absolute = True 134 | break 135 | 136 | if flag.startswith( path_flag ): 137 | path = flag[ len( path_flag ): ] 138 | new_flag = path_flag + os.path.join( working_directory, path ) 139 | break 140 | 141 | if new_flag: 142 | new_flags.append( new_flag ) 143 | return new_flags 144 | 145 | 146 | def IsHeaderFile( filename ): 147 | extension = os.path.splitext( filename )[ 1 ] 148 | return extension in [ '.h', '.hxx', '.hpp', '.hh' ] 149 | 150 | 151 | def GetCompilationInfoForFile( filename ): 152 | # The compilation_commands.json file generated by CMake does not have entries 153 | # for header files. So we do our best by asking the db for flags for a 154 | # corresponding source file, if any. If one exists, the flags for that file 155 | # should be good enough. 156 | if IsHeaderFile( filename ): 157 | basename = os.path.splitext( filename )[ 0 ] 158 | for extension in SOURCE_EXTENSIONS: 159 | replacement_file = basename + extension 160 | if os.path.exists( replacement_file ): 161 | compilation_info = database.GetCompilationInfoForFile( 162 | replacement_file ) 163 | if compilation_info.compiler_flags_: 164 | return compilation_info 165 | return None 166 | return database.GetCompilationInfoForFile( filename ) 167 | 168 | 169 | def FlagsForFile( filename, **kwargs ): 170 | if database: 171 | # Bear in mind that compilation_info.compiler_flags_ does NOT return a 172 | # python list, but a "list-like" StringVec object 173 | compilation_info = GetCompilationInfoForFile( filename ) 174 | if not compilation_info: 175 | return None 176 | 177 | final_flags = MakeRelativePathsInFlagsAbsolute( 178 | compilation_info.compiler_flags_, 179 | compilation_info.compiler_working_dir_ ) 180 | 181 | # NOTE: This is just for YouCompleteMe; it's highly likely that your project 182 | # does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR 183 | # ycm_extra_conf IF YOU'RE NOT 100% SURE YOU NEED IT. 184 | try: 185 | final_flags.remove( '-stdlib=libc++' ) 186 | except ValueError: 187 | pass 188 | else: 189 | relative_to = DirectoryOfThisScript() 190 | final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to ) 191 | 192 | return { 'flags': final_flags } 193 | -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | # |------------------------| 2 | # | Coolceph VIMRC | 3 | # |------------------------| 4 | # | _ | 5 | # | __ __(_)___ ___ | 6 | # | | | / / / __ `__ \ | 7 | # | | |/ / / / / / / / | 8 | # | |___/_/_/ /_/ /_/ | 9 | # | | 10 | # |------------------------| 11 | # 12 | # | ---------------------- | ---------------------- | 13 | # | vimrc安装脚本 | | 14 | # | ---------------------- | ---------------------- | 15 | # | 说明 | | 16 | # | ---------------------- | ---------------------- | 17 | # | vim_path | vimrc安装目录的父目录 | 18 | # | vim_dir | vimrc安装目录名 | 19 | # | ---------------------- | ---------------------- | 20 | vim_path=.vim 21 | vim_dir=$HOME 22 | 23 | #setup.sh start here, do not modify 24 | vim_fullpath=$vim_dir/$vim_path # vimrc安装到的目录 25 | vim_init_file=$vim_fullpath/vimrc.init # vimrc标志文件,记录安装的日期 26 | vim_pwd=$PWD 27 | 28 | color_print() { 29 | printf '\033[0;31m%s\033[0m\n' "$1" 30 | } 31 | 32 | warn() { 33 | color_print "$1" >&2 34 | } 35 | 36 | die() { 37 | warn "$1" 38 | exit 1 39 | } 40 | 41 | logo() { 42 | color_print "Thank you for installing vimrc!" 43 | color_print ' _ ' 44 | color_print ' __ __(_)___ ___ ' 45 | color_print ' | | / / / __ `__ \' 46 | color_print ' | |/ / / / / / / /' 47 | color_print ' |___/_/_/ /_/ /_/ ' 48 | color_print ' ' 49 | } 50 | 51 | require() { 52 | color_print "Checking requirements for vimrc..." 53 | color_print "Checking vim version..." 54 | vim_exec="vim" 55 | if [ `uname` == "Darwin" ]; then 56 | echo "OS_TYPE is Darwin" 57 | if [ `command -v mvim` ]; then 58 | vim_exec="mvim" 59 | echo "MacVim installed, use mvim for requirements" 60 | else 61 | vim_exec="vim" 62 | echo "Use vim for requirements" 63 | fi 64 | fi 65 | vim_version=`$vim_exec --version|head -n 1|awk '{print $5}'|cut -c 1,3` 66 | if [ ${vim_version} -lt 74 ] 67 | then 68 | die "Your vim's version is too low! Please download higher version(7.4+) from http://www.vim.org/download.php" 69 | fi 70 | $vim_exec --version | grep +python || die "Your vim does not have +python" 71 | color_print "Checking if git exists..." 72 | which git || die "No git installed!\nPlease install git from http://git-scm.com/downloads/" 73 | color_print "Check if ctags exists..." 74 | which ctags || warn "No ctags installed!\nPlease install ctags form http://ctags.sourceforge.net/ after vimrc intallation!" 75 | color_print "Check if clang exists..." 76 | which clang || warn "No clang installed!\nPlease install ctags form http://clang.llvm.org/ after vimrc intallation!" 77 | } 78 | 79 | help() { 80 | echo "setup.sh -- setup vimrc" 81 | echo "Usage: setup.sh -i/-u/-b/-l" 82 | echo "-i -- install vimrc" 83 | echo "-u -- update vimrc's plugins" 84 | echo "-b -- backup ~/.vim" 85 | echo "-l -- link ~/.vim/vimrc to ~/.vimrc and make vim-proc, for green install from tar.gz" 86 | exit 0 87 | } 88 | 89 | make_vimrc() { 90 | if [ -L $HOME/.vimrc ]; then 91 | unlink $HOME/.vimrc 92 | fi 93 | if [ -f $HOME/.vimrc ]; then 94 | /bin/rm -f $HOME/.vimrc 95 | fi 96 | echo "source $vim_fullpath/vimrc" > $HOME/.vimrc 97 | echo "colorscheme jellybeans" >> $HOME/.vimrc 98 | color_print "Make vimrc finished" 99 | } 100 | 101 | make_youcompleteme() { 102 | cd $vim_fullpath/bundle/YouCompleteMe/ 103 | ./install.py 104 | cd $vim_pwd 105 | color_print "Make YouCompleteMe finished" 106 | } 107 | 108 | #Dependency on Mac install guide: 109 | # brew install cmake go node mono rust 110 | make_youcompleteme_all() { 111 | cd $vim_fullpath/bundle/YouCompleteMe/ 112 | ./install.py --all 113 | cd $vim_pwd 114 | color_print "Make YouCompleteMe finished" 115 | } 116 | 117 | backup_vimrc() { 118 | cd $vim_dir 119 | backup_date=`date +%Y%m%d` 120 | color_print $backup_date 121 | tar --exclude .git -czvf vimrc-$backup_date-mini.tar.gz $vim_path/bundle $vim_path/fonts $vim_path/vimrc* $vim_path/setup.sh $vim_path/.tmux.conf 122 | cd $vim_pwd 123 | color_print "Backup Finished "$backup_date 124 | } 125 | 126 | check_term() { 127 | if [ x$TERM != x"xterm-256color" ] 128 | then 129 | color_print "TERM is not xterm-256color, will set TERM=xterm-256color now" 130 | 131 | is_zsh=`color_print $SHELL|grep 'zsh'|wc -l` 132 | is_bash=`color_print $SHELL|grep 'bash'|wc -l` 133 | 134 | if [ $is_zsh -eq 1 ] 135 | then 136 | color_print "Your shell is zsh, set TERM in ~/.zshrc" 137 | echo "export TERM=xterm-256color" >> ~/.zshrc 138 | color_print "Set TERM OK, please execute:" 139 | color_print " source ~/.zshrc" 140 | elif [ $is_bash -eq 1 ] 141 | then 142 | color_print "Your shell is bash, set TERM in ~/.bash_profile" 143 | echo "export TERM=xterm-256color" >> ~/.bash_profile 144 | color_print "Set TERM OK, please execute:" 145 | color_print " source ~/.bash_profile" 146 | else 147 | color_print "Your shell cannot set TERM automatically, please set TERM to xterm-256color by yourself" 148 | fi 149 | else 150 | color_print "TERM is xterm-256color, OK" 151 | fi 152 | } 153 | 154 | check_lang() { 155 | if [ x$LANG != x"en_US.UTF-8" ] 156 | then 157 | color_print "LANG is not en_US.UTF-8, will set LANG=en_US.UTF-8" 158 | 159 | is_zsh=`color_print $SHELL|grep 'zsh'|wc -l` 160 | is_bash=`color_print $SHELL|grep 'bash'|wc -l` 161 | 162 | if [ $is_zsh -eq 1 ] 163 | then 164 | color_print "Your shell is zsh, set LANG in ~/.zshrc" 165 | echo "export LANG=en_US.UTF-8" >> ~/.zshrc 166 | color_print "Set LANG OK, please execute:" 167 | color_print " source ~/.zshrc" 168 | elif [ $is_bash -eq 1 ] 169 | then 170 | color_print "Your shell is bash, set LANG in ~/.bash_profile" 171 | echo "export LANG=en_US.UTF-8" >> ~/.bash_profile 172 | color_print "Set LANG OK, please execute:" 173 | color_print " source ~/.bash_profile" 174 | else 175 | color_print "Your shell cannot set LANG automatically, please set LANG to xterm-256color by yourself" 176 | fi 177 | else 178 | color_print "LANG is en_US.UTF-8, OK" 179 | fi 180 | 181 | if [ x$LC_ALL != x"en_US.UTF-8" ] 182 | then 183 | color_print "LC_ALL is not en_US.UTF-8, will set LC_ALL=en_US.UTF-8" 184 | 185 | is_zsh=`color_print $SHELL|grep 'zsh'|wc -l` 186 | is_bash=`color_print $SHELL|grep 'bash'|wc -l` 187 | 188 | if [ $is_zsh -eq 1 ] 189 | then 190 | color_print "Your shell is zsh, set LC_ALL in ~/.zshrc" 191 | echo "export LC_ALL=en_US.UTF-8" >> ~/.zshrc 192 | color_print "Set LC_ALL OK, please execute:" 193 | color_print " source ~/.zshrc" 194 | elif [ $is_bash -eq 1 ] 195 | then 196 | color_print "Your shell is bash, set LC_ALL in ~/.bash_profile" 197 | echo "export LC_ALL=en_US.UTF-8" >> ~/.bash_profile 198 | color_print "Set LC_ALL OK, please execute:" 199 | color_print " source ~/.bash_profile" 200 | else 201 | color_print "Your shell cannot set LC_ALL automatically, please set LC_ALL to xterm-256color by yourself" 202 | fi 203 | else 204 | color_print "LC_ALL is en_US.UTF-8, OK" 205 | fi 206 | } 207 | 208 | install() { 209 | color_print "Start install" 210 | 211 | git clone https://github.com/coolceph/vimrc $vim_fullpath; 212 | if [ $? -eq 0 ]; then 213 | cd $vim_fullpath 214 | git submodule update --init --recursive 215 | cd $vim_pwd 216 | color_print "All plugins init finished!" 217 | else 218 | echo $? 219 | color_print "Install failed! " 220 | exit -1 221 | fi 222 | } 223 | 224 | update() { 225 | cd $vim_fullpath 226 | git pull 227 | git submodule update --init --recursive 228 | color_print "Update finished!" 229 | cd $vim_pwd 230 | } 231 | 232 | if [ $# -ne 1 ]; then 233 | logo 234 | require 235 | check_term 236 | check_lang 237 | install 238 | make_youcompleteme 239 | make_vimrc 240 | help 241 | fi 242 | 243 | while getopts ":iublna" opts; do 244 | case $opts in 245 | i) 246 | logo 247 | require 248 | check_term 249 | check_lang 250 | install 251 | make_youcompleteme 252 | make_vimrc 253 | ;; 254 | u) 255 | logo 256 | require 257 | update 258 | ;; 259 | b) 260 | logo 261 | backup_vimrc 262 | ;; 263 | l) 264 | logo 265 | require 266 | check_term 267 | check_lang 268 | make_youcompleteme 269 | make_vimrc 270 | ;; 271 | n) 272 | logo 273 | make_vimrc 274 | ;; 275 | a) 276 | logo 277 | check_term 278 | check_lang 279 | make_youcompleteme_all 280 | make_vimrc 281 | ;; 282 | :) 283 | help;; 284 | ?) 285 | help;; 286 | esac 287 | done 288 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Best vimrc for CoolCeph team, used for C/C++, Python, PHP and Go. 2 | 3 | The design principles of coolceph vimrc is simple, green and easy. Coolceph vimrc is designed running well on Linux and Mac, just need ctags, git and powerline_fonts. And also coolceph vimrc can be copied and installed anywhere by just a tarball. 4 | 5 | Enjoy it. 6 | 7 | ![alt tag](https://raw.github.com/coolceph/vimrc/master/screenshot-2.png) 8 | 9 | # Requirements 10 | 11 | * Mac use terminal vim: 12 | 13 | ``` 14 | brew install cmake go node mono rust 15 | brew install vim 16 | ``` 17 | 18 | * Use MacVim: 19 | 20 | ``` 21 | brew install cmake go node mono rust 22 | ``` 23 | 24 | Download macvim from [https://github.com/macvim-dev/macvim/releases/latest] and install it to /Applications . 25 | 26 | Do not install macvim from brew. 27 | 28 | * Linux user: 29 | 30 | Linux users who do not use YouCompleteMe could use wip-neocomplcache branch, this branch only depend on vim and has no python/lua requirement. 31 | 32 | And vim 7.4.1578+ is required. 33 | 34 | # Install 35 | 36 | * vimrc will install to ~/.vim, require ~/.vim does not exist. 37 | 38 | ``` 39 | bash -c "$( curl https://raw.githubusercontent.com/coolceph/vimrc/master/setup.sh )" 40 | ``` 41 | 42 | # ShortCuts 43 | 44 | | Key | Function | 45 | | -------------- | --------------------------------------------------- | 46 | | F2 | Paste mode toggle(normal/paste) | 47 | | F3 | NerdTREE toggle | 48 | | F4 | Tagbar toggle | 49 | | F5 | LineNumber Model Switch | 50 | | F6 | Whether or not show listchar | 51 | | F7 | Update ctags | 52 | | F8 | Open undotree | 53 | | F9 | Enter multi-cursor-mode | 54 | | F10 | Enter Rankring clipboard | 55 | | F12 | Mouse mode switch (mouse=a/-a) | 56 | | SpaceSpace | Activate CtrlP Mixed Search | 57 | | Ctrl+h/j/k/l | Switch between windows. | 58 | | Ctrl+c | Completely quit vim without saving | 59 | 60 | The leader key is ','. 61 | 62 | # Quick Commands 63 | 64 | | Cmd | Function | 65 | | ------- | ---------------------------- | 66 | | Ctags | Genrate ctags for pwd | 67 | | Gotags | Genrate gotags for pwd | 68 | | Cscope | Genrate cscope files for pwd | 69 | | Hex/Asc | Swtich between Asc and Hex | 70 | | Hexmode | Toggle Hex/Asc mode | 71 | | Cswp | Clear swp files | 72 | 73 | # FAQ 74 | 75 | - *How should I install vimrc on a Linux server with no internet* 76 | 77 | Vim version 7.4+ is needed on your Linux server, then the steps: 78 | 79 | 1) You need install vimrc on a Mac/Linux with internet first. 80 | 81 | 2) Then run "~/.vim/setup.sh -b", a "vimrc-2016xxxx-mini.tar.gz" file will appear in your ~ dir. 82 | 83 | 3) Copy the "vimrc-2016xxxx-mini.tar.gz" to your user's home dir on Linux server. 84 | 85 | 4) Run "cd ~;rm -rf ~/.vim;tar -zxvf vimrc-2016xxxx-mini.tar.gz;.vim/setup.sh -l" 86 | 87 | You now get full-featured vimrc on your Linux server. 88 | 89 | - *My state line has strange characters* 90 | 91 | You should install the powerline fonts into your system and update the config of your terminal to use powerline fonts to display the Non-ASCII characters. 92 | 93 | In the fonts dir, there is some powerline fonts you could choose. 94 | 95 | You could found more powerline fonts in [powerline_fonts] 96 | 97 | Remarks: 1. The SourceCodePro-Regular.otf contains all unicode character and new powerline glyphs. If you use a font that not contains powerline glyphs, you could setup your iTerm to use a different font for Non-ASCII text to use SourceCodePro-Regular. 98 | 2. The Menlo-OldPowerline.otf contains old powerline glyphs, installing it will make old powerline display correct on Mac OSX. 99 | 3. The SFMono is licensed to registered third-party developers for the design and development of applications for iOS, macOS and watchOS, please note that it is forbidden to use this typeface for your commercial project. 100 | 101 | - *My vim is ugly, it seems some color are missing* 102 | 103 | You should set your env TERM=xterm-256color, you can do this by the following two ways: 104 | 105 | 1) run ~/.vim/install.sh, it will set TERM to xterm-256color for bash/zsh. If you use other shells, you need to set TERM yourself. 106 | 107 | 2) Your terminal util like iterm is also needed to set for xterm-256color too. You need set it yourself too. 108 | 109 | - *Install all YouCompleteMe dependencies* 110 | 111 | If you use Mac OS and brew: 112 | 113 | ``` 114 | brew install cmake go node mono rust 115 | ``` 116 | 117 | - *MacVim Caught deadly signal SEGV* 118 | 119 | If you install macvim from brew, when you running mvim, you may seee "Caught deadly signal SEGV". 120 | 121 | The reason is brew macvim use the wrong python. 122 | 123 | To solve this problem, we suggest you download MacVim from [http://macvim-dev.github.io/macvim/] 124 | 125 | 126 | But after install from [http://macvim-dev.github.io/macvim/], if you also installed python3 on your Mac OS, this MacVim is going to have some new problem of python3. 127 | 128 | To solve this problem, if you want use MacVim with python2.7, just add this config in your ~/.vimrc file: 129 | 130 | ``` 131 | if has('gui_macvim') 132 | let $PYTHONHOME="/usr/local/Frameworks/Python.framework/Versions/2.7" 133 | endif 134 | ``` 135 | 136 | Or if you want use MacVim with python3.6: 137 | 138 | 1.Compile YouCompleteMe using python3: 139 | 140 | ``` 141 | cd ~/.vim/bundle/YouCompleteMe 142 | python3 ./install.py --all 143 | ``` 144 | 145 | 2.Add this config in your ~/.vimrc file: 146 | 147 | ``` 148 | if has('gui_macvim') 149 | let $PYTHONHOME="/usr/local/Frameworks/Python.framework/Versions/3.6" 150 | endif 151 | ``` 152 | 153 | The PYTHONHOME dir is like: 154 | ``` 155 | Headers Python Resources bin include lib share 156 | ``` 157 | 158 | # Plugins used in CoolCeph vimrc 159 | 160 | [YCM-Generator] 161 | 162 | [YankRing.vim] 163 | 164 | [YouCompleteMe] 165 | 166 | [a.vim] 167 | 168 | [ack.vim] 169 | 170 | [ag.vim] 171 | 172 | [better-indent-support-for-php-with-html] 173 | 174 | [csv.vim] 175 | 176 | [ctrlp.vim] 177 | 178 | [fzf.vim] 179 | 180 | [fzf] 181 | 182 | [gv.vim] 183 | 184 | [hexmode] 185 | 186 | [incsearch-easymotion.vim] 187 | 188 | [incsearch-fuzzy.vim] 189 | 190 | [incsearch.vim] 191 | 192 | [indentLine] 193 | 194 | [jellybeans.vim] 195 | 196 | [molokai] 197 | 198 | [neomru.vim] 199 | 200 | [nerdcommenter] 201 | 202 | [nerdtree-git-plugin] 203 | 204 | [nerdtree] 205 | 206 | [rainbow] 207 | 208 | [rust.vim] 209 | 210 | [syntastic] 211 | 212 | [tabular] 213 | 214 | [tagbar] 215 | 216 | [tern_for_vim] 217 | 218 | [ultisnips] 219 | 220 | [undotree] 221 | 222 | [vim-airline-themes] 223 | 224 | [vim-airline] 225 | 226 | [vim-better-whitespace] 227 | 228 | [vim-cpp-enhanced-highlight] 229 | 230 | [vim-easymotion] 231 | 232 | [vim-exchange] 233 | 234 | [vim-expand-region] 235 | 236 | [vim-fugitive] 237 | 238 | [vim-gitgutter] 239 | 240 | [vim-go] 241 | 242 | [vim-indexed-search] 243 | 244 | [vim-json] 245 | 246 | [vim-multiple-cursors] 247 | 248 | [vim-operator-user] 249 | 250 | [vim-pasta] 251 | 252 | [vim-pathogen] 253 | 254 | [vim-plist] 255 | 256 | [vim-repeat] 257 | 258 | [vim-signature] 259 | 260 | [vim-snippets] 261 | 262 | [vim-surround] 263 | 264 | [vim-table-mode] 265 | 266 | [vim-template] 267 | 268 | [vim-tmux-navigator] 269 | 270 | [vim-togglemouse] 271 | 272 | [vim-togglenumber] 273 | 274 | [vim-visual-star-search] 275 | 276 | 277 | [YCM-Generator]:https://github.com/rdnetto/YCM-Generator 278 | [YankRing.vim]:https://github.com/vim-scripts/YankRing.vim 279 | [YouCompleteMe]:https://github.com/Valloric/YouCompleteMe 280 | [a.vim]:https://github.com/vim-scripts/a.vim 281 | [ack.vim]:https://github.com/mileszs/ack.vim 282 | [ag.vim]:https://github.com/rking/ag.vim 283 | [better-indent-support-for-php-with-html]:https://github.com/captbaritone/better-indent-support-for-php-with-html 284 | [csv.vim]:https://github.com/chrisbra/csv.vim 285 | [ctrlp.vim]:https://github.com/ctrlpvim/ctrlp.vim 286 | [fzf.vim]:https://github.com/junegunn/fzf.vim 287 | [fzf]:https://github.com/junegunn/fzf 288 | [gv.vim]:https://github.com/junegunn/gv.vim 289 | [hexmode]:https://github.com/fidian/hexmode 290 | [incsearch-easymotion.vim]:https://github.com/haya14busa/incsearch-easymotion.vim 291 | [incsearch-fuzzy.vim]:https://github.com/haya14busa/incsearch-fuzzy.vim 292 | [incsearch.vim]:https://github.com/haya14busa/incsearch.vim 293 | [indentLine]:https://github.com/Yggdroot/indentLine 294 | [jellybeans.vim]:https://github.com/nanotech/jellybeans.vim 295 | [molokai]:https://github.com/tomasr/molokai 296 | [neomru.vim]:https://github.com/Shougo/neomru.vim 297 | [nerdcommenter]:https://github.com/scrooloose/nerdcommenter 298 | [nerdtree-git-plugin]:https://github.com/Xuyuanp/nerdtree-git-plugin 299 | [nerdtree]:https://github.com/scrooloose/nerdtree 300 | [rainbow]:https://github.com/luochen1990/rainbow 301 | [rust.vim]:https://github.com/rust-lang/rust.vim 302 | [syntastic]:https://github.com/vim-syntastic/syntastic 303 | [tabular]:https://github.com/godlygeek/tabular 304 | [tagbar]:https://github.com/majutsushi/tagbar 305 | [tern_for_vim]:https://github.com/ternjs/tern_for_vim 306 | [ultisnips]:https://github.com/SirVer/ultisnips 307 | [undotree]:https://github.com/mbbill/undotree 308 | [vim-airline-themes]:https://github.com/vim-airline/vim-airline-themes 309 | [vim-airline]:https://github.com/vim-airline/vim-airline 310 | [vim-better-whitespace]:https://github.com/ntpeters/vim-better-whitespace 311 | [vim-cpp-enhanced-highlight]:https://github.com/octol/vim-cpp-enhanced-highlight 312 | [vim-easymotion]:https://github.com/easymotion/vim-easymotion 313 | [vim-exchange]:https://github.com/tommcdo/vim-exchange 314 | [vim-expand-region]:https://github.com/terryma/vim-expand-region 315 | [vim-fugitive]:https://github.com/tpope/vim-fugitive 316 | [vim-gitgutter]:https://github.com/airblade/vim-gitgutter 317 | [vim-go]:https://github.com/fatih/vim-go 318 | [vim-indexed-search]:https://github.com/henrik/vim-indexed-search 319 | [vim-json]:https://github.com/elzr/vim-json 320 | [vim-multiple-cursors]:https://github.com/terryma/vim-multiple-cursors 321 | [vim-operator-user]:https://github.com/kana/vim-operator-user 322 | [vim-pasta]:https://github.com/sickill/vim-pasta 323 | [vim-pathogen]:https://github.com/tpope/vim-pathogen 324 | [vim-plist]:https://github.com/darfink/vim-plist 325 | [vim-repeat]:https://github.com/tpope/vim-repeat 326 | [vim-signature]:https://github.com/kshenoy/vim-signature 327 | [vim-snippets]:https://github.com/honza/vim-snippets 328 | [vim-surround]:https://github.com/tpope/vim-surround 329 | [vim-table-mode]:https://github.com/dhruvasagar/vim-table-mode 330 | [vim-template]:https://github.com/aperezdc/vim-template 331 | [vim-tmux-navigator]:https://github.com/christoomey/vim-tmux-navigator 332 | [vim-togglemouse]:https://github.com/nvie/vim-togglemouse 333 | [vim-togglenumber]:https://github.com/tkhoa2711/vim-togglenumber 334 | [vim-visual-star-search]:https://github.com/bronson/vim-visual-star-search 335 | [http://macvim-dev.github.io/macvim/]:http://macvim-dev.github.io/macvim/ 336 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | 341 | -------------------------------------------------------------------------------- /vimrc: -------------------------------------------------------------------------------- 1 | "|------------------------| 2 | "| Coolceph VIMRC | 3 | "|------------------------| 4 | "| _ | 5 | "| __ __(_)___ ___ | 6 | "| | | / / / __ `__ \ | 7 | "| | |/ / / / / / / / | 8 | "| |___/_/_/ /_/ /_/ | 9 | "| | 10 | "|------------------------| 11 | " 12 | " Maintainer: coolceph 13 | " Last change: 2017.10.09 14 | " 15 | " To use it, copy it to 16 | " for Unix and OS/2: ~/.vimrc 17 | " for Amiga: s:.vimrc 18 | " for MS-DOS and Win32: $VIM\_vimrc 19 | " for OpenVMS: sys$login:.vimrc 20 | " 21 | " +----------+---------------------+ 22 | " | Key | Function | 23 | " +----------+---------------------+ 24 | " | F2 | paste模式开关 | 25 | " | F3 | NerdTREE开关 | 26 | " | F4 | tagbar开关 | 27 | " | F5 | 行号模式切换 | 28 | " | F6 | 是否显示特殊字符 | 29 | " | F7 | 更新ctags文件 | 30 | " | F8 | 打开undotree | 31 | " | F9 | 进入MultiCursor模式 | 32 | " | F10 | 打开YankRing剪贴板 | 33 | " | F12 | 鼠标模式切换 | 34 | " | | 快速推出VIM(:qall!) | 35 | " +----------+---------------------+ 36 | 37 | " Use Vim settings, rather than Vi settings (much better!). 38 | " This must be first, because it changes other options as a side effect. 39 | set nocompatible 40 | 41 | " allow backspacing over everything in insert mode 42 | set backspace=indent,eol,start 43 | 44 | " Switch syntax highlighting on, when the terminal has colors 45 | " Also switch on highlighting the last used search pattern. 46 | if &t_Co > 2 || has("gui_running") 47 | syntax on 48 | set hlsearch 49 | endif 50 | 51 | "默认关闭鼠标,方便Terminal下操作 52 | if has('mouse') 53 | set mouse-=a 54 | endif 55 | 56 | "MacVim工作在gui模式,需要设置字体 57 | "在Powerline字体开启时,需要选择Powerline字体,例如原版Source\ Code\ Pro或者SF\ Mono\ for\ Powerline 58 | "在Powerline字体关闭时,可以任意选择等宽字体 59 | "GUI模式开启鼠标支持,关闭左右的scrollbar 60 | if has("gui_running") 61 | set guifont=SFMono\ Nerd\ Font:h12 62 | set mouse=a 63 | set guioptions-=r 64 | set guioptions-=L 65 | set guicursor+=a:blinkon0 "光标不闪烁 66 | endif 67 | 68 | "当有termguicolors特性时开启GUI配色 69 | if has("termguicolors") 70 | set termguicolors 71 | endif 72 | 73 | "代码缩进设置 74 | set smarttab "开启时,在行首按TAB将加入sw个空格,否则加入ts个空格 75 | set tabstop=4 "编辑时一个TAB字符占多少个空格的位置 76 | set softtabstop=4 "方便在开启了et后使用退格(backspace)键,每次退格将删除X个空格 77 | set shiftwidth=4 "使用每层缩进的空格数 78 | set expandtab "是否将输入的TAB自动展开成空格。开启后要输入TAB,需要Ctrl-V 79 | " set updatetime=250 80 | 81 | " Only do this part when compiled with support for autocommands. 82 | if has("autocmd") 83 | 84 | " Enable file type detection. 85 | " Use the default filetype settings, so that mail gets 'tw' set to 72, 86 | " 'cindent' is on in C files, etc. 87 | " Also load indent files, to automatically do language-dependent indenting. 88 | filetype plugin indent on 89 | 90 | " Put these in an autocmd group, so that we can delete them easily. 91 | augroup vimrcEx 92 | au! 93 | 94 | " For all text files set 'textwidth' to 78 characters. 95 | autocmd FileType text setlocal textwidth=78 96 | autocmd FileType html setlocal shiftwidth=2 tabstop=2 softtabstop=2 97 | autocmd FileType htmldjango setlocal shiftwidth=2 tabstop=2 softtabstop=2 98 | autocmd FileType javascript setlocal shiftwidth=2 tabstop=2 softtabstop=2 99 | autocmd FileType make setlocal noexpandtab 100 | autocmd FileType python setlocal expandtab smarttab shiftwidth=4 softtabstop=4 101 | autocmd FileType c,cpp setlocal shiftwidth=2 tabstop=8 smarttab 102 | 103 | " When editing a file, always jump to the last known cursor position. 104 | " Don't do it when the position is invalid or when inside an event handler 105 | " (happens when dropping a file on gvim). 106 | autocmd BufReadPost * 107 | \ if line("'\"") >= 1 && line("'\"") <= line("$") | 108 | \ exe "normal! g`\"" | 109 | \ endif 110 | 111 | augroup END 112 | 113 | else 114 | 115 | set autoindent " always set autoindenting on 116 | 117 | endif " has("autocmd") 118 | 119 | set history=1024 120 | set number " 显示行号 121 | set autoread " 文件在Vim之外修改过,自动重新读入 122 | set showbreak=↪ " 显示换行符 123 | set completeopt=longest,menu " 更好的insert模式自动完成 124 | set modeline " 允许被编辑的文件以注释的形式设置Vim选项 125 | set hidden " switching buffers without saving 126 | set ruler " show the cursor position all the time 127 | set showcmd " display incomplete commands 128 | set wildmenu " show enhanced completion 129 | set wildmode=list:longest " together with wildmenu 130 | set wildignore+=.hg,.git,.svn " Version control 131 | set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg " binary images 132 | set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest " compiled object files 133 | set wildignore+=*.sw? " Vim swap files 134 | set wildignore+=*.DS_Store " OSX bullshit 135 | set wildignore+=*.pyc " Python byte code 136 | set wildignore+=*.orig " Merge resolution files 137 | set visualbell " flash screen when bell rings 138 | set cursorline " highline cursor line 139 | set ttyfast " indicate faster terminal connection 140 | set laststatus=2 " always show status line 141 | set cpoptions+=J 142 | set linebreak " break the line by words 143 | set scrolloff=3 " show at least 3 lines around the current cursor position 144 | set sidescroll=1 145 | set sidescrolloff=10 146 | set virtualedit+=block 147 | set lazyredraw 148 | set nolist 149 | set listchars=tab:▸\ ,eol:¬,extends:❯,precedes:❮ 150 | set splitbelow 151 | set splitright 152 | set fillchars=diff:⣿ 153 | " Make Vim able to edit crontab files again. 154 | set backupskip=/tmp/*,/private/tmp/*" 155 | 156 | " Resize splits when the window is resized 157 | au VimResized * :wincmd = 158 | 159 | "开关复制模式 160 | fun! TogglePasteMode() 161 | if !exists("s:old_pastemode") 162 | let s:old_pastemode = "1" 163 | endif 164 | 165 | if s:old_pastemode == "0" 166 | let s:old_pastemode = "1" 167 | set number 168 | set nopaste 169 | :EnableWhitespace 170 | :IndentLinesEnable 171 | call gitgutter#enable() 172 | 173 | if exists("s:old_pastemouse") 174 | let &mouse = s:old_pastemouse 175 | endif 176 | 177 | if exists("s:old_pastelist") 178 | let &list=s:old_pastelist 179 | endif 180 | 181 | echo "set edit mode" 182 | else 183 | let s:old_pastemode = "0" 184 | set nonumber 185 | set norelativenumber 186 | set paste 187 | :DisableWhitespace 188 | :IndentLinesDisable 189 | call gitgutter#disable() 190 | 191 | let s:old_pastemouse = &mouse 192 | let &mouse="" 193 | 194 | let s:old_pastelist = &list 195 | let &list="0" 196 | 197 | echo "set copy/paste mode" 198 | endif 199 | endfunction 200 | 201 | "使用F2切换复制/粘帖模式和正常编辑模式 202 | noremap :call TogglePasteMode() 203 | inoremap :call TogglePasteMode()i 204 | 205 | " toggle between no number, absolute number and relative number 206 | function! ToggleNumber() 207 | if !&number && !&relativenumber 208 | set number 209 | elseif !&relativenumber 210 | set relativenumber 211 | else 212 | set nonumber 213 | set norelativenumber 214 | endif 215 | endfunc 216 | 217 | "使用F5切换行号模式 218 | noremap :call ToggleNumber() 219 | 220 | "使用F6开关list字符 221 | noremap :set invlist:set list? 222 | 223 | "使用F7更新ctags 224 | fun! UpdateCtags() 225 | !ctags -R --c++-kinds=+p --fields=+iaS --extra=+q . 226 | echo "Create ctags OK" 227 | endfunction 228 | 229 | noremap :call UpdateCtags() 230 | 231 | "鼠标模式切换 232 | fun! ToggleMouse() 233 | if &mouse == "" 234 | let &mouse = "a" 235 | echo "Mouse is for Vim (" . &mouse . ")" 236 | else 237 | let &mouse = "" 238 | echo "Mouse is for Vim (" . &mouse . ")" 239 | endif 240 | endfunction 241 | 242 | "开关YankRing剪贴板缓冲区 243 | nnoremap :YRShow 244 | 245 | "使用F12切换鼠标模式 246 | noremap :call ToggleMouse() 247 | inoremap :call ToggleMouse()a 248 | 249 | " With a map leader it's possible to do extra key combinations 250 | let mapleader="," 251 | 252 | " Instead of reverting the cursor to the last position in the buffer, we 253 | " set it to the first line when editing a git commit message 254 | au FileType gitcommit au! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0]) 255 | 256 | "快速退出vim 257 | nnoremap :qall! 258 | 259 | "搜索相关的设置 260 | set showmatch " show matching brackets/parenthesis 261 | set magic " 根据vim说明默认开启此参数 262 | set ignorecase " 忽略大小写 263 | set smartcase " case sensitive when uc present 264 | 265 | "清空搜索结果高亮显示 266 | nnoremap / :nohlsearch 267 | 268 | "Window navigation mappings 269 | "deprecated after using vim-tmux-navigator 270 | " noremap h 271 | " noremap j 272 | " noremap k 273 | " noremap l 274 | 275 | "Tab navigation mappings 276 | map tn :tabn 277 | map tp :tabp 278 | map tm :tabm 279 | map tt :tabnew 280 | map ts :tab split 281 | map :tabn 282 | imap :tabn 283 | map :tabp 284 | imap :tabp 285 | 286 | "Code View Mode 287 | fun! ToggleCodeViewMode() 288 | if !exists("s:codeviewmode") 289 | let s:codeviewmode = "0" 290 | endif 291 | 292 | if s:codeviewmode == "0" 293 | nmap j jzz 294 | nmap k kzz 295 | let s:codeviewmode = "1" 296 | echo "Code View Mode" 297 | else 298 | unmap j 299 | unmap k 300 | let s:codeviewmode = "0" 301 | echo "Code Edit Mode" 302 | endif 303 | endfunction 304 | command! CodeReview :call ToggleCodeViewMode() 305 | 306 | " set text wrapping toggles 307 | nmap tw :set invwrap:set wrap? 308 | 309 | " find merge conflict markers 310 | nmap c /\v^[<=>]{7}( .*\|$) 311 | 312 | " 在命令行里面, 用%%表示当前文件路径 313 | cnoremap %% =fnameescape(expand('%:h')).'/' 314 | 315 | " 使用系统剪贴板复制粘帖(仅用于Mac) 316 | map y "+y 317 | map p "+p 318 | 319 | " command mode, ctrl-a to head, ctrl-e to tail 320 | cnoremap 321 | cnoremap 322 | cnoremap 323 | cnoremap 324 | 325 | "代码折叠相关配置 326 | " set foldmethod=syntax "代码折叠 共有6中方式如下 327 | "1. manual 手工定义折叠 328 | "2. indent 用缩进表示折叠 329 | "3. expr  用表达式来定义折叠 330 | "4. syntax 用语法高亮来定义折叠 331 | "5. diff 对没有更改的文本进行折叠 332 | "6. marker 用标志折叠 333 | 334 | "设置菜单和帮助的语言,默认改为英语 335 | set fileencodings=utf-8,gbk "使用utf-8或gbk打开文件 336 | set encoding=utf8 337 | set langmenu=en_US.UTF-8 338 | language message en_US.UTF-8 339 | let $LC_ALL='en_US.UTF-8' 340 | let $LANG='en_US.UTF-8' 341 | 342 | "pathogen是Vim用来管理插件的插件 343 | source ~/.vim/bundle/vim-pathogen/autoload/pathogen.vim 344 | execute pathogen#infect('bundle/{}', '~/.vim/bundle/{}') 345 | 346 | "colorscheme配色方案配置 347 | "Config of colorscheme is in $HOME/.vimrc 348 | 349 | " Airline ------------------------------ 350 | let g:airline_powerline_fonts = 1 351 | let g:airline_detect_paste=1 352 | let g:airline_theme = 'powerlineish' 353 | let g:airline#extensions#whitespace#enabled = 0 354 | let g:airline#extensions#whitespace#symbol = '!' 355 | let g:airline#extensions#syntastic#enabled = 0 356 | let g:airline#extensions#branch#enabled = 1 357 | let g:airline#extensions#tabline#enabled = 1 358 | let g:airline#extensions#tabline#buffer_nr_show = 1 359 | "let g:airline#extensions#tabline#left_sep = ' ' 360 | "let g:airline#extensions#tabline#left_alt_sep = '|' 361 | 362 | " to use fancy symbols for airline, uncomment the following lines and use a 363 | " patched font (more info on the README.rst) 364 | if !exists('g:airline_symbols') 365 | let g:airline_symbols = {} 366 | endif 367 | 368 | " unicode symbols 369 | "let g:airline_left_sep = '»' 370 | "let g:airline_left_sep = '▶' 371 | "let g:airline_right_sep = '«' 372 | "let g:airline_right_sep = '◀' 373 | "let g:airline_symbols.crypt = '🔒' 374 | "let g:airline_symbols.linenr = '␊' 375 | "let g:airline_symbols.linenr = '␤' 376 | "let g:airline_symbols.linenr = '¶' 377 | "let g:airline_symbols.branch = '⎇' 378 | "let g:airline_symbols.paste = 'ρ' 379 | "let g:airline_symbols.paste = 'Þ' 380 | "let g:airline_symbols.paste = '∥' 381 | "let g:airline_symbols.whitespace = 'Ξ' 382 | 383 | " powerline symbols 384 | "let g:airline_left_sep = '' 385 | "let g:airline_left_alt_sep = '' 386 | "let g:airline_right_sep = '' 387 | "let g:airline_right_alt_sep = '' 388 | "let g:airline_symbols.branch = '' 389 | "let g:airline_symbols.readonly = '' 390 | "let g:airline_symbols.linenr = '' 391 | 392 | "Ack选项 393 | let g:ack_default_options = " -s -H --nocolor --nogroup --column --ignore-file=is:tags --ignore-file=ext:taghl --ignore-file=ext:out" 394 | 395 | "Tagbar配置 396 | let g:tagbar_width=26 397 | let g:tagbar_autofocus = 1 398 | noremap :TagbarToggle 399 | 400 | "NerdTree配置 401 | map :NERDTreeToggle 402 | 403 | let NERDTreeShowBookmarks=1 404 | let NERDTreeIgnore=['\.o','\.pyc', '\~$', '\.swo$', '\.swp$', '\.git', '\.hg', '\.svn', '\.bzr'] 405 | let NERDTreeChDirMode=2 "setting root dir in NT also sets VIM's cd 406 | let NERDTreeQuitOnOpen=0 "the Nerdtree window will be close after a file is opend. 407 | let NERDTreeShowHidden=1 408 | let NERDTreeKeepTreeInNewTab=1 409 | 410 | "rainbow配置 411 | let g:rainbow_conf = { 412 | \ 'guifgs': ['RoyalBlue3', 'SeaGreen3', 'DarkOrchid3', 'firebrick3', 'darkorange3'], 413 | \ 'ctermfgs': ['red','darkred','darkcyan','darkgreen','Darkblue','darkmagenta','gray','brown','darkmagenta','darkred','darkcyan','darkgreen','darkgray','Darkblue','brown'], 414 | \ 'operators': '_,_', 415 | \ 'parentheses': ['start=/(/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/{/ end=/}/ fold'], 416 | \ 'separately': { 417 | \ '*': {}, 418 | \ 'lisp': { 419 | \ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick', 'darkorchid3'], 420 | \ }, 421 | \ 'tex': { 422 | \ 'parentheses': ['start=/(/ end=/)/', 'start=/\[/ end=/\]/'], 423 | \ }, 424 | \ 'vim': { 425 | \ 'parentheses': ['start=/(/ end=/)/', 'start=/\[/ end=/\]/', 'start=/{/ end=/}/ fold', 'start=/(/ end=/)/ containedin=vimFuncBody', 'start=/\[/ end=/\]/ containedin=vimFuncBody', 'start=/{/ end=/}/ fold containedin=vimFuncBody'], 426 | \ }, 427 | \ 'xml': { 428 | \ 'parentheses': ['start=/\v\<\z([-_:a-zA-Z0-9]+)(\s+[-_:a-zA-Z0-9]+(\=("[^"]*"|'."'".'[^'."'".']*'."'".'))?)*\>/ end=## fold'], 429 | \ }, 430 | \ 'xhtml': { 431 | \ 'parentheses': ['start=/\v\<\z([-_:a-zA-Z0-9]+)(\s+[-_:a-zA-Z0-9]+(\=("[^"]*"|'."'".'[^'."'".']*'."'".'))?)*\>/ end=## fold'], 432 | \ }, 433 | \ 'html': { 434 | \ 'parentheses': ['start=/\v\<((area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)[ >])@!\z([-_:a-zA-Z0-9]+)(\s+[-_:a-zA-Z0-9]+(\=("[^"]*"|'."'".'[^'."'".']*'."'".'|[^ '."'".'"><=`]*))?)*\>/ end=## fold'], 435 | \ }, 436 | \ 'php': { 437 | \ 'parentheses': ['start=/\v\<((area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)[ >])@!\z([-_:a-zA-Z0-9]+)(\s+[-_:a-zA-Z0-9]+(\=("[^"]*"|'."'".'[^'."'".']*'."'".'|[^ '."'".'"><=`]*))?)*\>/ end=## fold', 'start=/(/ end=/)/ containedin=@htmlPreproc contains=@phpClTop', 'start=/\[/ end=/\]/ containedin=@htmlPreproc contains=@phpClTop', 'start=/{/ end=/}/ containedin=@htmlPreproc contains=@phpClTop'], 438 | \ }, 439 | \ 'css': 0, 440 | \ } 441 | \} 442 | 443 | let g:rainbow_active = 1 "0 if you want to enable it later via :RainbowToggle 444 | 445 | "Fugitive配置 446 | nnoremap gs :Gstatus 447 | nnoremap gr :Gremove 448 | "nnoremap gl :Glog 449 | nnoremap gb :Gblame 450 | nnoremap gm :Gmove 451 | nnoremap gp :Ggrep 452 | nnoremap gR :Gread 453 | nnoremap gg :Git 454 | nnoremap gd :Gdiff 455 | 456 | "vim-go & gotags config 457 | let g:go_highlight_functions = 1 458 | let g:go_highlight_methods = 1 459 | let g:go_highlight_structs = 1 460 | let g:go_highlight_operators = 1 461 | let g:go_highlight_build_constraints = 1 462 | 463 | if executable('goimports') 464 | let g:go_fmt_command = "goimports" 465 | endif 466 | 467 | let g:go_fmt_autosave = 1 468 | 469 | au FileType go nmap r (go-run) 470 | au FileType go nmap b (go-build) 471 | au FileType go nmap t (go-test) 472 | au FileType go nmap c (go-coverage) 473 | let g:tagbar_type_go = { 474 | \ 'ctagstype' : 'go', 475 | \ 'kinds' : [ 476 | \ 'p:package', 477 | \ 'i:imports:1', 478 | \ 'c:constants', 479 | \ 'v:variables', 480 | \ 't:types', 481 | \ 'n:interfaces', 482 | \ 'w:fields', 483 | \ 'e:embedded', 484 | \ 'm:methods', 485 | \ 'r:constructor', 486 | \ 'f:functions' 487 | \ ], 488 | \ 'sro' : '.', 489 | \ 'kind2scope' : { 490 | \ 't' : 'ctype', 491 | \ 'n' : 'ntype' 492 | \ }, 493 | \ 'scope2kind' : { 494 | \ 'ctype' : 't', 495 | \ 'ntype' : 'n' 496 | \ }, 497 | \ 'ctagsbin' : 'gotags', 498 | \ 'ctagsargs' : '-sort -silent' 499 | \ } 500 | 501 | "CompletePlugin 502 | source ~/.vim/vimrc-completeplugin.vim 503 | 504 | "UltiSnips(Compatible with YouCompleteMe) 505 | let g:UltiSnipsExpandTrigger="" 506 | let g:UltiSnipsJumpForwardTrigger="" 507 | let g:UltiSnipsJumpBackwardTrigger="" 508 | 509 | "YCM-Generator 510 | "Usage in VIM: 511 | " :YcmGenerateConfig to generate .ycm_extra_conf.py in work dir. 512 | "Usage in shell: 513 | " ~/.vim/bundle/YCM-Generator/config_gen.py PROJECT_DIR 514 | 515 | "easymotion 516 | let g:EasyMotion_smartcase = 1 " Turn on case insensitive feature 517 | 518 | " Note: The default leader has been changed to to avoid 519 | " conflicts with other plugins you may have installed 520 | " Default Mapping | Details 521 | " ---------------------|---------------------------------------------- 522 | " f{char} | Find {char} to the right. See |f|. 523 | " F{char} | Find {char} to the left. See |F|. 524 | " t{char} | Till before the {char} to the right. See |t|. 525 | " T{char} | Till after the {char} to the left. See |T|. 526 | " w | Beginning of word forward. See |w|. 527 | " W | Beginning of WORD forward. See |W|. 528 | " b | Beginning of word backward. See |b|. 529 | " B | Beginning of WORD backward. See |B|. 530 | " e | End of word forward. See |e|. 531 | " E | End of WORD forward. See |E|. 532 | " ge | End of word backward. See |ge|. 533 | " gE | End of WORD backward. See |gE|. 534 | " j | Line downward. See |j|. 535 | " k | Line upward. See |k|. 536 | " n | Jump to latest "/" or "?" forward. See |n|. 537 | " N | Jump to latest "/" or "?" backward. See |N|. 538 | " s | Find(Search) {char} forward and backward. 539 | " | See |f| and |F|. 540 | 541 | "undotree 542 | function! s:get_undotree_dir() "{{{ 543 | let s:undotree_dir= 544 | \ substitute(substitute(fnamemodify( 545 | \ get(s:, 'undotree_dir', 546 | \ ($XDG_CACHE_HOME != '' ? 547 | \ $XDG_CACHE_HOME . '/undotree' : expand('~/.cache/undotree'))), 548 | \ ':p'), '\\', '/', 'g'), '/$', '', '') 549 | 550 | if !isdirectory(s:undotree_dir) 551 | call mkdir(s:undotree_dir, 'p') 552 | endif 553 | 554 | return s:undotree_dir 555 | endfunction"}}} 556 | 557 | nnoremap :UndotreeToggle 558 | if has("persistent_undo") 559 | let s:undotree_dir = "~/.cache/undotree" 560 | call s:get_undotree_dir() 561 | let &undodir = s:undotree_dir 562 | set undofile 563 | endif 564 | 565 | "vim-multiple-cursors 566 | " Called once right before you start selecting multiple cursors 567 | " Only use with neocomplcache 568 | if g:my_complete_plugin == "neocomplcache" 569 | function! Multiple_cursors_before() 570 | if exists(':NeoComplCacheLock')==2 571 | exe 'NeoComplCacheLock' 572 | endif 573 | endfunction 574 | 575 | " Called once only when the multiple selection is canceled (default ) 576 | function! Multiple_cursors_after() 577 | if exists(':NeoComplCacheUnlock')==2 578 | exe 'NeoComplCacheUnlock' 579 | endif 580 | endfunction 581 | endif 582 | 583 | "If you don't like the plugin taking over your favorite key bindings, you 584 | "can turn off the default with 585 | let g:multi_cursor_use_default_mapping=0 586 | 587 | " Default mapping 588 | let g:multi_cursor_next_key='' 589 | let g:multi_cursor_prev_key='' 590 | let g:multi_cursor_skip_key='' 591 | let g:multi_cursor_quit_key='' 592 | 593 | "By default, the 'next' key is also used to enter multicursor mode. If you 594 | "want to use a different key to start multicursor mode than for selecting 595 | "the next location, do like the following: 596 | " Map start key separately from next key 597 | let g:multi_cursor_start_key='' 598 | 599 | "Note that when multicursor mode is started, it selects current word with 600 | "boundaries, i.e. it behaves like *. If you want to avoid word boundaries in 601 | "Normal mode (as g* does) but still have old behaviour up your sleeve, you can 602 | "do the following 603 | "let g:multi_cursor_start_key='' 604 | let g:multi_cursor_start_word_key='g' 605 | 606 | "You can also map your own keys to quit, if g:multi_cursor_quit_key won't 607 | "work: 608 | "let g:multi_cursor_quit_key='' 609 | "nnoremap :call multiple_cursors#quit() 610 | 611 | "vim-expand-region 612 | "Press '+' to expand the visual selection and '_' to shrink it. 613 | 614 | "vim-exchange 615 | "Press 'X' to exchange between block in visual mode 616 | 617 | "vim-better-whitespace 618 | "need this hack code to make everything OK now 619 | autocmd VimEnter * DisableWhitespace 620 | autocmd VimEnter * EnableWhitespace 621 | map :StripWhitespace 622 | 623 | "indentLine 624 | " let g:indentLine_char = '┆' 625 | let g:indentLine_char = '¦' 626 | 627 | "vim-visual-star-search 628 | "This plugin allows you to select some text using Vim's visual mode, then hit 629 | "* and # to search for it elsewhere in the file 630 | "If you hit * (\* unless you changed the mapleader), vim recursively 631 | "vimgreps for the word under the cursor or the visual selection. 632 | 633 | "统一swapdir&backupdir 634 | function! s:get_swap_dir() "{{{ 635 | let s:swap_dir= 636 | \ substitute(substitute(fnamemodify( 637 | \ get(s:, 'swap_dir', 638 | \ ($XDG_CACHE_HOME != '' ? 639 | \ $XDG_CACHE_HOME . '/swap_dir' : expand('~/.cache/swap_dir'))), 640 | \ ':p'), '\\', '/', 'g'), '/$', '', '') 641 | 642 | if !isdirectory(s:swap_dir) 643 | call mkdir(s:swap_dir, 'p') 644 | endif 645 | 646 | return s:swap_dir 647 | endfunction"}}} 648 | 649 | let s:swap_dir = "~/.cache/swap_dir//" 650 | call s:get_swap_dir() 651 | "let &directory = s:swap_dir 652 | "为了实现同名文件可以同时存在swapfile,先写死 653 | set directory=~/.cache/swap_dir// 654 | set backupdir=~/.cache/swap_dir// 655 | 656 | " YankRing 剪贴板增量,支持256个最近剪贴 657 | function! s:get_yankring_dir() "{{{ 658 | let s:yankring_dir= 659 | \ substitute(substitute(fnamemodify( 660 | \ get(s:, 'yankring_dir', 661 | \ ($XDG_CACHE_HOME != '' ? 662 | \ $XDG_CACHE_HOME . '/yankring_dir' : expand('~/.cache/yankring_dir'))), 663 | \ ':p'), '\\', '/', 'g'), '/$', '', '') 664 | 665 | if !isdirectory(s:yankring_dir) 666 | call mkdir(s:yankring_dir, 'p') 667 | endif 668 | 669 | return s:yankring_dir 670 | endfunction"}}} 671 | 672 | let s:yankring_dir = "~/.cache/yankring_dir//" 673 | call s:get_yankring_dir() 674 | 675 | let g:yankring_history_dir="~/.cache/yankring_dir//" 676 | let g:yankring_max_history=512 677 | let g:yankring_replace_n_pkey = '[' 678 | let g:yankring_replace_n_nkey = ']' 679 | 680 | "gv.vim 查看gitlog 681 | nnoremap gl :GV 682 | 683 | "vim-plist 684 | let g:plist_display_format = 'xml' 685 | let g:plist_save_format = '' 686 | 687 | "vim-json 688 | let g:vim_json_syntax_conceal = 0 689 | 690 | "cscope setting 691 | function! AddScope() 692 | " set csprg=/usr/local/bin/cscope 693 | " set cscopetagorder=1 694 | " set cscopetag 695 | set nocsverb 696 | " add any database in current directory 697 | if filereadable("cscope.out") 698 | cs add cscope.out 699 | endif 700 | set csverb 701 | endfunction 702 | 703 | function! GenerateScope() 704 | !find . -name "*.h" -o -name "*.c" -o -name "*.cc" -o -name "*.cpp" -o -name "*.hpp" -o -name "*.java" -o -name "*.php" -o -name "*.go"> cscope.files;cscope -bkq -i cscope.files 705 | call AddScope() 706 | endfunction 707 | 708 | if has("cscope") 709 | call AddScope() 710 | endif 711 | 712 | " The following maps all invoke one of the following cscope search types: 713 | " 's' symbol: find all references to the token under cursor 714 | " 'g' global: find global definition(s) of the token under cursor 715 | " 'c' calls: find all calls to the function name under cursor 716 | " 't' text: find all instances of the text under cursor 717 | " 'e' egrep: egrep search for the word under cursor 718 | " 'f' file: open the filename under cursor 719 | " 'i' includes: find files that include the filename under cursor 720 | " 'd' called: find functions that function under cursor calls 721 | nmap s :cs find s =expand("") 722 | nmap g :cs find g =expand("") 723 | nmap c :cs find c =expand("") 724 | nmap t :cs find t =expand("") 725 | nmap e :cs find e =expand("") 726 | nmap f :cs find f =expand("") 727 | nmap i :cs find i =expand("") 728 | nmap d :cs find d =expand("") 729 | 730 | "nerdtree-git-plugin 731 | let g:NERDTreeUpdateOnCursorHold = 0 732 | 733 | "vim-cpp-enhanced-highlight 734 | let g:cpp_class_scope_highlight = 1 735 | 736 | "Toggle quickfix 737 | function! s:GetBufferList() 738 | redir =>buflist 739 | silent! ls 740 | redir END 741 | return buflist 742 | endfunction 743 | 744 | function! ToggleQuickfixList() 745 | for bufnum in map(filter(split(s:GetBufferList(), '\n'), 'v:val =~ "Quickfix List"'), 'str2nr(matchstr(v:val, "\\d\\+"))') 746 | if bufwinnr(bufnum) != -1 747 | cclose 748 | return 749 | endif 750 | endfor 751 | copen 752 | endfunction 753 | 754 | nmap