fun neovim things

This commit is contained in:
chloe caruso 2025-05-27 19:12:01 -07:00
parent 73902bf700
commit 926f53011d
3 changed files with 96 additions and 38 deletions

View file

@ -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 = { };
};
};
};

View file

@ -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.

View file

@ -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', '<D-s>', ':w<CR>') -- Save
vim.keymap.set('v', '<D-c>', '"+y') -- Copy
vim.keymap.set('n', '<D-v>', '"+P') -- Paste normal mode
vim.keymap.set('v', '<D-v>', '"+P') -- Paste visual mode
vim.keymap.set('c', '<D-v>', '<C-R>+') -- Paste command mode
vim.keymap.set('i', '<D-v>', '<ESC>l"+Pli') -- Paste insert mode
end
vim.api.nvim_set_keymap("", '<D-v>', '+p<CR>', { noremap = true, silent = true})
vim.api.nvim_set_keymap('!', '<D-v>', '<C-R>+', { noremap = true, silent = true})
vim.api.nvim_set_keymap('t', '<D-v>', '<C-R>+', { noremap = true, silent = true})
vim.api.nvim_set_keymap('v', '<D-v>', '<C-R>+', { 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 "<leader>e" ":lua require('snacks').explorer()<CR>" "File Explorer")
# Find Files
(n "<leader><space>" ":lua require('snacks').picker.smart()<CR>" "Smart Find Files")
(n "<leader>f" ":lua require('snacks').picker.grep()<CR>" "Grep Files")
# Lsp
(n "K" ":Lspsaga hover_doc<CR>" "Hover docs")
(n "lr" ":lua vim.lsp.buf.rename()<CR>" "Rename")
(n "gd" ":lua vim.lsp.buf.definition()<CR>" "Go to Definition")
(n "gD" ":lua vim.lsp.buf.declaration()<CR>" "Go to Declaration")
];
};
}