-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc2
318 lines (268 loc) · 10.1 KB
/
vimrc2
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
call plug#begin('~/.vim/plugged2')
"Plug 'christoomey/vim-tmux-navigator'
Plug 'mg979/vim-visual-multi', {'branch': 'master'}
"" file explorer -- install font `Monaco Nerd Font` from https://github.com/Karmenzind/monaco-nerd-fonts
Plug 'nvim-tree/nvim-web-devicons'
Plug 'nvim-tree/nvim-tree.lua'
Plug 'simeji/winresizer'
Plug 'stevearc/aerial.nvim'
"folding
Plug 'kevinhwang91/nvim-ufo'
Plug 'kevinhwang91/promise-async'
Plug 'christoomey/vim-tmux-navigator'
Plug 'easymotion/vim-easymotion'
Plug 'neovim/nvim-lspconfig'
"commenting with <leadier>ci
Plug 'scrooloose/nerdcommenter'
Plug 'mhartington/formatter.nvim'
Plug 'mfussenegger/nvim-lint'
" surround text - in visual mode press `S` on selected text and press surrounding char
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'windwp/nvim-autopairs'
Plug 'nvim-neotest/neotest'
Plug 'lukas-reineke/indent-blankline.nvim'
" Coc
" Use release branch (recommended)
" coc-prettier, coc-git, coc-json, coc-elixir, coc-rls, coc-snippets,
" coc-webview, coc-markdown-preview-enhanced, coc-go
" coc-tsserver, coc-json, coc-rust-analyzer, coc-tailwindcss3
" coc-go (run CocCommand go.install.tools)
Plug 'mrcjkb/rustaceanvim', {'ft': 'rust', 'version': '^4'}
Plug 'antoinemadec/FixCursorHold.nvim'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'elixir-lsp/coc-elixir', {'do': 'yarn install && yarn prepack'}
Plug 'elixir-editors/vim-elixir'
Plug 'williamboman/mason.nvim'
"" Golang
""Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'nvim-neotest/neotest-go'
"" debugging
Plug 'mfussenegger/nvim-dap'
Plug 'leoluz/nvim-dap-go'
Plug 'rcarriga/nvim-dap-ui'
Plug 'nvim-neotest/nvim-nio'
Plug 'theHamsta/nvim-dap-virtual-text'
Plug 'LiadOz/nvim-dap-repl-highlights'
Plug 'nvim-telescope/telescope-dap.nvim'
"" syntax highligting
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'maxmellon/vim-jsx-pretty'
"" Fuzzy searching
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' }
Plug 'nvim-telescope/telescope-live-grep-args.nvim', { 'do': 'make' }
Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.3' }
Plug 'sharkdp/fd'
"" Theme
Plug 'patstockwell/vim-monokai-tasty'
Plug 'ribru17/bamboo.nvim'
"" Comand prompt and popups
Plug 'folke/noice.nvim'
Plug 'rcarriga/nvim-notify'
Plug 'MunifTanjim/nui.nvim'
Plug 'github/copilot.vim'
call plug#end()
lua << EOF
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- set termguicolors to enable highlight groups
vim.opt.termguicolors = true
-- empty setup using defaults
-- require("ibl").setup()
-- require('telescope').load_extension('live_grep_args')
local telescope = require("telescope")
local lga_actions = require("telescope-live-grep-args.actions")
telescope.setup {
extensions = {
live_grep_args = {
auto_quoting = true, -- enable/disable auto-quoting
-- define mappings, e.g.
mappings = { -- extend mappings
i = {
["<C-k>"] = lga_actions.quote_prompt(),
["<C-i>"] = lga_actions.quote_prompt({ postfix = " --iglob **" }),
},
},
-- ... also accepts theme settings, for example:
-- theme = "dropdown", -- use dropdown theme
-- theme = { }, -- use own theme spec
-- layout_config = { mirror=true }, -- mirror preview pane
}
}
}
require("ibl").setup({indent = {char = "┊"}, scope = {enabled = true, highlight = {"Function", "Label", "Whitespace", "NonText"}}})
require('telescope').load_extension('dap')
require('dap-go').setup()
require('nvim-dap-repl-highlights').setup()
require("nvim-dap-virtual-text").setup()
require("dapui").setup()
local dap, dapui = require("dap"), require("dapui")
dap.listeners.before.attach.dapui_config = function()
dapui.open()
end
dap.listeners.before.launch.dapui_config = function()
dapui.open()
end
dap.listeners.before.event_terminated.dapui_config = function()
dapui.close()
end
dap.listeners.before.event_exited.dapui_config = function()
dapui.close()
end
require'lspconfig'.gopls.setup{}
require("mason").setup()
require('ufo').setup()
require("nvim-tree").setup()
require("nvim-autopairs").setup {}
require("noice").setup()
require("notify").setup {top_down = true, stages = "static", timeout=5000, render="compact"}
require("neotest").setup({
adapters = {
require("neotest-go")({
experimental = {
test_table = true,
},
args = { "-count=1", "-timeout=60s" }
})
}
})
require'nvim-treesitter.configs'.setup {
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
}
}
require("aerial").setup({
-- optionally use on_attach to set keymaps when aerial has attached to a buffer
on_attach = function(bufnr)
-- Jump forwards/backwards with '{' and '}'
vim.keymap.set("n", "{", "<cmd>AerialPrev<CR>", { buffer = bufnr })
vim.keymap.set("n", "}", "<cmd>AerialNext<CR>", { buffer = bufnr })
end,
})
EOF
let mapleader = ","
map <Leader>n :NvimTreeToggle<CR>
map <Leader>m :AerialToggle!<CR>
map <Leader>w :WinResizerStartResize<CR>
"" Disable Ex mode
nnoremap Q <Nop>
nnoremap H gT
nnoremap L gt
set number "" Show line numbers
set ruler "" Show line and column number
set cursorline "" Highlight current line
set scrolloff=5 "" Start scrolling n lines before horizontal border of window.
set sidescrolloff=7 "" Start scrolling n chars before end of screen.
set sidescroll=1 "" The minimal number of columns to scroll
set clipboard^=unnamed,unnamedplus
""
"" filetype aliases for highlighting
""
autocmd BufEnter *.zok :setlocal filetype=solidity
autocmd BufEnter *.exs :setlocal filetype=elixir
autocmd BufEnter *.heex :setlocal filetype=elixir
""
"" Markdown preview mapping to `,mp`
""
map <silent> <leader>mp :<C-u>CocCommand markdown-preview-enhanced.openPreview<CR>
""
"" Whitespace
""
set nowrap "" don't wrap lines
set tabstop=2 "" a tab is two spaces
set shiftwidth=2 "" an autoindent (with <<) is two spaces
set expandtab "" use spaces, not tabs
"set list "" Show invisible characters (eg. tabs as '>')
set backspace=indent,eol,start "" backspace through everything in insert mode
""
"" Theme
""
colorscheme vim-monokai-tasty
"colorscheme bamboo
let g:airline_theme='base16_spacemacs'
let g:airline#extensions#tabline#enabled = 1
hi CocInlayHint guifg=grey40
""
"" Treesitter
""
"" tree-sitter -- folding options
set foldmethod=expr
set foldexpr=nvim_treesitter#foldexpr()
set foldlevel=99
set foldcolumn=0
highlight Folded guifg=grey85
autocmd BufReadPost,FileReadPost * normal zX
"set nofoldenable
""
" Go
""
" Neotest
autocmd FileType go nnoremap <leader>ta <cmd>lua require('neotest').run.attach()<cr>
autocmd FileType go nnoremap <leader>ts <cmd>lua require('neotest').summary.toggle()<cr>
autocmd FileType go nnoremap <leader>to <cmd>lua require('neotest').output_panel.toggle()<cr>
autocmd FileType go nnoremap <leader>tc <cmd>lua require('neotest').output_panel.clear()<cr>
autocmd FileType go nnoremap <leader>tS <cmd>lua require('neotest').run.stop()<cr>
autocmd FileType go nnoremap <leader>tf <cmd>lua require('neotest').run.run(vim.fn.expand('%'))<cr>
autocmd FileType go nnoremap <leader>tn <cmd>lua require('neotest').run.run()<cr>
" tags
autocmd FileType go nmap gta :CocCommand go.tags.add.prompt<cr>
autocmd FileType go nmap gtc :CocCommand go.tags.clear<cr>
""
"" Telescop searching
""
" Telescop Using Lua functions
nnoremap <leader>ff <cmd>lua require('telescope.builtin').find_files()<cr>
"" nnoremap <leader>fg <cmd>lua require('telescope.builtin').live_grep()<cr>
nnoremap <leader>fg <cmd>lua require('telescope').extensions.live_grep_args.live_grep_args()<cr>
nnoremap <leader>fb <cmd>lua require('telescope.builtin').buffers()<cr>
nnoremap <leader>fh <cmd>lua require('telescope.builtin').help_tags()<cr>
""
"" Debugging DAP
""
nnoremap <leader>db <cmd>lua require('dap').toggle_breakpoint()<cr>
nnoremap <leader>dc <cmd>lua require('dap').continue()<cr>
""
"" Coc settings
""
inoremap <silent><expr> <c-space> coc#refresh()
nmap <leader>la <Plug>(coc-codelens-action)
nmap <leader>ll <Plug>(coc-codeaction-source)
nmap <leader>rn <Plug>(coc-rename)
" GoTo code navigation
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use tab for trigger completion with characters ahead and navigate
" NOTE: There's always complete item selected by default, you may want to enable
" no select by `"suggest.noselect": true` in your configuration file
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
" Use K to show documentation in preview window
nnoremap <silent> K :call ShowDocumentation()<CR>
function! ShowDocumentation()
if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
else
call feedkeys('K', 'in')
endif
endfunction
" nighlight the symbol and its references when holding the cursor
autocmd CursorHold * silent call CocActionAsync('highlight')