diff --git a/config/completion/cmp.nix b/config/completion/cmp.nix index 82ab3f8e..a8c5bc06 100644 --- a/config/completion/cmp.nix +++ b/config/completion/cmp.nix @@ -111,7 +111,7 @@ }; }; extraConfigLua = '' - luasnip = require("luasnip") + local luasnip = require("luasnip") kind_icons = { Text = "󰊄", Method = "îȘŒ", @@ -149,15 +149,6 @@ } }) - -- Set configuration for specific filetype. - cmp.setup.filetype('gitcommit', { - sources = cmp.config.sources({ - { name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it. - }, { - { name = 'buffer' }, - }) - }) - -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). cmp.setup.cmdline(':', { sources = cmp.config.sources({ diff --git a/config/default.nix b/config/default.nix index af311dca..73bab05f 100644 --- a/config/default.nix +++ b/config/default.nix @@ -23,7 +23,6 @@ ./keys.nix ./languages ./lsp - ./none-ls ./pluginmanagers ./sets ./snippets @@ -42,7 +41,6 @@ keys.enable = true; languages.enable = true; lsp.enable = lib.mkDefault true; - none-ls.enable = lib.mkDefault false; sets.enable = lib.mkDefault true; pluginmanagers.enable = lib.mkDefault true; snippets.enable = lib.mkDefault true; diff --git a/config/languages/jdtls.nix b/config/languages/jdtls.nix index edaf0fbb..e6edcfa9 100644 --- a/config/languages/jdtls.nix +++ b/config/languages/jdtls.nix @@ -1,4 +1,9 @@ -{ lib, config, pkgs, ... }: +{ + lib, + config, + pkgs, + ... +}: { options = { jdtls.enable = lib.mkEnableOption "Enable jdtls module"; diff --git a/config/languages/treesitter-nvim.nix b/config/languages/treesitter-nvim.nix index 2a02a670..e4627e7f 100644 --- a/config/languages/treesitter-nvim.nix +++ b/config/languages/treesitter-nvim.nix @@ -13,12 +13,6 @@ indent = { enable = true; }; - autopairs = { - enable = true; - }; - folding = { - enable = true; - }; ensure_installed = [ "bash" "c" @@ -45,7 +39,7 @@ "toml" "yaml" ]; - auto_install = true; + auto_install = false; incremental_selection = { enable = true; keymaps = { diff --git a/config/lsp/default.nix b/config/lsp/default.nix index 09e23adb..400f6bdf 100644 --- a/config/lsp/default.nix +++ b/config/lsp/default.nix @@ -8,7 +8,6 @@ ./conform.nix ./fidget.nix ./lsp-nvim.nix - ./lspsaga.nix ./trouble.nix ]; @@ -19,7 +18,6 @@ conform.enable = lib.mkDefault true; fidget.enable = lib.mkDefault true; lsp-nvim.enable = lib.mkDefault true; - lspsaga.enable = lib.mkDefault false; trouble.enable = lib.mkDefault true; }; } diff --git a/config/lsp/lsp-nvim.nix b/config/lsp/lsp-nvim.nix index 0ccdf2db..a345bf34 100644 --- a/config/lsp/lsp-nvim.nix +++ b/config/lsp/lsp-nvim.nix @@ -158,14 +158,6 @@ action = "open_float"; desc = "Line Diagnostics"; }; - "[d" = { - action = "goto_next"; - desc = "Next Diagnostic"; - }; - "]d" = { - action = "goto_prev"; - desc = "Previous Diagnostic"; - }; }; }; onAttach = '' @@ -183,60 +175,47 @@ }; }; extraConfigLua = '' - local _border = "rounded" - - require('lspconfig.ui.windows').default_options = { - border = _border - } - - vim.lsp.handlers["textDocument/hover"] = function(err, result, ctx, config) - config = vim.tbl_deep_extend("force", config or {}, { border = _border }) - return vim.lsp.handlers.hover(err, result, ctx, config) - end - - vim.lsp.handlers["textDocument/signatureHelp"] = function(err, result, ctx, config) - config = vim.tbl_deep_extend("force", config or {}, { border = _border }) - return vim.lsp.handlers.signature_help(err, result, ctx, config) - end + require("lspconfig.ui.windows").default_options = { border = "rounded" } - vim.diagnostic.config({ - float = { border = "rounded" }, - virtual_text = { - prefix = "", - }, - signs = true, - underline = true, - update_in_insert = true, - }) + vim.lsp.config("*", { + handlers = { + ["textDocument/hover"] = function(err, result, ctx, config) + vim.lsp.handlers.hover(err, result, ctx, vim.tbl_extend("force", config or {}, { border = "rounded" })) + end, + ["textDocument/signatureHelp"] = function(err, result, ctx, config) + vim.lsp.handlers.signature_help(err, result, ctx, vim.tbl_extend("force", config or {}, { border = "rounded" })) + end, + }, + }) - -- vim.api.nvim_create_autocmd("LspAttach", { - -- group = vim.api.nvim_create_augroup("UserLspConfig", {}), - -- callback = function(args) - -- local client = vim.lsp.get_client_by_id(args.data.client_id) - -- if client.server_capabilities.inlayHintProvider then - -- vim.lsp.inlay_hint.enable(false) - -- end - -- vim.bo[args.buf].omnifunc = "v:lua.vim.lsp.omnifunc" - -- - -- local opts = { buffer = args.buf } - -- vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) - -- vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) - -- vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts) - -- vim.keymap.set("n", "gI", vim.lsp.buf.implementation, opts) - -- vim.keymap.set("n", "gT", vim.lsp.buf.type_definition, opts) - -- vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) - -- vim.keymap.set("n", "", vim.lsp.buf.signature_help, opts) - -- vim.keymap.set("n", "cw", vim.lsp.buf.workspace_symbol, opts) - -- vim.keymap.set("n", "cr", vim.lsp.buf.rename, opts) - -- vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) - -- vim.keymap.set("n", "cf", function() - -- vim.lsp.buf.format({ async = true }) - -- end, opts) - -- vim.keymap.set("n", "cd", vim.diagnostic.open_float, opts) - -- vim.keymap.set("n", "[d", vim.diagnostic.goto_next, opts) - -- vim.keymap.set("n", "]d", vim.diagnostic.goto_prev, opts) - -- end, - -- }) + vim.diagnostic.config({ + float = { border = "rounded" }, + virtual_text = { prefix = "" }, + signs = true, + underline = true, + update_in_insert = true, + }) ''; + + keymaps = [ + { + mode = "n"; + key = "[d"; + action.__raw = "function() vim.diagnostic.jump({ count = 1, float = true }) end"; + options = { + silent = true; + desc = "Next Diagnostic"; + }; + } + { + mode = "n"; + key = "]d"; + action.__raw = "function() vim.diagnostic.jump({ count = -1, float = true }) end"; + options = { + silent = true; + desc = "Previous Diagnostic"; + }; + } + ]; }; } diff --git a/config/lsp/lspsaga.nix b/config/lsp/lspsaga.nix deleted file mode 100644 index f57ed168..00000000 --- a/config/lsp/lspsaga.nix +++ /dev/null @@ -1,198 +0,0 @@ -{ lib, config, ... }: -{ - options = { - lspsaga.enable = lib.mkEnableOption "Enable lspsaga module"; - }; - config = lib.mkIf config.lspsaga.enable { - plugins.lspsaga = { - enable = true; - beacon = { - enable = true; - }; - ui = { - border = "rounded"; # One of none, single, double, rounded, solid, shadow - codeAction = "💡"; # Can be any symbol you want 💡 - }; - hover = { - openCmd = "!floorp"; # Choose your browser - openLink = "gx"; - }; - diagnostic = { - borderFollow = true; - diagnosticOnlyCurrent = false; - showCodeAction = true; - }; - symbolInWinbar = { - enable = true; # Breadcrumbs - }; - codeAction = { - extendGitSigns = false; - showServerName = true; - onlyInCursor = true; - numShortcut = true; - keys = { - exec = ""; - quit = [ - "" - "q" - ]; - }; - }; - lightbulb = { - enable = false; - sign = false; - virtualText = true; - }; - implement = { - enable = false; - }; - rename = { - autoSave = false; - keys = { - exec = ""; - quit = [ - "" - "" - ]; - select = "x"; - }; - }; - outline = { - autoClose = true; - autoPreview = true; - closeAfterJump = true; - layout = "normal"; # normal or float - winPosition = "right"; # left or right - keys = { - jump = "e"; - quit = "q"; - toggleOrJump = "o"; - }; - }; - scrollPreview = { - scrollDown = ""; - scrollUp = ""; - }; - }; - # keymaps = [ - # { - # mode = "n"; - # key = "gd"; - # action = "Lspsaga finder def"; - # options = { - # desc = "Goto Definition"; - # silent = true; - # }; - # } - # { - # mode = "n"; - # key = "gr"; - # action = "Lspsaga finder ref"; - # options = { - # desc = "Goto References"; - # silent = true; - # }; - # } - # - # # { - # # mode = "n"; - # # key = "gD"; - # # action = "Lspsaga show_line_diagnostics"; - # # options = { - # # desc = "Goto Declaration"; - # # silent = true; - # # }; - # # } - # - # { - # mode = "n"; - # key = "gI"; - # action = "Lspsaga finder imp"; - # options = { - # desc = "Goto Implementation"; - # silent = true; - # }; - # } - # - # { - # mode = "n"; - # key = "gT"; - # action = "Lspsaga peek_type_definition"; - # options = { - # desc = "Type Definition"; - # silent = true; - # }; - # } - # - # { - # mode = "n"; - # key = "K"; - # action = "Lspsaga hover_doc"; - # options = { - # desc = "Hover"; - # silent = true; - # }; - # } - # - # { - # mode = "n"; - # key = "cw"; - # action = "Lspsaga outline"; - # options = { - # desc = "Outline"; - # silent = true; - # }; - # } - # - # { - # mode = "n"; - # key = "cr"; - # action = "Lspsaga rename"; - # options = { - # desc = "Rename"; - # silent = true; - # }; - # } - # - # { - # mode = "n"; - # key = "ca"; - # action = "Lspsaga code_action"; - # options = { - # desc = "Code Action"; - # silent = true; - # }; - # } - # - # { - # mode = "n"; - # key = "cd"; - # action = "Lspsaga show_line_diagnostics"; - # options = { - # desc = "Line Diagnostics"; - # silent = true; - # }; - # } - # - # { - # mode = "n"; - # key = "[d"; - # action = "Lspsaga diagnostic_jump_next"; - # options = { - # desc = "Next Diagnostic"; - # silent = true; - # }; - # } - # - # { - # mode = "n"; - # key = "]d"; - # action = "Lspsaga diagnostic_jump_prev"; - # options = { - # desc = "Previous Diagnostic"; - # silent = true; - # }; - # } - # ]; - }; -} diff --git a/config/none-ls/default.nix b/config/none-ls/default.nix deleted file mode 100644 index 57e313fd..00000000 --- a/config/none-ls/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - lib, - config, - ... -}: -{ - imports = [ - ./none-ls-nvim.nix - ]; - - options = { - none-ls.enable = lib.mkEnableOption "Enable none-ls module"; - }; - config = lib.mkIf config.none-ls.enable { - none-ls-nvim.enable = lib.mkDefault true; - }; -} diff --git a/config/none-ls/none-ls-nvim.nix b/config/none-ls/none-ls-nvim.nix deleted file mode 100644 index fc97b7cb..00000000 --- a/config/none-ls/none-ls-nvim.nix +++ /dev/null @@ -1,84 +0,0 @@ -{ lib, config, ... }: -{ - options = { - none-ls-nvim.enable = lib.mkEnableOption "Enable none-ls-nvim module"; - }; - config = lib.mkIf config.none-ls-nvim.enable { - plugins.none-ls = { - enable = true; - settings = { - enableLspFormat = false; - updateInInsert = false; - onAttach = '' - function(client, bufnr) - if client.supports_method "textDocument/formatting" then - vim.api.nvim_clear_autocmds { group = augroup, buffer = bufnr } - vim.api.nvim_create_autocmd("BufWritePre", { - group = augroup, - buffer = bufnr, - callback = function() - vim.lsp.buf.format { bufnr = bufnr } - end, - }) - end - end - ''; - }; - sources = { - code_actions = { - gitsigns.enable = true; - statix.enable = true; - }; - diagnostics = { - checkstyle = { - enable = true; - }; - statix = { - enable = true; - }; - }; - formatting = { - alejandra = { - enable = false; - }; - nixfmt = { - enable = true; - }; - prettier = { - enable = true; - settings = '' - { - extra_args = { "--no-semi", "--single-quote" }, - } - ''; - }; - google_java_format = { - enable = true; - }; - stylua = { - enable = true; - }; - black = { - enable = true; - settings = '' - { - extra_args = { "--fast" }, - } - ''; - }; - }; - }; - }; - # keymaps = [ - # { - # mode = [ "n" "v" ]; - # key = "cf"; - # action = "lua vim.lsp.buf.format()"; - # options = { - # silent = true; - # desc = "Format"; - # }; - # } - # ]; - }; -} diff --git a/config/ui/dressing-nvim.nix b/config/ui/dressing-nvim.nix index 075c8877..3e2ffd16 100644 --- a/config/ui/dressing-nvim.nix +++ b/config/ui/dressing-nvim.nix @@ -18,8 +18,14 @@ relative = "cursor"; prefer_width = 40; width = null; - max_width = [ 140 0.9 ]; - min_width = [ 20 0.2 ]; + max_width = [ + 140 + 0.9 + ]; + min_width = [ + 20 + 0.2 + ]; win_options = { wrap = false; list = true; @@ -41,7 +47,13 @@ }; select = { enabled = true; - backend = [ "telescope" "fzf_lua" "fzf" "builtin" "nui" ]; + backend = [ + "telescope" + "fzf_lua" + "fzf" + "builtin" + "nui" + ]; trim_prompt = true; telescope = null; fzf = { @@ -71,11 +83,20 @@ cursorlineopt = "both"; }; width = null; - max_width = [ 140 0.8 ]; - min_width = [ 40 0.2 ]; + max_width = [ + 140 + 0.8 + ]; + min_width = [ + 40 + 0.2 + ]; height = null; max_height = 0.9; - min_height = [ 10 0.2 ]; + min_height = [ + 10 + 0.2 + ]; mappings = { "" = "Close"; "" = "Close"; diff --git a/config/utils/default.nix b/config/utils/default.nix index dbfac458..395ca98a 100644 --- a/config/utils/default.nix +++ b/config/utils/default.nix @@ -23,7 +23,6 @@ ./project-nvim.nix ./tmux-navigator.nix ./todo-comments.nix - ./ultimate-autopair.nix ./undotree.nix ./wakatime.nix ./which-key.nix @@ -52,7 +51,6 @@ project-nvim.enable = lib.mkDefault true; tmux-navigator.enable = lib.mkDefault true; todo-comments.enable = lib.mkDefault true; - ultimate-autopair.enable = lib.mkDefault true; undotree.enable = lib.mkDefault true; wakatime.enable = lib.mkDefault true; which-key.enable = lib.mkDefault true; diff --git a/config/utils/mini.nix b/config/utils/mini.nix index cbae13f6..ec13a194 100644 --- a/config/utils/mini.nix +++ b/config/utils/mini.nix @@ -9,8 +9,10 @@ modules = { comment = { options = { - customCommentString = '' - lua require("ts_context_commentstring.internal").calculate_commentstring() or vim.bo.commentstring + custom_commentstring.__raw = '' + function() + return require("ts_context_commentstring").calculate_commentstring() or vim.bo.commentstring + end ''; }; }; diff --git a/config/utils/nvterm.nix b/config/utils/nvterm.nix index 3c296ffa..4e652eaa 100644 --- a/config/utils/nvterm.nix +++ b/config/utils/nvterm.nix @@ -9,66 +9,70 @@ nvterm.enable = lib.mkEnableOption "Enable nvterm module"; }; config = lib.mkIf config.nvterm.enable { - extraPlugins = [ - pkgs.vimPlugins.nvterm - ]; + extraPlugins = [ pkgs.vimPlugins.nvterm ]; + extraConfigLua = '' require("nvterm").setup({ - terminals = { - shell = vim.o.shell, - list = {}, - type_opts = { - float = { - relative = "editor", - row = 0.3, - col = 0.25, - width = 0.5, - height = 0.4, - border = "single", - }, - horizontal = { location = "rightbelow", split_ratio = 0.5 }, - vertical = { location = "rightbelow", split_ratio = 0.5 }, - }, - }, - behavior = { - autoclose_on_quit = { - enabled = false, - confirm = true, - }, - close_on_exit = true, - auto_insert = true, - }, + terminals = { + shell = vim.o.shell, + type_opts = { + float = { + relative = "editor", + row = 0.3, + col = 0.25, + width = 0.5, + height = 0.4, + border = "single", + }, + horizontal = { location = "rightbelow", split_ratio = 0.5 }, + vertical = { location = "rightbelow", split_ratio = 0.5 }, + }, + }, + behavior = { + autoclose_on_quit = { enabled = false, confirm = true }, + close_on_exit = true, + auto_insert = true, + }, }) - local terminal = require("nvterm.terminal") + ''; - local toggle_modes = { "n", "t" } - local mappings = { - { - toggle_modes, - "", - function() - terminal.toggle("horizontal") - end, - }, - { - toggle_modes, - "", - function() - terminal.toggle("vertical") - end, - }, - { - toggle_modes, - "", - function() - terminal.toggle("float") - end, - }, + keymaps = [ + { + mode = [ + "n" + "t" + ]; + key = ""; + action.__raw = ''function() require("nvterm.terminal").toggle("horizontal") end''; + options = { + silent = true; + desc = "Toggle horizontal terminal"; + }; } - local opts = { noremap = true, silent = true } - for _, mapping in ipairs(mappings) do - vim.keymap.set(mapping[1], mapping[2], mapping[3], opts) - end - ''; + { + mode = [ + "n" + "t" + ]; + key = ""; + action.__raw = ''function() require("nvterm.terminal").toggle("vertical") end''; + options = { + silent = true; + desc = "Toggle vertical terminal"; + }; + } + { + mode = [ + "n" + "t" + ]; + key = ""; + action.__raw = ''function() require("nvterm.terminal").toggle("float") end''; + options = { + silent = true; + desc = "Toggle floating terminal"; + }; + } + ]; }; } diff --git a/config/utils/ultimate-autopair.nix b/config/utils/ultimate-autopair.nix deleted file mode 100644 index 2abb2fe0..00000000 --- a/config/utils/ultimate-autopair.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: -{ - options = { - ultimate-autopair.enable = lib.mkEnableOption "Enable ultimate-autopair module"; - }; - config = lib.mkIf config.ultimate-autopair.enable { - - extraPlugins = with pkgs.vimPlugins; [ - ultimate-autopair-nvim - ]; - extraConfigLua = '' - require('ultimate-autopair').setup() - ''; - }; -}