1

Neovim: Add java config

This commit is contained in:
2024-07-14 21:12:25 +02:00
parent 9d4ef1604a
commit 48f1ef47ef

View File

@ -123,10 +123,30 @@ in {
''; '';
} }
{ {
event = "FileType"; event = ["FileType"];
pattern = ["json" "jsonc" "json5"]; # Disable conceal for these filetypes pattern = ["json" "jsonc" "json5"]; # Disable conceal for these filetypes
callback.__raw = "function() vim.opt_local.conceallevel = 0 end"; callback.__raw = "function() vim.opt_local.conceallevel = 0 end";
} }
{
event = ["FileType"];
pattern = ["Java" "java"];
callback.__raw = ''
function()
local workspace = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, { upward = true })[1])
local opts = {
root_dir = workspace,
cmd = {
"jdtls",
"-data",
"/home/christoph/.local/share/eclipse/" .. vim.fn.fnamemodify(workspace, ":p:h:t"),
},
}
require('jdtls').start_or_attach(opts)
end
'';
}
]; ];
# TODO: Incremental selection # TODO: Incremental selection
@ -740,6 +760,29 @@ in {
event = ["InsertEnter"]; event = ["InsertEnter"];
}; };
jdtls = {
name = "jdtls";
pkg = pkgs.vimPlugins.nvim-jdtls;
lazy = false; # Is only ever loaded in Java buffers anyway
# NOTE: The below stuff is configured in the AutoCMD
# ft = ["Java" "java"];
# config = ''
# function(_, opts)
# require('jdtls').start_or_attach(opts)
# end
# '';
# opts = {
# cmd.__raw = ''
# {
# "jdtls",
# "-data",
# "/home/christoph/.local/share/eclipse/" .. vim.fn.fnamemodify(root_dir, ":p:h:t"),
# }
# '';
# root_dir.__raw = "vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, { upward = true })[1])";
# };
};
lastplace = rec { lastplace = rec {
name = "nvim-lastplace"; name = "nvim-lastplace";
pkg = pkgs.vimPlugins.nvim-lastplace; pkg = pkgs.vimPlugins.nvim-lastplace;
@ -881,6 +924,7 @@ in {
{name = "pyright";} {name = "pyright";}
{name = "texlab";} {name = "texlab";}
# {name = "jdtls";} # Don't set up when using nvim-jdtls
# {name = "rust_analyzer";} # Don't set up when using rustaceanvim # {name = "rust_analyzer";} # Don't set up when using rustaceanvim
# {name = "hls";} # Don't set up when using haskell-tools # {name = "hls";} # Don't set up when using haskell-tools
]; ];
@ -1672,6 +1716,7 @@ in {
illuminate illuminate
# incline # TODO: Bad styling # incline # TODO: Bad styling
intellitab intellitab
jdtls
lastplace lastplace
lazygit lazygit
lint lint