Add Java & Some Cleanup
This commit is contained in:
parent
d0ace3c891
commit
073aa72a25
6 changed files with 126 additions and 45 deletions
|
@ -99,6 +99,11 @@ K.SEARCH = {
|
|||
shortcut = '<leader>fz',
|
||||
description = 'Fuzzy File',
|
||||
},
|
||||
SYMBOLS = {
|
||||
mode = 'n',
|
||||
shortcut = '<leader>fs',
|
||||
description = 'Find Symbols',
|
||||
},
|
||||
GLOBAL_FIND_FILE = {
|
||||
mode = 'n',
|
||||
shortcut = '<leader>gff',
|
||||
|
|
|
@ -14,6 +14,8 @@ return {
|
|||
close_if_last_window = false,
|
||||
enable_git_status = true,
|
||||
enable_diagnostics = true,
|
||||
enable_cursor_hijack = true,
|
||||
hide_root_node = true,
|
||||
name = {
|
||||
trailing_slash = false,
|
||||
use_git_status_colors = true,
|
||||
|
@ -39,7 +41,10 @@ return {
|
|||
},
|
||||
filesystem = {
|
||||
hijack_netrw_behavior = 'open_default',
|
||||
group_empty_dirs = true,
|
||||
scan_mode = 'deep',
|
||||
},
|
||||
popup_border_style = 'rounded',
|
||||
-- Keybinding --
|
||||
window = {
|
||||
mappings = {
|
||||
|
|
|
@ -6,7 +6,12 @@ return {
|
|||
'williamboman/mason.nvim',
|
||||
lazy = false,
|
||||
config = function()
|
||||
require('mason').setup()
|
||||
require('mason').setup({
|
||||
registries = {
|
||||
'github:nvim-java/mason-registry',
|
||||
'github:mason-org/mason-registry',
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
|
@ -23,6 +28,9 @@ return {
|
|||
},
|
||||
{
|
||||
'neovim/nvim-lspconfig',
|
||||
dependencies = {
|
||||
'nvim-java/nvim-java', -- Needs To Be Loaded before lspconfig
|
||||
},
|
||||
lazy = false,
|
||||
config = function()
|
||||
-- Setup --
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
local K = require('core.keymap')
|
||||
return {
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
tag = '0.1.5',
|
||||
dependencies = {
|
||||
|
@ -49,4 +50,20 @@ return {
|
|||
true
|
||||
)
|
||||
end,
|
||||
},
|
||||
{
|
||||
'ibhagwan/fzf-lua',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
config = function()
|
||||
local fzf = require('fzf-lua')
|
||||
fzf.setup({})
|
||||
|
||||
vim.keymap.set(
|
||||
K.SEARCH.SYMBOLS.mode,
|
||||
K.SEARCH.SYMBOLS.shortcut,
|
||||
fzf.lsp_live_workspace_symbols,
|
||||
{ desc = K.SEARCH.SYMBOLS.description }
|
||||
)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -135,6 +135,7 @@ function TOOLCHAINS.init()
|
|||
require('toolchain.text').setup()
|
||||
require('toolchain.web').setup()
|
||||
require('toolchain.angular').setup()
|
||||
require('toolchain.java').setup()
|
||||
end
|
||||
|
||||
return TOOLCHAINS
|
||||
|
|
45
lua/toolchain/java.lua
Normal file
45
lua/toolchain/java.lua
Normal file
|
@ -0,0 +1,45 @@
|
|||
local T = require('toolchain')
|
||||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
T.add_highlighter_autoinstalls('java', 'kotlin')
|
||||
T.add_lsps(function(lspconfig, capabilities)
|
||||
local paths = vim.fn.systemlist(
|
||||
"update-alternatives --display java | grep '^/.*$' | cut -d ' ' -f 1"
|
||||
)
|
||||
local runtimes = {}
|
||||
for _, path in ipairs(paths) do
|
||||
local version = vim.fn.matchstr(path, '\\v\\d+(\\.\\d+)*')
|
||||
table.insert(runtimes, {
|
||||
name = version,
|
||||
path = path,
|
||||
})
|
||||
end
|
||||
lspconfig.jdtls.setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
java = {
|
||||
configuration = {
|
||||
runtimes = runtimes,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end)
|
||||
|
||||
T.add_plugins({
|
||||
'nvim-java/nvim-java',
|
||||
config = function()
|
||||
require('java').setup({
|
||||
notifications = {
|
||||
dap = false,
|
||||
},
|
||||
jdk = {
|
||||
auto_install = false,
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
Loading…
Add table
Reference in a new issue