chore: format everything with stylua and update

This commit is contained in:
Alexander Gehrke 2025-02-26 11:22:27 +01:00
parent 473d78494e
commit e90763e223
22 changed files with 273 additions and 222 deletions

View file

@ -8,6 +8,7 @@ charset = utf-8
[*.{lua,vim}]
indent_size = tab
indent_style = tab
tab_width = 4
trim_trailing_whitespace = true
[*.{lua}]

View file

@ -1,22 +1,30 @@
vim.api.nvim_buf_set_option(0, 'textwidth', 120)
vim.cmd.iabbrev('syso', 'System.out.println')
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' })
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" })

View file

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

View file

@ -1,33 +1,46 @@
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 })
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
if not node then
return false
end
local parent = node:parent()
if not parent then return false end
if not parent then
return false
end
local grandparent = parent:parent()
if not grandparent then return false end
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
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
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 .. "\"))")
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()
@ -37,17 +50,19 @@ local function goToCSSClassDefinition()
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')
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 })
require("nvim-quick-switcher").toggle("tsx", "scss", { only_existing = true })
end
return true
end
@ -56,9 +71,12 @@ 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.keymap.set("n", "gd", function()
if not goToCSSClassDefinition() then
require("telescope.builtin").lsp_definitions()
end
end, { buffer = true })
end,
})
vim.o.foldmethod = "expr"

View file

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

View file

@ -1,4 +1,4 @@
require 'nvim-treesitter.configs'.setup {
require("nvim-treesitter.configs").setup({
ensure_installed = { "typescript" },
sync_install = true,
auto_install = true,
@ -11,6 +11,6 @@ require 'nvim-treesitter.configs'.setup {
additional_vim_regex_highlighting = false,
},
indent = {
enable = true
enable = true,
},
}
})

View file

@ -1,8 +1,8 @@
require("trouble").setup {
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 })

View file

