diff --git a/ftplugin/java.lua b/ftplugin/java.lua new file mode 100644 index 0000000..61e818d --- /dev/null +++ b/ftplugin/java.lua @@ -0,0 +1,5 @@ +local config = { + cmd = { "/home/aselimov/.local/share/nvim/mason/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/ftplugin/java.vim b/ftplugin/java.vim deleted file mode 100644 index ec32e0a..0000000 --- a/ftplugin/java.vim +++ /dev/null @@ -1,2 +0,0 @@ -set colorcolumn=120 -set tw=120 diff --git a/init.lua b/init.lua index b8f90fe..2e8538a 100644 --- a/init.lua +++ b/init.lua @@ -255,9 +255,9 @@ require("lazy").setup({ -- You can put your default mappings / updates / etc. in here -- All the info you're looking for is in `:help telescope.setup()` -- - defaults = { + defaults = vim.tbl_extend("force", require("telescope.themes").get_ivy(), { path_display = { "smart" }, - }, + }), }) pcall(require("telescope").load_extension("live_grep_args")) @@ -377,6 +377,7 @@ require("lazy").setup({ local servers = { clangd = {}, -- gopls = {}, + jdtls = {}, pyright = {}, rust_analyzer = { settings = { @@ -467,13 +468,34 @@ require("lazy").setup({ "hrsh7th/nvim-cmp", event = "InsertEnter", dependencies = { + -- Snippet Engine & its associated nvim-cmp source + { + "L3MON4D3/LuaSnip", + build = (function() + -- Build Step is needed for regex support in snippets + -- This step is not supported in many windows environments + -- Remove the below condition to re-enable on windows + if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then + return + end + return "make install_jsregexp" + end)(), + }, + "saadparwaiz1/cmp_luasnip", "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-path", }, config = function() -- See `:help cmp` local cmp = require("cmp") + local luasnip = require("luasnip") + luasnip.config.setup({}) cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, completion = { completeopt = "menu,menuone,noinsert" }, -- For an understanding of why these mappings were @@ -496,6 +518,11 @@ require("lazy").setup({ -- completions whenever it has completion options available. [""] = cmp.mapping.complete({}), }), + sources = { + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "path" }, + }, }) end, },