-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
94 lines (75 loc) · 2.19 KB
/
vimrc
File metadata and controls
94 lines (75 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
" 去除vi兼容
set nocompatible
" 打开高亮
syntax on
" Color scheme
"colorscheme kolor
set background=dark
"set columns=80
"set ruler
" 显示行号
set number
set noswapfile
set autowrite
" 不将=包括为文件名
set isfname-==
set modeline
set mouse=a
" Code folding
set nofoldenable
set foldnestmax=10
set foldlevel=0
"set foldmethod=indent
set foldmethod=syntax
"set foldenable
" 设置缩进为8个空格
set tabstop=8
set noexpandtab
" 文件编码与格式
set fileencodings=utf-8,gb18030,gbk
set fileformats=unix,dos
filetype plugin indent on
set wrap "自动换行
set wrapmargin=0
set linebreak
set hlsearch "高亮显示结果
set incsearch "在输入要搜索的文字时,vim会实时匹配
autocmd FileType python setlocal expandtab shiftround smartindent autoindent tabstop=8 shiftwidth=4 softtabstop=4
autocmd FileType c setlocal noexpandtab shiftround autoindent cindent tabstop=8
let mapleader = ","
inoremap jj <ESC>
" taglist
if filereadable("tags")
set tags+=tags
endif
let Tlist_Ctags_Cmd = '/usr/bin/ctags'
let Tlist_GainFocus_On_ToggleOpen = 1
let Tlist_Exit_OnlyWindow = 1
map tt :TlistToggle<cr>
if executable('clangd')
au User lsp_setup call lsp#register_server({
\ 'name': 'clangd',
\ 'cmd': {server_info->['clangd', '--header-insertion-decorators=false']},
\ 'whitelist': ['c', 'cpp', 'objc', 'objcpp'],
\ })
endif
autocmd Filetype c,h nnoremap <buffer> <silent> <c-]> :LspDefinition<cr>
" vim-go
let g:go_highlight_types = 1
" let g:go_highlight_structs = 1
" let g:go_highlight_interfaces = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
" let g:go_highlight_methods = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_operators = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_generate_tags = 1
let g:go_auto_sameids = 1
let g:go_auto_type_info = 1
autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4
au Filetype go nnoremap <leader>v :vsp <CR>:exe "GoDef" <CR>
au Filetype go nnoremap <leader>s :sp <CR>:exe "GoDef"<CR>
au Filetype go nnoremap <leader>t :tab split <CR>:exe "GoDef"<CR>
au Filetype go nnoremap <leader>d :exe "GoDescribe" <CR>