Compare commits
100 commits
metals-dap
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0318cf895e | ||
|
|
0347d5d17e | ||
|
|
8981f39679 | ||
|
|
c56438c44b | ||
|
|
e5f3edd8c8 | ||
|
|
6e92e847a3 | ||
|
|
1bb84ebd6d | ||
|
|
fc2b1e2931 | ||
|
|
37309c0edd | ||
|
|
e317dca789 | ||
|
|
523fedae4e | ||
|
|
76a754de23 | ||
|
|
4a8e96ce1f | ||
|
|
d45706cd86 | ||
|
|
ea2fef69b3 | ||
|
|
65eb554dc9 | ||
|
|
4742d5b88e | ||
|
|
a3935e52f0 | ||
|
|
a236829581 | ||
|
|
d9f092adac | ||
|
|
e90763e223 | ||
|
|
473d78494e | ||
|
|
2c5d7faba6 | ||
|
|
7d42f1af29 | ||
|
|
77e8e0b88b | ||
|
|
04a589a130 | ||
|
|
5cab0a1769 | ||
|
|
c5a3ea61cd | ||
|
|
babd4bc6f5 | ||
|
|
4103cdc4d2 | ||
|
|
23c87b8983 | ||
|
|
c6010628ca | ||
|
|
0223565b9a | ||
|
|
be860e4e6d | ||
|
|
80cbab3afb | ||
|
|
8725cbfe54 | ||
|
|
b40055513b | ||
|
|
eaaabbf2cd | ||
|
|
7f9b25ac21 | ||
|
|
3219ec838f | ||
|
|
8798045ac2 | ||
|
|
2c0362678f | ||
|
|
0563865360 | ||
|
|
b1e951ef1d | ||
|
|
855db2feee | ||
|
|
0dee46da50 | ||
|
|
898639c4ea | ||
|
|
24ae47af7f | ||
|
|
99468565f2 | ||
|
|
302df4ef17 | ||
|
|
56f0d00f96 | ||
|
|
2eca6c0d56 | ||
|
|
2a36c3fc7a | ||
|
|
0e0a4c9c66 | ||
|
|
c9c8de00c8 | ||
|
|
fa838f8e1b | ||
|
|
0fc8456552 | ||
|
|
250a4a8142 | ||
|
|
573d230ad3 | ||
|
|
0b9c41b792 | ||
|
|
9bffccefba | ||
|
|
41d779e3c7 | ||
|
|
daa9394fd5 | ||
|
|
cc13b9bbdb | ||
|
|
80ecaf3616 | ||
|
|
381fb51b80 | ||
|
|
eb8a2a698a | ||
|
|
f51ddd6f72 | ||
|
|
8242bdd4c4 | ||
|
|
6e1060fbaf | ||
|
|
f3923dd425 | ||
|
|
cf181c41b7 | ||
|
|
eed2756f83 | ||
|
|
400495feb9 | ||
|
|
508883c3c2 | ||
|
|
b3925cebad | ||
|
|
b3ffefc07c | ||
|
|
aa7cf035ff | ||
|
|
dea49d5689 | ||
|
|
6012fd6461 | ||
|
|
7cdac89502 | ||
|
|
387db52c76 | ||
|
|
d34b91cfd8 | ||
|
|
94394fd3b4 | ||
|
|
9605898edd | ||
|
|
be6559c1b6 | ||
|
|
d7aa29354c | ||
|
|
6c48210006 | ||
|
|
555629aa41 | ||
|
|
499580fee2 | ||
|
|
85112244f6 | ||
|
|
6f90d902b9 | ||
|
|
c303fa0cec | ||
|
|
5feb871a98 | ||
|
|
3aeea26b73 | ||
|
|
c86636a697 | ||
|
|
59ec8d490b | ||
|
|
3a1ab705cb | ||
|
|
a8e4f7a113 | ||
|
|
00ec5eca12 |
99 changed files with 2365 additions and 3708 deletions
15
.editorconfig
Normal file
15
.editorconfig
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
charset = utf-8
|
||||||
|
|
||||||
|
[*.{lua,vim}]
|
||||||
|
indent_size = tab
|
||||||
|
indent_style = tab
|
||||||
|
tab_width = 4
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.{lua}]
|
||||||
|
max_line_length = 140
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
map <nowait> <silent> <Leader>f :%!bibformat<CR>
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
let c_space_errors = 1
|
|
||||||
let c_space_errors = 1
|
|
||||||
let c_no_comment_fold = 1
|
|
||||||
let g:syntastic_c_checkers=['make']
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
imap <buffer> <// </<C-X><C-O><esc>==A
|
|
||||||
30
after/ftplugin/java.lua
Normal file
30
after/ftplugin/java.lua
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
vim.api.nvim_buf_set_option(0, "textwidth", 120)
|
||||||
|
vim.cmd.iabbrev("syso", "System.out.println")
|
||||||
|
|
||||||
|
local bmap = vim.keymap.set
|
||||||
|
local map_opt = { silent = true, buffer = true }
|
||||||
|
|
||||||
|
bmap("n", "<leader>ev", function()
|
||||||
|
require("jdtls").extract_variable()
|
||||||
|
end, { silent = true, buffer = true, desc = "Extract variable" })
|
||||||
|
bmap("v", "<leader>ev", function()
|
||||||
|
require("jdtls").extract_variable(true)
|
||||||
|
end, { silent = true, buffer = true, desc = "Extract variable" })
|
||||||
|
bmap("n", "<leader>ec", function()
|
||||||
|
require("jdtls").extract_constant()
|
||||||
|
end, { silent = true, buffer = true, desc = "Extract constant" })
|
||||||
|
bmap("v", "<leader>ec", function()
|
||||||
|
require("jdtls").extract_constant(true)
|
||||||
|
end, { silent = true, buffer = true, desc = "Extract constant" })
|
||||||
|
bmap("v", "<leader>em", function()
|
||||||
|
require("jdtls").extract_method(true)
|
||||||
|
end, { silent = true, buffer = true, desc = "Extract method" })
|
||||||
|
bmap("n", "<leader>ro", function()
|
||||||
|
require("jdtls").organize_imports()
|
||||||
|
end, { silent = true, buffer = true, desc = "Organize imports" })
|
||||||
|
bmap("n", "<leader>tc", function()
|
||||||
|
require("jdtls").test_class()
|
||||||
|
end, { silent = true, buffer = true, desc = "Test class" })
|
||||||
|
bmap("n", "<leader>tm", function()
|
||||||
|
require("jdtls").test_nearest_method()
|
||||||
|
end, { silent = true, buffer = true, desc = "Test nearest method" })
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
iab <buffer> syso System.out.println
|
|
||||||
|
|
||||||
setlocal foldmethod=syntax
|
|
||||||
setlocal foldenable
|
|
||||||
setlocal textwidth=120
|
|
||||||
|
|
||||||
nnoremap <silent> <buffer> <leader>jc :JavaCorrect<cr>
|
|
||||||
nnoremap <silent> <buffer> <leader>jd :JavaDocComment<cr>
|
|
||||||
nnoremap <silent> <buffer> <F2> :JavaDocPreview<cr>
|
|
||||||
nnoremap <silent> <buffer> <F3> :JavaSearchContext<cr>
|
|
||||||
nnoremap <silent> <buffer> <leader>jf :%JavaFormat<cr>
|
|
||||||
nnoremap <silent> <buffer> <leader>ji :JavaImportOrganize<cr>
|
|
||||||
nnoremap <buffer> <leader>jr :JavaRename<space>
|
|
||||||
|
|
||||||
inoremap <expr> <C-Space> pumvisible() \|\| &omnifunc == '' ?
|
|
||||||
\ "\<lt>C-n>" :
|
|
||||||
\ "\<lt>C-x>\<lt>C-o><c-r>=pumvisible() ?" .
|
|
||||||
\ "\"\\<lt>c-n>\\<lt>c-p>\\<lt>c-n>\" :" .
|
|
||||||
\ "\" \\<lt>bs>\\<lt>C-n>\"\<CR>"
|
|
||||||
imap <C-@> <C-Space>map <silent> <buffer> <C-Space> <C-x><C-o>
|
|
||||||
|
|
||||||
function! InsertJavaPackage()
|
|
||||||
let filename = expand("%")
|
|
||||||
let filename = substitute(filename, "\.java$", "", "")
|
|
||||||
let dir = getcwd() . "/" . filename
|
|
||||||
let dir = substitute(dir, "^.*\/src\/", "", "")
|
|
||||||
let dir = substitute(dir, "\/[^\/]*$", "", "")
|
|
||||||
let dir = substitute(dir, "\/", ".", "g")
|
|
||||||
let filename = substitute(filename, "^.*\/", "", "")
|
|
||||||
let dir = "package " . dir . ";"
|
|
||||||
let result = append(0, dir)
|
|
||||||
let result = append(1, "")
|
|
||||||
let result = append(2, "class " . filename . " {")
|
|
||||||
let result = append(4, "}")
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"java {{{
|
|
||||||
"if filereadable(bufname("%")) == 0
|
|
||||||
" call InsertJavaPackage()
|
|
||||||
"endif
|
|
||||||
|
|
||||||
"}}}
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
iabbr mfg Mit freundlichen Grüßen
|
iabbr mfg Mit freundlichen Grüßen
|
||||||
|
setlocal spell
|
||||||
set fdl=99
|
setlocal fdl=99
|
||||||
|
|
|
||||||
3
after/ftplugin/markdown.lua
Normal file
3
after/ftplugin/markdown.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
vim.g.markdown_fenced_languages = { "html", "python", "scala", "js=javascript" }
|
||||||
|
vim.g.markdown_composer_autostart = 0
|
||||||
|
vim.o.textwidth = 80
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
let g:markdown_fenced_languages = ['html', 'python', 'scala', 'js=javascript']
|
|
||||||
let g:markdown_composer_autostart = 0
|
|
||||||
4
after/ftplugin/python.lua
Normal file
4
after/ftplugin/python.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
vim.o.tabstop = 4
|
||||||
|
vim.o.shiftwidth = 4
|
||||||
|
vim.o.expandtab = true
|
||||||
|
vim.o.textwidth = 120
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
set ts=4 sw=4 et
|
|
||||||
|
|
@ -1,10 +1,4 @@
|
||||||
setl sts=2
|
setl sts=2
|
||||||
setl sw=2
|
setl sw=2
|
||||||
setl expandtab
|
setl expandtab
|
||||||
setl omnifunc=rubycomplete#Complete
|
|
||||||
let g:rubycomplete_buffer_loading = 1
|
|
||||||
let g:rubycomplete_classes_in_global = 1
|
|
||||||
|
|
||||||
nmap K :!ri <cword><cr>
|
|
||||||
|
|
||||||
hi link rubySymbol Special
|
hi link rubySymbol Special
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
imap //< <Plug>(codelines-close)<CR>
|
imap <C-/> <Plug>(codelines-close)<CR>
|
||||||
map <silent> <buffer> <leader>cl :call jobstart(['codelines', '.'])<cr>
|
map <silent> <buffer> <leader>cl :call jobstart(['codelines', '.'])<cr>
|
||||||
|
|
||||||
set tw=120
|
set tw=120
|
||||||
set foldlevel=99
|
set foldlevel=99
|
||||||
|
|
||||||
|
set foldmethod=indent
|
||||||
|
"set foldmethod=expr
|
||||||
|
"set foldexpr=nvim_treesitter#foldexpr()
|
||||||
|
|
|
||||||
3
after/ftplugin/scss.lua
Normal file
3
after/ftplugin/scss.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
vim.keymap.set("n", "<leader>s", function()
|
||||||
|
require("nvim-quick-switcher").toggle("tsx", "scss")
|
||||||
|
end, { buffer = true })
|
||||||
|
|
@ -1,11 +1,3 @@
|
||||||
if exists("&cole")
|
|
||||||
" conceal" Use conceal vim 7.3 feature:
|
|
||||||
set cole=0 " conceal level
|
|
||||||
" Conceal in tex file: "admgs", a=accents, d=delimiters, m=math symbols,
|
|
||||||
" g=Greek, s=superscripts/subscripts:
|
|
||||||
let g:tex_conceal="agm"
|
|
||||||
endif
|
|
||||||
|
|
||||||
imap <buffer> [[ \begin{<C-x><C-o>
|
imap <buffer> [[ \begin{<C-x><C-o>
|
||||||
imap <buffer> ]] <Plug>(vimtex-delim-close)
|
imap <buffer> ]] <Plug>(vimtex-delim-close)
|
||||||
imap <buffer> [( \left(
|
imap <buffer> [( \left(
|
||||||
|
|
|
||||||
1
after/ftplugin/text.lua
Normal file
1
after/ftplugin/text.lua
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
vim.o.textwidth = 80
|
||||||
87
after/ftplugin/typescript.lua
Normal file
87
after/ftplugin/typescript.lua
Normal file
|
|
@ -0,0 +1,87 @@
|
||||||
|
vim.o.textwidth = 120
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>o", function()
|
||||||
|
vim.lsp.buf.execute_command({ command = "_typescript.organizeImports", arguments = { vim.fn.expand("%:p") } })
|
||||||
|
end, { desc = "Organize imports" })
|
||||||
|
vim.keymap.set("n", "<leader>s", function()
|
||||||
|
require("nvim-quick-switcher").toggle("tsx", "scss")
|
||||||
|
end, { buffer = true })
|
||||||
|
|
||||||
|
local function goToCSSClassDefinition()
|
||||||
|
local node = vim.treesitter.get_node()
|
||||||
|
if not node then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local parent = node:parent()
|
||||||
|
if not parent then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local grandparent = parent:parent()
|
||||||
|
if not grandparent then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local className
|
||||||
|
if
|
||||||
|
node:type() == "string_fragment"
|
||||||
|
and grandparent:type() == "jsx_attribute"
|
||||||
|
and vim.treesitter.get_node_text(grandparent:named_child(0), 0) == "className"
|
||||||
|
then
|
||||||
|
className = vim.treesitter.get_node_text(node, 0)
|
||||||
|
elseif
|
||||||
|
parent:type() == "jsx_attribute" and vim.treesitter.get_node_text(parent:named_child(0), 0) == "className"
|
||||||
|
then
|
||||||
|
className = vim.treesitter.get_node_text(parent:named_child(1):named_child(0), 0)
|
||||||
|
elseif node:type() == "jsx_attribute" and vim.treesitter.get_node_text(node:named_child(0), 0) == "className" then
|
||||||
|
className = vim.treesitter.get_node_text(node:named_child(1):named_child(0), 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
if className then
|
||||||
|
require("nvim-quick-switcher").toggle("tsx", "scss", { only_existing = true })
|
||||||
|
local query = vim.treesitter.query.parse("scss", '((class_name) @cn (#eq? @cn "' .. className .. '"))')
|
||||||
|
local node = vim.treesitter.get_node()
|
||||||
|
if not node then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local tree = node:tree()
|
||||||
|
vim.fn.setqflist({})
|
||||||
|
local start, _, stop, _ = tree:root():range()
|
||||||
|
local anyMatch = false
|
||||||
|
for _, match, _ in query:iter_matches(tree:root(), 0, start, stop) do
|
||||||
|
anyMatch = true
|
||||||
|
for _, node in pairs(match) do
|
||||||
|
local row, col = node:start()
|
||||||
|
vim.api.nvim_win_set_cursor(0, { row + 1, col })
|
||||||
|
vim.fn.setqflist({
|
||||||
|
{
|
||||||
|
lnum = row + 1,
|
||||||
|
col = col + 1,
|
||||||
|
text = "class selector: " .. className,
|
||||||
|
filename = vim.fn.expand("%:p"),
|
||||||
|
bufnr = vim.fn.bufnr("%"),
|
||||||
|
},
|
||||||
|
}, "a")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not anyMatch then
|
||||||
|
require("nvim-quick-switcher").toggle("tsx", "scss", { only_existing = true })
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
callback = function()
|
||||||
|
vim.keymap.set("n", "gd", function()
|
||||||
|
if not goToCSSClassDefinition() then
|
||||||
|
require("telescope.builtin").lsp_definitions()
|
||||||
|
end
|
||||||
|
end, { buffer = true })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.o.foldmethod = "expr"
|
||||||
|
vim.o.foldexpr = "nvim_treesitter#foldexpr()"
|
||||||
1
after/ftplugin/typescriptreact.lua
Symbolic link
1
after/ftplugin/typescriptreact.lua
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
typescript.lua
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
set ts=4 sw=4
|
set ts=4 sw=4
|
||||||
|
set iskeyword+=-
|
||||||
|
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
let g:airline_powerline_fonts = 1
|
|
||||||
let g:airline_left_sep = ''
|
|
||||||
let g:airline_left_alt_sep = ''
|
|
||||||
let g:airline_right_sep = ''
|
|
||||||
let g:airline_right_alt_sep = ''
|
|
||||||
let g:airline_symbols.branch = ''
|
|
||||||
let g:airline_symbols.readonly = ''
|
|
||||||
let g:airline_symbols.linenr = ''
|
|
||||||
let g:airline_section_z = 'L:%l/%L C:%v'
|
|
||||||
|
|
||||||
function! LspStatus() abort
|
|
||||||
let status = luaeval('require("lsp-status").status()')
|
|
||||||
return trim(status)
|
|
||||||
endfunction
|
|
||||||
call airline#parts#define_function('lsp_status', 'LspStatus')
|
|
||||||
call airline#parts#define_condition('lsp_status', 'luaeval("#vim.lsp.buf_get_clients() > 0")')
|
|
||||||
let g:airline#extensions#nvimlsp#enabled = 0
|
|
||||||
let g:airline_section_warning = airline#section#create_right(['lsp_status'])
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
let g:formatdef_scalafmt = '"scalafmt --stdin 2>/dev/null"'
|
|
||||||
let g:formatters_scala = ['scalafmt']
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
"{{{ c header gates
|
"{{{ c header gates
|
||||||
function! s:insert_gates()
|
function! s:insert_gates()
|
||||||
let gatename = substitute(toupper(expand("%:t")), "\\.", "_", "g")
|
let gatename = substitute(toupper(expand("%:t")), "\\.", "_", "g")
|
||||||
|
|
@ -8,5 +7,4 @@ function! s:insert_gates()
|
||||||
normal! kk
|
normal! kk
|
||||||
endfunction
|
endfunction
|
||||||
autocmd BufNewFile *.{h,hpp} call <SID>insert_gates()
|
autocmd BufNewFile *.{h,hpp} call <SID>insert_gates()
|
||||||
|
|
||||||
"}}}
|
"}}}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
set scrolloff=99999
|
|
||||||
set lazyredraw
|
|
||||||
|
|
||||||
nnoremap <C-U> 11kzz
|
|
||||||
nnoremap <C-D> 11jzz
|
|
||||||
nnoremap j gjzz
|
|
||||||
nnoremap k gkzz
|
|
||||||
nnoremap # #zz
|
|
||||||
nnoremap * *zz
|
|
||||||
nnoremap n nzz
|
|
||||||
nnoremap N Nzz
|
|
||||||
nnoremap gg ggzz
|
|
||||||
nnoremap G Gzz
|
|
||||||
nnoremap gj jzz
|
|
||||||
nnoremap gk kzz
|
|
||||||
vnoremap < <gv
|
|
||||||
vnoremap > >gv
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
if exists(":CocAction")
|
|
||||||
set signcolumn=yes
|
|
||||||
map <silent> gd <Plug>(coc-definition)
|
|
||||||
|
|
||||||
map <silent> <M-=> <cmd>call CocAction("doHover")<cr>
|
|
||||||
map <silent> <Leader>t <Plug>(coc-type-definition)
|
|
||||||
map <silent> <Leader>u <Plug>(coc-references)
|
|
||||||
map <silent> <Leader>r <Plug>(coc-rename)
|
|
||||||
map <silent> <Leader>q <Plug>(coc-quickfix)
|
|
||||||
|
|
||||||
map <silent> <Leader>F <Plug>(coc-format)
|
|
||||||
map <silent> <Leader>f <Plug>(coc-format-selected)
|
|
||||||
vmap <silent> <Leader>f <Plug>(coc-format-selected)
|
|
||||||
|
|
||||||
map <silent> <M-a> <Plug>(coc-codeaction)
|
|
||||||
vmap <silent> <M-a> <Plug>(coc-codeaction-selected)
|
|
||||||
|
|
||||||
omap <silent> af <Plug>(coc-funcobj-a)
|
|
||||||
omap <silent> if <Plug>(coc-funcobj-i)
|
|
||||||
endif
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
if exists('g:loaded_compe')
|
|
||||||
inoremap <silent><expr> <C-Space> compe#complete()
|
|
||||||
inoremap <silent><expr> <CR> compe#confirm('<CR>')
|
|
||||||
inoremap <silent><expr> <C-e> compe#close('<C-e>')
|
|
||||||
inoremap <silent><expr> <C-f> compe#scroll({ 'delta': +4 })
|
|
||||||
inoremap <silent><expr> <C-d> compe#scroll({ 'delta': -4 })
|
|
||||||
endif
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
map gf :GFiles<cr>
|
|
||||||
map <Leader>gf :Files<cr>
|
|
||||||
map gb :Buffers<cr>
|
|
||||||
map gs :GFiles?<cr>
|
|
||||||
map <Leader>ag :Ag<space>
|
|
||||||
|
|
||||||
imap <C-x><M-C-F> <plug>(fzf-complete-file)
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
let g:deoplete#enable_at_startup = 1
|
|
||||||
if !exists('g:deoplete#omni#input_patterns')
|
|
||||||
let g:deoplete#omni#input_patterns = {}
|
|
||||||
endif
|
|
||||||
|
|
||||||
" <C-h>, <BS>: close popup and delete backword char.
|
|
||||||
"inoremap <expr><C-h> deoplete#smart_close_popup()."\<C-h>"
|
|
||||||
"inoremap <expr><BS> deoplete#smart_close_popup()."\<C-h>"
|
|
||||||
|
|
||||||
"inoremap <silent><expr> <TAB>
|
|
||||||
" \ pumvisible() ? "\<C-n>" :
|
|
||||||
" \ <SID>check_back_space() ? "\<TAB>" :
|
|
||||||
" \ '\<C-x><C-o>'
|
|
||||||
|
|
||||||
function! s:check_back_space()
|
|
||||||
let col = col('.') - 1
|
|
||||||
return !col || getline('.')[col - 1] =~ '\s'
|
|
||||||
endfunction
|
|
||||||
"inoremap <silent> <c-space> <C-x><C-o>
|
|
||||||
3
after/plugin/genghis.lua
Normal file
3
after/plugin/genghis.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
vim.api.nvim_create_user_command("Trash", function()
|
||||||
|
require("genghis").trashFile({ trashCmd = "rm" })
|
||||||
|
end, { desc = "Delete current file" })
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
hi link GitGutterAddLineNr DiffAdd
|
|
||||||
hi link GitGutterChangeLineNr DiffChange
|
|
||||||
hi link GitGutterDeleteLineNr DiffDelete
|
|
||||||
hi link GitGutterChangeDeleteLineNr GitGutterChangeLine
|
|
||||||
GitGutterLineNrHighlightsEnable
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
":let g:metals_server_version = '0.10.6-M1+29-22f5a4b1-SNAPSHOT'
|
|
||||||
"let g:metals_server_version = '0.10.6-M1'
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
|
|
||||||
hi SyntasticErrorLine ctermbg=52 ctermfg=fg cterm=NONE
|
|
||||||
hi SyntasticWarningLine ctermbg=234 ctermfg=fg cterm=NONE
|
|
||||||
|
|
||||||
let g:syntastic_tex_chktex_showmsg = 0
|
|
||||||
let g:syntastic_tex_chktex_args = '-n 1 -n 11'
|
|
||||||
let g:syntastic_tex_checkers = ['chktex']
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
function MyTabLine()
|
|
||||||
let s = ''
|
|
||||||
let t = tabpagenr()
|
|
||||||
let i = 1
|
|
||||||
while i <= tabpagenr('$')
|
|
||||||
let buflist = tabpagebuflist(i)
|
|
||||||
let winnr = tabpagewinnr(i)
|
|
||||||
let s .= '%' . i . 'T'
|
|
||||||
let s .= (i == t ? '%2*' : '%1*')
|
|
||||||
let s .= ' '
|
|
||||||
let s .= i . ':'
|
|
||||||
let s .= winnr . '/' . tabpagewinnr(i,'$')
|
|
||||||
|
|
||||||
let bufnrlist = tabpagebuflist(i)
|
|
||||||
for bufnr in bufnrlist
|
|
||||||
if getbufvar(bufnr, "&modified")
|
|
||||||
let s .= '+'
|
|
||||||
break
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
|
|
||||||
let s .= ' %*'
|
|
||||||
let s .= (i == t ? '%#TabLineSel#' : '%#TabLine#')
|
|
||||||
let bufnr = buflist[winnr - 1]
|
|
||||||
let file = bufname(bufnr)
|
|
||||||
let buftype = getbufvar(bufnr, 'buftype')
|
|
||||||
if buftype == 'nofile'
|
|
||||||
if file =~ '\/.'
|
|
||||||
let file = substitute(file, '.*\/\ze.', '', '')
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
let file = fnamemodify(file, ':p:t')
|
|
||||||
endif
|
|
||||||
if file == ''
|
|
||||||
let file = '[No Name]'
|
|
||||||
endif
|
|
||||||
let s .= file
|
|
||||||
let i = i + 1
|
|
||||||
endwhile
|
|
||||||
let s .= '%T%#TabLineFill#%='
|
|
||||||
let s .= (tabpagenr('$') > 1 ? '%999XX' : 'X')
|
|
||||||
return s
|
|
||||||
endfunction
|
|
||||||
set stal=2
|
|
||||||
set tabline=%!MyTabLine()
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
|
|
||||||
" search for symbols
|
|
||||||
map gs :Telescope lsp_dynamic_workspace_symbols<cr>
|
|
||||||
16
after/plugin/treesitter.lua
Normal file
16
after/plugin/treesitter.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
require("nvim-treesitter.configs").setup({
|
||||||
|
ensure_installed = { "typescript" },
|
||||||
|
sync_install = true,
|
||||||
|
auto_install = true,
|
||||||
|
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,
|
||||||
|
},
|
||||||
|
indent = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
11
after/plugin/trouble.lua
Normal file
11
after/plugin/trouble.lua
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
require("trouble").setup({
|
||||||
|
-- your configuration comes here
|
||||||
|
-- or leave it empty to use the default settings
|
||||||
|
-- refer to the configuration section below
|
||||||
|
})
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>tx", "<cmd>Trouble<cr>", { silent = true, noremap = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>tw", "<cmd>Trouble workspace_diagnostics<cr>", { silent = true, noremap = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>td", "<cmd>Trouble document_diagnostics<cr>", { silent = true, noremap = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>tl", "<cmd>Trouble loclist<cr>", { silent = true, noremap = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>tq", "<cmd>Trouble quickfix<cr>", { silent = true, noremap = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "gR", "<cmd>Trouble lsp_references<cr>", { silent = true, noremap = true })
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
let g:vimtex_quickfix_ignorefilters = [
|
|
||||||
\ 'overfull',
|
|
||||||
\ 'underfull',
|
|
||||||
\]
|
|
||||||
2812
autoload/plug.vim
2812
autoload/plug.vim
File diff suppressed because it is too large
Load diff
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"languageserver": {
|
|
||||||
"turtle": {
|
|
||||||
"command": "turtle_lsp",
|
|
||||||
"filetypes": ["ttl", "turtle"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
au! BufRead,BufNewFile *.atg setfiletype coco
|
|
||||||
au! BufRead,BufNewFile *.wili setfiletype wili
|
|
||||||
24
ftdetect/extensions.lua
Normal file
24
ftdetect/extensions.lua
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
vim.filetype.add({
|
||||||
|
extension = {
|
||||||
|
["vtt"] = "vtt",
|
||||||
|
["typ"] = "typst",
|
||||||
|
["sc"] = "scala",
|
||||||
|
["nft"] = "nftables",
|
||||||
|
},
|
||||||
|
filename = {
|
||||||
|
[".scalafmt.conf"] = "hocon",
|
||||||
|
["kitty.conf"] = "kitty",
|
||||||
|
["neomuttrc"] = "neomutt",
|
||||||
|
["template"] = "sh",
|
||||||
|
["mbsyncrc"] = "mbsyncrc",
|
||||||
|
["nftables.conf"] = "nftables",
|
||||||
|
},
|
||||||
|
pattern = {
|
||||||
|
["${XDG_CONFIG_HOME}/kitty/*.conf"] = "kitty",
|
||||||
|
["${XDG_CONFIG_HOME}/kitty/*.session"] = "kitty-session",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- au BufRead,BufNewFile *.ttl set filetype=rdf-turtle
|
||||||
|
-- au! BufNewFile,BufRead *.xwiki set ft=xwiki syntax=xwiki
|
||||||
|
--
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
au! BufNewFile,BufRead .scalafmt.conf set ft=hocon syntax=hocon
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
au! BufNewFile,BufRead kitty.conf set ft=kitty syntax=kitty
|
|
||||||
if exists("$XDG_CONFIG_HOME")
|
|
||||||
au! BufNewFile,BufRead $XDG_CONFIG_HOME/kitty/*.conf set ft=kitty syntax=kitty
|
|
||||||
au! BufRead,BufNewFile $XDG_CONFIG_HOME/kitty/*.session set ft=kitty-session syntax=kitty-session
|
|
||||||
else
|
|
||||||
au! BufNewFile,BufRead ~/.config/kitty/*.conf set ft=kitty syntax=kitty
|
|
||||||
au! BufRead,BufNewFile ~/.config/kitty/*.session set ft=kitty-session syntax=kitty-session
|
|
||||||
endif
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
au! BufNewFile,BufRead *.sieve set ft=sieve syntax=sieve
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
au! BufRead,BufNewFile tolua_*.pkg set ft=tolua syntax=tolua
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
au BufRead,BufNewFile *.ttl set filetype=rdf-turtle
|
au BufRead,BufNewFile *.ttl set filetype=turtle
|
||||||
|
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
au! BufNewFile,BufRead *.xwiki set ft=xwiki syntax=xwiki
|
|
||||||
|
|
||||||
60
ftplugin/java.lua
Normal file
60
ftplugin/java.lua
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
local path = require("mason-core.path")
|
||||||
|
|
||||||
|
local function mason_package(...)
|
||||||
|
return path.concat({ vim.fn.stdpath("data"), "mason", "packages", ... })
|
||||||
|
end
|
||||||
|
|
||||||
|
local bundles = vim.fn.glob(
|
||||||
|
mason_package("java-debug-adapter", "extension", "server", "com.microsoft.java.debug.plugin-*.jar"),
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
local extra_bundles = vim.fn.glob(mason_package("java-test", "extension", "server", "*.jar"), true, true)
|
||||||
|
vim.list_extend(bundles, extra_bundles)
|
||||||
|
|
||||||
|
require("jdtls").start_or_attach({
|
||||||
|
cmd = { mason_package("jdtls", "bin", "jdtls") },
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
require("jdtls").setup_dap()
|
||||||
|
end,
|
||||||
|
init_options = {
|
||||||
|
bundles = extra_bundles,
|
||||||
|
},
|
||||||
|
settings = {
|
||||||
|
java = {
|
||||||
|
completion = {
|
||||||
|
favoriteStaticMembers = {
|
||||||
|
"org.hamcrest.MatcherAssert.assertThat",
|
||||||
|
"org.hamcrest.Matchers.*",
|
||||||
|
"org.hamcrest.CoreMatchers.*",
|
||||||
|
"org.junit.jupiter.api.Assertions.*",
|
||||||
|
"java.util.Objects.requireNonNull",
|
||||||
|
"java.util.Objects.requireNonNullElse",
|
||||||
|
"org.mockito.Mockito.*",
|
||||||
|
},
|
||||||
|
filteredTypes = {
|
||||||
|
"com.sun.*",
|
||||||
|
"io.micrometer.shaded.*",
|
||||||
|
"java.awt.*",
|
||||||
|
"jdk.*",
|
||||||
|
"sun.*",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
codeGeneration = {
|
||||||
|
toString = {
|
||||||
|
template = "${object.className}{${member.name()}=${member.value}, ${otherMembers}}",
|
||||||
|
},
|
||||||
|
hashCodeEquals = {
|
||||||
|
useJava7Objects = true,
|
||||||
|
},
|
||||||
|
useBlocks = true,
|
||||||
|
},
|
||||||
|
sources = {
|
||||||
|
organizeImports = {
|
||||||
|
starThreshold = 3,
|
||||||
|
staticStarThreshold = 5,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
157
init.lua
Normal file
157
init.lua
Normal file
|
|
@ -0,0 +1,157 @@
|
||||||
|
local should_profile = os.getenv("NVIM_PROFILE")
|
||||||
|
if should_profile then
|
||||||
|
require("profile").instrument_autocmds()
|
||||||
|
if should_profile:lower():match("^start") then
|
||||||
|
require("profile").start("*")
|
||||||
|
else
|
||||||
|
require("profile").instrument("*")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function toggle_profile()
|
||||||
|
local prof = require("profile")
|
||||||
|
if prof.is_recording() then
|
||||||
|
prof.stop()
|
||||||
|
vim.ui.input({ prompt = "Save profile to:", completion = "file", default = "profile.json" }, function(filename)
|
||||||
|
if filename then
|
||||||
|
prof.export(filename)
|
||||||
|
vim.notify(string.format("Wrote %s", filename))
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
prof.start("*")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.keymap.set("", "<f1>", toggle_profile)
|
||||||
|
|
||||||
|
-- lazy.nvim bootstrap
|
||||||
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
|
vim.fn.system({
|
||||||
|
"git",
|
||||||
|
"clone",
|
||||||
|
"--filter=blob:none",
|
||||||
|
"https://github.com/folke/lazy.nvim.git",
|
||||||
|
"--branch=stable", -- latest stable release
|
||||||
|
lazypath,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
require("lazy").setup("plugins", {
|
||||||
|
dev = {
|
||||||
|
path = "~/projects/nvim/",
|
||||||
|
patterns = { "crater2150" },
|
||||||
|
fallback = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.opt.background = "dark"
|
||||||
|
vim.opt.number = true
|
||||||
|
vim.opt.title = true
|
||||||
|
|
||||||
|
vim.opt.colorcolumn = "+1"
|
||||||
|
vim.opt.textwidth = 80
|
||||||
|
vim.opt.tabstop = 2
|
||||||
|
vim.opt.shiftwidth = 2
|
||||||
|
|
||||||
|
vim.opt.whichwrap = "b,s,<,>,[,],h,l"
|
||||||
|
|
||||||
|
--vim.opt.timeout = false
|
||||||
|
|
||||||
|
vim.opt.foldmethod = "expr"
|
||||||
|
vim.opt.foldlevel = 99
|
||||||
|
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||||
|
|
||||||
|
vim.opt.diffopt:append("vertical")
|
||||||
|
vim.opt.diffopt:append("linematch:50")
|
||||||
|
-- todo visualbell needed?
|
||||||
|
|
||||||
|
vim.opt.shell = "/bin/zsh"
|
||||||
|
vim.opt.ignorecase = true
|
||||||
|
vim.opt.smartcase = true
|
||||||
|
vim.opt.inccommand = "split"
|
||||||
|
vim.opt.listchars = "tab:⇥\\ ,trail:-,nbsp:+,lead:␣"
|
||||||
|
--vim.opt.list = true
|
||||||
|
vim.cmd([[hi link Whitespace Comment]])
|
||||||
|
|
||||||
|
vim.opt.wildmode = { "list:longest", "list:full" }
|
||||||
|
vim.opt.wildignore = { "*.so", "*.swp", "*.zip", "*.o" }
|
||||||
|
vim.opt.suffixes = {
|
||||||
|
".bak",
|
||||||
|
"~",
|
||||||
|
".h",
|
||||||
|
".info",
|
||||||
|
".swp",
|
||||||
|
".obj",
|
||||||
|
".info",
|
||||||
|
".aux",
|
||||||
|
".dvi",
|
||||||
|
".bbl",
|
||||||
|
".out",
|
||||||
|
".o",
|
||||||
|
".lo",
|
||||||
|
"\\.class",
|
||||||
|
".pdf",
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.opt.completeopt = "menu,menuone,noselect"
|
||||||
|
vim.opt.mouse = ""
|
||||||
|
vim.opt.shortmess = vim.o.shortmess .. "c"
|
||||||
|
|
||||||
|
vim.opt.cursorline = true
|
||||||
|
vim.opt.undofile = true
|
||||||
|
|
||||||
|
vim.opt.spelllang = "de,en"
|
||||||
|
|
||||||
|
vim.opt.termguicolors = true
|
||||||
|
vim.opt.pumblend = 10
|
||||||
|
|
||||||
|
vim.opt.updatetime = 300
|
||||||
|
|
||||||
|
vim.opt.fixendofline = false
|
||||||
|
|
||||||
|
local command = vim.api.nvim_create_user_command
|
||||||
|
local initlua = vim.fn.stdpath("config") .. "/init.lua"
|
||||||
|
command("RC", function()
|
||||||
|
vim.cmd.edit(initlua)
|
||||||
|
end, { desc = "edit init.lua" })
|
||||||
|
command("CD", ":cd %:h", { desc = "cd to current file" })
|
||||||
|
command("TrailingSpace", "%s/\\s*$//g", { desc = "remove trailing spaces" })
|
||||||
|
|
||||||
|
local key = vim.keymap.set
|
||||||
|
|
||||||
|
key("n", "<space>", "za", { desc = "toggle fold" })
|
||||||
|
key("v", ".", "<cmd>normal .<CR>", { desc = "repeat last command in visual mode" })
|
||||||
|
key("n", "cy", '"*y', { desc = "copy to system clipboard" })
|
||||||
|
|
||||||
|
key("t", "<C-q>", "<C-\\><C-n>", { desc = "exit terminal mode" })
|
||||||
|
|
||||||
|
-- Arrow keys for window movement and resizing
|
||||||
|
key("n", "<Left>", "<C-w>h")
|
||||||
|
key("n", "<Down>", "<C-w>j")
|
||||||
|
key("n", "<Up>", "<C-w>k")
|
||||||
|
key("n", "<Right>", "<C-w>l")
|
||||||
|
--
|
||||||
|
key("n", "<S-Left>", "<C-w><")
|
||||||
|
key("n", "<S-Right>", "<C-w>>")
|
||||||
|
key("n", "<S-Down>", "<C-w>-")
|
||||||
|
key("n", "<S-Up>", "<C-w>+")
|
||||||
|
|
||||||
|
key("n", "<M-[>", function()
|
||||||
|
vim.fn.search("^[^[:space:])\\]}]", "be")
|
||||||
|
end, { desc = "jump to previous unindented line" })
|
||||||
|
key("n", "<M-]>", function()
|
||||||
|
vim.fn.search("^[^[:space:])\\]}]", "e")
|
||||||
|
end, { desc = "jump to next unindented line" })
|
||||||
|
|
||||||
|
key("i", "<C-U>", "<C-G>u<C-U>")
|
||||||
|
key("n", "&", ":&&<CR>")
|
||||||
|
key("x", "&", ":&&<CR>")
|
||||||
|
key("n", "Y", "y$")
|
||||||
|
|
||||||
|
key("i", "<C-Space>", "<C-x><C-o>", { desc = "completion" })
|
||||||
|
key("n", "<C-l>", "<cmd>noh<CR><cmd>redraw!<CR>", { desc = "clear search highlight" })
|
||||||
|
key("v", "gs", "<cmd>'<,'>sort<CR>", { desc = "sort selection" })
|
||||||
|
|
||||||
|
key("n", "<M-b>", "<cmd>bnext<cr>", { desc = "next buffer" })
|
||||||
|
key("n", "<M-S-b>", "<cmd>bprevious<cr>", { desc = "previous buffer" })
|
||||||
199
init.vim
199
init.vim
|
|
@ -1,199 +0,0 @@
|
||||||
if exists("$VIRTUAL_ENV")
|
|
||||||
let g:python3_host_prog=substitute(system("which -a python3 | head -n2 | tail -n1"), "\n", '', 'g')
|
|
||||||
else
|
|
||||||
let g:python3_host_prog=substitute(system("which python3"), "\n", '', 'g')
|
|
||||||
endif
|
|
||||||
|
|
||||||
runtime packages.vim
|
|
||||||
|
|
||||||
let $MYVIMDIR=split(&rtp, ',')[0]
|
|
||||||
|
|
||||||
set exrc
|
|
||||||
|
|
||||||
set background=dark
|
|
||||||
let g:chroma_italic_style="bold"
|
|
||||||
let g:chroma_nontext_dark=1
|
|
||||||
colo chroma
|
|
||||||
|
|
||||||
if exists("&cc")
|
|
||||||
set cc=+1
|
|
||||||
endif
|
|
||||||
|
|
||||||
set number
|
|
||||||
|
|
||||||
set textwidth=80
|
|
||||||
set tabstop=2
|
|
||||||
set shiftwidth=2
|
|
||||||
|
|
||||||
set whichwrap+=<,>,h,l
|
|
||||||
|
|
||||||
set notimeout
|
|
||||||
set ttimeout
|
|
||||||
set ttimeoutlen=50
|
|
||||||
|
|
||||||
set foldmethod=syntax
|
|
||||||
set foldlevelstart=99
|
|
||||||
|
|
||||||
" disables visualbell
|
|
||||||
set vb t_vb=
|
|
||||||
|
|
||||||
set shellcmdflag=-c
|
|
||||||
set shell=/bin/zsh
|
|
||||||
|
|
||||||
set modeline
|
|
||||||
set showcmd
|
|
||||||
|
|
||||||
set ignorecase smartcase
|
|
||||||
set inccommand=split
|
|
||||||
set wildmode=list:longest,list:full
|
|
||||||
set wildignore+=*.so,*.swp,*.zip,*.o
|
|
||||||
set suffixes=.bak,~,.h,.info,.swp,.obj,.info,.aux,.dvi,.bbl,.out,.o,.lo,\.class
|
|
||||||
set suffixes+=.pdf
|
|
||||||
set wildmenu
|
|
||||||
set hidden
|
|
||||||
|
|
||||||
"set completeopt=menu,noinsert,preview
|
|
||||||
"set completeopt=menuone,noinsert,noselect
|
|
||||||
set completeopt=menu,menuone,noselect
|
|
||||||
set shortmess+=c
|
|
||||||
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
|
||||||
|
|
||||||
set mouse=
|
|
||||||
|
|
||||||
set cursorline
|
|
||||||
set guicursor=
|
|
||||||
|
|
||||||
set undofile
|
|
||||||
set undodir=~/.local/share/nvim/undo
|
|
||||||
|
|
||||||
set spelllang=de
|
|
||||||
|
|
||||||
set termguicolors
|
|
||||||
set pumblend=20
|
|
||||||
|
|
||||||
set updatetime=300
|
|
||||||
|
|
||||||
" custom commands
|
|
||||||
command! RC edit $MYVIMRC
|
|
||||||
command! SRC source $MYVIMRC
|
|
||||||
command! CD :cd %:h
|
|
||||||
command! PlugEdit edit $MYVIMDIR/packages.vim
|
|
||||||
command! PlugReload source $MYVIMDIR/packages.vim | PlugInstall
|
|
||||||
command! TrailingSpace %s/\s*$//g
|
|
||||||
|
|
||||||
|
|
||||||
"{{{ latex
|
|
||||||
|
|
||||||
" controls filetype setting, therefore not possible to move to ftplugin
|
|
||||||
let g:tex_flavor = "latex"
|
|
||||||
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" {{{ misc Autocommands
|
|
||||||
augroup Misc
|
|
||||||
au FileType mail setlocal spell
|
|
||||||
au FileType man setlocal nonu
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
|
|
||||||
augroup Cache
|
|
||||||
autocmd!
|
|
||||||
autocmd BufRead,BufNewFile ~/Private/* setlocal directory=.
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
"{{{ binary editing
|
|
||||||
augroup Binary
|
|
||||||
au!
|
|
||||||
au BufReadPre *.bin let &bin=1
|
|
||||||
au BufReadPost *.bin if &bin | %!xxd
|
|
||||||
au BufReadPost *.bin set ft=xxd | endif
|
|
||||||
au BufWritePre *.bin if &bin | %!xxd -r
|
|
||||||
au BufWritePre *.bin endif
|
|
||||||
au BufWritePost *.bin if &bin | %!xxd
|
|
||||||
au BufWritePost *.bin set nomod | endif
|
|
||||||
augroup END
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" common mappings {{{
|
|
||||||
|
|
||||||
nnoremap <space> za
|
|
||||||
vnoremap <silent> . <cmd>normal .<CR>
|
|
||||||
noremap cy "*y
|
|
||||||
|
|
||||||
tnoremap <C-q> <C-\><C-n>
|
|
||||||
|
|
||||||
map <Left> <C-w>h
|
|
||||||
map <Down> <C-w>j
|
|
||||||
map <Up> <C-w>k
|
|
||||||
map <Right> <C-w>l
|
|
||||||
|
|
||||||
map <S-Left> <C-w><
|
|
||||||
map <S-Right> <C-w>>
|
|
||||||
map <S-Down> <C-w>-
|
|
||||||
map <S-Up> <C-w>+
|
|
||||||
|
|
||||||
" navigate windows with alt+[hjkl]
|
|
||||||
tnoremap <A-h> <C-\><C-N><C-w>h
|
|
||||||
tnoremap <A-j> <C-\><C-N><C-w>j
|
|
||||||
tnoremap <A-k> <C-\><C-N><C-w>k
|
|
||||||
tnoremap <A-l> <C-\><C-N><C-w>l
|
|
||||||
inoremap <A-h> <C-\><C-N><C-w>h
|
|
||||||
inoremap <A-j> <C-\><C-N><C-w>j
|
|
||||||
inoremap <A-k> <C-\><C-N><C-w>k
|
|
||||||
inoremap <A-l> <C-\><C-N><C-w>l
|
|
||||||
nnoremap <A-h> <C-w>h
|
|
||||||
nnoremap <A-j> <C-w>j
|
|
||||||
nnoremap <A-k> <C-w>k
|
|
||||||
nnoremap <A-l> <C-w>l
|
|
||||||
|
|
||||||
nnoremap <M-[> :call search('^[^[:space:])\]}]', 'be')<cr>
|
|
||||||
nnoremap <M-]> :call search('^[^[:space:])\]}]', 'e')<cr>
|
|
||||||
|
|
||||||
inoremap <C-U> <C-G>u<C-U>
|
|
||||||
nnoremap & :&&<CR>
|
|
||||||
xnoremap & :&&<CR>
|
|
||||||
nnoremap Y y$
|
|
||||||
|
|
||||||
inoremap <C-Space> <C-x><C-o>
|
|
||||||
|
|
||||||
nmap <C-L> <cmd>noh<cr><cmd>redraw!<cr>
|
|
||||||
|
|
||||||
nmap <C-Tab> <C-w><C-w>
|
|
||||||
imap <C-Tab> <esc><C-w><C-w>
|
|
||||||
|
|
||||||
vmap <silent> gs <cmd>'<,'>sort<cr>
|
|
||||||
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
|
|
||||||
"Git {{{
|
|
||||||
nmap <Leader>gu <cmd>Gina push<CR>
|
|
||||||
nmap <Leader>gvc <cmd>!git svn dcommit<CR>
|
|
||||||
nmap <Leader>gvf <cmd>!git svn fetch<CR>
|
|
||||||
" Git }}}
|
|
||||||
|
|
||||||
" Start interactive EasyAlign in visual mode (e.g. vipga)
|
|
||||||
xmap <M-a> <Plug>(EasyAlign)
|
|
||||||
|
|
||||||
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
|
|
||||||
nmap <M-a> <Plug>(EasyAlign)
|
|
||||||
|
|
||||||
let g:signify_vcs_list = [ 'git', 'hg' ]
|
|
||||||
"let g:signify_disable_by_default = 1
|
|
||||||
|
|
||||||
|
|
||||||
let g:localvimrc_whitelist='/home/crater2150/work/.*'
|
|
||||||
let g:localvimrc_sandbox=0
|
|
||||||
|
|
||||||
lua require("my-lsp")
|
|
||||||
lua require("lsputils")
|
|
||||||
lua require("conf.cmp")
|
|
||||||
lua require("conf.trouble")
|
|
||||||
lua require("conf.treesitter")
|
|
||||||
set foldmethod=expr
|
|
||||||
set foldexpr=nvim_treesitter#foldexpr()
|
|
||||||
set nofoldenable " Disable folding at startup.
|
|
||||||
lua require("conf.indent-blankline")
|
|
||||||
" vi:foldmethod=marker sw=2
|
|
||||||
72
lazy-lock.json
Normal file
72
lazy-lock.json
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
{
|
||||||
|
"Vim-Jinja2-Syntax": { "branch": "master", "commit": "2c17843b074b06a835f88587e1023ceff7e2c7d1" },
|
||||||
|
"blink.cmp": { "branch": "main", "commit": "a999ddca2f629faf8a554a8fff904931935a7b1c" },
|
||||||
|
"conform.nvim": { "branch": "master", "commit": "c64cc754ace603e185ab30113aaef174187eacf8" },
|
||||||
|
"deepl.vim": { "branch": "main", "commit": "59df8cc17bb28989ce562bf4712c724d23baadcd" },
|
||||||
|
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
|
||||||
|
"gen.nvim": { "branch": "main", "commit": "c8e1f574d4a3a839dde73a87bdc319a62ee1e559" },
|
||||||
|
"gina.vim": { "branch": "master", "commit": "ff6c2ddeca98f886b57fb42283c12e167d6ab575" },
|
||||||
|
"gitsigns.nvim": { "branch": "main", "commit": "0c6826374f47fcbb2b53053986ccc59c115044ff" },
|
||||||
|
"hover.nvim": { "branch": "main", "commit": "99e4636cfa2778841ed127cfeadf912662bb8bfe" },
|
||||||
|
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
|
||||||
|
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||||
|
"lazydev.nvim": { "branch": "main", "commit": "258d2a5ef4a3e3d6d9ba9da72c9725c53e9afcbd" },
|
||||||
|
"lsp-colors.nvim": { "branch": "main", "commit": "2bbe7541747fd339bdd8923fc45631a09bb4f1e5" },
|
||||||
|
"lsp-progress.nvim": { "branch": "main", "commit": "ae52979ad412371ea6dc39ff70c8dfc681fb42b8" },
|
||||||
|
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
|
||||||
|
"lush.nvim": { "branch": "main", "commit": "9c60ec2279d62487d942ce095e49006af28eed6e" },
|
||||||
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "f760507df8c49a4bf46a4d12e1fc616797508979" },
|
||||||
|
"mason.nvim": { "branch": "main", "commit": "a83eabdc8c49c0c93bf5bb162fa3b57404a9d095" },
|
||||||
|
"multicursor.nvim": { "branch": "1.0", "commit": "0c6ceae228bf209e8b8717df9de500770c4e7022" },
|
||||||
|
"neoconf.nvim": { "branch": "main", "commit": "c6fce22fcf96edddab718730417632037420fe0a" },
|
||||||
|
"nvim-dap": { "branch": "master", "commit": "7367cec8e8f7a0b1e4566af9a7ef5959d11206a7" },
|
||||||
|
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
|
||||||
|
"nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" },
|
||||||
|
"nvim-genghis": { "branch": "main", "commit": "cdf584d05ffc9d5c1f247079991552249e4f7487" },
|
||||||
|
"nvim-jdtls": { "branch": "master", "commit": "b69924ca90014fef485ee153571bdcbc1ece8c2e" },
|
||||||
|
"nvim-lint": { "branch": "master", "commit": "335a6044be16d7701001059cba9baa36fbeef422" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "db8fef885009fdec0daeff3e5dda92e1f539611e" },
|
||||||
|
"nvim-luadev": { "branch": "master", "commit": "3ba0c02c378503739f1fdb95cff3ea2aad48db3e" },
|
||||||
|
"nvim-metals": { "branch": "main", "commit": "db6c9ffb32ec698b96d11cba1317dccc26f5c16d" },
|
||||||
|
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||||
|
"nvim-quick-switcher": { "branch": "main", "commit": "b56ba55cff165ae1551836a79313933bf4d43ae2" },
|
||||||
|
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||||
|
"nvim-treesitter-context": { "branch": "master", "commit": "41847d3dafb5004464708a3db06b14f12bde548a" },
|
||||||
|
"nvim-treesitter-textobjects": { "branch": "master", "commit": "71385f191ec06ffc60e80e6b0c9a9d5daed4824c" },
|
||||||
|
"nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" },
|
||||||
|
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
|
||||||
|
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||||
|
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
|
||||||
|
"shipwright.nvim": { "branch": "master", "commit": "e596ab48328c31873f4f4d2e070243bf9de16ff3" },
|
||||||
|
"splice.vim": { "branch": "master", "commit": "815a28e687fdf78b67e9b9cd4c21277bbe658873" },
|
||||||
|
"suda.vim": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" },
|
||||||
|
"table-nvim": { "branch": "main", "commit": "c044fd37169eb10376962b0d0cec5f94d58ca626" },
|
||||||
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
||||||
|
"telescope-lsp-handlers.nvim": { "branch": "trunk", "commit": "de02085d6af1633942549a238bc7a5524fa9b201" },
|
||||||
|
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
|
||||||
|
"trouble.nvim": { "branch": "main", "commit": "f176232e7759c4f8abd923c21e3e5a5c76cd6837" },
|
||||||
|
"vim-caddyfile": { "branch": "master", "commit": "6d60d5af0d73f20b88ec388a9d70188d55ed8223" },
|
||||||
|
"vim-characterize": { "branch": "master", "commit": "a8bffac6cead6b2869d939ecad06312b187a4c79" },
|
||||||
|
"vim-commentary": { "branch": "master", "commit": "64a654ef4a20db1727938338310209b6a63f60c9" },
|
||||||
|
"vim-easy-align": { "branch": "master", "commit": "9815a55dbcd817784458df7a18acacc6f82b1241" },
|
||||||
|
"vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" },
|
||||||
|
"vim-gitignore": { "branch": "master", "commit": "641dfa648d2581a5e5e9b0d11ffee37da8de49d7" },
|
||||||
|
"vim-gnupg": { "branch": "main", "commit": "f9b608f29003dfde6450931dc0f495a912973a88" },
|
||||||
|
"vim-highlightedyank": { "branch": "master", "commit": "285a61425e79742997bbde76a91be6189bc988fb" },
|
||||||
|
"vim-hocon": { "branch": "main", "commit": "5df6dc1b7c8f5811afe663b0441e6304a729dcaf" },
|
||||||
|
"vim-indent-object": { "branch": "master", "commit": "8ab36d5ec2a3a60468437a95e142ce994df598c6" },
|
||||||
|
"vim-kitty": { "branch": "main", "commit": "5c3efc79af70dc2c22cad03e6a7374a5f81205d9" },
|
||||||
|
"vim-ledger": { "branch": "master", "commit": "a0670d0c60c4933a70767033c89467631643a4c1" },
|
||||||
|
"vim-markdown-composer": { "branch": "master", "commit": "e6f99bc20cfcb277c63041b1f766e6d5940bcc76" },
|
||||||
|
"vim-mkdir": { "branch": "master", "commit": "f0ba7a7dc190a0cedf1d827958c99f3718109cf0" },
|
||||||
|
"vim-nftables": { "branch": "master", "commit": "26f8a506c6f3e41f1e4a8d6aa94c9a79a666bbff" },
|
||||||
|
"vim-pass": { "branch": "master", "commit": "601bdc138c736b36c695eebe68e31ce82bafdff0" },
|
||||||
|
"vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" },
|
||||||
|
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
|
||||||
|
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
|
||||||
|
"vim-textobj-comment": { "branch": "master", "commit": "58ae4571b76a5bf74850698f23d235eef991dd4b" },
|
||||||
|
"vim-textobj-user": { "branch": "master", "commit": "41a675ddbeefd6a93664a4dc52f302fe3086a933" },
|
||||||
|
"vimtex": { "branch": "master", "commit": "2e1bbabeb2c34bb17d7bc8cfdf8f95b16dd0db0c" },
|
||||||
|
"which-key.nvim": { "branch": "main", "commit": "904308e6885bbb7b60714c80ab3daf0c071c1492" },
|
||||||
|
"workspace-diagnostics.nvim": { "branch": "main", "commit": "60f9175b2501ae3f8b1aba9719c0df8827610c8e" }
|
||||||
|
}
|
||||||
71
lua/common.lua
Normal file
71
lua/common.lua
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
-- Adapted from https://github.com/LazyVim/LazyVim/
|
||||||
|
-- SPDX-License-Identifier: Apache-2.0
|
||||||
|
return {
|
||||||
|
icons = {
|
||||||
|
dap = {
|
||||||
|
Stopped = { " ", "DiagnosticWarn", "DapStoppedLine" },
|
||||||
|
Breakpoint = " ",
|
||||||
|
BreakpointCondition = " ",
|
||||||
|
BreakpointRejected = { " ", "DiagnosticError" },
|
||||||
|
LogPoint = ".>",
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
signs = {
|
||||||
|
text = {
|
||||||
|
[vim.diagnostic.severity.ERROR] = " ",
|
||||||
|
[vim.diagnostic.severity.WARN] = " ",
|
||||||
|
[vim.diagnostic.severity.HINT] = " ",
|
||||||
|
[vim.diagnostic.severity.INFO] = " ",
|
||||||
|
},
|
||||||
|
numhl = {
|
||||||
|
[vim.diagnostic.severity.ERROR] = "DiagnosticSignError",
|
||||||
|
[vim.diagnostic.severity.WARN] = "DiagnosticSignWarn",
|
||||||
|
[vim.diagnostic.severity.INFO] = "DiagnosticSignInfo",
|
||||||
|
[vim.diagnostic.severity.HINT] = "DiagnosticSignHint",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
git = {
|
||||||
|
added = " ",
|
||||||
|
modified = " ",
|
||||||
|
removed = " ",
|
||||||
|
},
|
||||||
|
kinds = {
|
||||||
|
Array = " ",
|
||||||
|
Boolean = " ",
|
||||||
|
Class = " ",
|
||||||
|
Color = " ",
|
||||||
|
Constant = " ",
|
||||||
|
Constructor = " ",
|
||||||
|
Copilot = " ",
|
||||||
|
Enum = " ",
|
||||||
|
EnumMember = " ",
|
||||||
|
Event = " ",
|
||||||
|
Field = " ",
|
||||||
|
File = " ",
|
||||||
|
Folder = " ",
|
||||||
|
Function = " ",
|
||||||
|
Interface = " ",
|
||||||
|
Key = " ",
|
||||||
|
Keyword = " ",
|
||||||
|
Method = " ",
|
||||||
|
Module = " ",
|
||||||
|
Namespace = " ",
|
||||||
|
Null = " ",
|
||||||
|
Number = " ",
|
||||||
|
Object = " ",
|
||||||
|
Operator = " ",
|
||||||
|
Package = " ",
|
||||||
|
Property = " ",
|
||||||
|
Reference = " ",
|
||||||
|
Snippet = " ",
|
||||||
|
String = " ",
|
||||||
|
Struct = " ",
|
||||||
|
Text = " ",
|
||||||
|
TypeParameter = " ",
|
||||||
|
Unit = " ",
|
||||||
|
Value = " ",
|
||||||
|
Variable = " ",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
local cmp = require'cmp'
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
vim.fn["vsnip#anonymous"](args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
mapping = {
|
|
||||||
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
|
||||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
||||||
['<C-Space>'] = cmp.mapping.complete(),
|
|
||||||
['<C-e>'] = cmp.mapping.close(),
|
|
||||||
['<CR>'] = cmp.mapping.confirm({
|
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
|
||||||
select = true,
|
|
||||||
}),
|
|
||||||
['<Tab>'] = function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
},
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'nvim_lsp' },
|
|
||||||
{ name = 'vsnip' },
|
|
||||||
},{
|
|
||||||
{ name = 'buffer' },
|
|
||||||
--{ name = 'path' },
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
|
|
||||||
cmp.setup.cmdline({ '/', '?' }, {
|
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
sources = {
|
|
||||||
{ name = 'buffer' }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
|
||||||
cmp.setup.cmdline(':', {
|
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'path' }
|
|
||||||
}, {
|
|
||||||
{ name = 'cmdline' }
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
vim.cmd [[highlight IndentBlanklineIndent1 guibg=#333333 gui=nocombine]]
|
|
||||||
vim.cmd [[highlight IndentBlanklineIndent2 guibg=#000000 gui=nocombine]]
|
|
||||||
|
|
||||||
require("indent_blankline").setup {
|
|
||||||
char = "",
|
|
||||||
char_highlight_list = {
|
|
||||||
"IndentBlanklineIndent1",
|
|
||||||
"IndentBlanklineIndent2",
|
|
||||||
},
|
|
||||||
space_char_highlight_list = {
|
|
||||||
"IndentBlanklineIndent1",
|
|
||||||
"IndentBlanklineIndent2",
|
|
||||||
},
|
|
||||||
show_trailing_blankline_indent = false,
|
|
||||||
show_current_context = true,
|
|
||||||
show_current_context_start = true,
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
telescope = require('telescope')
|
|
||||||
telescope.load_extension('fzf_native')
|
|
||||||
telescope.load_extension('lsp_handlers')
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
require'nvim-treesitter.configs'.setup {
|
|
||||||
ensure_installed = { "typescript" },
|
|
||||||
sync_install = true,
|
|
||||||
auto_install = true,
|
|
||||||
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,
|
|
||||||
},
|
|
||||||
indent = {
|
|
||||||
enable = true
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
require("trouble").setup {
|
|
||||||
-- your configuration comes here
|
|
||||||
-- or leave it empty to use the default settings
|
|
||||||
-- refer to the configuration section below
|
|
||||||
}
|
|
||||||
vim.api.nvim_set_keymap("n", "<leader>xx", "<cmd>Trouble<cr>", {silent = true, noremap = true})
|
|
||||||
vim.api.nvim_set_keymap("n", "<leader>xw", "<cmd>Trouble workspace_diagnostics<cr>", {silent = true, noremap = true})
|
|
||||||
vim.api.nvim_set_keymap("n", "<leader>xd", "<cmd>Trouble document_diagnostics<cr>", {silent = true, noremap = true})
|
|
||||||
vim.api.nvim_set_keymap("n", "<leader>xl", "<cmd>Trouble loclist<cr>", {silent = true, noremap = true})
|
|
||||||
vim.api.nvim_set_keymap("n", "<leader>xq", "<cmd>Trouble quickfix<cr>", {silent = true, noremap = true})
|
|
||||||
vim.api.nvim_set_keymap("n", "gR", "<cmd>Trouble lsp_references<cr>", {silent = true, noremap = true})
|
|
||||||
50
lua/findroot.lua
Normal file
50
lua/findroot.lua
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
local Path = require("plenary.path")
|
||||||
|
local source_basedir_markers = {
|
||||||
|
".telescope-root",
|
||||||
|
".editorconfig",
|
||||||
|
"build.sbt",
|
||||||
|
"package.json",
|
||||||
|
"setup.py",
|
||||||
|
".git",
|
||||||
|
}
|
||||||
|
function find_upwards_any(base, filenames)
|
||||||
|
local folder = Path:new(base)
|
||||||
|
local root = Path.path.root(folder)
|
||||||
|
|
||||||
|
while folder:absolute() ~= root do
|
||||||
|
for _, filename in ipairs(filenames) do
|
||||||
|
local p = folder:joinpath(filename)
|
||||||
|
if p:exists() then
|
||||||
|
return p
|
||||||
|
end
|
||||||
|
end
|
||||||
|
folder = folder:parent()
|
||||||
|
end
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
local function find_dir(base)
|
||||||
|
print("base: ", base)
|
||||||
|
if base == nil then
|
||||||
|
base = vim.loop.cwd()
|
||||||
|
end
|
||||||
|
--@type Path
|
||||||
|
local search_root
|
||||||
|
search_root = find_upwards_any(base, source_basedir_markers)
|
||||||
|
print("search_root: ", search_root)
|
||||||
|
if search_root ~= "" then
|
||||||
|
local file = search_root:_split()
|
||||||
|
if file[#file] == ".telescope-root" then
|
||||||
|
local target = search_root:parent():joinpath(search_root:head(1))
|
||||||
|
if target:exists() then
|
||||||
|
return tostring(target)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return tostring(search_root:parent())
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return base
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return find_dir
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
local status, lsp_installer = pcall(require,"nvim-lsp-installer")
|
|
||||||
if (not status) then return end
|
|
||||||
|
|
||||||
lsp_installer.on_server_ready(function(server)
|
|
||||||
local opts = {}
|
|
||||||
|
|
||||||
server:setup(opts)
|
|
||||||
end)
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
local status, metals = pcall(require, "metals")
|
|
||||||
if (not status) then return function() end end
|
|
||||||
|
|
||||||
return function(on_attach)
|
|
||||||
metals_config = metals.bare_config()
|
|
||||||
metals_config.init_options.statusBarProvider = "on"
|
|
||||||
metals_config.settings = {
|
|
||||||
showImplicitArguments = true,
|
|
||||||
superMethodLensesEnabled = true,
|
|
||||||
}
|
|
||||||
metals_config.on_attach = function(client, bufnr)
|
|
||||||
require("metals").setup_dap()
|
|
||||||
on_attach(client, bufnr)
|
|
||||||
end
|
|
||||||
metals_config.capabilities = require("cmp_nvim_lsp").default_capabilities()
|
|
||||||
-- Debug settings if you're using nvim-dap
|
|
||||||
local dap = require("dap")
|
|
||||||
dap.configurations.scala = {
|
|
||||||
{
|
|
||||||
type = "scala",
|
|
||||||
request = "launch",
|
|
||||||
name = "RunOrTest",
|
|
||||||
metals = {
|
|
||||||
runType = "runOrTestFile",
|
|
||||||
--args = { "firstArg", "secondArg", "thirdArg" }, -- here just as an example
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type = "scala",
|
|
||||||
request = "launch",
|
|
||||||
name = "Test Target",
|
|
||||||
metals = {
|
|
||||||
runType = "testTarget",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
vim.cmd [[augroup lsp]]
|
|
||||||
vim.cmd [[au!]]
|
|
||||||
vim.cmd([[autocmd FileType scala setlocal omnifunc=v:lua.vim.lsp.omnifunc]])
|
|
||||||
vim.cmd [[au FileType scala,sbt lua require("metals").initialize_or_attach(metals_config)]]
|
|
||||||
vim.cmd [[augroup end]]
|
|
||||||
|
|
||||||
return metals_config
|
|
||||||
end
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
local status, nvim_lsp = pcall(require, "lspconfig")
|
|
||||||
if (not status) then return function() end end
|
|
||||||
|
|
||||||
return function(on_attach)
|
|
||||||
local protocol = require('vim.lsp.protocol')
|
|
||||||
|
|
||||||
-- TypeScript
|
|
||||||
nvim_lsp.tsserver.setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
filetypes = { "typescript", "typescriptreact", "typescript.tsx" },
|
|
||||||
cmd = { "typescript-language-server", "--stdio" }
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
if vim.fn.has('nvim-0.5.1') == 1 then
|
|
||||||
vim.lsp.handlers['textDocument/codeAction'] = require'lsputil.codeAction'.code_action_handler
|
|
||||||
vim.lsp.handlers['textDocument/references'] = require'lsputil.locations'.references_handler
|
|
||||||
vim.lsp.handlers['textDocument/definition'] = require'lsputil.locations'.definition_handler
|
|
||||||
vim.lsp.handlers['textDocument/declaration'] = require'lsputil.locations'.declaration_handler
|
|
||||||
vim.lsp.handlers['textDocument/typeDefinition'] = require'lsputil.locations'.typeDefinition_handler
|
|
||||||
vim.lsp.handlers['textDocument/implementation'] = require'lsputil.locations'.implementation_handler
|
|
||||||
vim.lsp.handlers['textDocument/documentSymbol'] = require'lsputil.symbols'.document_handler
|
|
||||||
vim.lsp.handlers['workspace/symbol'] = require'lsputil.symbols'.workspace_handler
|
|
||||||
else
|
|
||||||
local bufnr = vim.api.nvim_buf_get_number(0)
|
|
||||||
|
|
||||||
vim.lsp.handlers['textDocument/codeAction'] = function(_, _, actions)
|
|
||||||
require('lsputil.codeAction').code_action_handler(nil, actions, nil, nil, nil)
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.lsp.handlers['textDocument/references'] = function(_, _, result)
|
|
||||||
require('lsputil.locations').references_handler(nil, result, { bufnr = bufnr }, nil)
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.lsp.handlers['textDocument/definition'] = function(_, method, result)
|
|
||||||
require('lsputil.locations').definition_handler(nil, result, { bufnr = bufnr, method = method }, nil)
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.lsp.handlers['textDocument/declaration'] = function(_, method, result)
|
|
||||||
require('lsputil.locations').declaration_handler(nil, result, { bufnr = bufnr, method = method }, nil)
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.lsp.handlers['textDocument/typeDefinition'] = function(_, method, result)
|
|
||||||
require('lsputil.locations').typeDefinition_handler(nil, result, { bufnr = bufnr, method = method }, nil)
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.lsp.handlers['textDocument/implementation'] = function(_, method, result)
|
|
||||||
require('lsputil.locations').implementation_handler(nil, result, { bufnr = bufnr, method = method }, nil)
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.lsp.handlers['textDocument/documentSymbol'] = function(_, _, result, _, bufn)
|
|
||||||
require('lsputil.symbols').document_handler(nil, result, { bufnr = bufn }, nil)
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.lsp.handlers['textDocument/symbol'] = function(_, _, result, _, bufn)
|
|
||||||
require('lsputil.symbols').workspace_handler(nil, result, { bufnr = bufn }, nil)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -1,79 +0,0 @@
|
||||||
local lsp_status = require('lsp-status')
|
|
||||||
|
|
||||||
lsp_status.register_progress()
|
|
||||||
|
|
||||||
-- enable snippet support
|
|
||||||
--local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
--capabilities.textDocument.completion.completionItem.snippetSupport = true
|
|
||||||
--capabilities.textDocument.completion.completionItem.resolveSupport = {
|
|
||||||
-- properties = {
|
|
||||||
-- 'documentation',
|
|
||||||
-- 'detail',
|
|
||||||
-- 'additionalTextEdits',
|
|
||||||
-- }
|
|
||||||
--}
|
|
||||||
--capabilities = vim.tbl_extend('keep', capabilities or {}, lsp_status.capabilities)
|
|
||||||
|
|
||||||
-- Use an on_attach function to only map the following keys
|
|
||||||
-- after the language server attaches to the current buffer
|
|
||||||
local on_attach = function(client, bufnr)
|
|
||||||
local function buf_set_keymap(...) vim.keymap.set(...) end
|
|
||||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
|
||||||
|
|
||||||
--Enable completion triggered by <c-x><c-o>
|
|
||||||
vim.bo[bufnr].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
|
||||||
|
|
||||||
-- Mappings.
|
|
||||||
local opts = { noremap=true, silent=true, buffer=bufnr }
|
|
||||||
local loud = { noremap=true, buffer=bufnr }
|
|
||||||
|
|
||||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
|
||||||
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
|
||||||
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
|
||||||
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
|
||||||
buf_set_keymap('v', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
|
||||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
|
||||||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
|
||||||
buf_set_keymap('n', '<Leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
|
||||||
buf_set_keymap('n', '<Leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
|
||||||
buf_set_keymap('n', '<M-a>', '<cmd>lua vim.lsp.buf.code_action()<CR>', loud)
|
|
||||||
buf_set_keymap('n', '<M-l>', '<cmd>lua vim.codelens.run()<CR>', loud)
|
|
||||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
|
||||||
buf_set_keymap('n', '<M-e>', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
|
|
||||||
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
|
||||||
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
|
||||||
buf_set_keymap('n', '<M-q>', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
|
||||||
buf_set_keymap("n", "<Leader>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
|
||||||
buf_set_keymap("n", "<leader>dc", function() require("dap").continue() end, opts)
|
|
||||||
buf_set_keymap("n", "<leader>dr", function() require("dap").repl.toggle() end, opts)
|
|
||||||
buf_set_keymap("n", "<leader>dK", function() require("dap.ui.widgets").hover() end, opts)
|
|
||||||
buf_set_keymap("n", "<leader>dt", function() require("dap").toggle_breakpoint() end, opts)
|
|
||||||
buf_set_keymap("n", "<leader>dso", function() require("dap").step_over() end, opts)
|
|
||||||
buf_set_keymap("n", "<leader>dsi", function() require("dap").step_into() end, opts)
|
|
||||||
buf_set_keymap("n", "<leader>dl", function() require("dap").run_last() end, opts)
|
|
||||||
|
|
||||||
lsp_status.on_attach(client)
|
|
||||||
|
|
||||||
--require'completion'.on_attach(client, bufnr)
|
|
||||||
end
|
|
||||||
|
|
||||||
require("lsp.metals")(on_attach)
|
|
||||||
|
|
||||||
require("lsp.typescript")(on_attach)
|
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
|
||||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
|
||||||
virtual_text = false,
|
|
||||||
underline = true,
|
|
||||||
signs = true,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
|
|
||||||
vim.lsp.handlers.signature_help, {
|
|
||||||
silent = true, focusable = false
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
vim.cmd [[autocmd CursorHoldI * silent! lua vim.lsp.buf.signature_help()]]
|
|
||||||
vim.cmd [[autocmd CursorHold * lua vim.diagnostic.open_float({max_width = 100, focusable = false})]]
|
|
||||||
9
lua/plugins/chroma.lua
Normal file
9
lua/plugins/chroma.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
return {
|
||||||
|
"crater2150/vim-theme-chroma",
|
||||||
|
lazy = false,
|
||||||
|
branch = "lush",
|
||||||
|
priority = 1000,
|
||||||
|
config = function()
|
||||||
|
vim.cmd.colorscheme("chroma")
|
||||||
|
end,
|
||||||
|
}
|
||||||
34
lua/plugins/conform.lua
Normal file
34
lua/plugins/conform.lua
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
return {
|
||||||
|
"stevearc/conform.nvim",
|
||||||
|
event = { "BufWritePre" },
|
||||||
|
cmd = { "ConformInfo" },
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
-- Customize or remove this keymap to your liking
|
||||||
|
"<leader>f",
|
||||||
|
function()
|
||||||
|
require("conform").format({ async = true, lsp_fallback = true })
|
||||||
|
end,
|
||||||
|
mode = "",
|
||||||
|
desc = "Format buffer",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- Everything in opts will be passed to setup()
|
||||||
|
opts = {
|
||||||
|
-- Define your formatters
|
||||||
|
formatters_by_ft = {
|
||||||
|
xml = { "xmlformatter" },
|
||||||
|
lua = { "stylua" },
|
||||||
|
python = { "isort", "black" },
|
||||||
|
javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
},
|
||||||
|
-- Set up format-on-save
|
||||||
|
--format_on_save = { timeout_ms = 500, lsp_fallback = true },
|
||||||
|
-- Customize formatters
|
||||||
|
formatters = {
|
||||||
|
shfmt = {
|
||||||
|
prepend_args = { "-i", "2" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
61
lua/plugins/dap.lua
Normal file
61
lua/plugins/dap.lua
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
config = function()
|
||||||
|
local dap = require("dap")
|
||||||
|
dap.adapters["pwa-node"] = {
|
||||||
|
type = "server",
|
||||||
|
host = "localhost",
|
||||||
|
port = "${port}",
|
||||||
|
executable = {
|
||||||
|
command = "js-debug-adapter",
|
||||||
|
args = { "${port}" },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dap.configurations.typescript = {
|
||||||
|
{
|
||||||
|
type = "pwa-node",
|
||||||
|
request = "launch",
|
||||||
|
name = "Launch file",
|
||||||
|
program = "${file}",
|
||||||
|
cwd = "${workspaceFolder}",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = 'pwa-node',
|
||||||
|
request = 'attach',
|
||||||
|
name = 'Attach to Node app',
|
||||||
|
address = 'localhost',
|
||||||
|
port = 9229,
|
||||||
|
cwd = '${workspaceFolder}',
|
||||||
|
restart = true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
dap.configurations.javascript = dap.configurations.typescript
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rcarriga/nvim-dap-ui",
|
||||||
|
dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" },
|
||||||
|
config = function(opts)
|
||||||
|
local dap, dapui = require("dap"), require("dapui")
|
||||||
|
dapui.setup(opts)
|
||||||
|
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
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"theHamsta/nvim-dap-virtual-text",
|
||||||
|
dependencies = { "mfussenegger/nvim-dap", "nvim-treesitter/nvim-treesitter" }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
29
lua/plugins/deepl.lua
Normal file
29
lua/plugins/deepl.lua
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
return {
|
||||||
|
"ryicoh/deepl.vim",
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader><C-e>",
|
||||||
|
function()
|
||||||
|
vim.fn["deepl#v"]("EN")
|
||||||
|
end,
|
||||||
|
mode = "v",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader><C-d>",
|
||||||
|
function()
|
||||||
|
vim.fn["deepl#v"]("DE")
|
||||||
|
end,
|
||||||
|
mode = "v",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
dependencies = { {
|
||||||
|
"tsuyoshicho/vim-pass",
|
||||||
|
init = function()
|
||||||
|
vim.g.pass_use_agent = 1
|
||||||
|
end,
|
||||||
|
} },
|
||||||
|
config = function()
|
||||||
|
vim.g["deepl#endpoint"] = "https://api-free.deepl.com/v2/translate"
|
||||||
|
vim.g["deepl#auth_key"] = vim.fn["pass#get"]("web/deepl.com", "apikey")
|
||||||
|
end,
|
||||||
|
}
|
||||||
3
lua/plugins/exttools.lua
Normal file
3
lua/plugins/exttools.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
return {
|
||||||
|
"mfussenegger/nvim-lint",
|
||||||
|
}
|
||||||
5
lua/plugins/filetypes.lua
Normal file
5
lua/plugins/filetypes.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
return {
|
||||||
|
{ "ledger/vim-ledger", ft = "ledger" },
|
||||||
|
{ "nfnty/vim-nftables", ft = "nftables" },
|
||||||
|
{ "jvirtanen/vim-hocon", ft = "hocon" },
|
||||||
|
}
|
||||||
1
lua/plugins/fugitive.lua
Normal file
1
lua/plugins/fugitive.lua
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
return { "tpope/vim-fugitive" }
|
||||||
11
lua/plugins/gen.lua
Normal file
11
lua/plugins/gen.lua
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
return {
|
||||||
|
"David-Kunz/gen.nvim",
|
||||||
|
opts = {
|
||||||
|
model = "gemma3:12b-it-qat", -- The default model to use.
|
||||||
|
init = false,
|
||||||
|
},
|
||||||
|
cmd = "Gen",
|
||||||
|
keys = {
|
||||||
|
{ "<leader>llm", ":Gen<CR>", mode = "n" },
|
||||||
|
},
|
||||||
|
}
|
||||||
14
lua/plugins/git.lua
Normal file
14
lua/plugins/git.lua
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
return {
|
||||||
|
"lambdalisue/gina.vim",
|
||||||
|
"gisphm/vim-gitignore",
|
||||||
|
"sjl/splice.vim",
|
||||||
|
{
|
||||||
|
"lewis6991/gitsigns.nvim",
|
||||||
|
config = {
|
||||||
|
signs = {
|
||||||
|
add = { text = "▌" },
|
||||||
|
change = { text = "▐" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
23
lua/plugins/hover.lua
Normal file
23
lua/plugins/hover.lua
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
return {
|
||||||
|
"lewis6991/hover.nvim",
|
||||||
|
config = function()
|
||||||
|
require("hover").setup({
|
||||||
|
init = function()
|
||||||
|
require("hover.providers.lsp")
|
||||||
|
require("hover.providers.gh")
|
||||||
|
require("hover.providers.man")
|
||||||
|
end,
|
||||||
|
preview_opts = {
|
||||||
|
border = nil,
|
||||||
|
},
|
||||||
|
-- Whether the contents of a currently open hover window should be moved
|
||||||
|
-- to a :h preview-window when pressing the hover keymap.
|
||||||
|
preview_window = false,
|
||||||
|
title = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Setup keymaps
|
||||||
|
vim.keymap.set("n", "K", require("hover").hover, { desc = "hover.nvim" })
|
||||||
|
vim.keymap.set("n", "gK", require("hover").hover_select, { desc = "hover.nvim (select)" })
|
||||||
|
end,
|
||||||
|
}
|
||||||
53
lua/plugins/init.lua
Normal file
53
lua/plugins/init.lua
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
return {
|
||||||
|
"pbrisbin/vim-mkdir",
|
||||||
|
"fladson/vim-kitty",
|
||||||
|
"tpope/vim-repeat",
|
||||||
|
"tpope/vim-surround",
|
||||||
|
"tpope/vim-characterize",
|
||||||
|
"tpope/vim-commentary",
|
||||||
|
"tpope/vim-sleuth",
|
||||||
|
|
||||||
|
{ "chrisgrieser/nvim-genghis", dependencies = "stevearc/dressing.nvim", opts = { trashCmd = "rm" } },
|
||||||
|
|
||||||
|
-- ic / ac
|
||||||
|
{
|
||||||
|
"glts/vim-textobj-comment",
|
||||||
|
dependencies = { "kana/vim-textobj-user" },
|
||||||
|
},
|
||||||
|
-- ii / ai
|
||||||
|
"michaeljsmith/vim-indent-object",
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
|
},
|
||||||
|
"kyazdani42/nvim-web-devicons",
|
||||||
|
"folke/trouble.nvim",
|
||||||
|
"folke/lsp-colors.nvim",
|
||||||
|
{
|
||||||
|
"artemave/workspace-diagnostics.nvim",
|
||||||
|
opts = {
|
||||||
|
workspace_files = function()
|
||||||
|
local project_root = vim.lsp.buf.list_workspace_folders()[1]
|
||||||
|
local workspace_files = vim.fn.split(vim.fn.system("git ls-files " .. project_root), "\n")
|
||||||
|
return workspace_files
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"nvim-lua/popup.nvim",
|
||||||
|
{
|
||||||
|
"junegunn/vim-easy-align",
|
||||||
|
keys = { { "<M-a>", "<Plug>(EasyAlign)", mode = { "n", "x" } } },
|
||||||
|
},
|
||||||
|
"machakann/vim-highlightedyank",
|
||||||
|
"lambdalisue/suda.vim",
|
||||||
|
"jamessan/vim-gnupg",
|
||||||
|
|
||||||
|
--"vim-pandoc/vim-pandoc",
|
||||||
|
--"vim-pandoc/vim-pandoc-syntax",
|
||||||
|
"isobit/vim-caddyfile",
|
||||||
|
"Glench/Vim-Jinja2-Syntax",
|
||||||
|
"Everduin94/nvim-quick-switcher",
|
||||||
|
}
|
||||||
|
-- 'powerman/vim-plugin-AnsiEsc',
|
||||||
56
lua/plugins/lazydev.lua
Normal file
56
lua/plugins/lazydev.lua
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"folke/lazydev.nvim",
|
||||||
|
ft = "lua", -- only load on lua files
|
||||||
|
opts = {
|
||||||
|
library = {
|
||||||
|
-- See the configuration section for more details
|
||||||
|
-- Load luvit types when the `vim.uv` word is found
|
||||||
|
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
||||||
|
"nvim-dap-ui"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ -- optional blink completion source for require statements and module annotations
|
||||||
|
"saghen/blink.cmp",
|
||||||
|
--version = "1.*",
|
||||||
|
build = "cargo build --release",
|
||||||
|
---@module 'blink.cmp'
|
||||||
|
---@type blink.cmp.Config
|
||||||
|
opts = {
|
||||||
|
sources = {
|
||||||
|
-- add lazydev to your completion providers
|
||||||
|
default = { "lazydev", "lsp", "path", "snippets", "buffer" },
|
||||||
|
providers = {
|
||||||
|
lazydev = {
|
||||||
|
name = "LazyDev",
|
||||||
|
module = "lazydev.integrations.blink",
|
||||||
|
-- make lazydev completions top priority (see `:h blink.cmp`)
|
||||||
|
score_offset = 100,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
|
||||||
|
-- 'super-tab' for mappings similar to vscode (tab to accept)
|
||||||
|
-- 'enter' for enter to accept
|
||||||
|
-- 'none' for no mappings
|
||||||
|
--
|
||||||
|
-- All presets have the following mappings:
|
||||||
|
-- C-space: Open menu or open docs if already open
|
||||||
|
-- C-n/C-p or Up/Down: Select next/previous item
|
||||||
|
-- C-e: Hide menu
|
||||||
|
-- C-k: Toggle signature help (if signature.enabled = true)
|
||||||
|
--
|
||||||
|
-- See :h blink-cmp-config-keymap for defining your own keymap
|
||||||
|
keymap = { preset = "super-tab" },
|
||||||
|
appearance = { nerd_font_variant = "mono" },
|
||||||
|
completion = {
|
||||||
|
documentation = { auto_show = false },
|
||||||
|
list = { selection = { preselect = false, auto_insert = true } },
|
||||||
|
ghost_text = { enabled = true },
|
||||||
|
},
|
||||||
|
fuzzy = { implementation = "prefer_rust_with_warning" },
|
||||||
|
},
|
||||||
|
opts_extend = { "sources.default" },
|
||||||
|
},
|
||||||
|
}
|
||||||
150
lua/plugins/lspconfig.lua
Normal file
150
lua/plugins/lspconfig.lua
Normal file
|
|
@ -0,0 +1,150 @@
|
||||||
|
return {
|
||||||
|
-- lspconfig
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
dependencies = {
|
||||||
|
{ "folke/neoconf.nvim", cmd = "Neoconf", config = true },
|
||||||
|
"mason-org/mason.nvim",
|
||||||
|
},
|
||||||
|
---@class PluginLspOpts
|
||||||
|
opts = function()
|
||||||
|
return {
|
||||||
|
-- options for vim.diagnostic.config()
|
||||||
|
diagnostics = {
|
||||||
|
underline = true,
|
||||||
|
update_in_insert = false,
|
||||||
|
virtual_text = {
|
||||||
|
spacing = 4,
|
||||||
|
source = "if_many",
|
||||||
|
prefix = "●",
|
||||||
|
-- this will set set the prefix to a function that returns the diagnostics icon based on the severity
|
||||||
|
-- this only works on a recent 0.10.0 build. Will be set to "●" when not supported
|
||||||
|
-- prefix = "icons",
|
||||||
|
},
|
||||||
|
severity_sort = true,
|
||||||
|
},
|
||||||
|
-- add any global capabilities here
|
||||||
|
capabilities = {},
|
||||||
|
servers = {
|
||||||
|
jsonls = {},
|
||||||
|
lua_ls = {
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
workspace = {
|
||||||
|
checkThirdParty = false,
|
||||||
|
},
|
||||||
|
completion = {
|
||||||
|
callSnippet = "Replace",
|
||||||
|
},
|
||||||
|
telemetry = { enable = false },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
pylsp = {
|
||||||
|
settings = {
|
||||||
|
pylsp = {
|
||||||
|
plugins = {
|
||||||
|
rope_autoimport = { enabled = true },
|
||||||
|
isort = { enabled = true },
|
||||||
|
pycodestyle = { maxLineLength = 120 },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lemminx = {
|
||||||
|
settings = { xml = { server = { workDir = "~/.cache/lemminx" } } },
|
||||||
|
},
|
||||||
|
tinymist = {
|
||||||
|
--- todo: these configuration from lspconfig maybe broken
|
||||||
|
single_file_support = true,
|
||||||
|
root_dir = function()
|
||||||
|
return vim.fn.getcwd()
|
||||||
|
end,
|
||||||
|
--- See [Tinymist Server Configuration](https://github.com/Myriad-Dreamin/tinymist/blob/main/Configuration.md) for references.
|
||||||
|
settings = {
|
||||||
|
exportPdf = "onType",
|
||||||
|
outputPath = "$root/target/$dir/$name",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- you can do any additional lsp server setup here
|
||||||
|
-- return true if you don't want this server to be setup with lspconfig
|
||||||
|
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
|
||||||
|
setup = {
|
||||||
|
-- example to setup with typescript.nvim
|
||||||
|
-- tsserver = function(_, opts)
|
||||||
|
-- require("typescript").setup({ server = opts })
|
||||||
|
-- return true
|
||||||
|
-- end,
|
||||||
|
-- Specify * to use this function as a fallback for any server
|
||||||
|
-- ["*"] = function(server, opts) end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
---@param opts PluginLspOpts
|
||||||
|
config = function(_, opts)
|
||||||
|
-- diagnostics
|
||||||
|
vim.diagnostic.config(require("common").icons.diagnostics)
|
||||||
|
|
||||||
|
if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then
|
||||||
|
opts.diagnostics.virtual_text.prefix = vim.fn.has("nvim-0.10.0") == 0 and "●"
|
||||||
|
or function(diagnostic)
|
||||||
|
local icons = require("common").icons.diagnostics
|
||||||
|
for d, icon in pairs(icons) do
|
||||||
|
if diagnostic.severity == vim.diagnostic.severity[d:upper()] then
|
||||||
|
return icon
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.diagnostic.config(vim.deepcopy(opts.diagnostics))
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- formatters
|
||||||
|
-- cmdline tools and lsp servers
|
||||||
|
{
|
||||||
|
"mason-org/mason.nvim",
|
||||||
|
cmd = "Mason",
|
||||||
|
opts = {
|
||||||
|
ensure_installed = {
|
||||||
|
"stylua",
|
||||||
|
"htmlbeautifier",
|
||||||
|
"prettier",
|
||||||
|
"prettierd",
|
||||||
|
"ansible-lint",
|
||||||
|
"clang-format",
|
||||||
|
"xmlformatter",
|
||||||
|
"eslint_d",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"mfussenegger/nvim-jdtls",
|
||||||
|
{
|
||||||
|
"mason-org/mason-lspconfig.nvim",
|
||||||
|
dependencies = {
|
||||||
|
{ "mason-org/mason.nvim", opts = {} },
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
ensure_installed = {
|
||||||
|
"ansiblels",
|
||||||
|
"cssls",
|
||||||
|
"eslint",
|
||||||
|
"html",
|
||||||
|
"jdtls",
|
||||||
|
"jsonls",
|
||||||
|
"lemminx",
|
||||||
|
"lua_ls",
|
||||||
|
"oxlint",
|
||||||
|
"pylsp",
|
||||||
|
"somesass_ls",
|
||||||
|
"tinymist",
|
||||||
|
"ts_ls",
|
||||||
|
},
|
||||||
|
automatic_installation = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
3
lua/plugins/luadev.lua
Normal file
3
lua/plugins/luadev.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
return {
|
||||||
|
"bfredl/nvim-luadev",
|
||||||
|
}
|
||||||
11
lua/plugins/lush.lua
Normal file
11
lua/plugins/lush.lua
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
return {
|
||||||
|
"rktjmp/lush.nvim",
|
||||||
|
cmd = {
|
||||||
|
"Lushify",
|
||||||
|
"LushImport",
|
||||||
|
"LushRunTutorial",
|
||||||
|
},
|
||||||
|
dependencies = {
|
||||||
|
"rktjmp/shipwright.nvim",
|
||||||
|
},
|
||||||
|
}
|
||||||
31
lua/plugins/markdown.lua
Normal file
31
lua/plugins/markdown.lua
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"euclio/vim-markdown-composer",
|
||||||
|
build = "cargo build --release",
|
||||||
|
enabled = function()
|
||||||
|
return vim.fn.executable("cargo")
|
||||||
|
end,
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'SCJangra/table-nvim',
|
||||||
|
ft = 'markdown',
|
||||||
|
opts = {
|
||||||
|
mappings = {
|
||||||
|
next = '<TAB>', -- Go to next cell.
|
||||||
|
prev = '<S-TAB>', -- Go to previous cell.
|
||||||
|
insert_row_up = '<A-t>k', -- Insert a row above the current row.
|
||||||
|
insert_row_down = '<A-t>j', -- Insert a row below the current row.
|
||||||
|
move_row_up = '<A-t>K', -- Move the current row up.
|
||||||
|
move_row_down = '<A-t>J', -- Move the current row down.
|
||||||
|
insert_column_left = '<A-t>h', -- Insert a column to the left of current column.
|
||||||
|
insert_column_right = '<A-t>l', -- Insert a column to the right of current column.
|
||||||
|
move_column_left = '<A-t>H', -- Move the current column to the left.
|
||||||
|
move_column_right = '<A-t>L', -- Move the current column to the right.
|
||||||
|
insert_table = '<A-t>t', -- Insert a new table.
|
||||||
|
insert_table_alt = '<A-t>T', -- Insert a new table that is not surrounded by pipes.
|
||||||
|
delete_column = '<A-t>d', -- Delete the column under cursor.
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
65
lua/plugins/metals.lua
Normal file
65
lua/plugins/metals.lua
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
return {
|
||||||
|
"scalameta/nvim-metals",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
--"hrsh7th/cmp-nvim-lsp",
|
||||||
|
},
|
||||||
|
ft = { "scala", "sbt" },
|
||||||
|
config = function()
|
||||||
|
local metals_config = require("metals").bare_config()
|
||||||
|
metals_config.init_options.statusBarProvider = "on"
|
||||||
|
metals_config.settings = {
|
||||||
|
showImplicitArguments = true,
|
||||||
|
superMethodLensesEnabled = true,
|
||||||
|
}
|
||||||
|
metals_config.on_attach = function(client, bufnr)
|
||||||
|
require("metals").setup_dap()
|
||||||
|
end
|
||||||
|
--metals_config.capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
|
-- Debug settings if you're using nvim-dap
|
||||||
|
local dap = require("dap")
|
||||||
|
dap.configurations.scala = {
|
||||||
|
{
|
||||||
|
type = "scala",
|
||||||
|
request = "launch",
|
||||||
|
name = "RunOrTest",
|
||||||
|
metals = {
|
||||||
|
runType = "runOrTestFile",
|
||||||
|
--args = { "firstArg", "secondArg", "thirdArg" }, -- here just as an example
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "scala",
|
||||||
|
request = "attach",
|
||||||
|
buildTarget = "main",
|
||||||
|
name = "attach to service",
|
||||||
|
hostName = "localhost",
|
||||||
|
port = 9999,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "scala",
|
||||||
|
request = "launch",
|
||||||
|
name = "Test Target",
|
||||||
|
metals = {
|
||||||
|
runType = "testTarget",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Autocmd that will actually be in charging of starting the whole thing
|
||||||
|
local nvim_metals_group = vim.api.nvim_create_augroup("nvim-metals", { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
-- NOTE: You may or may not want java included here. You will need it if you
|
||||||
|
-- want basic Java support but it may also conflict if you are using
|
||||||
|
-- something like nvim-jdtls which also works on a java filetype autocmd.
|
||||||
|
pattern = { "scala", "sbt" },
|
||||||
|
callback = function()
|
||||||
|
require("metals").initialize_or_attach(metals_config)
|
||||||
|
end,
|
||||||
|
group = nvim_metals_group,
|
||||||
|
})
|
||||||
|
|
||||||
|
return metals_config
|
||||||
|
end,
|
||||||
|
}
|
||||||
76
lua/plugins/multicursor.lua
Normal file
76
lua/plugins/multicursor.lua
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
return {
|
||||||
|
"jake-stewart/multicursor.nvim",
|
||||||
|
branch = "1.0",
|
||||||
|
config = function()
|
||||||
|
local mc = require("multicursor-nvim")
|
||||||
|
mc.setup()
|
||||||
|
|
||||||
|
local set = vim.keymap.set
|
||||||
|
|
||||||
|
-- Add or skip cursor above/below the main cursor.
|
||||||
|
set({ "n", "x" }, "<leader><up>", function()
|
||||||
|
mc.lineAddCursor(-1)
|
||||||
|
end)
|
||||||
|
set({ "n", "x" }, "<leader><down>", function()
|
||||||
|
mc.lineAddCursor(1)
|
||||||
|
end)
|
||||||
|
set({ "n", "x" }, "<leader><leader><up>", function()
|
||||||
|
mc.lineSkipCursor(-1)
|
||||||
|
end)
|
||||||
|
set({ "n", "x" }, "<leader><leader><down>", function()
|
||||||
|
mc.lineSkipCursor(1)
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Add or skip adding a new cursor by matching word/selection
|
||||||
|
set({ "n", "x" }, "<C-n>", function()
|
||||||
|
mc.matchAddCursor(1)
|
||||||
|
end)
|
||||||
|
set({ "n", "x" }, "<C-s>", function()
|
||||||
|
mc.matchSkipCursor(1)
|
||||||
|
end)
|
||||||
|
set({ "n", "x" }, "<C-S-n>", function()
|
||||||
|
mc.matchAddCursor(-1)
|
||||||
|
end)
|
||||||
|
set({ "n", "x" }, "<C-S-s>", function()
|
||||||
|
mc.matchSkipCursor(-1)
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Add and remove cursors with control + left click.
|
||||||
|
set("n", "<c-leftmouse>", mc.handleMouse)
|
||||||
|
set("n", "<c-leftdrag>", mc.handleMouseDrag)
|
||||||
|
set("n", "<c-leftrelease>", mc.handleMouseRelease)
|
||||||
|
|
||||||
|
-- Disable and enable cursors.
|
||||||
|
set({ "n", "x" }, "<c-q>", mc.toggleCursor)
|
||||||
|
|
||||||
|
-- Mappings defined in a keymap layer only apply when there are
|
||||||
|
-- multiple cursors. This lets you have overlapping mappings.
|
||||||
|
mc.addKeymapLayer(function(layerSet)
|
||||||
|
-- Select a different cursor as the main one.
|
||||||
|
layerSet({ "n", "x" }, "<leader>h", mc.prevCursor)
|
||||||
|
layerSet({ "n", "x" }, "<leader>l", mc.nextCursor)
|
||||||
|
|
||||||
|
-- Delete the main cursor.
|
||||||
|
layerSet({ "n", "x" }, "<leader>x", mc.deleteCursor)
|
||||||
|
|
||||||
|
-- Enable and clear cursors using escape.
|
||||||
|
layerSet("n", "<esc>", function()
|
||||||
|
if not mc.cursorsEnabled() then
|
||||||
|
mc.enableCursors()
|
||||||
|
else
|
||||||
|
mc.clearCursors()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Customize how cursors look.
|
||||||
|
local hl = vim.api.nvim_set_hl
|
||||||
|
hl(0, "MultiCursorCursor", { reverse = true })
|
||||||
|
hl(0, "MultiCursorVisual", { link = "Visual" })
|
||||||
|
hl(0, "MultiCursorSign", { link = "SignColumn" })
|
||||||
|
hl(0, "MultiCursorMatchPreview", { link = "Search" })
|
||||||
|
hl(0, "MultiCursorDisabledCursor", { reverse = true })
|
||||||
|
hl(0, "MultiCursorDisabledVisual", { link = "Visual" })
|
||||||
|
hl(0, "MultiCursorDisabledSign", { link = "SignColumn" })
|
||||||
|
end,
|
||||||
|
}
|
||||||
86
lua/plugins/tabline.lua
Normal file
86
lua/plugins/tabline.lua
Normal file
|
|
@ -0,0 +1,86 @@
|
||||||
|
return {
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
dependencies = {
|
||||||
|
{ "kyazdani42/nvim-web-devicons", lazy = true },
|
||||||
|
"crater2150/vim-theme-chroma",
|
||||||
|
{
|
||||||
|
"linrongbin16/lsp-progress.nvim",
|
||||||
|
config = function()
|
||||||
|
require("lsp-progress").setup()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
event = "VeryLazy",
|
||||||
|
opts = function(_, opts)
|
||||||
|
return {
|
||||||
|
options = {
|
||||||
|
theme = require("chroma-theme.lualine"),
|
||||||
|
},
|
||||||
|
tabline = {
|
||||||
|
lualine_a = { "branch" },
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_c = {
|
||||||
|
{
|
||||||
|
"buffers",
|
||||||
|
show_filename_only = false,
|
||||||
|
symbols = { modified = " ✏️]", alternate_file = " 🔃", folder = " 📁" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lualine_x = {},
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {
|
||||||
|
{
|
||||||
|
"tabs",
|
||||||
|
mode = 1,
|
||||||
|
fmt = function(name, context)
|
||||||
|
local buflist = vim.fn.tabpagebuflist(context.tabnr)
|
||||||
|
local mod = not vim.tbl_isempty(vim.tbl_filter(function(bufnr)
|
||||||
|
return vim.fn.getbufvar(bufnr, "&mod") == 1
|
||||||
|
end, buflist))
|
||||||
|
|
||||||
|
local wincount = #vim.tbl_filter(function(i)
|
||||||
|
return i == "leaf"
|
||||||
|
end, vim.iter(vim.fn.winlayout(context.tabnr)):flatten():totable())
|
||||||
|
|
||||||
|
return name
|
||||||
|
.. (wincount > 1 and " +" .. (wincount - 1) or "")
|
||||||
|
.. (mod and " [✏️]]" or "")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
lualine_a = { { "filename", path = 1 } },
|
||||||
|
lualine_b = { "diff", "diagnostics" },
|
||||||
|
lualine_x = {
|
||||||
|
function()
|
||||||
|
-- invoke `progress` here.
|
||||||
|
return require("lsp-progress").progress()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
lualine_y = { "filetype" },
|
||||||
|
lualine_z = { "searchcount", "selectioncount", "location" },
|
||||||
|
},
|
||||||
|
inactive_sections = {
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_c = { { "filename", path = 1 } },
|
||||||
|
lualine_x = { "location" },
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
},
|
||||||
|
winbar = {},
|
||||||
|
inactive_winbar = {},
|
||||||
|
extensions = {},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
config = function(_, opts)
|
||||||
|
require("lualine").setup(opts)
|
||||||
|
vim.api.nvim_create_augroup("lualine_augroup", { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
group = "lualine_augroup",
|
||||||
|
pattern = "LspProgressStatusUpdated",
|
||||||
|
callback = require("lualine").refresh,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
61
lua/plugins/telescope.lua
Normal file
61
lua/plugins/telescope.lua
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
return {
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope-fzf-native.nvim",
|
||||||
|
build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
|
||||||
|
},
|
||||||
|
"gbrlsnchs/telescope-lsp-handlers.nvim",
|
||||||
|
},
|
||||||
|
cmd = "Telescope",
|
||||||
|
version = false,
|
||||||
|
keys = function()
|
||||||
|
local builtin = require("telescope.builtin")
|
||||||
|
local utils = require("telescope.utils")
|
||||||
|
-- stylua: ignore start
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
',,',
|
||||||
|
function()
|
||||||
|
builtin.fd { cwd = require("findroot")(utils.buffer_dir()) }
|
||||||
|
end,
|
||||||
|
desc = "Find files in base dir (defined by .telescope-root file)"
|
||||||
|
},
|
||||||
|
{ ',ff', builtin.fd, desc = "Find files" },
|
||||||
|
{ ',fg', builtin.git_files, desc = "Find files (git)" },
|
||||||
|
{ ',gs', builtin.git_status, desc = "Git status" },
|
||||||
|
{ ',s', builtin.lsp_dynamic_workspace_symbols, desc = "Symbols" },
|
||||||
|
{ 'g/', builtin.live_grep, desc = "Live grep" },
|
||||||
|
{ 'g:', builtin.command_history, desc = "Command history" },
|
||||||
|
{ '<C-/>', builtin.current_buffer_fuzzy_find, desc = "Fuzzy find" },
|
||||||
|
{ '<leader>*', builtin.grep_string, desc = "Find at cursor" },
|
||||||
|
{ 'gb', builtin.buffers, desc = "Switch buffer" },
|
||||||
|
{ "<leader>:", builtin.command_history, desc = "Command History" },
|
||||||
|
{ "<leader>;", builtin.commands, desc = "Commands" },
|
||||||
|
{ '""', builtin.registers, desc = "Registers" },
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
--stylua: ignore end
|
||||||
|
opts = {
|
||||||
|
defaults = {
|
||||||
|
prompt_prefix = " ",
|
||||||
|
selection_caret = " ",
|
||||||
|
},
|
||||||
|
extensions = {
|
||||||
|
fzf = {
|
||||||
|
fuzzy = true,
|
||||||
|
override_generic_sorter = true,
|
||||||
|
override_file_sorter = true,
|
||||||
|
case_mode = "smart_case",
|
||||||
|
},
|
||||||
|
["ui-select"] = {
|
||||||
|
require("telescope.themes").get_dropdown({}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
local telescope = require("telescope")
|
||||||
|
telescope.setup(opts)
|
||||||
|
telescope.load_extension("fzf")
|
||||||
|
end,
|
||||||
|
}
|
||||||
148
lua/plugins/treesitter.lua
Normal file
148
lua/plugins/treesitter.lua
Normal file
|
|
@ -0,0 +1,148 @@
|
||||||
|
local function ts_disable(_, bufnr)
|
||||||
|
return vim.api.nvim_buf_line_count(bufnr) > 5000
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
version = false,
|
||||||
|
build = ":TSUpdate",
|
||||||
|
event = { "BufReadPost", "BufNewFile" },
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||||
|
init = function()
|
||||||
|
-- PERF: no need to load the plugin, if we only need its queries for mini.ai
|
||||||
|
local plugin = require("lazy.core.config").spec.plugins["nvim-treesitter"]
|
||||||
|
local opts = require("lazy.core.plugin").values(plugin, "opts", false)
|
||||||
|
local enabled = false
|
||||||
|
if opts.textobjects then
|
||||||
|
for _, mod in ipairs({ "move", "select", "swap", "lsp_interop" }) do
|
||||||
|
if opts.textobjects[mod] and opts.textobjects[mod].enable then
|
||||||
|
enabled = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not enabled then
|
||||||
|
require("lazy.core.loader").disable_rtp_plugin("nvim-treesitter-textobjects")
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{ "<c-space>", desc = "Increment selection" },
|
||||||
|
{ "<bs>", desc = "Decrement selection", mode = "x" },
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
auto_install = true,
|
||||||
|
ignore_install = {},
|
||||||
|
highlight = { enable = true, disable = ts_disable },
|
||||||
|
indent = { enable = true },
|
||||||
|
ensure_installed = {
|
||||||
|
"bash",
|
||||||
|
"gitignore",
|
||||||
|
"html",
|
||||||
|
"java",
|
||||||
|
"json",
|
||||||
|
"lua",
|
||||||
|
"luadoc",
|
||||||
|
"luap",
|
||||||
|
"markdown",
|
||||||
|
"markdown_inline",
|
||||||
|
"python",
|
||||||
|
"query",
|
||||||
|
"regex",
|
||||||
|
"scala",
|
||||||
|
"tsx",
|
||||||
|
"typescript",
|
||||||
|
"vim",
|
||||||
|
"vimdoc",
|
||||||
|
"yaml",
|
||||||
|
},
|
||||||
|
incremental_selection = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
init_selection = "<C-space>",
|
||||||
|
node_incremental = "<C-space>",
|
||||||
|
scope_incremental = false,
|
||||||
|
node_decremental = "<bs>",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
textobjects = {
|
||||||
|
select = {
|
||||||
|
enable = true,
|
||||||
|
lookahead = true,
|
||||||
|
keymaps = {
|
||||||
|
-- stylua: ignore start
|
||||||
|
["af"] = { query = "@function.outer", desc = "outer function" },
|
||||||
|
["if"] = { query = "@function.inner", desc = "inner function" },
|
||||||
|
["ac"] = { query = "@class.outer", desc = "outer class" },
|
||||||
|
["ic"] = { query = "@class.inner", desc = "inner class" },
|
||||||
|
["ap"] = { query = "@parameter.outer", desc = "outer parameter" },
|
||||||
|
["ip"] = { query = "@parameter.inner", desc = "inner parameter" },
|
||||||
|
["ar"] = { query = "@return_type.outer", desc = "outer return type" },
|
||||||
|
["ir"] = { query = "@return_type.inner", desc = "inner return type" },
|
||||||
|
-- stylua: ignore end
|
||||||
|
},
|
||||||
|
selection_modes = {
|
||||||
|
["@parameter.outer"] = "v", -- charwise
|
||||||
|
["@function.outer"] = "V", -- linewise
|
||||||
|
["@class.outer"] = "V",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
swap = {
|
||||||
|
enable = true,
|
||||||
|
swap_next = {
|
||||||
|
["<leader>a"] = "@parameter.inner",
|
||||||
|
},
|
||||||
|
swap_previous = {
|
||||||
|
["<leader>A"] = "@parameter.inner",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
---@param opts TSConfig
|
||||||
|
config = function(_, opts)
|
||||||
|
if type(opts.ensure_installed) == "table" then
|
||||||
|
---@type table<string, boolean>
|
||||||
|
local added = {}
|
||||||
|
opts.ensure_installed = vim.tbl_filter(function(lang)
|
||||||
|
if added[lang] then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
added[lang] = true
|
||||||
|
return true
|
||||||
|
end, opts.ensure_installed --[[@as string[] ]])
|
||||||
|
end
|
||||||
|
require("nvim-treesitter.configs").setup(opts)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-treesitter/playground",
|
||||||
|
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||||
|
cmd = {
|
||||||
|
"TSPlaygroundToggle",
|
||||||
|
"TSHighlightCapturesUnderCursor",
|
||||||
|
"TSNodeUnderCursor",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter-context",
|
||||||
|
event = "VeryLazy",
|
||||||
|
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||||
|
cmd = { "TSContextEnable", "TSContextDisable", "TSContextToggle" },
|
||||||
|
keys = {
|
||||||
|
-- stylua: ignore start
|
||||||
|
{ "[c", function() require("treesitter-context").go_to_context() end, desc = "Go to context start", },
|
||||||
|
{ "<leader>c", function() require("treesitter-context").toggle() end, desc = "Toggle context view", },
|
||||||
|
-- stylua: ignore end
|
||||||
|
},
|
||||||
|
opts = { enable = true },
|
||||||
|
config = function(_, opts)
|
||||||
|
require("treesitter-context").setup(opts)
|
||||||
|
vim.api.nvim_set_hl(0, "TreesitterContext", { bg = "#555555" })
|
||||||
|
vim.api.nvim_set_hl(0, "TreesitterContextLineNumber", { link = "Special" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
76
lua/plugins/ui.lua
Normal file
76
lua/plugins/ui.lua
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"stevearc/dressing.nvim",
|
||||||
|
enabled = true,
|
||||||
|
dependencies = {
|
||||||
|
--'nvim-telescope/telescope-ui-select.nvim',
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
select = {
|
||||||
|
backend = { "telescope" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
|
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||||
|
main = "ibl",
|
||||||
|
--tag = "v3.5.4",
|
||||||
|
--opts = {
|
||||||
|
-- whitespace = { highlight = { "Whitespace", "CursorLine" }, remove_blankline_trail = false },
|
||||||
|
-- indent = { highlight = { "Whitespace", "CursorLine" }, char = "" },
|
||||||
|
-- scope = { enabled = true },
|
||||||
|
--},
|
||||||
|
config = function()
|
||||||
|
local highlightLines = {
|
||||||
|
"RainbowCyan",
|
||||||
|
"RainbowYellow",
|
||||||
|
"RainbowBlue",
|
||||||
|
"RainbowOrange",
|
||||||
|
"RainbowGreen",
|
||||||
|
"RainbowViolet",
|
||||||
|
"RainbowRed",
|
||||||
|
}
|
||||||
|
local highlightDimLines = {
|
||||||
|
"RainbowDimCyan",
|
||||||
|
"RainbowDimYellow",
|
||||||
|
"RainbowDimBlue",
|
||||||
|
"RainbowDimOrange",
|
||||||
|
"RainbowDimGreen",
|
||||||
|
"RainbowDimViolet",
|
||||||
|
"RainbowDimRed",
|
||||||
|
}
|
||||||
|
local hooks = require 'ibl.hooks'
|
||||||
|
|
||||||
|
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowDimRed", { fg = "#733338" })
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowDimYellow", { fg = "#7B6335" })
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowDimBlue", { fg = "#2B587D" })
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowDimOrange", { fg = "#674D35" })
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowDimGreen", { fg = "#4C613D" })
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowDimViolet", { fg = "#663774" })
|
||||||
|
vim.api.nvim_set_hl(0, "RainbowDimCyan", { fg = "#32555A" })
|
||||||
|
end)
|
||||||
|
|
||||||
|
require('ibl').setup {
|
||||||
|
indent = {
|
||||||
|
highlight = highlightDimLines,
|
||||||
|
char = '┊',
|
||||||
|
tab_char = '┊',
|
||||||
|
},
|
||||||
|
scope = {
|
||||||
|
highlight = highlightLines,
|
||||||
|
char = '▎',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vim.api.nvim_set_hl(0, "@ibl.whitespace.char.1", {})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
10
lua/plugins/vimtex.lua
Normal file
10
lua/plugins/vimtex.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
return {
|
||||||
|
"lervag/vimtex",
|
||||||
|
init = function()
|
||||||
|
vim.g.tex_flavor = "latex"
|
||||||
|
vim.g.tex_conceal = "agm"
|
||||||
|
vim.g.vimtex_quickfix_ignorefilters = { "overfull", "underfull" }
|
||||||
|
vim.g.vimtex_syntax_enabled = 0
|
||||||
|
end,
|
||||||
|
ft = "tex",
|
||||||
|
}
|
||||||
9
lua/plugins/which-key.lua
Normal file
9
lua/plugins/which-key.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
return {
|
||||||
|
"folke/which-key.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
init = function()
|
||||||
|
vim.o.timeout = true
|
||||||
|
vim.o.timeoutlen = 300
|
||||||
|
end,
|
||||||
|
opts = {},
|
||||||
|
}
|
||||||
143
lua/profile.lua
Normal file
143
lua/profile.lua
Normal file
|
|
@ -0,0 +1,143 @@
|
||||||
|
local autocmd = require("profile.autocmd")
|
||||||
|
local clock = require("profile.clock")
|
||||||
|
local instrument = require("profile.instrument")
|
||||||
|
local util = require("profile.util")
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local event_defaults = {
|
||||||
|
pid = 1,
|
||||||
|
tid = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
---Call this at the top of your init.vim to get durations for autocmds. If you
|
||||||
|
---don't, autocmds will show up as 'instant' events in the profile
|
||||||
|
M.instrument_autocmds = function()
|
||||||
|
autocmd.instrument_start()
|
||||||
|
end
|
||||||
|
|
||||||
|
---Instrument matching modules
|
||||||
|
---@param name string Name of module or glob pattern (e.g. "telescope*")
|
||||||
|
M.instrument = function(name)
|
||||||
|
instrument(name)
|
||||||
|
end
|
||||||
|
|
||||||
|
---Mark matching modules to be ignored by profiling
|
||||||
|
---@param name string Name of module or glob pattern (e.g. "telescope*")
|
||||||
|
M.ignore = function(name)
|
||||||
|
instrument.ignore(name)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param sample_rate number Float between 0 and 1
|
||||||
|
M.set_sample_rate = function(sample_rate)
|
||||||
|
instrument.set_sample_rate(sample_rate)
|
||||||
|
end
|
||||||
|
|
||||||
|
---Start collecting data for a profile
|
||||||
|
---@param ... string Names or patterns of modules to instrument (if instrument() not called before this)
|
||||||
|
M.start = function(...)
|
||||||
|
for _, pattern in ipairs({ ... }) do
|
||||||
|
instrument(pattern)
|
||||||
|
end
|
||||||
|
autocmd.instrument_auto()
|
||||||
|
instrument.clear_events()
|
||||||
|
clock.reset()
|
||||||
|
instrument.recording = true
|
||||||
|
vim.api.nvim_exec_autocmds("User", { pattern = "ProfileStart", modeline = false })
|
||||||
|
end
|
||||||
|
|
||||||
|
---@return boolean
|
||||||
|
M.is_recording = function()
|
||||||
|
return instrument.recording
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param filename? string If present, write the profile data to this file
|
||||||
|
M.stop = function(filename)
|
||||||
|
instrument.recording = false
|
||||||
|
vim.api.nvim_exec_autocmds("User", { pattern = "ProfileStop", modeline = false })
|
||||||
|
if filename then
|
||||||
|
M.export(filename)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---@private
|
||||||
|
---@param name string Name of the function
|
||||||
|
---@param ... any Arguments to the function
|
||||||
|
M.log_start = function(name, ...)
|
||||||
|
if not instrument.recording then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
instrument.add_event({
|
||||||
|
name = name,
|
||||||
|
args = util.format_args(...),
|
||||||
|
cat = "function,manual",
|
||||||
|
ph = "B",
|
||||||
|
ts = clock(),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
---@private
|
||||||
|
---@param name string Name of the function
|
||||||
|
---@param ... any Arguments to the function
|
||||||
|
M.log_end = function(name, ...)
|
||||||
|
if not instrument.recording then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
instrument.add_event({
|
||||||
|
name = name,
|
||||||
|
args = util.format_args(...),
|
||||||
|
cat = "function,manual",
|
||||||
|
ph = "E",
|
||||||
|
ts = clock(),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
---@private
|
||||||
|
---@param name string Name of the function
|
||||||
|
---@param ... any Arguments to the function
|
||||||
|
M.log_instant = function(name, ...)
|
||||||
|
if not instrument.recording then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
instrument.add_event({
|
||||||
|
name = name,
|
||||||
|
args = util.format_args(...),
|
||||||
|
cat = "",
|
||||||
|
ph = "i",
|
||||||
|
ts = clock(),
|
||||||
|
s = "g",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
---Print out a list of all modules that have been instrumented
|
||||||
|
M.print_instrumented_modules = function()
|
||||||
|
instrument.print_modules()
|
||||||
|
end
|
||||||
|
|
||||||
|
---Write the trace to a file
|
||||||
|
---@param filename string
|
||||||
|
M.export = function(filename)
|
||||||
|
local file = assert(io.open(filename, "w"))
|
||||||
|
local events = instrument.get_events()
|
||||||
|
file:write("[")
|
||||||
|
for i, event in ipairs(events) do
|
||||||
|
local e = vim.tbl_extend("keep", event, event_defaults)
|
||||||
|
local ok, jse = pcall(vim.json.encode, e)
|
||||||
|
if not ok and e.args then
|
||||||
|
e.args = nil
|
||||||
|
ok, jse = pcall(vim.json.encode, e)
|
||||||
|
end
|
||||||
|
if ok then
|
||||||
|
file:write(jse)
|
||||||
|
if i < #events then
|
||||||
|
file:write(",\n")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local err = string.format("Could not encode event: %s\n%s", jse, vim.inspect(e))
|
||||||
|
vim.api.nvim_echo({ { err, "Error" } }, true, {})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
file:write("]")
|
||||||
|
file:close()
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
154
lua/profile/autocmd.lua
Normal file
154
lua/profile/autocmd.lua
Normal file
|
|
@ -0,0 +1,154 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local autocmds = {
|
||||||
|
"BufAdd",
|
||||||
|
"BufDelete",
|
||||||
|
"BufEnter",
|
||||||
|
"BufFilePost",
|
||||||
|
"BufFilePre",
|
||||||
|
"BufHidden",
|
||||||
|
"BufLeave",
|
||||||
|
"BufModifiedSet",
|
||||||
|
"BufNew",
|
||||||
|
"BufNewFile",
|
||||||
|
"BufRead",
|
||||||
|
-- "BufReadCmd",
|
||||||
|
"BufReadPre",
|
||||||
|
"BufUnload",
|
||||||
|
"BufWinEnter",
|
||||||
|
"BufWinLeave",
|
||||||
|
"BufWipeout",
|
||||||
|
"BufWrite",
|
||||||
|
-- "BufWriteCmd",
|
||||||
|
"BufWritePost",
|
||||||
|
"ChanInfo",
|
||||||
|
"ChanOpen",
|
||||||
|
"CmdUndefined",
|
||||||
|
"CmdlineChanged",
|
||||||
|
"CmdlineEnter",
|
||||||
|
"CmdlineLeave",
|
||||||
|
"CmdwinEnter",
|
||||||
|
"CmdwinLeave",
|
||||||
|
"ColorScheme",
|
||||||
|
"ColorSchemePre",
|
||||||
|
"CompleteChanged",
|
||||||
|
"CompleteDonePre",
|
||||||
|
"CompleteDone",
|
||||||
|
"CursorHold",
|
||||||
|
"CursorHoldI",
|
||||||
|
"CursorMoved",
|
||||||
|
"CursorMovedI",
|
||||||
|
"DiffUpdated",
|
||||||
|
"DirChanged",
|
||||||
|
-- "FileAppendCmd",
|
||||||
|
"FileAppendPost",
|
||||||
|
"FileAppendPre",
|
||||||
|
"FileChangedRO",
|
||||||
|
"ExitPre",
|
||||||
|
"FileChangedShell",
|
||||||
|
"FileChangedShellPost",
|
||||||
|
-- "FileReadCmd",
|
||||||
|
"FileReadPost",
|
||||||
|
"FileReadPre",
|
||||||
|
"FileType",
|
||||||
|
-- "FileWriteCmd",
|
||||||
|
"FileWritePost",
|
||||||
|
"FileWritePre",
|
||||||
|
"FilterReadPost",
|
||||||
|
"FilterReadPre",
|
||||||
|
"FilterWritePost",
|
||||||
|
"FilterWritePre",
|
||||||
|
"FocusGained",
|
||||||
|
"FocusLost",
|
||||||
|
"FuncUndefined",
|
||||||
|
"UIEnter",
|
||||||
|
"UILeave",
|
||||||
|
"InsertChange",
|
||||||
|
"InsertCharPre",
|
||||||
|
"TextYankPost",
|
||||||
|
"InsertEnter",
|
||||||
|
"InsertLeavePre",
|
||||||
|
"InsertLeave",
|
||||||
|
"LspAttach",
|
||||||
|
"LspDetach",
|
||||||
|
"LspTokenUpdate",
|
||||||
|
"MenuPopup",
|
||||||
|
"OptionSet",
|
||||||
|
"QuickFixCmdPre",
|
||||||
|
"QuickFixCmdPost",
|
||||||
|
"QuitPre",
|
||||||
|
"RemoteReply",
|
||||||
|
"SessionLoadPost",
|
||||||
|
"ShellCmdPost",
|
||||||
|
"Signal",
|
||||||
|
"ShellFilterPost",
|
||||||
|
"SourcePre",
|
||||||
|
"SourcePost",
|
||||||
|
-- "SourceCmd",
|
||||||
|
"SpellFileMissing",
|
||||||
|
"StdinReadPost",
|
||||||
|
"StdinReadPre",
|
||||||
|
"SwapExists",
|
||||||
|
"Syntax",
|
||||||
|
"TabEnter",
|
||||||
|
"TabLeave",
|
||||||
|
"TabNew",
|
||||||
|
"TabNewEntered",
|
||||||
|
"TabClosed",
|
||||||
|
"TermOpen",
|
||||||
|
"TermEnter",
|
||||||
|
"TermLeave",
|
||||||
|
"TermClose",
|
||||||
|
"TermResponse",
|
||||||
|
"TextChanged",
|
||||||
|
"TextChangedI",
|
||||||
|
"TextChangedP",
|
||||||
|
"User",
|
||||||
|
"VimEnter",
|
||||||
|
"VimLeave",
|
||||||
|
"VimLeavePre",
|
||||||
|
"VimResized",
|
||||||
|
"VimResume",
|
||||||
|
"VimSuspend",
|
||||||
|
"WinClosed",
|
||||||
|
"WinEnter",
|
||||||
|
"WinLeave",
|
||||||
|
"WinNew",
|
||||||
|
"WinScrolled",
|
||||||
|
}
|
||||||
|
|
||||||
|
---@param groupname string
|
||||||
|
---@param fn string
|
||||||
|
local function create(groupname, fn)
|
||||||
|
local aug = vim.api.nvim_create_augroup(groupname, {})
|
||||||
|
for _, autocmd in ipairs(autocmds) do
|
||||||
|
vim.api.nvim_create_autocmd(autocmd, {
|
||||||
|
desc = "profile.nvim " .. fn,
|
||||||
|
pattern = "*",
|
||||||
|
group = aug,
|
||||||
|
callback = function(args)
|
||||||
|
require("profile")[fn](autocmd, { match = args.match })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.instrument_start = function()
|
||||||
|
create("lua_profile_start", "log_start")
|
||||||
|
end
|
||||||
|
|
||||||
|
M.instrument_auto = function()
|
||||||
|
if vim.fn.exists("#lua_profile_start") ~= 0 then
|
||||||
|
create("lua_profile_end", "log_end")
|
||||||
|
else
|
||||||
|
create("lua_profile", "log_instant")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.clear = function()
|
||||||
|
vim.api.nvim_create_augroup("lua_profile", {})
|
||||||
|
vim.api.nvim_create_augroup("lua_profile_start", {})
|
||||||
|
vim.api.nvim_create_augroup("lua_profile_end", {})
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
14
lua/profile/clock.lua
Normal file
14
lua/profile/clock.lua
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
local hrtime = vim.loop.hrtime
|
||||||
|
|
||||||
|
local start = hrtime()
|
||||||
|
|
||||||
|
return setmetatable({
|
||||||
|
reset = function()
|
||||||
|
start = hrtime()
|
||||||
|
end,
|
||||||
|
}, {
|
||||||
|
__call = function()
|
||||||
|
-- Microseconds
|
||||||
|
return (hrtime() - start) / 1e3
|
||||||
|
end,
|
||||||
|
})
|
||||||
209
lua/profile/instrument.lua
Normal file
209
lua/profile/instrument.lua
Normal file
|
|
@ -0,0 +1,209 @@
|
||||||
|
local clock = require("profile.clock")
|
||||||
|
local util = require("profile.util")
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local rawrequire = require
|
||||||
|
local events = {}
|
||||||
|
local ignore_list = {
|
||||||
|
"^_G$",
|
||||||
|
"^bit$",
|
||||||
|
"^coroutine$",
|
||||||
|
"^debug$",
|
||||||
|
"^ffi$",
|
||||||
|
"^io$",
|
||||||
|
"^jit.*$",
|
||||||
|
"^luv$",
|
||||||
|
"^math$",
|
||||||
|
"^os$",
|
||||||
|
"^package$",
|
||||||
|
"^string$",
|
||||||
|
"^table$",
|
||||||
|
"^vim%.inspect$",
|
||||||
|
"^profile.*$",
|
||||||
|
"^lspconfig%.util%.script_path$",
|
||||||
|
"^plenary%.async_lib.*$",
|
||||||
|
}
|
||||||
|
|
||||||
|
local instrument_list = {}
|
||||||
|
local wrapped_modules = {}
|
||||||
|
local wrapped_functions = {}
|
||||||
|
M.recording = false
|
||||||
|
M.sample_rate = 1
|
||||||
|
local exposed_globals = {
|
||||||
|
["vim"] = vim,
|
||||||
|
["vim.fn"] = vim.fn,
|
||||||
|
["vim.api"] = vim.api,
|
||||||
|
}
|
||||||
|
|
||||||
|
local function all_modules()
|
||||||
|
return vim.tbl_extend("keep", package.loaded, exposed_globals)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function should_instrument(name)
|
||||||
|
-- Don't double-wrap
|
||||||
|
if wrapped_functions[name] then
|
||||||
|
return false
|
||||||
|
elseif wrapped_modules[name] then
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
for _, pattern in ipairs(ignore_list) do
|
||||||
|
if string.match(name, pattern) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function wrap_function(name, fn)
|
||||||
|
return function(...)
|
||||||
|
if M.sample_rate < 1 and math.random() > M.sample_rate then
|
||||||
|
return fn(...)
|
||||||
|
end
|
||||||
|
local arg_string = util.format_args(...)
|
||||||
|
local start = clock()
|
||||||
|
local function handle_result(...)
|
||||||
|
local delta = clock() - start
|
||||||
|
M.add_event({
|
||||||
|
name = name,
|
||||||
|
args = arg_string,
|
||||||
|
cat = "function",
|
||||||
|
ph = "X",
|
||||||
|
ts = start,
|
||||||
|
dur = delta,
|
||||||
|
})
|
||||||
|
return ...
|
||||||
|
end
|
||||||
|
return handle_result(fn(...))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function patch_function(modname, mod, name)
|
||||||
|
local fn = mod[name]
|
||||||
|
if type(fn) == "function" then
|
||||||
|
local fnname = string.format("%s.%s", modname, name)
|
||||||
|
if should_instrument(fnname) then
|
||||||
|
wrapped_functions[fnname] = fn
|
||||||
|
mod[name] = wrap_function(fnname, fn)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function maybe_wrap_function(name)
|
||||||
|
local parent_mod_name, fn = util.split_path(name)
|
||||||
|
local mod = M.get_module(parent_mod_name)
|
||||||
|
if mod then
|
||||||
|
patch_function(parent_mod_name, mod, fn)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function wrap_module(name, mod)
|
||||||
|
name = util.normalize_module_name(name)
|
||||||
|
if type(mod) ~= "table" or not should_instrument(name) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
wrapped_modules[name] = true
|
||||||
|
for k in pairs(mod) do
|
||||||
|
-- Do not wrap module functions that start with '_'
|
||||||
|
-- Those have to be explicitly passed to instrument()
|
||||||
|
if type(k) == "string" and not util.startswith(k, "_") then
|
||||||
|
patch_function(name, mod, k)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function should_profile_module(name)
|
||||||
|
for _, pattern in ipairs(instrument_list) do
|
||||||
|
if string.match(name, pattern) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
M.hook_require = function(module_name)
|
||||||
|
if rawrequire ~= require then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local wrapped_require = wrap_function("require", rawrequire)
|
||||||
|
_G.require = function(name)
|
||||||
|
-- Don't time the require if the file is already loaded
|
||||||
|
if package.loaded[name] or not should_profile_module(name) then
|
||||||
|
return rawrequire(name)
|
||||||
|
end
|
||||||
|
local mod = wrapped_require(name)
|
||||||
|
wrap_module(name, mod)
|
||||||
|
return mod
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.clear_events = function()
|
||||||
|
events = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
M.add_event = function(event)
|
||||||
|
if M.recording then
|
||||||
|
table.insert(events, event)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.get_module = function(name)
|
||||||
|
local ok, mod = pcall(require, name)
|
||||||
|
if ok then
|
||||||
|
if type(mod) == "table" then
|
||||||
|
return mod
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
else
|
||||||
|
mod = _G
|
||||||
|
local paths = vim.split(name, ".", { plain = true })
|
||||||
|
for _, token in ipairs(paths) do
|
||||||
|
mod = mod[token]
|
||||||
|
if not mod then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return type(mod) == "table" and mod or nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.get_events = function()
|
||||||
|
return events
|
||||||
|
end
|
||||||
|
|
||||||
|
M.ignore = function(name)
|
||||||
|
table.insert(ignore_list, util.path_glob_to_regex(name))
|
||||||
|
end
|
||||||
|
|
||||||
|
M.print_modules = function()
|
||||||
|
for module, _ in pairs(wrapped_modules) do
|
||||||
|
print(module)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function instrument(_, name)
|
||||||
|
local pattern = util.path_glob_to_regex(name)
|
||||||
|
if not vim.tbl_contains(instrument_list, pattern) then
|
||||||
|
table.insert(instrument_list, pattern)
|
||||||
|
end
|
||||||
|
M.hook_require(name)
|
||||||
|
for modname, mod in pairs(all_modules()) do
|
||||||
|
if string.match(modname, pattern) then
|
||||||
|
wrap_module(modname, mod)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
maybe_wrap_function(name)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param sample_rate number Float between 0 and 1
|
||||||
|
M.set_sample_rate = function(sample_rate)
|
||||||
|
if sample_rate <= 0 or sample_rate > 1 then
|
||||||
|
error("sample_rate must be between 0 (exclusive) and 1 (inclusive)")
|
||||||
|
end
|
||||||
|
M.sample_rate = sample_rate
|
||||||
|
end
|
||||||
|
|
||||||
|
return setmetatable(M, {
|
||||||
|
__call = instrument,
|
||||||
|
})
|
||||||
83
lua/profile/util.lua
Normal file
83
lua/profile/util.lua
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local MAX_ARG_LEN = 200
|
||||||
|
local tbl_isarray = vim.isarray or vim.tbl_isarray or vim.tbl_islist
|
||||||
|
local pack_len = vim.F.pack_len
|
||||||
|
local split = vim.split
|
||||||
|
|
||||||
|
---@param glob string
|
||||||
|
---@return string
|
||||||
|
M.path_glob_to_regex = function(glob)
|
||||||
|
local pattern = string.gsub(glob, "%.", "[%./]")
|
||||||
|
pattern = string.gsub(pattern, "*", ".*")
|
||||||
|
return "^" .. pattern .. "$"
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param name string
|
||||||
|
---@return string
|
||||||
|
M.normalize_module_name = function(name)
|
||||||
|
local ret = string.gsub(name, "/", ".")
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param haystack string
|
||||||
|
---@param prefix string
|
||||||
|
---@return boolean
|
||||||
|
M.startswith = function(haystack, prefix)
|
||||||
|
return string.find(haystack, prefix) == 1
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param path string
|
||||||
|
---@return string module
|
||||||
|
---@return string tail
|
||||||
|
M.split_path = function(path)
|
||||||
|
local pieces = split(path, ".", { plain = true })
|
||||||
|
if #pieces == 1 then
|
||||||
|
return "_G", path
|
||||||
|
end
|
||||||
|
local mod = table.concat(pack_len(unpack(pieces, 1, #pieces - 1)), ".")
|
||||||
|
return mod, pieces[#pieces]
|
||||||
|
end
|
||||||
|
|
||||||
|
local function sanitize(table)
|
||||||
|
local clean = {}
|
||||||
|
local iterfn
|
||||||
|
if tbl_isarray(table) then
|
||||||
|
iterfn = ipairs
|
||||||
|
else
|
||||||
|
iterfn = pairs
|
||||||
|
end
|
||||||
|
for i, v in iterfn(table) do
|
||||||
|
local t = type(v)
|
||||||
|
if t == "string" then
|
||||||
|
if string.len(v) > MAX_ARG_LEN then
|
||||||
|
clean[tostring(i)] = string.sub(v, 1, MAX_ARG_LEN - 3) .. "..."
|
||||||
|
else
|
||||||
|
clean[tostring(i)] = v
|
||||||
|
end
|
||||||
|
elseif t == "nil" or t == "boolean" or t == "number" then
|
||||||
|
clean[tostring(i)] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- If no args, then return nil
|
||||||
|
if next(clean) == nil then
|
||||||
|
return nil
|
||||||
|
else
|
||||||
|
return clean
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param ... any[]
|
||||||
|
---@return any
|
||||||
|
M.format_args = function(...)
|
||||||
|
local args = pack_len(...)
|
||||||
|
if args.n == 0 then
|
||||||
|
return nil
|
||||||
|
elseif args.n == 1 and type(args[1]) == "table" then
|
||||||
|
return sanitize(args[1])
|
||||||
|
else
|
||||||
|
return sanitize(args)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
118
packages.vim
118
packages.vim
|
|
@ -1,118 +0,0 @@
|
||||||
call plug#begin(expand('<sfile>:p:h') . '/plugged')
|
|
||||||
|
|
||||||
" basic stuff
|
|
||||||
Plug 'pbrisbin/vim-mkdir'
|
|
||||||
Plug 'embear/vim-localvimrc'
|
|
||||||
|
|
||||||
Plug 'crater2150/vim-theme-chroma'
|
|
||||||
"Plug '~/sources/chroma-colors/vim'
|
|
||||||
Plug 'fladson/vim-kitty'
|
|
||||||
|
|
||||||
" generic
|
|
||||||
Plug 'ryicoh/deepl.vim'
|
|
||||||
|
|
||||||
" tim pope stuff
|
|
||||||
Plug 'tpope/vim-repeat' " . for commands from plugins
|
|
||||||
Plug 'tpope/vim-surround' " add/remove braces,quotes,...
|
|
||||||
Plug 'tpope/vim-characterize' " More info in ga output
|
|
||||||
Plug 'tpope/vim-eunuch' " :Delete, :Move, etc.
|
|
||||||
Plug 'tpope/vim-commentary' " gc operator
|
|
||||||
Plug 'tpope/vim-sleuth' " detect shiftwidth/expandtab
|
|
||||||
"
|
|
||||||
" motions and textobjects
|
|
||||||
Plug 'kana/vim-textobj-user' | Plug 'glts/vim-textobj-comment' " ic / ac
|
|
||||||
Plug 'michaeljsmith/vim-indent-object'
|
|
||||||
Plug 'vim-scripts/argtextobj.vim'
|
|
||||||
|
|
||||||
Plug 'airblade/vim-gitgutter'
|
|
||||||
|
|
||||||
" LSP
|
|
||||||
Plug 'neovim/nvim-lspconfig'
|
|
||||||
Plug 'hrsh7th/cmp-buffer'
|
|
||||||
Plug 'hrsh7th/cmp-nvim-lsp'
|
|
||||||
Plug 'hrsh7th/cmp-path'
|
|
||||||
Plug 'hrsh7th/cmp-vsnip'
|
|
||||||
Plug 'hrsh7th/nvim-cmp'
|
|
||||||
Plug 'hrsh7th/vim-vsnip'
|
|
||||||
Plug 'hrsh7th/vim-vsnip-integ'
|
|
||||||
Plug 'nvim-lua/plenary.nvim'
|
|
||||||
Plug 'scalameta/nvim-metals'
|
|
||||||
Plug 'williamboman/nvim-lsp-installer'
|
|
||||||
|
|
||||||
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
|
||||||
Plug 'nvim-lua/lsp-status.nvim'
|
|
||||||
Plug 'RishabhRD/popfix'
|
|
||||||
Plug 'RishabhRD/nvim-lsputils'
|
|
||||||
Plug 'kyazdani42/nvim-web-devicons'
|
|
||||||
Plug 'folke/trouble.nvim'
|
|
||||||
Plug 'folke/lsp-colors.nvim'
|
|
||||||
Plug 'nvim-lua/popup.nvim'
|
|
||||||
Plug 'nvim-lua/plenary.nvim'
|
|
||||||
Plug 'nvim-telescope/telescope.nvim'
|
|
||||||
Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
|
|
||||||
Plug 'gbrlsnchs/telescope-lsp-handlers.nvim'
|
|
||||||
|
|
||||||
Plug 'mfussenegger/nvim-dap'
|
|
||||||
|
|
||||||
|
|
||||||
Plug 'machakann/vim-highlightedyank'
|
|
||||||
|
|
||||||
Plug 'junegunn/vim-easy-align'
|
|
||||||
|
|
||||||
" for stuff installed via disto package manager, e.g. fzf's bundled vim plugin
|
|
||||||
Plug '/usr/share/vim/vimfiles'
|
|
||||||
Plug 'junegunn/fzf.vim'
|
|
||||||
|
|
||||||
Plug 'vim-airline/vim-airline'
|
|
||||||
Plug 'lambdalisue/suda.vim'
|
|
||||||
|
|
||||||
Plug 'vim-scripts/SyntaxRange'
|
|
||||||
|
|
||||||
Plug 'lukas-reineke/indent-blankline.nvim'
|
|
||||||
|
|
||||||
" ruby
|
|
||||||
Plug 'depuracao/vim-rdoc'
|
|
||||||
Plug 'vim-ruby/vim-ruby'
|
|
||||||
Plug 'tpope/vim-rails'
|
|
||||||
Plug 'tpope/vim-rake'
|
|
||||||
|
|
||||||
" git
|
|
||||||
Plug 'lambdalisue/gina.vim'
|
|
||||||
Plug 'gregsexton/gitv'
|
|
||||||
Plug 'gisphm/vim-gitignore'
|
|
||||||
Plug 'sjl/splice.vim'
|
|
||||||
|
|
||||||
|
|
||||||
" other filetype specific plugins
|
|
||||||
Plug 'jamessan/vim-gnupg'
|
|
||||||
let g:no_cecutil_maps = 1
|
|
||||||
Plug 'powerman/vim-plugin-AnsiEsc'
|
|
||||||
Plug 'tpope/vim-markdown'
|
|
||||||
Plug 'lervag/vimtex'
|
|
||||||
" let g:vimtex_compiler_method = 'arara'
|
|
||||||
Plug 'ledger/vim-ledger'
|
|
||||||
Plug 'anekos/hledger-vim'
|
|
||||||
Plug 'elzr/vim-json'
|
|
||||||
Plug 'kchmck/vim-coffee-script'
|
|
||||||
Plug 'gre/play2vim'
|
|
||||||
Plug 'isobit/vim-caddyfile'
|
|
||||||
Plug 'vim-pandoc/vim-pandoc'
|
|
||||||
Plug 'vim-pandoc/vim-pandoc-syntax'
|
|
||||||
Plug 'GEverding/vim-hocon'
|
|
||||||
Plug 'nfnty/vim-nftables'
|
|
||||||
|
|
||||||
function! BuildComposer(info)
|
|
||||||
if a:info.status != 'unchanged' || a:info.force
|
|
||||||
if has('nvim')
|
|
||||||
!cargo build --release
|
|
||||||
else
|
|
||||||
!cargo build --release --no-default-features --features json-rpc
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
Plug 'euclio/vim-markdown-composer', { 'do': function('BuildComposer') }
|
|
||||||
|
|
||||||
call plug#end()
|
|
||||||
|
|
||||||
" vim:ft=vim foldmethod=marker
|
|
||||||
1
plugin/ansible-ftdetect.vim
Normal file
1
plugin/ansible-ftdetect.vim
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
au BufRead,BufNewFile */ansible-playbooks/*.yml set filetype=yaml.ansible
|
||||||
16
plugin/centerscroll.lua
Normal file
16
plugin/centerscroll.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
-- " from https://vi.stackexchange.com/a/26055
|
||||||
|
-- augroup KeepCentered
|
||||||
|
-- autocmd!
|
||||||
|
-- autocmd CursorMoved * if &buftype == '' | normal! zz | endif
|
||||||
|
-- augroup END
|
||||||
|
|
||||||
|
vim.api.nvim_create_augroup("KeepCentered", { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd("CursorMoved", {
|
||||||
|
group = "KeepCentered",
|
||||||
|
pattern = "*",
|
||||||
|
callback = function()
|
||||||
|
if vim.o.buftype == "" then
|
||||||
|
vim.cmd([[normal! zz]])
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
67
plugin/on-attach.lua
Normal file
67
plugin/on-attach.lua
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
local on_attach = function(args)
|
||||||
|
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
|
if client.server_capabilities.completionProvider then
|
||||||
|
--Enable completion triggered by <c-x><c-o>
|
||||||
|
vim.bo[args.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||||
|
end
|
||||||
|
if client.server_capabilities.definitionProvider then
|
||||||
|
vim.bo[args.buf].tagfunc = "v:lua.vim.lsp.tagfunc"
|
||||||
|
end
|
||||||
|
--
|
||||||
|
|
||||||
|
local function diag_jump(count)
|
||||||
|
return function()
|
||||||
|
vim.diagnostic.jump({ count = count, float = true })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Mappings.
|
||||||
|
-- stylua: ignore start
|
||||||
|
for _, mapping in ipairs({
|
||||||
|
{ 'gD', vim.lsp.buf.declaration, "Go to declaration" },
|
||||||
|
{ 'gd', require('telescope.builtin').lsp_definitions, "Go to definition" },
|
||||||
|
{ 'gi', vim.lsp.buf.implementation, "Go to implementation" },
|
||||||
|
{ '<C-k>', vim.lsp.buf.signature_help, "Show signature help" },
|
||||||
|
{ '<Leader>D', vim.lsp.buf.type_definition, "Go to type definition" },
|
||||||
|
{ '<Leader>rn', vim.lsp.buf.rename, "Rename" },
|
||||||
|
{ '<M-x>', vim.lsp.buf.code_action, "Code action" },
|
||||||
|
{ '<M-return>', vim.lsp.buf.code_action, "Code action" },
|
||||||
|
{ '<M-s>', vim.lsp.codelens.run, "Run code lens" },
|
||||||
|
{ 'gr', function() require('telescope.builtin').lsp_references() end,"Go to references" },
|
||||||
|
{ '<M-e>', vim.diagnostic.open_float, "Open diagnostics" },
|
||||||
|
{ '[d', diag_jump(-1), "Go to previous diagnostic" },
|
||||||
|
{ ']d', diag_jump(1), "Go to next diagnostic" },
|
||||||
|
{ '<F2>', diag_jump(1), "Go to next diagnostic" },
|
||||||
|
{ '<M-q>', vim.diagnostic.setloclist, "Add buffer diagnostics to location list" },
|
||||||
|
{ "<leader>dc", function() require("dap").continue() end, "Debug: Continue" },
|
||||||
|
{ "<leader>dK", function() require("dap.ui.widgets").hover() end, "Debug: Hover" },
|
||||||
|
{ "<leader>dt", function() require("dap").toggle_breakpoint() end, "Debug: Toggle breakpoint" },
|
||||||
|
{ "<leader>dso", function() require("dap").step_over() end, "Debug: Step over" },
|
||||||
|
{ "<leader>dsi", function() require("dap").step_into() end, "Debug: Step into" },
|
||||||
|
{ "<leader>dl", function() require("dap").run_last() end, "Debug: Run last" },
|
||||||
|
{ "<F5>", function() require("dap").continue() end, "Debug: Continue" },
|
||||||
|
{ "<M-h>", function() require("dap.ui.widgets").hover() end, "Debug: Hover" },
|
||||||
|
{ "<F7>", function() require("dap").step_over() end, "Debug: Step over" },
|
||||||
|
{ "<F8>", function() require("dap").step_into() end, "Debug: Step into" },
|
||||||
|
{ "<leader>aa", vim.diagnostic.setqflist, "Add all diagnostics to quickfix list" },
|
||||||
|
{ "<leader>aw", function() vim.diagnostic.setqflist({ severity = "W" }) end, "Add all warnings to quickfix list" },
|
||||||
|
{ "<leader>ae", function() vim.diagnostic.setqflist({ severity = "E" }) end, "Add all errors to quickfix list" },
|
||||||
|
}) do
|
||||||
|
vim.keymap.set("n", mapping[1], mapping[2], { silent = true, buffer = args.buf, desc = mapping[3] })
|
||||||
|
end
|
||||||
|
-- stylua: ignore end
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>dr", function()
|
||||||
|
require("dap").repl.toggle()
|
||||||
|
end, { silent = true, desc = "Toogle debug REPL" })
|
||||||
|
|
||||||
|
if client.server_capabilities.documentHighlightingProvider then
|
||||||
|
vim.cmd([[autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()]])
|
||||||
|
vim.cmd([[autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()]])
|
||||||
|
vim.cmd([[autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()]])
|
||||||
|
end
|
||||||
|
|
||||||
|
require("workspace-diagnostics").populate_workspace_diagnostics(client, args.buf)
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", { callback = on_attach })
|
||||||
11
plugin/scaladeps.lua
Normal file
11
plugin/scaladeps.lua
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
local sbtToScalaCLI = function()
|
||||||
|
vim.cmd([[s/\s*libraryDependencies\s*+=\s*/\/\/> using dep /]])
|
||||||
|
vim.cmd([[s/" \(%\+\) "/\=repeat(":", strlen(submatch(1)))/g]])
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set(
|
||||||
|
"n",
|
||||||
|
"<leader>dep",
|
||||||
|
sbtToScalaCLI,
|
||||||
|
{ noremap = true, silent = true, desc = "Convert sbt dependency to Scala CLI" }
|
||||||
|
)
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
if exists("b:current_syntax")
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
syn include @EmbeddedLua syntax/lua.vim
|
|
||||||
syn include @EmbeddedPreproc syntax/c.vim
|
|
||||||
|
|
||||||
syn match toluaString "\".*\""
|
|
||||||
syn match toluaInclude "<.*>"
|
|
||||||
syn region toluaEmbeddedLua matchgroup=toluaEmbeddedDelimiter
|
|
||||||
\ start="^\$\[" end="^\$\]" contains=@EmbeddedLua
|
|
||||||
syn match toluaCInclude "^\$#.*$" contains=toluaString,toluaInclude
|
|
||||||
|
|
||||||
syn keyword toluaStatement module nextgroup=toluaModuleName skipwhite
|
|
||||||
syn match toluaModuleName "[_a-zA-Z]\+" contained
|
|
||||||
|
|
||||||
syn match toluaRename "@ [_a-zA-Z]\+"
|
|
||||||
|
|
||||||
" from c syntax file
|
|
||||||
syn keyword cType int long short char void
|
|
||||||
syn keyword cType signed unsigned float double
|
|
||||||
syn keyword luaState lua_State
|
|
||||||
|
|
||||||
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell extend
|
|
||||||
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell extend
|
|
||||||
syn keyword cStructure struct union enum typedef
|
|
||||||
syn keyword cStorageClass static register auto volatile extern const
|
|
||||||
|
|
||||||
let b:current_syntax = "tolua"
|
|
||||||
|
|
||||||
hi def link toluaEmbeddedDelimiter Special
|
|
||||||
hi def link toluaCInclude PreProc
|
|
||||||
hi def link toluaString String
|
|
||||||
hi def link toluaInclude String
|
|
||||||
hi def link toluaStatement Statement
|
|
||||||
hi def link toluaModuleName Identifier
|
|
||||||
hi def link toluaRename Special
|
|
||||||
hi def link cType Type
|
|
||||||
hi def link luaState Type
|
|
||||||
hi def link cStorageClass StorageClass
|
|
||||||
hi def link cStructure Structure
|
|
||||||
25
syntax/vtt.vim
Normal file
25
syntax/vtt.vim
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
" Vim syntax file
|
||||||
|
" Language: Web Video Text Tracks Format (VTT)
|
||||||
|
" Filenames: *.vtt
|
||||||
|
" Vim syntax file
|
||||||
|
" SeeAlso: <https://developer.mozilla.org/en-US/docs/Web/API/WebVTT_API>
|
||||||
|
" Maintainer: Alexander Gehrke
|
||||||
|
" Created: 2023-12-19
|
||||||
|
|
||||||
|
if version < 600
|
||||||
|
syntax clear
|
||||||
|
elseif exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn region vttComment start="^NOTE .*" end="^$"
|
||||||
|
syn match vttTimings "\d\{2}:\d\{2}\.\d\{3}"
|
||||||
|
syn match vttArrow "-->"
|
||||||
|
syn keyword vttHeader WEBVTT
|
||||||
|
|
||||||
|
hi def link vttTimings Number
|
||||||
|
hi def link vttArrow Special
|
||||||
|
hi def link vttComment Comment
|
||||||
|
hi def link vttHeader Keyword
|
||||||
|
|
||||||
|
let b:current_syntax = "vtt"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue