From 94463cb021ebb0f901fbea81dd65768d13f9aee7 Mon Sep 17 00:00:00 2001 From: Julian Raufelder Date: Sun, 4 Feb 2024 00:48:46 +0100 Subject: [PATCH] Further enhancements --- ftplugin/java.lua | 5 +++++ init.lua | 29 +++++++++++++++++++---------- lazy-lock.json | 43 ++++++++++++++++++++++--------------------- 3 files changed, 46 insertions(+), 31 deletions(-) create mode 100644 ftplugin/java.lua diff --git a/ftplugin/java.lua b/ftplugin/java.lua new file mode 100644 index 0000000..4c7dcfe --- /dev/null +++ b/ftplugin/java.lua @@ -0,0 +1,5 @@ +local config = { + cmd = {'/usr/bin/jdtls'}, + root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, { upward = true })[1]), +} +require('jdtls').start_or_attach(config) diff --git a/init.lua b/init.lua index 0fd7f5e..a232f40 100644 --- a/init.lua +++ b/init.lua @@ -308,6 +308,7 @@ require('lazy').setup({ 'tpope/vim-surround', 'tpope/vim-commentary', 'github/copilot.vim', + 'mfussenegger/nvim-jdtls', -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- These are some example plugins that I've included in the kickstart repository. @@ -487,6 +488,15 @@ local function telescope_live_grep_open_files() prompt_title = 'Live Grep in Open Files', } end + +local function telescope_find_files_in_current_directory() + local opts = { + hidden = true, + cwd = vim.fn.expand('%:p:h') + } + require('telescope.builtin').find_files(opts) +end + vim.keymap.set('n', 's/', telescope_live_grep_open_files, { desc = '[S]earch [/] in Open Files' }) vim.keymap.set('n', 'ss', require('telescope.builtin').builtin, { desc = '[S]earch [S]elect Telescope' }) vim.keymap.set('n', 'gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) @@ -496,8 +506,10 @@ vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc vim.keymap.set('n', 'sG', ':LiveGrepGitRoot', { desc = '[S]earch by [G]rep on Git Root' }) vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) -vim.keymap.set('n', 'sfn', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles [N]o Hidden' }) -vim.keymap.set('n', 'sfh', 'Telescope find_files hidden=true no_ignore=true', { desc = '[S]earch [F]iles [H]idden' }) + +vim.keymap.set('n', 'ff', require('telescope.builtin').find_files, { desc = '[F]ind [F]iles no Hidden' }) +vim.keymap.set('n', 'fh', 'Telescope find_files hidden=true no_ignore=true', { desc = '[F]ind files [H]idden' }) +vim.keymap.set('n', 'fc', telescope_find_files_in_current_directory, { desc = '[F]ind files in [C]urrent directory' }) -- [[ Configure Treesitter ]] -- See `:help nvim-treesitter` @@ -597,7 +609,7 @@ local on_attach = function(_, bufnr) -- See `:help K` for why this keymap nmap('K', vim.lsp.buf.hover, 'Hover Documentation') - nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') + -- nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') this breaks jumping between buffers in split view -- Lesser used LSP functionality nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') @@ -617,6 +629,7 @@ end require('which-key').register { ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, + ['f'] = { name = '[F]ind', _ = 'which_key_ignore' }, ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, ['h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' }, ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, @@ -770,13 +783,8 @@ wilder.setup({modes = {':', '/', '?'}}) vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) -- neo_tree -vim.keymap.set('n', 'f', 'Neotree toggle', { desc = 'Toggle NeoTree' }) +vim.keymap.set('n', 'n', 'Neotree toggle', { desc = 'Toggle [N]eoTree' }) --- database -vim.keymap.set('n', 'nu', 'DBUIToggle', { desc = 'Toggle UI' }) -vim.keymap.set('n', 'nf', 'DBUIFindBuffer', { desc = 'Find buffer' }) -vim.keymap.set('n', 'nr', 'DBUIRenameBuffer', { desc = 'Rename buffer' }) -vim.keymap.set('n', 'nq', 'DBUILastQueryInfo', { desc = 'Last query info' }) -- harpoon local mark = require('harpoon.mark') @@ -793,8 +801,9 @@ vim.keymap.set('n', '', function () ui.nav_file(4) end, { desc = 'Harpoon f -- undotree vim.keymap.set('n', 'u', vim.cmd.UndotreeToggle , { desc = 'Toggle Undotree'}) --- copilot disabled by default, enable it by typing :let b:copilot_enabled = 1 +-- copilot disabled by default, enable it by typing :let b:copilot_enabled = 1 or executing ThisIsYourCaptainSpeaking vim.g.copilot_assume_mapped = true vim.api.nvim_exec([[ au BufNewFile,BufRead * let b:copilot_enabled = 0 ]], false) vim.api.nvim_create_user_command('ThisIsYourCaptainSpeaking', 'let b:copilot_enabled = 1', {}) + diff --git a/lazy-lock.json b/lazy-lock.json index ee3545d..0e5a4c9 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,40 +1,41 @@ { "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, - "LuaSnip": { "branch": "master", "commit": "2463d687fe704b76eb0aa3bb34e95f69a5bb0362" }, + "LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "copilot.vim": { "branch": "release", "commit": "5b19fb001d7f31c4c7c5556d7a97b243bd29f45f" }, - "fidget.nvim": { "branch": "main", "commit": "a4a7edfea37e557dbff5509ee374ffb57051bba9" }, - "friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" }, - "gitsigns.nvim": { "branch": "main", "commit": "d195f0c35ced5174d3ecce1c4c8ebb3b5bc23fa9" }, + "copilot.vim": { "branch": "release", "commit": "49e0348bfb913fae63ca5ddb987a8bccd193da86" }, + "fidget.nvim": { "branch": "main", "commit": "3a93300c076109d86c7ce35ec67a8034ae6ba9db" }, + "friendly-snippets": { "branch": "main", "commit": "69a2c1675b66e002799f5eef803b87a12f593049" }, + "gitsigns.nvim": { "branch": "main", "commit": "4aaacbf5e5e2218fd05eb75703fe9e0f85335803" }, "harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" }, - "indent-blankline.nvim": { "branch": "master", "commit": "5da5546947f3125dfd6aa85ab21074dc83f776d5" }, - "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, + "indent-blankline.nvim": { "branch": "master", "commit": "12e92044d313c54c438bd786d11684c88f6f78cd" }, + "lazy.nvim": { "branch": "main", "commit": "747bb955c5bfb2dc5d51280132f00a56a53f9f6d" }, "lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" }, - "mason.nvim": { "branch": "main", "commit": "a09da6ac634926a299dd439da08bdb547a8ca011" }, - "neo-tree.nvim": { "branch": "main", "commit": "77d9f484b88fd380386b46ed9206e5374d69d9d8" }, - "neodev.nvim": { "branch": "main", "commit": "7cb4f7f29c6bf6f1d21a37f6dd6d12ba64266b09" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "3ba1b92b771f33256b4969d696b82c8ae7075364" }, + "mason.nvim": { "branch": "main", "commit": "e110bc3be1a7309617cecd77bfe4bf86ba1b8134" }, + "neo-tree.nvim": { "branch": "main", "commit": "2f2d08894bbc679d4d181604c16bb7079f646384" }, + "neodev.nvim": { "branch": "main", "commit": "aaeb44589cab39c2545a328661af355622d68479" }, "noice.nvim": { "branch": "main", "commit": "92433164e2f7118d4122c7674c3834d9511722ba" }, - "nui.nvim": { "branch": "main", "commit": "80445d015d2b5f9af0d9e8bce63d303bc86eda8a" }, + "nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" }, "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, - "nvim-lspconfig": { "branch": "master", "commit": "9bedcfed749755e43fc8bed46f85ce2044fe3b77" }, - "nvim-notify": { "branch": "master", "commit": "ebcdd8219e2a2cbc0a4bef68002f6867f1fde269" }, - "nvim-treesitter": { "branch": "master", "commit": "e49f1e8ef3e8450a8446cb1f2bbb53c919f60b6d" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "0e2d5bd4cbe75849a013901555d436a48c6680cb" }, - "nvim-web-devicons": { "branch": "master", "commit": "808627b8d412b2a6b6fc6eed816fec3557198b01" }, - "onedark.nvim": { "branch": "master", "commit": "c5476a091b0f1b4e853db91c91ff941f848a1cdd" }, + "nvim-jdtls": { "branch": "master", "commit": "66b5ace68a5d1c45fdfb1afa8d847e87af2aa1f8" }, + "nvim-lspconfig": { "branch": "master", "commit": "042aa6b27b8b8d4f4e1bd42de2037c83d676a8a0" }, + "nvim-notify": { "branch": "master", "commit": "80b67b265530632505193553d05127ae7fe09ddd" }, + "nvim-treesitter": { "branch": "master", "commit": "f5a839d1e87fd1782849a98342fd6931c9066c9a" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "19a91a38b02c1c28c14e0ba468d20ae1423c39b2" }, + "nvim-web-devicons": { "branch": "master", "commit": "140edfcf25093e8b321d13e154cbce89ee868ca0" }, + "onedark.nvim": { "branch": "master", "commit": "dc3bad0121298f89b50aaff8599d1946e07eb4c2" }, "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, "telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, "undotree": { "branch": "master", "commit": "36ff7abb6b60980338344982ad4cdf03f7961ecd" }, - "vim-commentary": { "branch": "master", "commit": "e87cd90dc09c2a203e13af9704bd0ef79303d755" }, + "vim-commentary": { "branch": "master", "commit": "f67e3e67ea516755005e6cccb178bc8439c6d402" }, "vim-dadbod": { "branch": "master", "commit": "738cfc2ea6a1510fe23cba9006fef9291be70f7b" }, "vim-dadbod-completion": { "branch": "master", "commit": "c920cb0ba3dff4b1b0ed373e1c0b3007dec696c2" }, - "vim-dadbod-ui": { "branch": "master", "commit": "9ddb0623e69d696b7a8355b93e3950a8dc6e00a0" }, - "vim-fugitive": { "branch": "master", "commit": "59659093581aad2afacedc81f009ed6a4bfad275" }, + "vim-dadbod-ui": { "branch": "master", "commit": "e99dcfd5162d9b9b4b24a5d035cf114315f1aeec" }, + "vim-fugitive": { "branch": "master", "commit": "854a8df0d06b8d3fcb30fa7f2b08c62b553eee3b" }, "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },