diff --git a/config/nvim/lsp.lua b/config/nvim/lsp.lua index ed10928f..51f7bc40 100644 --- a/config/nvim/lsp.lua +++ b/config/nvim/lsp.lua @@ -40,3 +40,20 @@ require("neo-tree").setup({ }) require('todo-comments').setup() require("scrollbar").setup() + +-- Auto indent when pressing Enter between brackets +local remap = vim.api.nvim_set_keymap +local npairs = require('nvim-autopairs') +npairs.setup({map_cr=false}) + +_G.MUtils= {} + +MUtils.completion_confirm=function() + if vim.fn["coc#pum#visible"]() ~= 0 then + return vim.fn["coc#pum#confirm"]() + else + return npairs.autopairs_cr() + end +end + +remap('i' , '','v:lua.MUtils.completion_confirm()', {expr = true , noremap = true}) diff --git a/nixos/home/nvim.nix b/nixos/home/nvim.nix index 489d6b9a..d16661b6 100644 --- a/nixos/home/nvim.nix +++ b/nixos/home/nvim.nix @@ -19,8 +19,8 @@ in { xdg.configFile = { "nvim/coc-settings.json".source = pkgs.writeText "coc-settings.json" '' { - "java.jdt.ls.java.home": "${pkgs.temurin-bin-18}", "colors.enable": true, + "coc.preferences.formatOnType": true, "Lua.misc.parameters": [ "--metapath", "~/.cache/sumneko_lua/meta", @@ -28,6 +28,7 @@ in { "~/.cache/sumneko_lua/log" ], "sumneko-lua.serverDir": "${pkgs.lua-language-server}/share/lua-language-server", + "java.jdt.ls.java.home": "${pkgs.temurin-bin-18}", "bashIde.shellcheckPath": "${pkgs.shellcheck}/bin/shellcheck" } ''; @@ -67,7 +68,6 @@ in { coc-sumneko-lua coc-highlight coc-json - coc-pairs coc-pyright coc-sh coc-snippets @@ -75,6 +75,7 @@ in { coc-yaml coc-toml coc-markdownlint + coc-tsserver coc-fzf (plugin "junegunn/fzf.vim") @@ -95,6 +96,7 @@ in { (plugin "MunifTanjim/nui.nvim") # to explore more + nvim-autopairs (plugin "sindrets/diffview.nvim") (plugin "folke/todo-comments.nvim") (plugin "petertriho/nvim-scrollbar")