-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvimrc.local
More file actions
222 lines (209 loc) · 7.07 KB
/
Copy pathvimrc.local
File metadata and controls
222 lines (209 loc) · 7.07 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
" Load vim-plug
set nocompatible
"set shell=/bin/bash
set rtp+=/usr/local/etc/vim
let g:rooter_change_directory_for_non_project_files = 'current'
if empty(glob("/usr/local/etc/vim/autoload/plug.vim"))
silent !curl -fLo /usr/local/etc/vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin("/usr/local/etc/vim/plugged")
" git wrapper
Plug 'tpope/vim-fugitive'
" show marks on left side
Plug 'kshenoy/vim-signature'
Plug 'morhetz/gruvbox'
Plug 'bling/vim-airline'
Plug 'airblade/vim-gitgutter'
Plug 'airblade/vim-rooter'
Plug 'terryma/vim-multiple-cursors'
Plug 'junegunn/fzf', {'do': './install --bin --all'}
Plug 'junegunn/fzf.vim'
Plug 'jez/vim-superman'
Plug 'neovim/nvim-lspconfig'
Plug 'williamboman/mason.nvim'
Plug 'williamboman/mason-lspconfig.nvim'
Plug 'junnplus/lsp-setup.nvim'
Plug 'ms-jpq/coq_nvim', {'branch': 'coq'}
Plug 'ms-jpq/coq.artifacts', {'branch': 'artifacts'}
call plug#end() " required
filetype plugin indent on " required
" theme
set t_Co=256
set background=dark
let g:gruvbox_contrast_light='hard'
let g:gruvbox_contrast_dark='hard'
if &term =~ '256color' || &term == 'nvim'
let g:gruvbox_italic=1
endif
set guifont=Fantasque\ Sans\ Mono\ 15
colorscheme gruvbox
" airline
set hidden
set laststatus=2
let g:airline_powerline_fonts=1
let g:airline#extensions#branch#enabled = 1
let g:airline#extensions#branch#displayed_head_limit = 10
let g:airline#extensions#hunks#enabled = 0
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_idx_mode = 1
let g:airline#extensions#whitespace#mixed_indent_algo = 1
let g:airline#extensions#tagbar#enabled = 1
let g:airline#extensions#fugitiveline#enabled = 1
let g:airline#extensions#ale#enabled = 1
let g:airline_skip_empty_sections = 1
let g:airline_detect_spell=0
let g:airline#extensions#wordcount#enabled = 0
let g:airline_mode_map = {
\ 'n' : 'N',
\ 'i' : 'I',
\ 'v' : 'V',
\ 'V' : 'VL',
\ '' : 'VB',
\ }
nmap <leader>1 <Plug>AirlineSelectTab1
nmap <leader>2 <Plug>AirlineSelectTab2
nmap <leader>3 <Plug>AirlineSelectTab3
nmap <leader>4 <Plug>AirlineSelectTab4
nmap <leader>5 <Plug>AirlineSelectTab5
nmap <leader>6 <Plug>AirlineSelectTab6
nmap <leader>7 <Plug>AirlineSelectTab7
nmap <leader>8 <Plug>AirlineSelectTab8
nmap <leader>9 <Plug>AirlineSelectTab9
" TMUX
if exists('$TMUX') && !exists('$NORENAME')
au BufEnter * if empty(&buftype) | call system('tmux rename-window '.expand('%:t:S')) | endif
au VimLeave * call system('tmux set-window automatic-rename on')
endif
" quickfix
au FileType qf nnoremap <silent> <C-j> :cn<CR>
au FileType qf nnoremap <silent> <C-k> :cp<CR>
function! GetBufferList()
redir =>buflist
silent! ls!
redir END
return buflist
endfunction
function! ToggleList(bufname, pfx)
let buflist = GetBufferList()
for bufnum in map(filter(split(buflist, '\n'), 'v:val =~ "'.a:bufname.'"'), 'str2nr(matchstr(v:val, "\\d\\+"))')
if bufwinnr(bufnum) != -1
exec(a:pfx.'close')
return
endif
endfor
if a:pfx == 'l' && len(getloclist(0)) == 0
echohl ErrorMsg
echo "Location List is Empty."
return
endif
let winnr = winnr()
exec(a:pfx.'open')
if winnr() != winnr
wincmd p
endif
endfunction
nmap <silent> <leader>l :call ToggleList("Location List", 'l')<CR>
nmap <silent> <leader>e :call ToggleList("Quickfix List", 'c')<CR>
function! RipgrepFzf(query, fullscreen)
let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case -- %s || true'
let initial_command = printf(command_fmt, shellescape(a:query))
let reload_command = printf(command_fmt, '{q}')
let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
endfunction
command! -nargs=* -bang Rg call RipgrepFzf(<q-args>, <bang>0)
command! -nargs=* -bang RG call fzf#vim#grep("rg --column --line-number --no-heading --color=always --case-sensitive -- ".shellescape(<q-args>), 1, fzf#vim#with_preview(), <bang>0)
nnoremap <silent> <C-p> :execute system('git rev-parse --is-inside-work-tree') =~ 'true' ? 'GFiles' : 'Files'<CR>
nnoremap <silent> <leader><Tab> :Buffers<CR>
nnoremap <silent> <leader>f :RG <C-R><C-W><CR>
nnoremap <silent> gt :Rg<CR>
nnoremap <silent> gc :BCommits<CR>
nnoremap <silent> gl :Lines<CR>
nnoremap <silent> gh :History<CR>
nnoremap <silent> gH :History:<CR>
nnoremap <silent> ml :Marks<CR>
nnoremap <silent> gz :Helptags<CR>
nnoremap <silent> gZ :Filetypes<CR>
inoremap <silent> <C-h> <Esc><Cmd>lua COQnav_mark()<CR>
vnoremap <silent> <C-h> <Esc><Cmd>lua COQnav_mark()<CR>
" lsp-setup
lua << EOF
require("mason").setup()
require("mason-lspconfig").setup {
ensure_installed = {"clangd"},
}
require("lsp-setup").setup({
-- Default mappings
-- gD = 'lua vim.lsp.buf.declaration()',
-- gd = 'lua vim.lsp.buf.definition()',
-- gt = 'lua vim.lsp.buf.type_definition()',
-- gi = 'lua vim.lsp.buf.implementation()',
-- gr = 'lua vim.lsp.buf.references()',
-- K = 'lua vim.lsp.buf.hover()',
-- ['<C-k>'] = 'lua vim.lsp.buf.signature_help()',
-- ['<space>rn'] = 'lua vim.lsp.buf.rename()',
-- ['<space>ca'] = 'lua vim.lsp.buf.code_action()',
-- ['<space>f'] = 'lua vim.lsp.buf.formatting()',
-- ['<space>e'] = 'lua vim.diagnostic.open_float()',
-- ['[d'] = 'lua vim.diagnostic.goto_prev()',
-- [']d'] = 'lua vim.diagnostic.goto_next()',
default_mappings = true,
-- Custom mappings, will overwrite the default mappings for the same key
-- Example mappings for telescope pickers:
-- gd = 'lua require"telescope.builtin".lsp_definitions()',
-- gi = 'lua require"telescope.builtin".lsp_implementations()',
-- gr = 'lua require"telescope.builtin".lsp_references()',
mappings = {},
-- Global on_attach
on_attach = function(client, bufnr)
-- Support custom the on_attach function for global
-- Formatting on save as default
-- require('lsp-setup.utils').format_on_save(client)
end,
-- Global capabilities
capabilities = vim.lsp.protocol.make_client_capabilities(),
-- Configuration of LSP servers
servers = {
-- Install LSP servers automatically (requires mason and mason-lspconfig)
-- LSP server configuration please see: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
-- pylsp = {},
-- rust_analyzer = {
-- settings = {
-- ['rust-analyzer'] = {
-- cargo = {
-- loadOutDirsFromCheck = true,
-- },
-- procMacro = {
-- enable = true,
-- },
-- },
-- },
-- },
clangd = {},
bashls = {},
},
-- Configuration of LSP inlay hints
inlay_hints = {
enabled = false,
highlight = 'Comment',
}
})
vim.g.coq_settings = {
auto_start = true,
keymap = {
bigger_preview = "",
},
clients = {
tmux = {
match_syms = true,
},
tabnine = {
enabled = true,
}
}
}
EOF
ino <silent><expr> <C-j> pumvisible() ? "\<C-n>" : "\<C-j>"
nnoremap <silent> <S-Tab> :ClangdSwitchSourceHeader<CR>