diff --git a/ftplugin/java.lua b/ftplugin/java.lua index 7dd724a6..e47a9ab6 100644 --- a/ftplugin/java.lua +++ b/ftplugin/java.lua @@ -99,8 +99,7 @@ local config = { enabled = true, -- Formatting works by default, but you can refer to a specific file/URL if you choose settings = { - path = '/home/lucas/magna-sistemas-java-code-formatter.xml', - profile = 'MagnaSistemasStyle', + url = '/home/lucas/magna-sistemas-java-code-formatter.xml', }, }, completion = { @@ -116,6 +115,7 @@ local config = { importOrder = { 'java', 'javax', + 'jakarta', 'lombok', 'springfox', 'org', diff --git a/init.lua b/init.lua index 86612c18..a3cc308f 100644 --- a/init.lua +++ b/init.lua @@ -156,10 +156,11 @@ vim.opt.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. vim.opt.scrolloff = 15 +-- Uncoment if you want a margin in filetypes vim.api.nvim_create_autocmd('FileType', { pattern = 'java', callback = function() - vim.opt_local.colorcolumn = '120' + vim.opt_local.colorcolumn = '200' end, }) @@ -337,7 +338,7 @@ require('lazy').setup({ { 's', group = '[S]earch' }, { 'w', group = '[W]orkspace' }, { 't', group = '[T]oggle' }, - { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, + --{ 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, }, }, }, @@ -677,11 +678,9 @@ require('lazy').setup({ local ensure_installed = vim.tbl_keys(servers or {}) vim.list_extend(ensure_installed, { 'stylua', -- Used to format Lua code - 'java-debug-adapter', 'java-test', 'prettier', 'eslint_d', - 'angular-language-server', }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } @@ -707,6 +706,10 @@ require('lazy').setup({ require('lspconfig')[server_name].setup(server) end end, + -- TODO: configurar versão do angular e capabilities + angularls = function() + require('lspconfig').angularls.setup {} + end, }, } end, diff --git a/lazy-lock.json b/lazy-lock.json index 15f7f8d9..31441747 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,5 +1,6 @@ { "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, + "auto-session": { "branch": "main", "commit": "9c3f977aafb56bd73ba0d082c4dcbdba5666faf3" }, "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, @@ -7,6 +8,7 @@ "conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" }, "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, "gitsigns.nvim": { "branch": "main", "commit": "4c40357994f386e72be92a46f41fc1664c84c87d" }, + "harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, "lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" }, diff --git a/lua/custom/plugins/auto-session.lua b/lua/custom/plugins/auto-session.lua new file mode 100644 index 00000000..25fa7e93 --- /dev/null +++ b/lua/custom/plugins/auto-session.lua @@ -0,0 +1,14 @@ +return { + { + 'rmagatti/auto-session', + lazy = false, + + ---enables autocomplete for opts + ---@module "auto-session" + ---@type AutoSession.Config + opts = { + -- suppressed_dirs = { '~/', '~/Projects', '~/Downloads', '/' }, + -- log_level = 'debug', + }, + }, +} diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua new file mode 100644 index 00000000..4a88a6bb --- /dev/null +++ b/lua/custom/plugins/harpoon.lua @@ -0,0 +1,60 @@ +return { + 'ThePrimeagen/harpoon', + branch = 'harpoon2', + dependencies = { 'nvim-lua/plenary.nvim', 'nvim-telescope/telescope.nvim' }, + config = function() + local harpoon = require 'harpoon' + harpoon:setup() + vim.keymap.set('n', 'a', function() + harpoon:list():add() + end, { desc = '[A]dd current buffer to harpoon' }) + vim.keymap.set('n', 'h', function() + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, { desc = 'Toggle [H]arpoon Menu' }) + + --vim.keymap.set('n', '', function() + -- harpoon:list():select(1) + --end) + --vim.keymap.set('n', '', function() + -- harpoon:list():select(2) + --end) + --vim.keymap.set('n', '', function() + -- harpoon:list():select(3) + --end) + --vim.keymap.set('n', '', function() + -- harpoon:list():select(4) + --end) + + ---- Toggle previous & next buffers stored within Harpoon list + --vim.keymap.set('n', '', function() + -- harpoon:list():prev() + --end) + --vim.keymap.set('n', '', function() + -- harpoon:list():next() + --end) + + -- basic telescope configuration + --local conf = require('telescope.config').values + --local function toggle_telescope(harpoon_files) + -- local file_paths = {} + -- for _, item in ipairs(harpoon_files.items) do + -- table.insert(file_paths, item.value) + -- end + + -- require('telescope.pickers') + -- .new({}, { + -- prompt_title = 'Harpoon', + -- finder = require('telescope.finders').new_table { + -- results = file_paths, + -- }, + -- previewer = conf.file_previewer {}, + -- sorter = conf.generic_sorter {}, + -- }) + -- :find() + --end + + --vim.keymap.set('n', '', function() + -- toggle_telescope(harpoon:list()) + --end, { desc = 'Open harpoon window' }) + end, +} diff --git a/lua/custom/plugins/springboot-nvim.lua b/lua/custom/plugins/springboot-nvim.lua index 37eb2db9..7bf32dad 100644 --- a/lua/custom/plugins/springboot-nvim.lua +++ b/lua/custom/plugins/springboot-nvim.lua @@ -3,13 +3,55 @@ return { depedencies = { 'neovim/nvim-lspconfig', 'mfussenegger/nvim-jdtls', + 'folke/which-key', }, config = function() local springboot_nvim = require 'springboot-nvim' - vim.keymap.set('n', 'Jr', springboot_nvim.boot_run, { desc = 'Spring Boot Run Project' }) - vim.keymap.set('n', 'Jc', springboot_nvim.generate_class, { desc = 'Java Create Class' }) - vim.keymap.set('n', 'Ji', springboot_nvim.generate_interface, { desc = 'Java Create Interface' }) - vim.keymap.set('n', 'Je', springboot_nvim.generate_enum, { desc = 'Java Create Enum' }) + local java_group = vim.api.nvim_create_augroup('java_commands', { clear = false }) + vim.api.nvim_create_autocmd('FileType', { + pattern = { 'java' }, + callback = function() + vim.api.nvim_buf_set_keymap( + 0, + 'n', + 'Jr', + ':lua require("springboot-nvim").boot_run()', + { desc = 'Spring Boot [R]un Project', noremap = true, silent = true } + ) + vim.api.nvim_buf_set_keymap( + 0, + 'n', + 'Jc', + ':lua require("springboot-nvim").generate_class()', + { desc = 'Java Create [C]lass', noremap = true, silent = true } + ) + vim.api.nvim_buf_set_keymap( + 0, + 'n', + 'Ji', + ':lua require("springboot-nvim").generate_interface()', + { desc = 'Java Create [I]nterface', noremap = true, silent = true } + ) + vim.api.nvim_buf_set_keymap( + 0, + 'n', + 'Je', + ':lua require("springboot-nvim").generate_enum()', + { desc = 'Java Create [E]num', noremap = true, silent = true } + ) + end, + group = java_group, + }) + --vim.keymap.set('n', 'Jr', springboot_nvim.boot_run, { desc = 'Spring Boot Run Project' }) + --vim.keymap.set('n', 'Jc', springboot_nvim.generate_class, { desc = 'Java Create Class' }) + --vim.keymap.set('n', 'Ji', springboot_nvim.generate_interface, { desc = 'Java Create Interface' }) + --vim.keymap.set('n', 'Je', springboot_nvim.generate_enum, { desc = 'Java Create Enum' }) + + local wk = require 'which-key' + wk.add { + { 'J', group = '[J]ava' }, + } + springboot_nvim.setup {} end, } diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 753cb0ce..69ed9341 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -94,7 +94,8 @@ return { -- online, please don't ask me how to install them :) ensure_installed = { -- Update this to ensure that you have the debuggers for the langs you want - 'delve', + -- 'delve', + 'java-debug-adapter', }, }