From 22fafbd51379630395b89af5b2515ddc207ccae9 Mon Sep 17 00:00:00 2001 From: uttarayan21 Date: Tue, 28 Jan 2025 20:43:25 +0530 Subject: [PATCH] chore: Reorganize neovim --- common/home.nix | 1 + modules/aichat.nix | 2 +- neovim/default.nix | 300 ++++++++++++++++++++++----------------------- 3 files changed, 151 insertions(+), 152 deletions(-) diff --git a/common/home.nix b/common/home.nix index decfc6b4..ce0ce0de 100644 --- a/common/home.nix +++ b/common/home.nix @@ -337,6 +337,7 @@ in { aichat = { enable = true; enableFishIntegration = true; + enableNushellIntegration = false; settings = { save_session = true; model = "openai:gpt-4o"; diff --git a/modules/aichat.nix b/modules/aichat.nix index cc247057..350d6943 100644 --- a/modules/aichat.nix +++ b/modules/aichat.nix @@ -29,7 +29,7 @@ with lib; let $env.config.keybindings = ($env.config.keybindings | append { name: aichat_integration modifier: control - keycode: char_o + keycode: char_g mode: [emacs, vi_insert] event:[ { diff --git a/neovim/default.nix b/neovim/default.nix index e5ab2b24..900b7f5a 100644 --- a/neovim/default.nix +++ b/neovim/default.nix @@ -25,6 +25,115 @@ ''; }; in { + opts = { + completeopt = "menu,menuone,popup,noselect"; + expandtab = true; + foldenable = true; + foldlevel = 99; + foldlevelstart = 99; + hidden = true; + number = true; + relativenumber = true; + shell = "sh"; + shiftwidth = 4; + signcolumn = "yes"; + smartcase = true; + softtabstop = 4; + tabstop = 4; + termguicolors = true; + undofile = true; + viewoptions = "cursor,folds"; + wrap = true; + }; + globals = { + mapleader = " "; + localleader = " "; + }; + colorschemes = { + catppuccin = { + enable = true; + settings.flavour = "mocha"; + }; + }; + keymaps = mkMappings { + normal = { + "" = "[[Outline]]"; + "\"" = "[[split]]"; + "%" = "[[vsplit]]"; + "gh" = "[[Octo actions]]"; + "\"" = ''[["+]]''; + "" = "[[ChatGPT]]"; + "dr" = "[[RustLsp debuggables]]"; + "ee" = "[[Rest run]]"; + "el" = "[[Rest run last]]"; + "hh" = "[[DevdocsOpen]]"; + "hl" = "[[DevdocsToggle]]"; + "" = "''"; + "n" = "[[bnext]]"; + "o" = "[[Trouble diagnostics]]"; + "p" = "[[bprev]]"; + "q" = "[[bw]]"; + "mm" = "[[Neorg]]"; + "vff" = "[[vertical Gdiffsplit]]"; + + "rr" = "vim.lsp.buf.rename"; + "" = "vim.lsp.buf.definition"; + "" = "require('FTerm').toggle"; + # "F" = "function() vim.lsp.buf.format({ async = true }) end"; + "F" = "require('conform').format"; + "gi" = "require'telescope.builtin'.lsp_references"; + "a" = "vim.lsp.buf.code_action"; + "bb" = "require'dap'.toggle_breakpoint"; + "du" = "require'dapui'.toggle"; + "fb" = "require'telescope'.extensions.file_browser.file_browser"; + "fg" = "require'yazi'.yazi"; + "ff" = "require'telescope.builtin'.find_files"; + "gg" = "require'telescope.builtin'.live_grep"; + ";" = "require'telescope.builtin'.buffers"; + "zR" = "require'ufo'.openAllFolds"; + "zM" = "require'ufo'.closeAllFolds"; + + # Emulate tmux bindings with prefix and tabs + "" = "[[g]]"; + "c" = "[[tabnew]]"; + "x" = "[[tabclose]]"; + "n" = "[[tabnext]]"; + "p" = "[[tabprevious]]"; + }; + terminal = { + "" = "require('FTerm').toggle"; + }; + insert = { + "" = "require('FTerm').toggle"; + }; + visual = { + "L" = "[[:'<,'>!sort -u]]"; + }; + }; + + autoCmd = [ + { + event = ["BufEnter" "BufWinEnter"]; + pattern = "*.norg"; + command = "set conceallevel=3"; + } + # { + # event = ["BufEnter" "BufWinEnter"]; + # pattern = "*.sql"; + # command = "nnoremap F :Sqlfmt"; + # } + { + event = ["BufWinLeave"]; + pattern = "?*"; + command = "mkview!"; + } + { + event = ["BufWinEnter"]; + pattern = "?*"; + command = "silent! loadview!"; + } + ]; + plugins = { fugitive.enable = true; gitsigns.enable = true; @@ -294,7 +403,7 @@ in { }; }; rustaceanvim = { - enable = false; + enable = true; settings = { server = { default_settings = { @@ -307,12 +416,12 @@ in { }; files = { excludeDirs = [ - ".cargo" - ".direnv" - ".git" - ".vcpkg" - "node_modules" - "target" + ".cargo/" + ".direnv/" + ".git/" + ".vcpkg/" + "node_modules/" + "target/" ]; }; diagnostics = { @@ -379,40 +488,40 @@ in { sqls.enable = true; pyright.enable = true; slint_lsp.enable = true; - rust_analyzer = { - enable = true; - package = null; - installCargo = false; - installRustc = false; - settings = { - inlayHints = { - genericParameterHints = { - lifetime.enable = true; - }; - # implicitDrops.enable = true; - }; - files = { - excludeDirs = [ - ".cargo" - ".direnv" - ".git" - ".vcpkg" - "node_modules" - "target" - ]; - }; - diagnostics = { - enable = true; - styleLints.enable = true; - }; + # rust_analyzer = { + # enable = false; + # package = null; + # installCargo = false; + # installRustc = false; + # settings = { + # inlayHints = { + # genericParameterHints = { + # lifetime.enable = true; + # }; + # # implicitDrops.enable = true; + # }; + # files = { + # excludeDirs = [ + # ".cargo" + # ".direnv" + # ".git" + # ".vcpkg" + # "node_modules" + # "target" + # ]; + # }; + # diagnostics = { + # enable = true; + # styleLints.enable = true; + # }; - checkOnSave = true; - check = { - command = "check"; - features = "all"; - }; - }; - }; + # checkOnSave = true; + # check = { + # command = "check"; + # features = "all"; + # }; + # }; + # }; }; onAttach = /* @@ -483,95 +592,6 @@ in { }; }; }; - globals = { - mapleader = " "; - localleader = " "; - }; - colorschemes = { - catppuccin = { - enable = true; - settings.flavour = "mocha"; - }; - }; - keymaps = mkMappings { - normal = { - "" = "[[Outline]]"; - "\"" = "[[split]]"; - "%" = "[[vsplit]]"; - "gh" = "[[Octo actions]]"; - "\"" = ''[["+]]''; - "" = "[[ChatGPT]]"; - "dr" = "[[RustLsp debuggables]]"; - "ee" = "[[Rest run]]"; - "el" = "[[Rest run last]]"; - "hh" = "[[DevdocsOpen]]"; - "hl" = "[[DevdocsToggle]]"; - "" = "''"; - "n" = "[[bnext]]"; - "o" = "[[Trouble diagnostics]]"; - "p" = "[[bprev]]"; - "q" = "[[bw]]"; - "mm" = "[[Neorg]]"; - "vff" = "[[vertical Gdiffsplit]]"; - - "rr" = "vim.lsp.buf.rename"; - "" = "vim.lsp.buf.definition"; - "" = "require('FTerm').toggle"; - # "F" = "function() vim.lsp.buf.format({ async = true }) end"; - "F" = "require('conform').format"; - "gi" = "require'telescope.builtin'.lsp_references"; - "a" = "vim.lsp.buf.code_action"; - "bb" = "require'dap'.toggle_breakpoint"; - "du" = "require'dapui'.toggle"; - "fb" = "require'telescope'.extensions.file_browser.file_browser"; - "fg" = "require'yazi'.yazi"; - "ff" = "require'telescope.builtin'.find_files"; - "gg" = "require'telescope.builtin'.live_grep"; - ";" = "require'telescope.builtin'.buffers"; - "zR" = "require'ufo'.openAllFolds"; - "zM" = "require'ufo'.closeAllFolds"; - - # Emulate tmux bindings with prefix and tabs - "" = "[[g]]"; - "c" = "[[tabnew]]"; - "x" = "[[tabclose]]"; - "n" = "[[tabnext]]"; - "p" = "[[tabprevious]]"; - }; - terminal = { - "" = "require('FTerm').toggle"; - }; - insert = { - "" = "require('FTerm').toggle"; - }; - visual = { - "L" = "[[:'<,'>!sort -u]]"; - }; - }; - - autoCmd = [ - { - event = ["BufEnter" "BufWinEnter"]; - pattern = "*.norg"; - command = "set conceallevel=3"; - } - # { - # event = ["BufEnter" "BufWinEnter"]; - # pattern = "*.sql"; - # command = "nnoremap F :Sqlfmt"; - # } - { - event = ["BufWinLeave"]; - pattern = "?*"; - command = "mkview!"; - } - { - event = ["BufWinEnter"]; - pattern = "?*"; - command = "silent! loadview!"; - } - ]; - extraConfigLua = /* lua @@ -729,28 +749,6 @@ in { }) ''; - # package = pkgs.neovim-unwrapped; - # pkgs.neovim; - opts = { - completeopt = "menu,menuone,popup,noselect"; - expandtab = true; - foldenable = true; - foldlevel = 99; - foldlevelstart = 99; - hidden = true; - number = true; - relativenumber = true; - shell = "sh"; - shiftwidth = 4; - signcolumn = "yes"; - smartcase = true; - softtabstop = 4; - tabstop = 4; - termguicolors = true; - undofile = true; - viewoptions = "cursor,folds"; - wrap = true; - }; extraPlugins = with pkgs.vimPlugins; [ FTerm-nvim copilot-lua