From 745d1a6321273e3b71dd462d36d12c6aeba66932 Mon Sep 17 00:00:00 2001 From: tiyn Date: Fri, 17 Sep 2021 04:35:24 +0200 Subject: [PATCH] nvim: setup for java development --- .config/nvim/init.vim | 13 ++++++++++++- .local/bin/tools/nvim/compiler | 1 + .profile | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index ed3b9a6..a5fcfc4 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -134,7 +134,7 @@ end -- Use a loop to conveniently call 'setup' on multiple servers and -- map buffer local keybindings when the language server attaches -local servers = { "pyright", "java_language_server", "bashls", "tsserver", "texlab", "ccls", "gopls", "hls", "nimls" } +local servers = { "pyright", "bashls", "tsserver", "texlab", "ccls", "gopls", "hls", "nimls" } for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup { on_attach=on_attach, @@ -143,6 +143,17 @@ for _, lsp in ipairs(servers) do } } end + +require'lspconfig'.jdtls.setup{ + on_attach=on_attach, + flags = { + debounce_text_changes = 150 + }, + cmd = { 'jdtls' } + } + + + EOF autocmd BufEnter * lua require'completion'.on_attach() diff --git a/.local/bin/tools/nvim/compiler b/.local/bin/tools/nvim/compiler index f4747df..53f1b05 100755 --- a/.local/bin/tools/nvim/compiler +++ b/.local/bin/tools/nvim/compiler @@ -31,6 +31,7 @@ case "$file" in *\.m) octave -qW "$file" ;; *\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;; *config.h) sudo make install ;; + *\.java) java "$file" ;; *\.js) node "$file" ;; *\.c) if [ -f Makefile ]; then make run; else cc "$file" -o "$base" && "$base"; fi ;; *\.nim) nim c -r -d:noColors "$file" ;; diff --git a/.profile b/.profile index e6ec532..f23c925 100644 --- a/.profile +++ b/.profile @@ -41,6 +41,7 @@ export ZDOTDIR="${XDG_CONFIG_HOME}/zsh" # java export JAVA_HOME="/usr/lib/jvm/java-11-openjdk" export _JAVA_AWT_WM_NONREPARENTING=1 +export JDTLS_HOME="/usr/share/java/jdtls" # golang export GOPATH="${HOME}/code/go"