Compare commits

..

No commits in common. "master" and "metals-dap" have entirely different histories.

88 changed files with 3705 additions and 1640 deletions

View file

@ -1,15 +0,0 @@
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
after/ftplugin/bib.vim Normal file
View file

@ -0,0 +1 @@
map <nowait> <silent> <Leader>f :%!bibformat<CR>

4
after/ftplugin/c.vim Normal file
View file

@ -0,0 +1,4 @@
let c_space_errors = 1
let c_space_errors = 1
let c_no_comment_fold = 1
let g:syntastic_c_checkers=['make']

View file

@ -0,0 +1 @@
imap <buffer> <// </<C-X><C-O><esc>==A

View file

@ -1,30 +0,0 @@
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" })

42
after/ftplugin/java.vim Normal file
View file

@ -0,0 +1,42 @@
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
"}}}

View file

@ -1,3 +1,3 @@
iabbr mfg Mit freundlichen Grüßen iabbr mfg Mit freundlichen Grüßen
setlocal spell
setlocal fdl=99 set fdl=99

View file

@ -1,4 +1,10 @@
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

View file

@ -1,9 +1,5 @@
imap <C-/> <Plug>(codelines-close)<CR> imap //< <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()

View file

@ -1,3 +0,0 @@
vim.keymap.set("n", "<leader>s", function()
require("nvim-quick-switcher").toggle("tsx", "scss")
end, { buffer = true })

View file

@ -1,3 +1,11 @@
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(

View file

@ -1,83 +0,0 @@
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 tree = vim.treesitter.get_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()"

View file

@ -1 +0,0 @@
typescript.lua

18
after/plugin/airline.vim Normal file
View file

@ -0,0 +1,18 @@
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'])

View file

@ -0,0 +1,2 @@
let g:formatdef_scalafmt = '"scalafmt --stdin 2>/dev/null"'
let g:formatters_scala = ['scalafmt']

View file

@ -1,3 +1,4 @@
"{{{ 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")
@ -7,4 +8,5 @@ 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()
"}}} "}}}

View file

@ -0,0 +1,17 @@
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

20
after/plugin/coc.vim Normal file
View file

@ -0,0 +1,20 @@
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

7
after/plugin/compe.vim Normal file
View file

@ -0,0 +1,7 @@
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

7
after/plugin/fzf.vim Normal file
View file

@ -0,0 +1,7 @@
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)

19
after/plugin/general.vim Normal file
View file

@ -0,0 +1,19 @@
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>

View file

@ -1,3 +0,0 @@
vim.api.nvim_create_user_command("Trash", function()
require("genghis").trashFile({ trashCmd = "rm" })
end, { desc = "Delete current file" })

View file

@ -0,0 +1,5 @@
hi link GitGutterAddLineNr DiffAdd
hi link GitGutterChangeLineNr DiffChange
hi link GitGutterDeleteLineNr DiffDelete
hi link GitGutterChangeDeleteLineNr GitGutterChangeLine
GitGutterLineNrHighlightsEnable

View file

@ -0,0 +1,2 @@
":let g:metals_server_version = '0.10.6-M1+29-22f5a4b1-SNAPSHOT'
"let g:metals_server_version = '0.10.6-M1'

View file

@ -0,0 +1,7 @@
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']

45
after/plugin/tabline.vim Normal file
View file

@ -0,0 +1,45 @@
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()

View file

@ -0,0 +1,3 @@
" search for symbols
map gs :Telescope lsp_dynamic_workspace_symbols<cr>

View file

@ -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,
},
})

View file

@ -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 })

4
after/plugin/vimtex.vim Normal file
View file

@ -0,0 +1,4 @@
let g:vimtex_quickfix_ignorefilters = [
\ 'overfull',
\ 'underfull',
\]

2812
autoload/plug.vim Normal file

File diff suppressed because it is too large Load diff

8
coc-settings.json Normal file
View file

@ -0,0 +1,8 @@
{
"languageserver": {
"turtle": {
"command": "turtle_lsp",
"filetypes": ["ttl", "turtle"]
}
}
}

2
ftdetect/cocor.vim Normal file
View file

@ -0,0 +1,2 @@
au! BufRead,BufNewFile *.atg setfiletype coco
au! BufRead,BufNewFile *.wili setfiletype wili

View file

@ -1,24 +0,0 @@
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
ftdetect/hocon.vim Normal file
View file

@ -0,0 +1 @@
au! BufNewFile,BufRead .scalafmt.conf set ft=hocon syntax=hocon

8
ftdetect/kitty.vim Normal file
View file

@ -0,0 +1,8 @@
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
ftdetect/sieve.vim Normal file
View file

@ -0,0 +1 @@
au! BufNewFile,BufRead *.sieve set ft=sieve syntax=sieve

1
ftdetect/tolua.vim Normal file
View file

@ -0,0 +1 @@
au! BufRead,BufNewFile tolua_*.pkg set ft=tolua syntax=tolua

View file

@ -1 +1 @@
au BufRead,BufNewFile *.ttl set filetype=turtle au BufRead,BufNewFile *.ttl set filetype=rdf-turtle

2
ftdetect/xwiki.vim Normal file
View file

@ -0,0 +1,2 @@
au! BufNewFile,BufRead *.xwiki set ft=xwiki syntax=xwiki

View file

@ -1,60 +0,0 @@
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,
},
},
},
},
})

132
init.lua
View file

@ -1,132 +0,0 @@
if vim.env["VIRTUAL_ENV"] ~= nil then
vim.g.python3_host_prog = vim.fn.system("which -a python3 | sed -n 2p | tr -d '\n'")
else
vim.g.python3_host_prog = vim.fn.system("which python3 | tr -d '\n'")
end
-- 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
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" })

199
init.vim Normal file
View file

@ -0,0 +1,199 @@
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

View file

@ -1,75 +0,0 @@
{
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
"Vim-Jinja2-Syntax": { "branch": "master", "commit": "2c17843b074b06a835f88587e1023ceff7e2c7d1" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" },
"copilot-cmp": { "branch": "master", "commit": "15fc12af3d0109fa76b60b5cffa1373697e261d1" },
"copilot.lua": { "branch": "master", "commit": "30321e33b03cb924fdcd6a806a0dc6fa0b0eafb9" },
"deepl.vim": { "branch": "main", "commit": "59df8cc17bb28989ce562bf4712c724d23baadcd" },
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
"gen.nvim": { "branch": "main", "commit": "e09a8dbffa139ad60d5b47998fcc8669ead1ebf4" },
"gina.vim": { "branch": "master", "commit": "ff6c2ddeca98f886b57fb42283c12e167d6ab575" },
"gitsigns.nvim": { "branch": "main", "commit": "4c40357994f386e72be92a46f41fc1664c84c87d" },
"hover.nvim": { "branch": "main", "commit": "140c4d0ae9397b76baa46b87c574f5377de09309" },
"indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lsp-colors.nvim": { "branch": "main", "commit": "2bbe7541747fd339bdd8923fc45631a09bb4f1e5" },
"lsp-progress.nvim": { "branch": "main", "commit": "f3df1df8f5ea33d082db047b5d2d2b83cc01cd8a" },
"lsp_signature.nvim": { "branch": "master", "commit": "693b75f1dc31f5af45ceb762966a6ab00af1850b" },
"lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
"lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" },
"lush.nvim": { "branch": "main", "commit": "45a79ec4acb5af783a6a29673a999ce37f00497e" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
"neoconf.nvim": { "branch": "main", "commit": "9cc9425be8360827b29d97e21d1a0e111f432099" },
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
"nvim-cmp": { "branch": "main", "commit": "5a11682453ac6b13dbf32cd403da4ee9c07ef1c3" },
"nvim-dap": { "branch": "master", "commit": "379cf26e9c457b66a0152cd5d018418c03720d47" },
"nvim-genghis": { "branch": "main", "commit": "99ca8b9e6e6bae0899cc2902f4103204572ac8ee" },
"nvim-jdtls": { "branch": "master", "commit": "2f7bff9b8d2ee1918b36ca55f19547d9d335a268" },
"nvim-lint": { "branch": "master", "commit": "6e9dd545a1af204c4022a8fcd99727ea41ffdcc8" },
"nvim-lspconfig": { "branch": "master", "commit": "99c75820f2606b6b446cad7c75ec2ef7ee8a1317" },
"nvim-luadev": { "branch": "master", "commit": "3ba0c02c378503739f1fdb95cff3ea2aad48db3e" },
"nvim-metals": { "branch": "main", "commit": "5d27f4918ea954772725d6741f84a71cfaff932a" },
"nvim-quick-switcher": { "branch": "main", "commit": "b56ba55cff165ae1551836a79313933bf4d43ae2" },
"nvim-treesitter": { "branch": "master", "commit": "93ce9feb4fabbb37b3e7f47d80f27be778f4d956" },
"nvim-treesitter-context": { "branch": "master", "commit": "198720b4016af04c9590f375d714d5bf8afecc1a" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" },
"nvim-web-devicons": { "branch": "master", "commit": "1020869742ecb191f260818234517f4a1515cfe8" },
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
"shipwright.nvim": { "branch": "master", "commit": "e596ab48328c31873f4f4d2e070243bf9de16ff3" },
"splice.vim": { "branch": "master", "commit": "815a28e687fdf78b67e9b9cd4c21277bbe658873" },
"suda.vim": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "2a5ceff981501cff8f46871d5402cd3378a8ab6a" },
"telescope-lsp-handlers.nvim": { "branch": "trunk", "commit": "de02085d6af1633942549a238bc7a5524fa9b201" },
"telescope.nvim": { "branch": "master", "commit": "814f102cd1da3dc78c7d2f20f2ef3ed3cdf0e6e4" },
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
"vim-caddyfile": { "branch": "master", "commit": "24fe0720551883e407cb70ae1d7c03f162d1d5a0" },
"vim-characterize": { "branch": "master", "commit": "a8bffac6cead6b2869d939ecad06312b187a4c79" },
"vim-commentary": { "branch": "master", "commit": "64a654ef4a20db1727938338310209b6a63f60c9" },
"vim-easy-align": { "branch": "master", "commit": "9815a55dbcd817784458df7a18acacc6f82b1241" },
"vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" },
"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": "ceaae754267f9578b6313890596ee34a19c00dad" },
"vim-ledger": { "branch": "master", "commit": "aabf1976dfefe5665233c600421aea2798ff7ea0" },
"vim-markdown-composer": { "branch": "master", "commit": "e6f99bc20cfcb277c63041b1f766e6d5940bcc76" },
"vim-mkdir": { "branch": "master", "commit": "f0ba7a7dc190a0cedf1d827958c99f3718109cf0" },
"vim-nftables": { "branch": "master", "commit": "26f8a506c6f3e41f1e4a8d6aa94c9a79a666bbff" },
"vim-pass": { "branch": "master", "commit": "71adc31459d2ebd5d51c9d8214b111be8c86b833" },
"vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" },
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
"vim-textobj-comment": { "branch": "master", "commit": "58ae4571b76a5bf74850698f23d235eef991dd4b" },
"vim-textobj-user": { "branch": "master", "commit": "41a675ddbeefd6a93664a4dc52f302fe3086a933" },
"vimtex": { "branch": "master", "commit": "096a0450261abccb7944630fae66788712be46a8" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
}

