vim配置
1 |
set nocompatible " 去除对vi的兼容 |
2 |
"设置状态栏显示的内容 |
3 |
set statusline=%F%m%r%h%w [FORMAT=%{&ff}] [TYPE=%Y] [POS=%l,%v][%p%%] %{strftime("%d/%m/%y - %H:%M")} %{ALEGetStatusLine()} |
4 |
set tags+=./tags |
5 |
filetype off " 关闭文件类型检测 |
6 |
set rtp+=~/.vim/bundle/Vundle.vim " 设置vundle路径 |
7 |
call vundle#begin() " 插件管理函数开始 |
8 |
Plugin 'VundleVim/Vundle.vim' |
9 |
Plugin 'fatih/vim-go' |
10 |
"Plugin 'Tagbar' |
11 |
Plugin 'Valloric/YouCompleteMe' |
12 |
Plugin 'https://github.com/scrooloose/nerdtree.git' |
13 |
Plugin 'fatih/molokai' |
14 |
Plugin 'majutsushi/tagbar' |
15 |
"Plugin 'ctrlpvim/ctrlp.vim' |
16 |
Plugin 'morhetz/gruvbox' |
17 |
Plugin 'Raimondi/delimitMate' |
18 |
"Plugin 'mileszs/ack.vim' |
19 |
Plugin 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } |
20 |
Plugin 'junegunn/fzf.vim' |
21 |
Plugin 'Xuyuanp/nerdtree-git-plugin' |
22 |
Plugin 'vim-airline/vim-airline' |
23 |
Plugin 'w0rp/ale' |
24 |
Plugin 'nsf/gocode', {'rtp': 'vim/'} |
25 |
call vundle#end() " 插件管理函数结束 |
26 |
"NERDTree config |
27 |
"autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") &&b:NERDTreeType == "primary") | q | endif " 当目录树窗口为最后一个窗口时自动退出vim |
28 |
"inoremap jj <Esc> |
29 |
"let g:go_highlight_types = 1 |
30 |
"let g:go_highlight_fields = 1 |
31 |
"let g:go_highlight_functions = 1 |
32 |
"let g:go_highlight_function_calls = 1 |
33 |
"let g:go_highlight_operators = 1 |
34 |
"let g:go_highlight_extra_types = 1 |
35 |
let mapleader = " " |
36 |
let g:quickfix_hight=70 |
37 |
"===================== |
38 |
"ack |
39 |
"===================== |
40 |
"map <c-u> :Ack<space> |
41 |
nnoremap <c-p> :Files<CR> |
42 |
|
43 |
" 退出插入模式指定类型的文件自动保存 |
44 |
au InsertLeave *.go,*.sh,*.php write |
45 |
|
46 |
" Tagbar |
47 |
" 打开和关闭NERDTree快捷键 |
48 |
map <leader>fl :NERDTreeToggle<CR> |
49 |
" 显示行号 |
50 |
let NERDTreeShowLineNumbers=1 |
51 |
" 打开文件时是否显示目录 |
52 |
let NERDTreeAutoCenter=1 |
53 |
" 是否显示隐藏文件 |
54 |
let NERDTreeShowHidden=0 |
55 |
" 设置宽度 |
56 |
" let NERDTreeWinSize=31 |
57 |
" 忽略一下文件的显示 |
58 |
let NERDTreeIgnore=['.pyc','~$','.swp'] |
59 |
" 打开 vim 文件及显示书签列表 |
60 |
let NERDTreeShowBookmarks=2 |
61 |
" 在终端启动vim时,共享NERDTree |
62 |
let g:nerdtree_tabs_open_on_console_startup=1 |
63 |
|
64 |
let g:ale_sign_column_always = 1 |
65 |
let g:ale_set_highlights = 0 |
66 |
"自定义error和warning图标 |
67 |
let g:ale_sign_error = '?' |
68 |
let g:ale_sign_warning = '?' |
69 |
"在vim自带的状态栏中整合ale |
70 |
let g:ale_statusline_format = ['? %d', '? %d', '? OK'] |
71 |
"显示Linter名称,出错或警告等相关信息 |
72 |
let g:ale_echo_msg_error_str = 'E' |
73 |
let g:ale_echo_msg_warning_str = 'W' |
74 |
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]' |
75 |
"let g:ale_linters = { |
76 |
"" 'golang': ['gofmt','golint','errorCheck'], |
77 |
""} |
78 |
|
79 |
let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:10,results:128' |
80 |
"============================================================================== |
81 |
" majutsushi/tagbar 插件 |
82 |
"============================================================================== |
83 |
|
84 |
" majutsushi/tagbar 插件打开关闭快捷键 |
85 |
nmap <leader>f :TagbarToggle<CR> |
86 |
|
87 |
let g:tagbar_width=65 |
88 |
let g:tagbar_type_go = { |
89 |
'ctagstype' : 'go', |
90 |
'kinds' : [ |
91 |
'p:package', |
92 |
'i:imports:1', |
93 |
'c:constants', |
94 |
'v:variables', |
95 |
't:types', |
96 |
'n:interfaces', |
97 |
'w:fields', |
98 |
'e:embedded', |
99 |
'm:methods', |
10 大专栏 vim-config0 |
'r:constructor', |
101 |
'f:functions' |
102 |
], |
103 |
'sro' : '.', |
104 |
'kind2scope' : { |
105 |
't' : 'ctype', |
106 |
'n' : 'ntype' |
107 |
}, |
108 |
'scope2kind' : { |
109 |
'ctype' : 't', |
110 |
'ntype' : 'n' |
111 |
}, |
112 |
'ctagsbin' : 'gotags', |
113 |
'ctagsargs' : '-sort -silent' |
114 |
} |
115 |
"============================================================================== |
116 |
" nerdtree-git-plugin 插件 |
117 |
"============================================================================== |
118 |
let g:NERDTreeIndicatorMapCustom = { |
119 |
"Modified" : "?", |
120 |
"Staged" : "?", |
121 |
"Untracked" : "?", |
122 |
"Renamed" : "?", |
123 |
"Unmerged" : "═", |
124 |
"Deleted" : "?", |
125 |
"Dirty" : "?", |
126 |
"Clean" : "??", |
127 |
'Ignored' : '?', |
128 |
"Unknown" : "?" |
129 |
} |
130 |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif |
131 |
let g:NERDTreeShowIgnoredStatus = 1 |
132 |
|
133 |
let g:go_fmt_command = "goimports" |
134 |
let g:rehash256 = 1 |
135 |
let g:molokai_original = 1 |
136 |
|
137 |
|
138 |
|
139 |
|
140 |
" YouCompleteMe |
141 |
"set runtimepath+=~/.vim/bundle/YouCompleteMe |
142 |
"let g:ycm_collect_identifiers_from_tags_files = 1 " 开启 YCM 基于标签引擎 |
143 |
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释与字符串中的内容也用于补全 |
144 |
"let g:syntastic_ignore_files=[".*.py$"] |
145 |
let g:ycm_seed_identifiers_with_syntax = 1 " 语法关键字补全 |
146 |
"let g:ycm_complete_in_comments = 1 |
147 |
"let g:ycm_confirm_extra_conf = 0 |
148 |
let g:ycm_key_list_select_completion = ['<c-j>', '<Down>'] " 映射按键, 没有这个会拦截掉tab, 导致其他插件的tab不能用. |
149 |
let g:ycm_key_list_previous_completion = ['<c-k>', '<Up>'] |
150 |
let g:ycm_complete_in_comments = 1 " 在注释输入中也能补全 |
151 |
let g:ycm_complete_in_strings = 1 " 在字符串输入中也能补全 |
152 |
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释和字符串中的文字也会被收入补全 |
153 |
"let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py' |
154 |
"let g:ycm_show_diagnostics_ui = 0 " 禁用语法检查 |
155 |
inoremap <expr> <CR> pumvisible() ? "<C-y>" : "<CR>" | " 回车即选中当前项 |
156 |
let g:ycm_min_num_of_chars_for_completion=2 " 从第2个键入字符就开始罗列匹配项 |
157 |
let g:ycm_autoclose_preview_window_after_completion = 1 |
158 |
let g:ycm_autoclose_preview_window_after_insertion = 1 |
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
"colorscheme molokai |
168 |
set bg=dark "设置背景为黑色 |
169 |
colorscheme gruvbox "设置主题为 gruvbox |
170 |
set guioptions= "去掉两边的scrollbar |
171 |
set guifont=Monaco:h17 "设置字体和字的大小 |
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
syntax on "显示行号 |
178 |
"设置缩进 |
179 |
set tabstop=4 |
180 |
set softtabstop=4 |
181 |
set shiftwidth=4 |
182 |
set nu |
183 |
set cursorline "突出显示当前行 |
184 |
" ==== 系统剪切板复制粘贴 ==== |
185 |
" v 模式下复制内容到系统剪切板 |
186 |
vmap <Leader>c "+yy |
187 |
" n 模式下复制一行到系统剪切板 |
188 |
nmap <Leader>c "+yy |
189 |
" n 模式下粘贴系统剪切板的内容 |
190 |
nmap <Leader>v "+p |
191 |
set incsearch |
192 |
set ignorecase |
193 |
filetype plugin indent on " 必须,作用未知 |
194 |
|
195 |
let g:go_def_mode='gopls' |
196 |
let g:go_info_mode='gopls' |
197 |
nmap fs :GoFillStruct<CR> |
198 |
nmap fr :YcmCompleter GoToReferences<CR> |
199 |
nmap fe :GoIfErr<CR> |
原文地址:https://www.cnblogs.com/lijianming180/p/12389270.html
时间: 2024-11-09 06:15:00