@ -1,21 +1,24 @@
local path = require("mason-core.path")
local function mason_package(...)
return path.concat { vim.fn.stdpath("data"), "mason", "packages", ... }
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)
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({
require("jdtls").start_or_attach({
cmd = { mason_package("jdtls", "bin", "jdtls") },
on_attach = function(client, bufnr)
require 'jdtls'.setup_dap()
require("jdtls").setup_dap()
end,
init_options = {
bundles = extra_bundles
bundles = extra_bundles,
},
settings = {
java = {
@ -27,7 +30,7 @@ require('jdtls').start_or_attach({
"org.junit.jupiter.api.Assertions.*",
"java.util.Objects.requireNonNull",
"java.util.Objects.requireNonNullElse",
"org.mockito.Mockito.*"
"org.mockito.Mockito.*",
},
filteredTypes = {
"com.sun.*",
@ -39,7 +42,7 @@ require('jdtls').start_or_attach({
},
codeGeneration = {
toString = {
template = "${object.className}{${member.name()}=${member.value}, ${otherMembers}}"
template = "${object.className}{${member.name()}=${member.value}, ${otherMembers}}",
},
hashCodeEquals = {
useJava7Objects = true,
@ -52,6 +55,6 @@ require('jdtls').start_or_attach({
staticStarThreshold = 5,
},
},
}
}
},
},
})

View file

@ -1,67 +1,67 @@
{
"LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" },
"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": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conform.nvim": { "branch": "master", "commit": "1a99fdc1d3aa9ccdf3021e67982a679a8c5c740c" },
"copilot-cmp": { "branch": "master", "commit": "b6e5286b3d74b04256d0a7e3bd2908eabec34b44" },
"copilot.lua": { "branch": "master", "commit": "1a237cf50372830a61d92b0adf00d3b23882e0e1" },
"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": "c5775a888adbc50652cb370073fcfec963eca93e" },
"gen.nvim": { "branch": "main", "commit": "c9a73d8c0d462333da6d2191806ff98f2884d706" },
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
"gen.nvim": { "branch": "main", "commit": "e09a8dbffa139ad60d5b47998fcc8669ead1ebf4" },
"gina.vim": { "branch": "master", "commit": "ff6c2ddeca98f886b57fb42283c12e167d6ab575" },
"gitsigns.nvim": { "branch": "main", "commit": "1ef74b546732f185d0f806860fa5404df7614f28" },
"hover.nvim": { "branch": "main", "commit": "4339cbbcb572b1934c53dcb66ad4bf6a0abb7918" },
"gitsigns.nvim": { "branch": "main", "commit": "4c40357994f386e72be92a46f41fc1664c84c87d" },
"hover.nvim": { "branch": "main", "commit": "140c4d0ae9397b76baa46b87c574f5377de09309" },
"indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
"lazy.nvim": { "branch": "main", "commit": "48b52b5cfcf8f88ed0aff8fde573a5cc20b1306d" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lsp-colors.nvim": { "branch": "main", "commit": "2bbe7541747fd339bdd8923fc45631a09bb4f1e5" },
"lsp-progress.nvim": { "branch": "main", "commit": "d5f4d28efe75ce636bfbe271eb45f39689765aab" },
"lsp_signature.nvim": { "branch": "master", "commit": "a38da0a61c172bb59e34befc12efe48359884793" },
"lspkind.nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" },
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
"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": "25c11854aa25558ee6c03432edfa0df0217324be" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"neoconf.nvim": { "branch": "main", "commit": "ce074ec29a6a65bfe2064dbed99a25f3d6ddd1fa" },
"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": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
"nvim-dap": { "branch": "master", "commit": "90616ae6ae40053103dc66872886fc26b94c70c8" },
"nvim-genghis": { "branch": "main", "commit": "382ddb90a31313f0b2e059db50df0ca4dd2859d2" },
"nvim-jdtls": { "branch": "master", "commit": "99e4b2081de1d9162666cc7b563cbeb01c26b66b" },
"nvim-lint": { "branch": "master", "commit": "2bb7cc049d129d7fdbf31db0bc34fad5dd216f0d" },
"nvim-lspconfig": { "branch": "master", "commit": "bb682c167a0878338b4313b55538953d1c039085" },
"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": "1b87e6bfa4174b5fbaee9ca7ec79d8eae8df7f18" },
"nvim-metals": { "branch": "main", "commit": "5d27f4918ea954772725d6741f84a71cfaff932a" },
"nvim-quick-switcher": { "branch": "main", "commit": "b56ba55cff165ae1551836a79313933bf4d43ae2" },
"nvim-treesitter": { "branch": "master", "commit": "e0338f2b74fbad808f2569c7d4eadd8796af2118" },
"nvim-treesitter-context": { "branch": "master", "commit": "e6cc783b74606d97ca9eff6494e3f5c2ca603a50" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "bf8d2ad35d1d1a687eae6c065c3d524f7ab61b23" },
"nvim-web-devicons": { "branch": "master", "commit": "9154484705968658e9aab2b894d1b2a64bf9f83d" },
"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": "ec289423a1693aeae6cd0d503bac2856af74edaa" },
"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": "b97fab52f9cdeabe2bbb5eb98d82356899f30829" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
"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": "927c10f748e49c543b2d544c321a1245302ff324" },
"trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" },
"telescope.nvim": { "branch": "master", "commit": "814f102cd1da3dc78c7d2f20f2ef3ed3cdf0e6e4" },
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
"vim-caddyfile": { "branch": "master", "commit": "24fe0720551883e407cb70ae1d7c03f162d1d5a0" },
"vim-characterize": { "branch": "master", "commit": "7fc5b75e7a9e46676cf736b56d99dd32004ff3d6" },
"vim-commentary": { "branch": "master", "commit": "c4b8f52cbb7142ec239494e5a2c4a512f92c4d07" },
"vim-characterize": { "branch": "master", "commit": "a8bffac6cead6b2869d939ecad06312b187a4c79" },
"vim-commentary": { "branch": "master", "commit": "64a654ef4a20db1727938338310209b6a63f60c9" },
"vim-easy-align": { "branch": "master", "commit": "9815a55dbcd817784458df7a18acacc6f82b1241" },
"vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" },
"vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" },
"vim-gitignore": { "branch": "master", "commit": "641dfa648d2581a5e5e9b0d11ffee37da8de49d7" },
"vim-gnupg": { "branch": "main", "commit": "f9b608f29003dfde6450931dc0f495a912973a88" },
"vim-highlightedyank": { "branch": "master", "commit": "afb0f262b490706c23e94012c2ab9fa67c0481ce" },
"vim-highlightedyank": { "branch": "master", "commit": "285a61425e79742997bbde76a91be6189bc988fb" },
"vim-hocon": { "branch": "main", "commit": "5df6dc1b7c8f5811afe663b0441e6304a729dcaf" },
"vim-indent-object": { "branch": "master", "commit": "8ab36d5ec2a3a60468437a95e142ce994df598c6" },
"vim-kitty": { "branch": "main", "commit": "9cc594a634308aa3bfaf3da5b5e741da1c0144c1" },
"vim-ledger": { "branch": "master", "commit": "dbc683e24bd5338b8c12540227a58b2d247e097a" },
"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" },
@ -70,6 +70,6 @@
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
"vim-textobj-comment": { "branch": "master", "commit": "58ae4571b76a5bf74850698f23d235eef991dd4b" },
"vim-textobj-user": { "branch": "master", "commit": "41a675ddbeefd6a93664a4dc52f302fe3086a933" },
"vimtex": { "branch": "master", "commit": "539a203f19531c6b9d2d1b093ee8911fb7050bbc" },
"which-key.nvim": { "branch": "main", "commit": "bfec3d6bc0a9b0b2cb11644642f78c2c3915eef0" }
"vimtex": { "branch": "master", "commit": "096a0450261abccb7944630fae66788712be46a8" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
}