View file

@ -1,3 +0,0 @@
{
"workspace.checkThirdParty": false
}

View file

@ -1,61 +0,0 @@
-- 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 = {
Error = "",
Warn = "",
Hint = "",
Info = "",
},
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 = "",
},
},
}

51
lua/conf/cmp.lua Normal file
View file

@ -0,0 +1,51 @@
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' }
})
})

View file

@ -0,0 +1,17 @@
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,
}

3
lua/conf/telescope.lua Normal file
View file

@ -0,0 +1,3 @@
telescope = require('telescope')
telescope.load_extension('fzf_native')
telescope.load_extension('lsp_handlers')

16
lua/conf/treesitter.lua Normal file
View 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
lua/conf/trouble.lua Normal file
View 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>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})

View file

@ -1,39 +0,0 @@
-- Setup nvim-cmp.
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
--vim.fn["vsnip#anonymous"](args.body)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = {
["<C-d>"] = 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({ select = true }),
},
sources = {
{ name = "nvim_lsp" },
-- For vsnip user.
{ name = "vsnip" },
-- For luasnip user.
-- { name = 'luasnip' },
-- For ultisnips user.
-- { name = 'ultisnips' },
{ name = "buffer" },
},
})
-- Setup lsp.
metals_config = require("metals").bare_config
metals_config.init_options.statusBarProvider = "on"
metals_config.settings = { showImplicitArguments = true }
metals_config.on_attach = on_attach
metals_config.capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())

View file

@ -1,50 +0,0 @@
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

8
lua/lsp/installer.lua Normal file
View file

@ -0,0 +1,8 @@
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)

46
lua/lsp/metals.lua Normal file
View file

@ -0,0 +1,46 @@
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

13
lua/lsp/typescript.lua Normal file
View file

@ -0,0 +1,13 @@
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

44
lua/lsputils.lua Normal file
View file

@ -0,0 +1,44 @@
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

79
lua/my-lsp.lua Normal file
View file

@ -0,0 +1,79 @@
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})]]

View file

@ -1,10 +0,0 @@
return {
"crater2150/vim-theme-chroma",
dev = true,
lazy = false,
branch = "lush",
priority = 1000,
config = function()
vim.cmd.colorscheme("chroma")
end,
}

View file

