authorgravatar for git@paperclover.netclover caruso <git@paperclover.net> 2025-05-27 19:12:01-07:00
committergravatar for git@paperclover.netclover caruso <git@paperclover.net> 2025-05-27 19:12:01-07:00
log926f53011d593219726d6432324071a2d589df96
treea2f0fed87716443db0f49eb122fd04ab0f3a9af4
parent73902bf7006a8aef3954708d96a19c79764ef30c

fun neovim things


3 files changed, 95 insertions(+), 37 deletions(-)

modules/neovim/default.nix+38-18
......@@ -1,9 +1,5 @@
1{ config, lib, ... }:
12{
2 config,
3 lib,
4 host,
5 ...
6}: {
73 # based on default options from upstream:
84 # https://github.com/NotAShelf/nvf/blob/main/configuration.nix
95 #
......@@ -45,6 +41,10 @@
4541 # https://github.com/onsails/lspkind.nvim
4642 lspkind.enable = config.vim.autocomplete.blink-cmp.enable;
4743 };
44 treesitter = {
45 enable = true;
46 addDefaultGrammars = true;
47 };
4848 debugger = {
4949 nvim-dap = {
5050 enable = true;
......@@ -57,17 +57,17 @@
5757 enableExtraDiagnostics = true;
5858
5959 # sort-lines: on
60 assembly.enable = true;
6160 bash.enable = true;
6261 clang.enable = true;
6362 css.enable = true;
6463 html.enable = true;
64 markdown.enable = true;
6565 nix.enable = true;
66 python.enable = true;
6667 rust.crates.enable = true;
6768 rust.enable = true;
6869 ts.enable = true;
6970 zig.enable = true;
70 markdown.enable = true;
7171 # sort-lines: off
7272
7373 nix.format.type = "nixfmt"; # looks so much nicer
......@@ -107,19 +107,24 @@
107107 bigfile.enable = true;
108108 explorer.replace_netrw = true;
109109 dashboard = {
110 sections = [
111 {section = "header";}
110 preset.keys = [
112111 {
113 icon = " ";
114 title = "Keymaps";
115 section = "keys";
116 indent = 2;
117 padding = 1;
112 icon = " ";
113 key = "n";
114 desc = "New File";
115 action = ":ene | startinsert";
118116 }
119117 {
120 icon = " ";
121 title = "Recent Files";
122 section = "recent_files";
118 icon = " ";
119 key = "r";
120 desc = "Recent Files";
121 action = ":lua Snacks.dashboard.pick('oldfiles')";
122 }
123 ];
124 sections = [
125 { section = "header"; }
126 {
127 section = "keys";
123128 indent = 2;
124129 padding = 1;
125130 }
......@@ -130,6 +135,21 @@
130135 indent = 2;
131136 padding = 1;
132137 }
138 {
139 icon = " ";
140 title = "Git";
141 section = "terminal";
142 enabled = lib.options.literalExpression ''
143 function()
144 return Snacks.git.get_root() ~= nil
145 end
146 '';
147 cmd = "git status --short --branch --renames";
148 height = 10;
149 padding = 1;
150 ttl = 5 * 60;
151 indent = 3;
152 }
133153 ];
134154 };
135155 image.enable = true;
......@@ -137,7 +157,7 @@
137157 picker = {
138158 enable = true;
139159 sources = {
140 explorer = {};
160 explorer = { };
141161 };
142162 };
143163 };
users/chloe/configuration.nix+1-1
......@@ -3,8 +3,8 @@
33{
44 # packages for all machines
55 environment.systemPackages = with pkgs; [
6 git
67 ];
7 # services for all machines
88
99 # configuration for shared modules.
1010 # all custom options in 'shared' for clarity.
users/chloe/vim.nix+56-18
......@@ -1,20 +1,58 @@
1{ ... }:
2{
3 vim.theme.extraConfig = ''
4 if vim.g.neovide then
5 vim.g.neovide_cursor_trail_size = 0.3
6 vim.g.neovide_scroll_animation_length = 0.1;
1_: {
2 vim = {
3 options = {
4 tabstop = 2;
5 softtabstop = 2;
6 shiftwidth = 2;
7 undofile = true;
8 swapfile = false;
9 showmode = false;
10 foldlevel = 99;
11 foldcolumn = "1";
12 foldlevelstart = 99;
13 foldenable = true;
14 linebreak = true;
15 };
716
8 vim.keymap.set('n', '<D-s>', ':w<CR>') -- Save
9 vim.keymap.set('v', '<D-c>', '"+y') -- Copy
10 vim.keymap.set('n', '<D-v>', '"+P') -- Paste normal mode
11 vim.keymap.set('v', '<D-v>', '"+P') -- Paste visual mode
12 vim.keymap.set('c', '<D-v>', '<C-R>+') -- Paste command mode
13 vim.keymap.set('i', '<D-v>', '<ESC>l"+Pli') -- Paste insert mode
14 end
15 vim.api.nvim_set_keymap("", '<D-v>', '+p<CR>', { noremap = true, silent = true})
16 vim.api.nvim_set_keymap('!', '<D-v>', '<C-R>+', { noremap = true, silent = true})
17 vim.api.nvim_set_keymap('t', '<D-v>', '<C-R>+', { noremap = true, silent = true})
18 vim.api.nvim_set_keymap('v', '<D-v>', '<C-R>+', { noremap = true, silent = true})
19 '';
17 binds = {
18 hardtime-nvim.setupOpts = {
19 restriction_mode = "block";
20 disable_mouse = false;
21 };
22 };
23 git = {
24 gitsigns.setupOpts = {
25 current_line_blame = true;
26 current_line_blame_opts = {
27 virt_text = true;
28 virt_text_pos = "right_align";
29 delay = 25;
30 ignore_whitespace = true;
31 virt_text_priority = 100;
32 use_focus = true;
33 };
34 };
35 };
36
37 keymaps =
38 let
39 mkKeymap = mode: key: action: desc: {
40 inherit mode;
41 inherit key action desc;
42 };
43 n = mkKeymap "n"; # normal mode
44 in
45 [
46 # UI
47 (n "<leader>e" ":lua require('snacks').explorer()<CR>" "File Explorer")
48 # Find Files
49 (n "<leader><space>" ":lua require('snacks').picker.smart()<CR>" "Smart Find Files")
50 (n "<leader>f" ":lua require('snacks').picker.grep()<CR>" "Grep Files")
51 # Lsp
52 (n "K" ":Lspsaga hover_doc<CR>" "Hover docs")
53 (n "lr" ":lua vim.lsp.buf.rename()<CR>" "Rename")
54 (n "gd" ":lua vim.lsp.buf.definition()<CR>" "Go to Definition")
55 (n "gD" ":lua vim.lsp.buf.declaration()<CR>" "Go to Declaration")
56 ];
57 };
2058}