View file

@ -1,25 +1,25 @@
-- Setup nvim-cmp.
local cmp = require 'cmp'
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
--vim.fn["vsnip#anonymous"](args.body)
require('luasnip').lsp_expand(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 }),
["<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' },
{ name = "nvim_lsp" },
-- For vsnip user.
{ name = 'vsnip' },
{ name = "vsnip" },
-- For luasnip user.
-- { name = 'luasnip' },
@ -27,8 +27,8 @@ cmp.setup({
-- For ultisnips user.
-- { name = 'ultisnips' },
{ name = 'buffer' },
}
{ name = "buffer" },
},
})
-- Setup lsp.
@ -36,4 +36,4 @@ 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())
metals_config.capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())

View file

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

View file

@ -8,62 +8,64 @@ return {
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
'hrsh7th/cmp-path',
'hrsh7th/cmp-cmdline',
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
-- 'hrsh7th/cmp-vsnip',
-- 'hrsh7th/vim-vsnip',
-- 'hrsh7th/vim-vsnip-integ',
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
'onsails/lspkind.nvim',
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"onsails/lspkind.nvim",
{
'zbirenbaum/copilot-cmp',
dependencies = { "hrsh7th/nvim-cmp",
"zbirenbaum/copilot-cmp",
dependencies = {
"hrsh7th/nvim-cmp",
{
'zbirenbaum/copilot.lua',
"zbirenbaum/copilot.lua",
opts = {
suggestion = { enabled = false },
panel = { enabled = false },
filetypes = {
mail = false,
text = false,
}
}
},
},
},
},
config = function()
require("copilot_cmp").setup()
end
end,
},
},
config = function()
local cmp = require('cmp')
local lspkind = require('lspkind')
local luasnip = require('luasnip')
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
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)
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(),
['<C-CR>'] = cmp.mapping.confirm({
["<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,
}),
["<CR>"] = cmp.mapping({
["<C-CR>"] = cmp.mapping({
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
@ -98,20 +100,20 @@ return {
end, { "i", "s" }),
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "copilot" },
}, {
{ name = 'buffer', option = { keyword_pattern = [[\k\+]] } },
{ name = "buffer", option = { keyword_pattern = [[\k\+]] } },
--{ name = 'path' },
}),
formatting = {
format = lspkind.cmp_format({
mode = 'symbol_text', -- show only symbol annotations
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)
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,17 +1,29 @@
return {
'ryicoh/deepl.vim',
"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' },
{
"<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',
"tsuyoshicho/vim-pass",
init = function()
vim.g.pass_use_agent = 1
end
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
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,14 +1,5 @@
return {
{
"ledger/vim-ledger",
ft = "ledger",
},
{
"nfnty/vim-nftables",
ft = "nftables",
},
{
"jvirtanen/vim-hocon",
ft = "hocon",
},
{ "ledger/vim-ledger", ft = "ledger" },
{ "nfnty/vim-nftables", ft = "nftables" },
{ "jvirtanen/vim-hocon", ft = "hocon" },
}

View file

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

View file

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

View file

@ -1,23 +1,23 @@
return {
"lewis6991/hover.nvim",
config = function()
require("hover").setup {
require("hover").setup({
init = function()
require("hover.providers.lsp")
require('hover.providers.gh')
require('hover.providers.man')
require("hover.providers.gh")
require("hover.providers.man")
end,
preview_opts = {
border = nil
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
}
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
end,
}

View file

@ -176,5 +176,5 @@ return {
end
end,
},
'mfussenegger/nvim-jdtls',
"mfussenegger/nvim-jdtls",
}

View file

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

View file

@ -1,74 +1,77 @@
return {
'nvim-lualine/lualine.nvim',
"nvim-lualine/lualine.nvim",
dependencies = {
{ 'kyazdani42/nvim-web-devicons', lazy = true },
'crater2150/vim-theme-chroma',
{ "kyazdani42/nvim-web-devicons", lazy = true },
"crater2150/vim-theme-chroma",
{
'linrongbin16/lsp-progress.nvim',
"linrongbin16/lsp-progress.nvim",
config = function()
require('lsp-progress').setup()
end
require("lsp-progress").setup()
end,
},
},
event = "VeryLazy",
opts = function(_, opts)
return {
options = {
theme = require('chroma-theme.lualine')
theme = require("chroma-theme.lualine"),
},
tabline = {
lualine_a = { 'branch' },
lualine_a = { "branch" },
lualine_b = {},
lualine_c = { { 'buffers', show_filename_only = false, symbols = { modified = " ✏️]", alternate_file = " 🔃", folder = " 📁" }, } },
lualine_c = {
{
"buffers",
show_filename_only = false,
symbols = { modified = " ✏️]", alternate_file = " 🔃", folder = " 📁" },
},
},
lualine_x = {},
lualine_y = {},
lualine_z = {
{
'tabs',
"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 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))
)
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
} }
return name
.. (wincount > 1 and " +" .. (wincount - 1) or "")
.. (mod and " [✏️]]" or "")
end,
},
},
},
sections = {
lualine_a = { 'filename' },
lualine_b = { 'diff', 'diagnostics' },
lualine_a = { "filename" },
lualine_b = { "diff", "diagnostics" },
lualine_x = {
function()
-- invoke `progress` here.
return require('lsp-progress').progress()
end
return require("lsp-progress").progress()
end,
},
lualine_y = { 'filetype' },
lualine_z = { 'searchcount', 'selectioncount', 'location' }
lualine_y = { "filetype" },
lualine_z = { "searchcount", "selectioncount", "location" },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { 'filename' },
lualine_x = { 'location' },
lualine_c = { "filename" },
lualine_x = { "location" },
lualine_y = {},
lualine_z = {}
lualine_z = {},
},
winbar = {},
inactive_winbar = {},
extensions = {}
extensions = {},
}
end,
config = function(_, opts)

View file

@ -7,9 +7,9 @@
vim.api.nvim_create_augroup("KeepCentered", { clear = true })
vim.api.nvim_create_autocmd("CursorMoved", {
group = "KeepCentered",
pattern = '*',
pattern = "*",
callback = function()
if vim.o.buftype == '' then
if vim.o.buftype == "" then
vim.cmd([[normal! zz]])
end
end,

View file

@ -1,6 +1,11 @@
local sbtToScalaCLI = function()
vim.cmd [[s/\s*libraryDependencies\s*+=\s*/\/\/> using dep /]]
vim.cmd [[s/" \(%\+\) "/\=repeat(":", strlen(submatch(1)))/g]]
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" })
vim.keymap.set(
"n",
"<leader>dep",
sbtToScalaCLI,
{ noremap = true, silent = true, desc = "Convert sbt dependency to Scala CLI" }
)