diff --git a/modules/neovim/default.nix b/modules/neovim/default.nix index 355a395..121df04 100644 --- a/modules/neovim/default.nix +++ b/modules/neovim/default.nix @@ -1,9 +1,5 @@ +{ config, lib, ... }: { - config, - lib, - host, - ... -}: { # based on default options from upstream: # https://github.com/NotAShelf/nvf/blob/main/configuration.nix # @@ -45,6 +41,10 @@ # https://github.com/onsails/lspkind.nvim lspkind.enable = config.vim.autocomplete.blink-cmp.enable; }; + treesitter = { + enable = true; + addDefaultGrammars = true; + }; debugger = { nvim-dap = { enable = true; @@ -57,17 +57,17 @@ enableExtraDiagnostics = true; # sort-lines: on - assembly.enable = true; bash.enable = true; clang.enable = true; css.enable = true; html.enable = true; + markdown.enable = true; nix.enable = true; + python.enable = true; rust.crates.enable = true; rust.enable = true; ts.enable = true; zig.enable = true; - markdown.enable = true; # sort-lines: off nix.format.type = "nixfmt"; # looks so much nicer @@ -107,19 +107,24 @@ bigfile.enable = true; explorer.replace_netrw = true; dashboard = { - sections = [ - {section = "header";} - { - icon = " "; - title = "Keymaps"; - section = "keys"; - indent = 2; - padding = 1; - } + preset.keys = [ { icon = " "; - title = "Recent Files"; - section = "recent_files"; + key = "n"; + desc = "New File"; + action = ":ene | startinsert"; + } + { + icon = " "; + key = "r"; + desc = "Recent Files"; + action = ":lua Snacks.dashboard.pick('oldfiles')"; + } + ]; + sections = [ + { section = "header"; } + { + section = "keys"; indent = 2; padding = 1; } @@ -130,6 +135,21 @@ indent = 2; padding = 1; } + { + icon = " "; + title = "Git"; + section = "terminal"; + enabled = lib.options.literalExpression '' + function() + return Snacks.git.get_root() ~= nil + end + ''; + cmd = "git status --short --branch --renames"; + height = 10; + padding = 1; + ttl = 5 * 60; + indent = 3; + } ]; }; image.enable = true; @@ -137,7 +157,7 @@ picker = { enable = true; sources = { - explorer = {}; + explorer = { }; }; }; }; diff --git a/users/chloe/configuration.nix b/users/chloe/configuration.nix index afd13a6..3c0630e 100644 --- a/users/chloe/configuration.nix +++ b/users/chloe/configuration.nix @@ -3,8 +3,8 @@ { # packages for all machines environment.systemPackages = with pkgs; [ + git ]; - # services for all machines # configuration for shared modules. # all custom options in 'shared' for clarity. diff --git a/users/chloe/vim.nix b/users/chloe/vim.nix index f7db33f..29e23ce 100644 --- a/users/chloe/vim.nix +++ b/users/chloe/vim.nix @@ -1,20 +1,58 @@ -{ ... }: -{ - vim.theme.extraConfig = '' - if vim.g.neovide then - vim.g.neovide_cursor_trail_size = 0.3 - vim.g.neovide_scroll_animation_length = 0.1; +_: { + vim = { + options = { + tabstop = 2; + softtabstop = 2; + shiftwidth = 2; + undofile = true; + swapfile = false; + showmode = false; + foldlevel = 99; + foldcolumn = "1"; + foldlevelstart = 99; + foldenable = true; + linebreak = true; + }; - vim.keymap.set('n', '', ':w') -- Save - vim.keymap.set('v', '', '"+y') -- Copy - vim.keymap.set('n', '', '"+P') -- Paste normal mode - vim.keymap.set('v', '', '"+P') -- Paste visual mode - vim.keymap.set('c', '', '+') -- Paste command mode - vim.keymap.set('i', '', 'l"+Pli') -- Paste insert mode - end - vim.api.nvim_set_keymap("", '', '+p', { noremap = true, silent = true}) - vim.api.nvim_set_keymap('!', '', '+', { noremap = true, silent = true}) - vim.api.nvim_set_keymap('t', '', '+', { noremap = true, silent = true}) - vim.api.nvim_set_keymap('v', '', '+', { noremap = true, silent = true}) - ''; + binds = { + hardtime-nvim.setupOpts = { + restriction_mode = "block"; + disable_mouse = false; + }; + }; + git = { + gitsigns.setupOpts = { + current_line_blame = true; + current_line_blame_opts = { + virt_text = true; + virt_text_pos = "right_align"; + delay = 25; + ignore_whitespace = true; + virt_text_priority = 100; + use_focus = true; + }; + }; + }; + + keymaps = + let + mkKeymap = mode: key: action: desc: { + inherit mode; + inherit key action desc; + }; + n = mkKeymap "n"; # normal mode + in + [ + # UI + (n "e" ":lua require('snacks').explorer()" "File Explorer") + # Find Files + (n "" ":lua require('snacks').picker.smart()" "Smart Find Files") + (n "f" ":lua require('snacks').picker.grep()" "Grep Files") + # Lsp + (n "K" ":Lspsaga hover_doc" "Hover docs") + (n "lr" ":lua vim.lsp.buf.rename()" "Rename") + (n "gd" ":lua vim.lsp.buf.definition()" "Go to Definition") + (n "gD" ":lua vim.lsp.buf.declaration()" "Go to Declaration") + ]; + }; }