Get support working for java
This commit is contained in:
parent
6cdf9123c0
commit
82c4d62e9c
@ -3,6 +3,8 @@ vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"
|
||||
|
||||
-- Initialize lazy.nvim
|
||||
require("config.lazy")
|
||||
|
||||
|
||||
74
.config/nvim/lazy-lock.json
Normal file
74
.config/nvim/lazy-lock.json
Normal file
@ -0,0 +1,74 @@
|
||||
{
|
||||
"FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" },
|
||||
"LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" },
|
||||
"Sakura.nvim": { "branch": "master", "commit": "2fbf430890dd9466afc41a62a809c21871d126ef" },
|
||||
"auto-session": { "branch": "main", "commit": "292492ab7af4bd8b9e37e28508bc8ce995722fd5" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"conform.nvim": { "branch": "master", "commit": "ffe26e8df8115c9665d24231f8a49fadb2d611ce" },
|
||||
"cuddlefish.nvim": { "branch": "main", "commit": "8381e244350e03b702422da97587d027ea1708fb" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||
"dracula.nvim": { "branch": "master", "commit": "7fadc372bbb9638c19a18c2497167d854cdd6a19" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"fzf-lua": { "branch": "main", "commit": "f6d949549cc43fb5d35ef43db56f03131da469a7" },
|
||||
"gradle.nvim": { "branch": "main", "commit": "11186688cfa2cf217170c8b43f78113d07c957de" },
|
||||
"harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" },
|
||||
"haskell-tools.nvim": { "branch": "master", "commit": "5fb8eda3c4430cb1d473d3e2138b070bdca1c224" },
|
||||
"kanagawa.nvim": { "branch": "master", "commit": "aef7f5cec0a40dbe7f3304214850c472e2264b10" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
||||
"lsp_signature.nvim": { "branch": "master", "commit": "7d3bb0a641f516f1c7fd2e47852580dadbd7a430" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "3ddd1b4edefa425fda5a9f95a4f25578727c0bb3" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
|
||||
"luarocks.nvim": { "branch": "main", "commit": "1db9093915eb16ba2473cfb8d343ace5ee04130a" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "0b9bb925c000ae649ff7e7149c8cd00031f4b539" },
|
||||
"mason-registry": { "branch": "main", "commit": "826083e45460471c7f98634de090574e1d7b65df" },
|
||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" },
|
||||
"mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" },
|
||||
"mini.icons": { "branch": "main", "commit": "ff2e4f1d29f659cc2bad0f9256f2f6195c6b2428" },
|
||||
"mini.pick": { "branch": "main", "commit": "b4351399db5043a781a32699a1bde60b747f711f" },
|
||||
"mini.surround": { "branch": "main", "commit": "5aab42fcdcf31fa010f012771eda5631c077840a" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
||||
"neogit": { "branch": "master", "commit": "300949af63fa48cb6bc8d93822b78cb9dbb4fd75" },
|
||||
"neotest": { "branch": "master", "commit": "deadfb1af5ce458742671ad3a013acb9a6b41178" },
|
||||
"neotest-haskell": { "branch": "master", "commit": "a7182093aeb118b03d8dca90c1cba4b47841de3b" },
|
||||
"neotest-java": { "branch": "main", "commit": "d81e11daeddc6aff713258fa422df8c3de5047c7" },
|
||||
"neotest-jest": { "branch": "main", "commit": "a36df9109c75bd1ae46b7bad274615dbbe6e4dcd" },
|
||||
"neotest-python": { "branch": "master", "commit": "b0d3a861bd85689d8ed73f0590c47963a7eb1bf9" },
|
||||
"nightfall.nvim": { "branch": "master", "commit": "e0b85e2a8059d6b8ed1e5f89d33bd11b3d756e78" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "d97d85e01339f01b842e6ec1502f639b080cb0fc" },
|
||||
"nvim-dap": { "branch": "master", "commit": "5860c7c501eb428d3137ee22c522828d20cca0b3" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" },
|
||||
"nvim-jdtls": { "branch": "master", "commit": "f73731b543f5971e0da9665eb1d7ceffe1fde71f" },
|
||||
"nvim-lint": { "branch": "master", "commit": "5122c0c00a65cf6ce434b16b6a7587b62b6af00d" },
|
||||
"nvim-lsp-file-operations": { "branch": "master", "commit": "9744b738183a5adca0f916527922078a965515ed" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "9c923997123ff9071198ea3b594d4c1931fab169" },
|
||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" },
|
||||
"obsidian.nvim": { "branch": "main", "commit": "4065c233f618cdbfbf084d87e97317f8d019ef59" },
|
||||
"oil-git-status.nvim": { "branch": "main", "commit": "4b5cf53842c17a09420919e655a6a559da3112d7" },
|
||||
"oil-git.nvim": { "branch": "main", "commit": "d1f27a5982df35b70fb842aa6bbfac10735c7265" },
|
||||
"oil-lsp-diagnostics.nvim": { "branch": "master", "commit": "e04e3c387262b958fee75382f8ff66eae9d037f4" },
|
||||
"oil.nvim": { "branch": "master", "commit": "cbcb3f997f6f261c577b943ec94e4ef55108dd95" },
|
||||
"onedarkpro.nvim": { "branch": "main", "commit": "eeac8847a46a02c4de4e887c4c6d34b282060b5d" },
|
||||
"pastelnight.nvim": { "branch": "main", "commit": "23890b2788450f7d39ed19992007b6943dcffab2" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"themery.nvim": { "branch": "main", "commit": "bfa58f4b279d21cb515b28023e1b68ec908584b2" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
|
||||
"undotree": { "branch": "master", "commit": "0f1c9816975b5d7f87d5003a19c53c6fd2ff6f7f" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" },
|
||||
"vim-maximizer": { "branch": "master", "commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1" },
|
||||
"vim-suda": { "branch": "master", "commit": "c492741b4679b3cdd4d9e34138209784e061d916" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" },
|
||||
"yorumi.nvim": { "branch": "main", "commit": "e5b93e2c0adb3d95ca9f3c5c20e824d15afcfe48" }
|
||||
}
|
||||
@ -6,36 +6,7 @@ function M.setup()
|
||||
local jdtls = require("jdtls")
|
||||
local jdtls_dap = require("jdtls.dap")
|
||||
local jdtls_setup = require("jdtls.setup")
|
||||
local home = os.getenv("HOME")
|
||||
|
||||
local root_markers = { ".git", "mvnw", "gradlew" }
|
||||
local root_dir = jdtls_setup.find_root(root_markers)
|
||||
|
||||
local project_name = vim.fn.fnamemodify(root_dir, ":p:h:t")
|
||||
local workspace_dir = home .. "/.cache/jdtls/workspace/" .. project_name
|
||||
|
||||
local path_to_nvim_packages = home .. "/.local/share/nvim"
|
||||
local path_to_mason_packages = path_to_nvim_packages .. "/mason/packages"
|
||||
|
||||
local path_to_jdtls = path_to_mason_packages .. "/jdtls"
|
||||
local path_to_java_dap = path_to_mason_packages .. "/java-debug-adapter"
|
||||
local path_to_jtest = path_to_mason_packages .. "/java-test"
|
||||
|
||||
local path_to_config = path_to_jdtls .. "/config_linux"
|
||||
local lombok_path = path_to_jdtls .. "/lombok.jar"
|
||||
|
||||
local path_to_jar = vim.fn.glob(path_to_jdtls .. "/plugins/org.eclipse.equinox.launcher_*.jar", true)
|
||||
|
||||
local bundles = {
|
||||
vim.fn.glob(path_to_java_dap .. "/extension/server/com.microsoft.java.debug.plugin-*.jar", true),
|
||||
vim.fn.glob(
|
||||
path_to_nvim_packages
|
||||
.. "/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar"
|
||||
),
|
||||
}
|
||||
vim.list_extend(bundles, vim.split(vim.fn.glob(path_to_nvim_packages .. "/vscode-java-test/server/*.jar"), "\n"))
|
||||
|
||||
vim.list_extend(bundles, vim.split(vim.fn.glob(path_to_jtest .. "/extension/server/*.jar", true), "\n"))
|
||||
local lsp_signature = require("lsp_signature")
|
||||
|
||||
local on_attach = function(ev, bufnr)
|
||||
local opts = { buffer = ev.buf, silent = true }
|
||||
@ -53,11 +24,12 @@ function M.setup()
|
||||
jdtls_setup.add_commands()
|
||||
|
||||
-- Create a command `:Format` local to the LSP buffer
|
||||
-- TODO: shortcut
|
||||
vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_)
|
||||
vim.lsp.buf.format()
|
||||
end, { desc = "Format current buffer with LSP" })
|
||||
|
||||
require("lsp_signature").on_attach({
|
||||
lsp_signature.on_attach({
|
||||
bind = true,
|
||||
padding = "",
|
||||
handler_opts = {
|
||||
@ -67,6 +39,14 @@ function M.setup()
|
||||
}, bufnr)
|
||||
end
|
||||
|
||||
local home = os.getenv("HOME")
|
||||
local root_dir = jdtls_setup.find_root({ ".git", "mvnw", "gradlew" })
|
||||
local project_name = vim.fn.fnamemodify(root_dir, ":p:h:t")
|
||||
|
||||
local nvim_d = home .. "/.local/share/nvim"
|
||||
local mason_d = nvim_d .. "/mason/packages"
|
||||
local jdtls_d = mason_d .. "/jdtls"
|
||||
|
||||
local cmd = {
|
||||
"/usr/lib/jvm/java-1.21.0-openjdk-amd64/bin/java",
|
||||
|
||||
@ -76,7 +56,7 @@ function M.setup()
|
||||
"-Dlog.protocol=true",
|
||||
"-Dlog.level=ALL",
|
||||
"-Xmx1g",
|
||||
"-javaagent:" .. lombok_path,
|
||||
"-javaagent:" .. jdtls_d .. "/lombok.jar",
|
||||
"--add-modules=ALL-SYSTEM",
|
||||
"--add-opens",
|
||||
"java.base/java.util=ALL-UNNAMED",
|
||||
@ -84,13 +64,13 @@ function M.setup()
|
||||
"java.base/java.lang=ALL-UNNAMED",
|
||||
|
||||
"-jar",
|
||||
path_to_jar,
|
||||
vim.fn.glob(jdtls_d .. "/plugins/org.eclipse.equinox.launcher_*.jar", true),
|
||||
|
||||
"-configuration",
|
||||
path_to_config,
|
||||
jdtls_d .. "/config_linux",
|
||||
|
||||
"-data",
|
||||
workspace_dir,
|
||||
home .. "/.cache/jdtls/workspace/" .. project_name,
|
||||
}
|
||||
|
||||
local settings = {
|
||||
@ -181,16 +161,24 @@ function M.setup()
|
||||
},
|
||||
}
|
||||
|
||||
local extendedClientCapabilities = jdtls.extendedClientCapabilities
|
||||
extendedClientCapabilities.resolveAdditionalTextEditsSupport = true
|
||||
|
||||
local config = {
|
||||
-- Start Server
|
||||
local jdap_d = mason_d .. "/java-debug-adapter/extension/server"
|
||||
local jtest_d = mason_d .. "/java-test/extension/server"
|
||||
jdtls.start_or_attach({
|
||||
flags = {
|
||||
allow_incremental_sync = true,
|
||||
},
|
||||
init_options = {
|
||||
bundles = vim.split(vim.fn.glob("/home/iborrelli/pde/extension/server/*.jar"), "\n"),
|
||||
extendedClientCapabilities = extendedClientCapabilities,
|
||||
bundles = {
|
||||
vim.fn.glob(jdap_d .. "/com.microsoft.java.debug.plugin-*.jar"),
|
||||
vim.fn.glob(jtest_d .. "/com.microsoft.java.test.plugin-*.jar"),
|
||||
vim.fn.glob(jtest_d .. "/com.microsoft.java.test.runner-*.jar"),
|
||||
-- TODO: pde
|
||||
--vim.fn.glob(home .. "/pde/extension/server/*.jar")
|
||||
},
|
||||
extendedClientCapabilities = {
|
||||
resolveAdditionalTextEditsSupport = true,
|
||||
},
|
||||
},
|
||||
on_init = function(client)
|
||||
client.notify("workspace/didChangeConfiguration", { settings = settings })
|
||||
@ -211,10 +199,7 @@ function M.setup()
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Start Server
|
||||
jdtls.start_or_attach(config)
|
||||
})
|
||||
|
||||
vim.cmd(
|
||||
"command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_compile JdtCompile lua require('jdtls').compile(<f-args>)"
|
||||
|
||||
@ -1,30 +1,20 @@
|
||||
local utils = require("utils")
|
||||
return {
|
||||
"stevearc/conform.nvim",
|
||||
config = function()
|
||||
local conform = require("conform")
|
||||
|
||||
local function file_exists(name)
|
||||
local f = io.open(name, "r")
|
||||
if f ~= nil then
|
||||
io.close(f)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
local function decide_js_formatter()
|
||||
local cwd = vim.fn.getcwd()
|
||||
if file_exists(cwd .. "/biome.json") or file_exists(cwd .. "/biome.jsonc") then
|
||||
if utils.cwd_is_biome() then
|
||||
return "biome"
|
||||
else
|
||||
return "prettier"
|
||||
end
|
||||
end
|
||||
local function decide_json_formatter()
|
||||
local cwd = vim.fn.getcwd()
|
||||
if file_exists(cwd .. "/biome.json") or file_exists(cwd .. "/biome.jsonc") then
|
||||
if utils.cwd_is_biome() then
|
||||
return "biome"
|
||||
elseif file_exists(cwd .. "/.prettierrc") then
|
||||
elseif utils.cwd_is_prettier() then
|
||||
return "prettier"
|
||||
else
|
||||
return "jq"
|
||||
@ -34,7 +24,10 @@ return {
|
||||
conform.setup({
|
||||
formatters_by_ft = {
|
||||
groovy = { "npm-groovy-lint" },
|
||||
haskell = { "fourmolu" },
|
||||
haskell = {
|
||||
"fourmolu",
|
||||
"apply_refact",
|
||||
},
|
||||
javascript = { decide_js_formatter() },
|
||||
javascriptreact = { decide_js_formatter() },
|
||||
json = { decide_json_formatter() },
|
||||
@ -54,6 +47,14 @@ return {
|
||||
sql_formatter = {
|
||||
prepend_args = { "-c", '{"functionCase": "upper", "keywordCase": "upper"}', "-l", "postgresql" },
|
||||
},
|
||||
fourmolu = {
|
||||
command = "/home/iborrelli/.local/bin/fourmolu",
|
||||
args = { "--stdin-input-file", "$FILENAME" },
|
||||
},
|
||||
apply_refact = {
|
||||
command = "/home/iborrelli/.local/bin/refactor",
|
||||
args = { "$FILENAME" },
|
||||
},
|
||||
},
|
||||
|
||||
default_format_opts = {
|
||||
|
||||
23
.config/nvim/lua/plugins/language_support/haskell-tools.lua
Normal file
23
.config/nvim/lua/plugins/language_support/haskell-tools.lua
Normal file
@ -0,0 +1,23 @@
|
||||
return {
|
||||
"mrcjkb/haskell-tools.nvim",
|
||||
version = "^6",
|
||||
config = function()
|
||||
local ht = require("haskell-tools")
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local opts = { noremap = true, silent = true, buffer = bufnr }
|
||||
-- haskell-language-server relies heavily on codeLenses,
|
||||
-- so auto-refresh (see advanced configuration) is enabled by default
|
||||
vim.keymap.set("n", "<space>cl", vim.lsp.codelens.run, opts)
|
||||
-- Hoogle search for the type signature of the definition under the cursor
|
||||
vim.keymap.set("n", "<space>hs", ht.hoogle.hoogle_signature, opts)
|
||||
-- Evaluate all code snippets
|
||||
vim.keymap.set("n", "<space>ea", ht.lsp.buf_eval_all, opts)
|
||||
-- Toggle a GHCi repl for the current package
|
||||
vim.keymap.set("n", "<leader>rr", ht.repl.toggle, opts)
|
||||
-- Toggle a GHCi repl for the current buffer
|
||||
vim.keymap.set("n", "<leader>rf", function()
|
||||
ht.repl.toggle(vim.api.nvim_buf_get_name(0))
|
||||
end, opts)
|
||||
vim.keymap.set("n", "<leader>rq", ht.repl.quit, opts)
|
||||
end,
|
||||
}
|
||||
10
.config/nvim/lua/plugins/language_support/lsp-signature.lua
Normal file
10
.config/nvim/lua/plugins/language_support/lsp-signature.lua
Normal file
@ -0,0 +1,10 @@
|
||||
return {
|
||||
"ray-x/lsp_signature.nvim",
|
||||
event = "InsertEnter",
|
||||
opts = {
|
||||
bind = true,
|
||||
handler_opts = {
|
||||
border = "rounded",
|
||||
},
|
||||
},
|
||||
}
|
||||
10
.config/nvim/lua/plugins/language_support/neotest-java.lua
Normal file
10
.config/nvim/lua/plugins/language_support/neotest-java.lua
Normal file
@ -0,0 +1,10 @@
|
||||
return {
|
||||
"rcasia/neotest-java",
|
||||
ft = "java",
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-jdtls",
|
||||
"mfussenegger/nvim-dap",
|
||||
"rcarriga/nvim-dap-ui",
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
},
|
||||
}
|
||||
@ -5,12 +5,17 @@ return {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"antoinemadec/FixCursorHold.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"rcasia/neotest-java",
|
||||
"nvim-neotest/neotest-python",
|
||||
"nvim-neotest/neotest-jest",
|
||||
"mrcjkb/neotest-haskell",
|
||||
},
|
||||
config = function()
|
||||
require("neotest").setup({
|
||||
adapters = {
|
||||
require("neotest-python"),
|
||||
require("neotest-jest"),
|
||||
require("neotest-java"),
|
||||
require("neotest-haskell"),
|
||||
},
|
||||
})
|
||||
end,
|
||||
|
||||
@ -49,10 +49,22 @@ return {
|
||||
end
|
||||
end),
|
||||
|
||||
["<C-l>"] = cmp.mapping.complete({
|
||||
config = { sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
} },
|
||||
}), -- show only lsp completions
|
||||
["<C-s"] = cmp.mapping.complete({
|
||||
config = { sources = {
|
||||
{ name = "luasnip" },
|
||||
} },
|
||||
}), -- show only snippet completions
|
||||
-- On tab with completion open, go to next option
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.locally_jumpable(1) then
|
||||
luasnip.jump(1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
@ -62,6 +74,8 @@ return {
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
@ -111,39 +125,7 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
mapping = mapping.insert({
|
||||
["<C-l>"] = cmp.mapping.complete({
|
||||
config = { sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
} },
|
||||
}), -- show only lsp completions
|
||||
["<C-s"] = cmp.mapping.complete({
|
||||
config = { sources = {
|
||||
{ name = "luasnip" },
|
||||
} },
|
||||
}), -- show only snippet completions
|
||||
-- On tab with completion open, go to next option
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.locally_jumpable(1) then
|
||||
luasnip.jump(1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s", "c" }),
|
||||
|
||||
-- On shift tab with completion open, go to prev option
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s", "c" }),
|
||||
}),
|
||||
mapping = mapping,
|
||||
|
||||
-- Sources for autocompletion
|
||||
sources = cmp.config.sources({
|
||||
|
||||
80
.config/nvim/lua/plugins/language_support/nvim-dap.lua
Normal file
80
.config/nvim/lua/plugins/language_support/nvim-dap.lua
Normal file
@ -0,0 +1,80 @@
|
||||
return {
|
||||
"mfussenegger/nvim-dap",
|
||||
dependencies = { "rcarriga/nvim-dap-ui", "nvim-neotest/nvim-nio" },
|
||||
config = function()
|
||||
local dapui = require("dapui")
|
||||
local dap = require("dap")
|
||||
|
||||
-- open the ui as soon as we are debugging
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
|
||||
-- https://emojipedia.org/en/stickers/search?q=circle
|
||||
vim.fn.sign_define("DapBreakpoint", {
|
||||
text = "⚪",
|
||||
texthl = "DapBreakpointSymbol",
|
||||
linehl = "DapBreakpoint",
|
||||
numhl = "DapBreakpoint",
|
||||
})
|
||||
|
||||
vim.fn.sign_define("DapStopped", {
|
||||
text = "🔴",
|
||||
texthl = "yellow",
|
||||
linehl = "DapBreakpoint",
|
||||
numhl = "DapBreakpoint",
|
||||
})
|
||||
vim.fn.sign_define("DapBreakpointRejected", {
|
||||
text = "⭕",
|
||||
texthl = "DapStoppedSymbol",
|
||||
linehl = "DapBreakpoint",
|
||||
numhl = "DapBreakpoint",
|
||||
})
|
||||
|
||||
local map, opts = vim.keymap.set, { noremap = true, silent = true }
|
||||
|
||||
map("n", "<leader>du", function()
|
||||
dapui.toggle()
|
||||
end, { noremap = true, silent = true, desc = "Toggle DAP UI" })
|
||||
|
||||
map({ "n", "v" }, "<leader>dw", function()
|
||||
require("dapui").eval(nil, { enter = true })
|
||||
end, { noremap = true, silent = true, desc = "Add word under cursor to Watches" })
|
||||
|
||||
map({ "n", "v" }, "Q", function()
|
||||
require("dapui").eval()
|
||||
end, {
|
||||
noremap = true,
|
||||
silent = true,
|
||||
desc = "Hover/eval a single value (opens a tiny window instead of expanding the full object) ",
|
||||
})
|
||||
|
||||
-- more minimal ui
|
||||
dapui.setup({
|
||||
expand_lines = true,
|
||||
controls = { enabled = false }, -- no extra play/step buttons
|
||||
floating = { border = "rounded" },
|
||||
-- Set dapui window
|
||||
render = {
|
||||
max_type_length = 60,
|
||||
max_value_lines = 200,
|
||||
},
|
||||
-- Only one layout: just the "scopes" (variables) list at the bottom
|
||||
layouts = {
|
||||
{
|
||||
elements = {
|
||||
{ id = "scopes", size = 1.0 }, -- 100% of this panel is scopes
|
||||
},
|
||||
size = 15, -- height in lines (adjust to taste)
|
||||
position = "bottom", -- "left", "right", "top", "bottom"
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
@ -3,27 +3,17 @@ local utils = require("utils")
|
||||
return {
|
||||
"mfussenegger/nvim-lint",
|
||||
config = function()
|
||||
local function file_exists(name)
|
||||
local f = io.open(name, "r")
|
||||
if f ~= nil then
|
||||
io.close(f)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
local lint = require("lint")
|
||||
local function decide_js_linter()
|
||||
local cwd = vim.fn.getcwd()
|
||||
if file_exists(cwd .. "/biome.json") or file_exists(cwd .. "/biome.jsonc") then
|
||||
if utils.cwd_is_biome() then
|
||||
return "biomejs"
|
||||
else
|
||||
return "eslint_d"
|
||||
end
|
||||
end
|
||||
|
||||
local lint = require("lint")
|
||||
|
||||
lint.linters_by_ft = {
|
||||
haskell = { "hlint" },
|
||||
javascript = { decide_js_linter() },
|
||||
javascriptreact = { decide_js_linter() },
|
||||
markdown = { "markdownlint" },
|
||||
@ -41,6 +31,15 @@ return {
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufWritePost", "BufEnter" }, {
|
||||
group = vim.api.nvim_create_augroup("lint", { clear = true }),
|
||||
callback = function(args)
|
||||
if not utils.buf_is_obsidian(args.buf) then
|
||||
lint.try_lint()
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
utils.nmapkey("<leader>l", function()
|
||||
lint.try_lint()
|
||||
end, "Trigger linting for current file")
|
||||
|
||||
@ -11,21 +11,27 @@ return {
|
||||
"gitcommit",
|
||||
"gitignore",
|
||||
"groovy",
|
||||
"haskell",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"kotlin",
|
||||
"latex",
|
||||
"lua",
|
||||
"make",
|
||||
"matlab",
|
||||
"nginx",
|
||||
"norg",
|
||||
"pug",
|
||||
"python",
|
||||
"regex",
|
||||
"scss",
|
||||
"sql",
|
||||
"ssh_config",
|
||||
"svelte",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"typst",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"vue",
|
||||
|
||||
@ -3,6 +3,7 @@ return {
|
||||
dependencies = {
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"mason-org/mason-registry",
|
||||
},
|
||||
config = function()
|
||||
-- enable mason and configure icons
|
||||
@ -19,6 +20,7 @@ return {
|
||||
require("mason-lspconfig").setup({
|
||||
automatic_enable = {
|
||||
exclude = {
|
||||
"hls",
|
||||
"jdtls",
|
||||
},
|
||||
},
|
||||
@ -51,16 +53,16 @@ return {
|
||||
"biome",
|
||||
"black",
|
||||
"checkstyle",
|
||||
"chrome-debug-adapter",
|
||||
"eslint_d",
|
||||
"firefox-debug-adapter",
|
||||
"flake8",
|
||||
"fourmolu",
|
||||
"haskell-debug-adapter",
|
||||
"hlint",
|
||||
"isort",
|
||||
"java-debug-adapter",
|
||||
"java-test",
|
||||
"jq",
|
||||
"markdownlint",
|
||||
"js-debug-adapter",
|
||||
"matlab-language-server",
|
||||
"mdformat",
|
||||
"nginx-config-formatter",
|
||||
@ -68,6 +70,7 @@ return {
|
||||
"prettier",
|
||||
"shellcheck",
|
||||
"shfmt",
|
||||
"sql-formatter",
|
||||
"stylua",
|
||||
"xmlformatter",
|
||||
"yamlfmt",
|
||||
|
||||
@ -48,6 +48,37 @@ return {
|
||||
return
|
||||
end
|
||||
end
|
||||
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most
|
||||
-- likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
-- Tell the language server how to find Lua modules same way as Neovim
|
||||
-- (see `:h lua-module-load`)
|
||||
path = {
|
||||
"lua/?.lua",
|
||||
"lua/?/init.lua",
|
||||
},
|
||||
},
|
||||
-- Make the server aware of Neovim runtime files
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME,
|
||||
-- Depending on the usage, you might want to add additional paths
|
||||
-- here.
|
||||
-- '${3rd}/luv/library'
|
||||
-- '${3rd}/busted/library'
|
||||
},
|
||||
-- Or pull in all of 'runtimepath'.
|
||||
-- NOTE: this is a lot slower and will cause issues when working on
|
||||
-- your own configuration.
|
||||
-- See https://github.com/neovim/nvim-lspconfig/issues/3189
|
||||
-- library = {
|
||||
-- vim.api.nvim_get_runtime_file('', true),
|
||||
-- }
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
@ -103,14 +134,14 @@ return {
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
vim.lsp.config("hls", {
|
||||
capabilities = capabilities,
|
||||
filetypes = { "haskell", "lhaskell", "cabal" },
|
||||
settings = {
|
||||
haskell = {
|
||||
formattingProvider = "fourmolu",
|
||||
},
|
||||
},
|
||||
})
|
||||
-- vim.lsp.config("hls", {
|
||||
-- capabilities = capabilities,
|
||||
-- filetypes = { "haskell", "lhaskell", "cabal" },
|
||||
-- settings = {
|
||||
-- haskell = {
|
||||
-- formattingProvider = "fourmolu",
|
||||
-- },
|
||||
-- },
|
||||
-- })
|
||||
end,
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ return {
|
||||
enabled = true,
|
||||
timeout = 3000,
|
||||
},
|
||||
picker = { enabled = true },
|
||||
picker = { enabled = false },
|
||||
quickfile = { enabled = true },
|
||||
scope = { enabled = true },
|
||||
scroll = { enabled = true },
|
||||
@ -21,7 +21,7 @@ return {
|
||||
words = { enabled = true },
|
||||
styles = {
|
||||
notification = {
|
||||
-- wo = { wrap = true } -- Wrap notifications
|
||||
wo = { wrap = true }, -- Wrap notifications
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
5
.config/nvim/lua/plugins/util/luarocks.lua
Normal file
5
.config/nvim/lua/plugins/util/luarocks.lua
Normal file
@ -0,0 +1,5 @@
|
||||
return {
|
||||
"vhyrro/luarocks.nvim",
|
||||
priority = 1000, -- Very high priority is required, luarocks.nvim should run as the first plugin in your config.
|
||||
config = true,
|
||||
}
|
||||
37
.config/nvim/lua/plugins/util/obsidian.lua
Normal file
37
.config/nvim/lua/plugins/util/obsidian.lua
Normal file
@ -0,0 +1,37 @@
|
||||
return {
|
||||
"obsidian-nvim/obsidian.nvim",
|
||||
version = "*",
|
||||
ft = "markdown",
|
||||
|
||||
config = function()
|
||||
local format_title = function(title)
|
||||
if title and string.find(title, "/") then
|
||||
local last_part = string.match(title, "([^/]+)$")
|
||||
if last_part and last_part ~= "" then
|
||||
return last_part
|
||||
end
|
||||
end
|
||||
return title
|
||||
end
|
||||
require("obsidian").setup({
|
||||
legacy_commands = false,
|
||||
note_id_func = function(title)
|
||||
local date = os.date("%Y-%m-%d")
|
||||
local time = os.date("%H:%M")
|
||||
|
||||
if not title or title == "" then
|
||||
return string.format("%s %s", date, time)
|
||||
end
|
||||
|
||||
return string.format("%s %s", date, format_title(title))
|
||||
end,
|
||||
daily_notes = { folder = "daily_notes" },
|
||||
workspaces = {
|
||||
{
|
||||
name = "personal",
|
||||
path = "~/vaults/personal",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
@ -20,7 +20,7 @@ return {
|
||||
desc = "Symbols (Trouble)",
|
||||
},
|
||||
{
|
||||
"<leader>cl",
|
||||
"<leader>xl",
|
||||
"<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
|
||||
desc = "LSP Definitions / references / ... (Trouble)",
|
||||
},
|
||||
|
||||
@ -43,8 +43,8 @@ end
|
||||
|
||||
function M.common_mappings(opts)
|
||||
local telescope = require("telescope.builtin")
|
||||
M.nmapkey("gr", telescope.lsp_references, "[g]et [r]eferences", opts)
|
||||
M.nmapkey("gd", telescope.lsp_definitions, "[g]et [d]definitions", opts)
|
||||
M.nmapkey("gR", telescope.lsp_references, "[g]et [R]eferences", opts)
|
||||
M.nmapkey("gd", telescope.lsp_definitions, "[g]et [d]efinitions", opts)
|
||||
M.nmapkey("gi", telescope.lsp_implementations, "[g]et [i]mplementations", opts)
|
||||
M.nmapkey("gt", telescope.lsp_type_definitions, "[g]et [t]ype definitions", opts)
|
||||
M.nmapkey("gD", vim.lsp.buf.declaration, "[g]o to [D]eclaration", opts)
|
||||
@ -68,4 +68,35 @@ function M.common_mappings(opts)
|
||||
M.nmapkey("<leader>rs", "<cmd>LspRestart<cr>", "Restart LSP", opts)
|
||||
end
|
||||
|
||||
local function any_file_exists_at_root(names)
|
||||
local cwd = vim.fn.getcwd()
|
||||
for _, name in ipairs(names) do
|
||||
local path = cwd .. "/" .. name
|
||||
if vim.loop.fs_stat(path) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function M.cwd_is_biome()
|
||||
return any_file_exists_at_root({ "biome.json", "biome.jsonc" })
|
||||
end
|
||||
function M.cwd_is_prettier()
|
||||
return any_file_exists_at_root({ ".prettierrc", "prettierrc.json", "prettierrc.jsonc", ".prettierrc.js" })
|
||||
end
|
||||
function M.cwd_is_eslint()
|
||||
return any_file_exists_at_root({ ".eslintrc", ".eslintrc.js", ".eslintrc.json" })
|
||||
end
|
||||
|
||||
function M.buf_is_obsidian(bufnr)
|
||||
local clients = vim.lsp.get_clients({ bufnr = bufnr })
|
||||
for _, client in ipairs(clients) do
|
||||
if client.name == "obsidian-ls" then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
set -g default-terminal "screen-256color"
|
||||
set -g terminal-overrides ",xterm-256color:RGB"
|
||||
set-option -g default-terminal "screen-256color"
|
||||
|
||||
set -g prefix ^B
|
||||
set -g base-index 1 # start indexing windows at 1 instead of 0
|
||||
@ -23,6 +24,8 @@ set -g visual-activity off
|
||||
set -g visual-silence off
|
||||
set -g bell-action none
|
||||
|
||||
# Reduce delay when pressing Escape in Vim
|
||||
set -sg escape-time 10
|
||||
|
||||
#######################
|
||||
### VI MODE COPYING ###
|
||||
|
||||
@ -64,10 +64,3 @@ set -g @plugin "tmux-plugins/tmux-continuum"
|
||||
# set -g @plugin "sainnhe/tmux-fzf"
|
||||
# set -g @plugin "wfxr/tmux-fzf-url"
|
||||
# set -g @plugin "omerxx/tmux-floax"
|
||||
# set -g @plugin "ThePrimeagen/tmux-sessionizer"
|
||||
#
|
||||
# bind-key -r f run-shell "tmux neww ~/.local/bin/tmux-sessionizer"
|
||||
# bind-key -r M-h run-shell "tmux neww tmux-sessionizer -s 0"
|
||||
# bind-key -r M-t run-shell "tmux neww tmux-sessionizer -s 1"
|
||||
# bind-key -r M-n run-shell "tmux neww tmux-sessionizer -s 2"
|
||||
# bind-key -r M-s run-shell "tmux neww tmux-sessionizer -s 3"
|
||||
|
||||
@ -84,6 +84,10 @@ zinit ice wait lucid from'gh-r' id-as as'completion' bpick'man-*' atpull'%atclon
|
||||
for man in $PWD/target/*/*.5; do ln -svf $man $ZPFX/man/man5; done'
|
||||
zinit light eza-community/eza
|
||||
|
||||
# VI MODE
|
||||
zinit ice depth=1
|
||||
zinit light jeffreytse/zsh-vi-mode
|
||||
|
||||
################
|
||||
### SNIPPETS ###
|
||||
################
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user