@ -1,121 +0,0 @@
return {
{
"hrsh7th/nvim-cmp",
-- load cmp on InsertEnter
event = "InsertEnter",
-- these dependencies will only be loaded when cmp loads
-- dependencies are always lazy-loaded unless specified otherwise
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
-- 'hrsh7th/cmp-vsnip',
-- 'hrsh7th/vim-vsnip',
-- 'hrsh7th/vim-vsnip-integ',
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"onsails/lspkind.nvim",
{
"zbirenbaum/copilot-cmp",
dependencies = {
"hrsh7th/nvim-cmp",
{
"zbirenbaum/copilot.lua",
opts = {
suggestion = { enabled = false },
panel = { enabled = false },
filetypes = {
mail = false,
text = false,
},
},
},
},
config = function()
require("copilot_cmp").setup()
end,
},
},
config = function()
local cmp = require("cmp")
local lspkind = require("lspkind")
local luasnip = require("luasnip")
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0
and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
cmp.setup({
snippet = {
expand = function(args)
--vim.fn["vsnip#anonymous"](args.body)
require("luasnip").lsp_expand(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.abort(),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
["<C-CR>"] = cmp.mapping({
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
else
fallback()
end
end,
s = cmp.mapping.confirm({ select = true }),
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- they way you will only jump inside the snippet region
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
},
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "copilot" },
}, {
{ name = "buffer", option = { keyword_pattern = [[\k\+]] } },
--{ name = 'path' },
}),
formatting = {
format = lspkind.cmp_format({
mode = "symbol_text", -- show only symbol annotations
maxwidth = 80, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
ellipsis_char = "", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
symbol_map = { Copilot = "" },
}),
},
})
end,
},
}

View file

@ -1,33 +0,0 @@
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 = {
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" },
},
},
},
}

View file

@ -1,29 +0,0 @@
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,
}

View file

@ -1,3 +0,0 @@
return {
"mfussenegger/nvim-lint",
}

View file

@ -1,5 +0,0 @@
return {
{ "ledger/vim-ledger", ft = "ledger" },
{ "nfnty/vim-nftables", ft = "nftables" },
{ "jvirtanen/vim-hocon", ft = "hocon" },
}

View file

@ -1 +0,0 @@
return { "tpope/vim-fugitive" }

View file

@ -1,11 +0,0 @@
return {
"David-Kunz/gen.nvim",
opts = {
model = "mistral", -- The default model to use.
init = false,
},
cmd = "Gen",
keys = {
{ "<leader>llm", ":Gen<CR>", mode = "n" },
},
}

View file

@ -1,14 +0,0 @@
return {
"lambdalisue/gina.vim",
"gisphm/vim-gitignore",
"sjl/splice.vim",
{
"lewis6991/gitsigns.nvim",
config = {
signs = {
add = { text = "" },
change = { text = "" },
},
},
},
}

View file

@ -1,23 +0,0 @@
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,
}

View file

@ -1,49 +0,0 @@
return {
"pbrisbin/vim-mkdir",
"fladson/vim-kitty",
"tpope/vim-repeat",
"tpope/vim-surround",
"tpope/vim-characterize",
"tpope/vim-commentary",
{ "chrisgrieser/nvim-genghis", dependencies = "stevearc/dressing.nvim" },
-- 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" },
},
{
"ray-x/lsp_signature.nvim",
config = function()
require("lsp_signature").setup({})
end,
},
"kyazdani42/nvim-web-devicons",
"folke/trouble.nvim",
"folke/lsp-colors.nvim",
"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',

View file

