diff options
Diffstat (limited to 'after/ftplugin')
-rw-r--r-- | after/ftplugin/c.lua | 3 | ||||
-rw-r--r-- | after/ftplugin/dap-float.lua | 1 | ||||
-rw-r--r-- | after/ftplugin/java.lua | 30 | ||||
-rw-r--r-- | after/ftplugin/netrw.lua | 5 |
4 files changed, 17 insertions, 22 deletions
diff --git a/after/ftplugin/c.lua b/after/ftplugin/c.lua index 6d4efca..e07a653 100644 --- a/after/ftplugin/c.lua +++ b/after/ftplugin/c.lua @@ -1,5 +1,4 @@ -local misc = require('core.misc') -local map_local = misc.map_local +local map_local = core.misc.map_local -- sort #includes <> (very jank) -- TODO: rewrite in a semi-sane way diff --git a/after/ftplugin/dap-float.lua b/after/ftplugin/dap-float.lua new file mode 100644 index 0000000..2a52dea --- /dev/null +++ b/after/ftplugin/dap-float.lua @@ -0,0 +1 @@ +core.misc.map("n", "q", "<cmd>q<CR>") diff --git a/after/ftplugin/java.lua b/after/ftplugin/java.lua index ee47369..9401ec1 100644 --- a/after/ftplugin/java.lua +++ b/after/ftplugin/java.lua @@ -1,5 +1,7 @@ -local misc = require("core.misc") -local map, auto = misc.map, misc.auto +-- FIXME: the following error is emmitted when starting up jdtls: +-- ERROR No LSP client found that supports vscode.java.resolveMainClass + +local map, auto = core.misc.map, core.misc.auto local ok, jdtls = pcall(require, "jdtls") if not ok then @@ -8,20 +10,16 @@ if not ok then return end --- HACK: I don't like using path concatination there *should* be a way to get --- the path from mason -local jdtls_install = vim.fs.joinpath(vim.fn.stdpath('data'), - "/mason/packages/jdtls") -local java_dap_install = vim.fs.joinpath(vim.fn.stdpath('data'), - "/mason/packages/java-debug-adapter") +local jdtls_install = core.mason.get_pkg_path("jdtls") +local java_dap_install = core.mason.get_pkg_path("java-debug-adapter") -- make sure to check if things with 💀 need updating local config = { cmd = { "/usr/lib/jvm/openjdk21/bin/java", -- 💀 "-jar", -- 💀 - vim.fn.glob(jdtls_install.."/plugins/org.eclipse.equinox.launcher_*.jar"), - "-configuration", jdtls_install.."/config_linux", + vim.fn.glob(vim.fs.joinpath(jdtls_install, "plugins/org.eclipse.equinox.launcher_*.jar")), + "-configuration", jdtls_install.."config_linux", "-data", vim.fn.stdpath("cache").."/nvim-jdtls", "--add-modules=ALL-SYSTEM", @@ -88,15 +86,13 @@ local config = { init_options = { bundles = { vim.fs.joinpath(java_dap_install, - vim.fn.glob("/extension/server/com.microsoft.java.debug.plugin-*.jar", + vim.fn.glob("extension/server/com.microsoft.java.debug.plugin-*.jar", true) ) } } } --- HACK: same hack as before - -- generate the path to the java file(s) ---@type string? local cache_path = vim.fs.joinpath(vim.fn.stdpath("cache"), @@ -150,20 +146,20 @@ local function version_check() if out.code ~= 0 then vim.notify(string.format( "java version check failed: exit code %s", out.code), - vim.log.levels.ERROR, { title = misc.appid }) + vim.log.levels.ERROR, { title = core.misc.appid }) vim.notify(string.format( "%s", vim.inspect(out.stdout)), - vim.log.levels.ERROR, { title = misc.appid }) + vim.log.levels.ERROR, { title = core.misc.appid }) return false elseif not v then vim.notify("no java version info found", vim.log.levels.ERROR, - { title = misc.appid }) + { title = core.misc.appid }) return false elseif v.major < 21 then vim.notify(string.format( "java version %s < 21.0.0 Cannot run jdtls, bailing out", v[1].."."..v[2].."."..v[3]), - vim.log.levels.ERROR, { title = misc.appid }) + vim.log.levels.ERROR, { title = core.misc.appid }) return false end diff --git a/after/ftplugin/netrw.lua b/after/ftplugin/netrw.lua index eb37bd5..d81ef0f 100644 --- a/after/ftplugin/netrw.lua +++ b/after/ftplugin/netrw.lua @@ -1,5 +1,4 @@ -local misc = require("core.misc") -local map_local = misc.map_local +local map_local = core.misc.map_local map_local("n", "h", "-", { noremap = false, remap = true }) -- Go up a directory map_local("n", "l", "<CR>", { noremap = false, remap = true }) -- Go down a directory / open a file @@ -17,5 +16,5 @@ end) map_local("n", "rt", function() vim.api.nvim_set_current_dir(vim.b.netrw_curdir) vim.notify("root dir updated: "..vim.b.netrw_curdir, vim.log.levels.LOW, - { title = misc.appid }) + { title = core.misc.appid }) end) |