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: # based on default options from upstream:
# https://github.com/NotAShelf/nvf/blob/main/configuration.nix # https://github.com/NotAShelf/nvf/blob/main/configuration.nix
# #
@ -45,6 +41,10 @@
# https://github.com/onsails/lspkind.nvim # https://github.com/onsails/lspkind.nvim
lspkind.enable = config.vim.autocomplete.blink-cmp.enable; lspkind.enable = config.vim.autocomplete.blink-cmp.enable;
}; };
treesitter = {
enable = true;
addDefaultGrammars = true;
};
debugger = { debugger = {
nvim-dap = { nvim-dap = {
enable = true; enable = true;
@ -57,17 +57,17 @@
enableExtraDiagnostics = true; enableExtraDiagnostics = true;
# sort-lines: on # sort-lines: on
assembly.enable = true;
bash.enable = true; bash.enable = true;
clang.enable = true; clang.enable = true;
css.enable = true; css.enable = true;
html.enable = true; html.enable = true;
markdown.enable = true;
nix.enable = true; nix.enable = true;
python.enable = true;
rust.crates.enable = true; rust.crates.enable = true;
rust.enable = true; rust.enable = true;
ts.enable = true; ts.enable = true;
zig.enable = true; zig.enable = true;
markdown.enable = true;
# sort-lines: off # sort-lines: off
nix.format.type = "nixfmt"; # looks so much nicer nix.format.type = "nixfmt"; # looks so much nicer
@ -107,19 +107,24 @@
bigfile.enable = true; bigfile.enable = true;
explorer.replace_netrw = true; explorer.replace_netrw = true;
dashboard = { dashboard = {
sections = [ preset.keys = [
{section = "header";}
{
icon = " ";
title = "Keymaps";
section = "keys";
indent = 2;
padding = 1;
}
{ {
icon = " "; icon = " ";
title = "Recent Files"; key = "n";
section = "recent_files"; 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; indent = 2;
padding = 1; padding = 1;
} }
@ -130,6 +135,21 @@
indent = 2; indent = 2;
padding = 1; 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; image.enable = true;
@ -137,7 +157,7 @@
picker = { picker = {
enable = true; enable = true;
sources = { sources = {
explorer = {}; explorer = { };
}; };
}; };
}; };

View file

@ -3,8 +3,8 @@
{ {
# packages for all machines # packages for all machines
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
git
]; ];
# services for all machines
# configuration for shared modules. # configuration for shared modules.
# all custom options in 'shared' for clarity. # all custom options in 'shared' for clarity.

View file

@ -1,20 +1,58 @@
{ ... }: _: {
{ vim = {
vim.theme.extraConfig = '' options = {
if vim.g.neovide then tabstop = 2;
vim.g.neovide_cursor_trail_size = 0.3 softtabstop = 2;
vim.g.neovide_scroll_animation_length = 0.1; 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 binds = {
vim.keymap.set('v', '<D-c>', '"+y') -- Copy hardtime-nvim.setupOpts = {
vim.keymap.set('n', '<D-v>', '"+P') -- Paste normal mode restriction_mode = "block";
vim.keymap.set('v', '<D-v>', '"+P') -- Paste visual mode disable_mouse = false;
vim.keymap.set('c', '<D-v>', '<C-R>+') -- Paste command mode };
vim.keymap.set('i', '<D-v>', '<ESC>l"+Pli') -- Paste insert mode };
end git = {
vim.api.nvim_set_keymap("", '<D-v>', '+p<CR>', { noremap = true, silent = true}) gitsigns.setupOpts = {
vim.api.nvim_set_keymap('!', '<D-v>', '<C-R>+', { noremap = true, silent = true}) current_line_blame = true;
vim.api.nvim_set_keymap('t', '<D-v>', '<C-R>+', { noremap = true, silent = true}) current_line_blame_opts = {
vim.api.nvim_set_keymap('v', '<D-v>', '<C-R>+', { noremap = true, silent = true}) 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")
];
};
} }