@ -1,180 +0,0 @@
return {
-- lspconfig
{
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
{ "folke/neoconf.nvim", cmd = "Neoconf", config = true },
{ "folke/neodev.nvim", opts = {} },
"mason.nvim",
"williamboman/mason-lspconfig.nvim",
"hrsh7th/cmp-nvim-lsp",
},
---@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 },
},
},
},
},
lemminx = {
settings = { xml = { server = { workDir = "~/.cache/lemminx" } } },
},
},
-- 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
for name, icon in pairs(require("common").icons.diagnostics) do
name = "DiagnosticSign" .. name
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
end
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))
local servers = opts.servers
local capabilities = vim.tbl_deep_extend(
"force",
{},
vim.lsp.protocol.make_client_capabilities(),
require("cmp_nvim_lsp").default_capabilities(),
opts.capabilities or {}
)
local function setup(server)
local server_opts = vim.tbl_deep_extend("force", {
capabilities = vim.deepcopy(capabilities),
}, servers[server] or {})
if opts.setup[server] then
if opts.setup[server](server, server_opts) then
return
end
elseif opts.setup["*"] then
if opts.setup["*"](server, server_opts) then
return
end
end
require("lspconfig")[server].setup(server_opts)
end
-- get all the servers that are available thourgh mason-lspconfig
local have_mason, mlsp = pcall(require, "mason-lspconfig")
local all_mslp_servers = {}
if have_mason then
all_mslp_servers = vim.tbl_keys(require("mason-lspconfig.mappings.server").lspconfig_to_package)
end
local ensure_installed = {} ---@type string[]
for server, server_opts in pairs(servers) do
if server_opts then
server_opts = server_opts == true and {} or server_opts
-- run manual setup if mason=false or if this is a server that cannot be installed with mason-lspconfig
if server_opts.mason == false or not vim.tbl_contains(all_mslp_servers, server) then
setup(server)
else
ensure_installed[#ensure_installed + 1] = server
end
end
end
if have_mason then
mlsp.setup({ ensure_installed = ensure_installed, handlers = { setup } })
end
end,
},
-- formatters
-- cmdline tools and lsp servers
{
"williamboman/mason.nvim",
cmd = "Mason",
opts = {
ensure_installed = {
"jdtls",
"lua-language-server",
},
},
---@param opts MasonSettings | {ensure_installed: string[]}
config = function(_, opts)
require("mason").setup(opts)
local mr = require("mason-registry")
local function ensure_installed()
for _, tool in ipairs(opts.ensure_installed) do
local p = mr.get_package(tool)
if not p:is_installed() then
p:install()
end
end
end
if mr.refresh then
mr.refresh(ensure_installed)
else
ensure_installed()
end
end,
},
"mfussenegger/nvim-jdtls",
}

View file

@ -1,3 +0,0 @@
return {
"bfredl/nvim-luadev",
}

View file

@ -1,11 +0,0 @@
return {
"rktjmp/lush.nvim",
cmd = {
"Lushify",
"LushImport",
"LushRunTutorial",
},
dependencies = {
"rktjmp/shipwright.nvim",
},
}

View file

@ -1,7 +0,0 @@
return {
"euclio/vim-markdown-composer",
build = "cargo build --release",
enabled = function()
return vim.fn.executable("cargo")
end,
}

View file

@ -1,65 +0,0 @@
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,
}

View file

@ -1,86 +0,0 @@
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.tbl_flatten(vim.fn.winlayout(context.tabnr)))
return name
.. (wincount > 1 and " +" .. (wincount - 1) or "")
.. (mod and " [✏️]]" or "")
end,
},
},
},
sections = {
lualine_a = { "filename" },
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" },
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,
}

View file

@ -1,59 +0,0 @@
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" },
}
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,
}

View file

@ -1,148 +0,0 @@
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,
},
}

View file

@ -1,24 +0,0 @@
return {
{
"stevearc/dressing.nvim",
enabled = true,
dependencies = {
--'nvim-telescope/telescope-ui-select.nvim',
},
opts = {
select = {
backend = { "telescope" },
},
},
},
{
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
tag = "v3.5.4",
opts = {
whitespace = { highlight = { "Whitespace", "CursorLine" }, remove_blankline_trail = false },
indent = { highlight = { "Whitespace", "CursorLine" }, char = "" },
scope = { enabled = true },
},
},
}

View file

@ -1,10 +0,0 @@
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",
}

View file

@ -1,9 +0,0 @@
return {
"folke/which-key.nvim",
event = "VeryLazy",
init = function()
vim.o.timeout = true
vim.o.timeoutlen = 300
end,
opts = {},
}

118
packages.vim Normal file
View file

@ -0,0 +1,118 @@
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

View file

@ -1,16 +0,0 @@
-- " 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,
})

View file

@ -1,62 +0,0 @@
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
--
-- 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-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', vim.diagnostic.goto_prev, "Go to previous diagnostic" },
{ ']d', vim.diagnostic.goto_next, "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.signatureHelpProvider then
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})]])
end
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
end
vim.api.nvim_create_autocmd("LspAttach", { callback = on_attach })

View file

@ -1,11 +0,0 @@
vim.g.clipboard = {
name = "OSC 52",
copy = {
["+"] = require("vim.ui.clipboard.osc52").copy("+"),
["*"] = require("vim.ui.clipboard.osc52").copy("*"),
},
paste = {
["+"] = require("vim.ui.clipboard.osc52").paste("+"),
["*"] = require("vim.ui.clipboard.osc52").paste("*"),
},
}

View file

@ -1,11 +0,0 @@
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" }
)

41
syntax/tolua.vim Normal file
View file

@ -0,0 +1,41 @@
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

View file

@ -1,25 +0,0 @@
" 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"