diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000..86cc929 --- /dev/null +++ b/.mailmap @@ -0,0 +1,3 @@ +# To learn more about git's mailmap: https://ntietz.com/blog/git-mailmap-for-name-changes +clover caruso +Natalie Marks diff --git a/flake.nix b/flake.nix index 8f40bd9..24e6c7d 100644 --- a/flake.nix +++ b/flake.nix @@ -97,9 +97,9 @@ packages = forAllSystems ( { system, pkgs, ... }: { - nvim-chloe = mkNeovim "chloe" pkgs; + nvim-clover = mkNeovim "clover" pkgs; + nvim-fish = mkNeovim "fish" pkgs; nvim-natalie = mkNeovim "natalie" pkgs; - nvim-julia = mkNeovim "julia" pkgs; inherit (pkgs) autofmt; } @@ -122,22 +122,22 @@ system = "aarch64-darwin"; }; - # chloe's mac studio "sandwich" + # clover's mac studio "sandwich" darwinConfigurations.sandwich = mkSystem "sandwich" { - user = "chloe"; + user = "clover"; host = "sandwich"; system = "aarch64-darwin"; }; - # chloe's macbook air "paperback" + # clover's macbook air "paperback" darwinConfigurations.paperback = mkSystem "paperback" { - user = "chloe"; + user = "clover"; host = "paperback"; system = "aarch64-darwin"; }; - # julia's cattop + # fish's cattop nixosConfigurations.cattop = mkSystem "cattop" { - user = "julia"; + user = "fish"; host = "cattop"; system = "x86_64-linux"; }; diff --git a/modules/neovim/default.nix b/modules/neovim/default.nix index 80bd3a1..734dd03 100644 --- a/modules/neovim/default.nix +++ b/modules/neovim/default.nix @@ -6,8 +6,9 @@ }: { imports = [ - ./options.nix ./formatter.nix + ./keybind.nix + ./options.nix ]; # based on default options from upstream: # https://github.com/NotAShelf/nvf/blob/main/configuration.nix @@ -18,6 +19,10 @@ # override level 999 is used to not conflict with mkDefault as used by nvf. # which allows user configurations to disable/override anything here. config.vim = lib.mkOverride 999 { + extraLuaFiles = [ + ./lib.lua + ]; + theme = { enable = true; }; @@ -60,8 +65,8 @@ listReferences = "gr"; goToType = "gy"; hover = "K"; - nextDiagnostic = "d"; - openDiagnosticFloat = "df"; + nextDiagnostic = null; # ]d + openDiagnosticFloat = "d"; renameSymbol = "rn"; documentHighlight = null; listDocumentSymbols = null; @@ -78,11 +83,9 @@ enable = true; addDefaultGrammars = true; }; - debugger = { - nvim-dap = { - enable = true; - ui.enable = true; - }; + debugger.nvim-dap = { + enable = true; + ui.enable = true; }; languages = { enableFormat = true; @@ -96,36 +99,58 @@ clang.enable = true; css.enable = true; html.enable = true; + lua.enable = true; markdown.enable = true; + nix.enable = true; python.enable = true; rust.crates.enable = true; rust.enable = true; ts.enable = true; zig.enable = true; - lua.enable = true; # sort-lines: off - - nix = { - enable = true; - format.type = "nixfmt"; # looks so much nicer + }; + filetree.neo-tree = { + enable = true; + setupOpts = { + enable_cursor_hijack = true; + git_status_async = true; }; }; - filetree = { - neo-tree = { - enable = false; + fzf-lua = { + enable = true; + setupOpts = { + fzf_colors = true; }; }; - tabline = { - nvimBufferline.enable = true; - }; - autocomplete = { - blink-cmp = { - enable = true; - sourcePlugins = { - ripgrep.enable = true; + autocomplete.blink-cmp = { + enable = true; + mappings = { + close = null; + complete = null; + confirm = null; + next = null; + previous = null; + scrollDocsDown = null; + scrollDocsUp = null; + }; + setupOpts = { + keymap = { + preset = "super-tab"; }; - friendly-snippets.enable = true; + completion = { + ghost_text.enabled = false; + list.selection.preselect = true; + trigger = { + show_in_snippet = true; + }; + accept.auto_brackets.enabled = true; + }; + signature.enabled = true; }; + sourcePlugins = { + ripgrep.enable = true; + }; + friendly-snippets.enable = true; }; statusline = { lualine = { @@ -137,71 +162,6 @@ }; }; }; - - utility = { - snacks-nvim = { - enable = true; - setupOpts = { - bigfile.enable = true; - dashboard = { - preset.keys = [ - { - icon = " "; - 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; - } - { - icon = " "; - title = "Projects"; - section = "projects"; - 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; - math.enabled = false; - }; - notifier.timeout = 3000; - picker = { - enable = true; - sources = { - }; - }; - }; - }; - }; binds = { whichKey.enable = true; cheatsheet.enable = true; diff --git a/modules/neovim/keybind.nix b/modules/neovim/keybind.nix new file mode 100644 index 0000000..f5b2d0f --- /dev/null +++ b/modules/neovim/keybind.nix @@ -0,0 +1,83 @@ +# this file implements a keybind system, which is a higher level system +# to configure vim.keymaps (note the different name bind vs map) +{ + pkgs, + lib, + config, + ... +}: +let + keyRemap = mode: key: action: { inherit mode key action; }; + keyCmd = + mode: key: cmd: + keyRemap mode key ":${cmd}"; +in +{ + # default binds + config.vim.keybinds = { + search-commands = keyCmd "n" "?" "FzfLua keymaps"; + + # user interface + toggle-explorer = keyCmd "n" "e" "Neotree toggle"; + reveal-active-file = keyCmd "n" "E" "Neotree reveal:Neotree focus"; + lazygit = keyCmd "n" "gg" "FullscreenTerm ${pkgs.lazygit}/bin/lazygit"; + + # pickers + pick-file = keyCmd "n" "" "FzfLua files"; + pick-mark = keyCmd "n" "'" "FzfLua marks"; + #pick-buffer = keyCmd "n" "b" "FzfLua buffers"; + pick-grep = keyCmd "n" "ff" "FzfLua grep_project"; + pick-recent-command = keyCmd "n" "fc" "FzfLua command_history"; + pick-other = keyCmd "n" "f?" "FzfLua builtin"; # picker of Fzf pickers + + # lsp + code-action = + keyCmd "n" "ca" + "FzfLua lsp_code_actions winopts.height=15 winopts.backdrop=100 winopts.title=false winopts.preview.title=false winopts.row=1"; + + # subtle nice features + visual-dedent = keyRemap "v" "<" "" ">gv"; # keep selection + clear-search-highlights = keyRemap "n" ""; + }; + + # implementation + options.vim.keybinds = lib.mkOption { + type = lib.types.attrsOf ( + lib.types.nullOr ( + lib.types.submodule { + options = { + mode = lib.mkOption { type = lib.types.str; }; + key = lib.mkOption { type = lib.types.str; }; + action = lib.mkOption { type = lib.types.str; }; + }; + } + ) + ); + default = { }; + }; + config.vim.keymaps = + let + titleCase = + str: + lib.concatStringsSep " " ( + map ( + word: + lib.strings.toUpper (builtins.substring 0 1 word) + + builtins.substring 1 (builtins.stringLength word) word + ) (lib.splitString "-" str) + ); + in + builtins.filter (f: f != null) ( + lib.attrsets.mapAttrsToList ( + desc: bind: + if bind != null then + { + desc = titleCase desc; + inherit (bind) mode key action; + } + else + null + ) config.vim.keybinds + ); +} diff --git a/modules/neovim/lib.lua b/modules/neovim/lib.lua new file mode 100644 index 0000000..4daeb6b --- /dev/null +++ b/modules/neovim/lib.lua @@ -0,0 +1,27 @@ +-- Ported from https://www.reddit.com/r/neovim/comments/vemydn +vim.api.nvim_create_user_command("FullscreenTerm", function(opts) + vim.cmd("tab terminal " .. opts.args) + local laststatus = vim.o.laststatus + local showtabline = vim.o.showtabline + local cmdheight = vim.o.cmdheight + vim.o.laststatus = 0 + vim.o.cmdheight = 0 + vim.o.showtabline = 0 + vim.wo.signcolumn = "no" + vim.wo.relativenumber = false + vim.wo.number = false + vim.cmd( + "autocmd! TermClose " + .. "if !v:event.status" + .. " | exec 'bd! '..expand('')" + .. " | endif" + .. " | checktime" + .. " | set laststatus=" + .. laststatus + .. " | set cmdheight=" + .. cmdheight + .. " | set showtabline=" + .. showtabline + ) + vim.cmd("startinsert") +end, { nargs = "*" }) diff --git a/nvim b/nvim index 417714b..9301a34 100755 --- a/nvim +++ b/nvim @@ -1,11 +1,11 @@ #!/bin/sh username="$(id -u -n)" if [ "$username" = "clo" ]; then - name="chloe" + name="clover" elif [ "$username" = "nmarks" ]; then name="natalie" elif [ "$username" = "fish" ]; then - name="julia" + name="fish" fi if [ -z "$name" ]; then echo "Configure this wrapper script with your name." >&2 diff --git a/readme.md b/readme.md index 7c7416d..8a9bd5e 100644 --- a/readme.md +++ b/readme.md @@ -1,7 +1,7 @@ # nix config -this setup allows natalie and chloe to share common configuration between their -machines, but also share useful modules between each other. +this setup allows natalie, clover, and more to share common configuration +between their machines, but also share useful modules between each other. ``` lib/ # reusable functions @@ -12,7 +12,7 @@ modules/ # reusable modules +-- nixos/ # linux configurations +-- shared/ # shared between nixos-rebuild & darwin-rebuild users/ - +-- chloe/ + +-- clover/ | +-- user.nix # info about her | +-- configuration.nix # for all hosts (system) | +-- home.nix # for all hosts (userspace) diff --git a/users/chloe/paperback/configuration.nix b/users/chloe/paperback/configuration.nix deleted file mode 100644 index 6fc73ce..0000000 --- a/users/chloe/paperback/configuration.nix +++ /dev/null @@ -1,6 +0,0 @@ -_: { - homebrew = { - enable = true; - casks = [ "eloston-chromium" ]; - }; -} diff --git a/users/chloe/vim.nix b/users/chloe/vim.nix deleted file mode 100644 index 4dfae25..0000000 --- a/users/chloe/vim.nix +++ /dev/null @@ -1,65 +0,0 @@ -_: { - vim = { - options = { - linebreak = true; - }; - 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; - }; - }; - }; - autocomplete.blink-cmp = { - enable = true; - mappings = { - close = null; - complete = null; - confirm = null; - next = null; - previous = null; - scrollDocsDown = null; - scrollDocsUp = null; - }; - - setupOpts = { - keymap = { - preset = "super-tab"; - }; - completion = { - ghost_text.enabled = false; - list.selection.preselect = true; - trigger = { - show_in_snippet = true; - }; - accept.auto_brackets.enabled = true; - }; - signature = { - enabled = 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") - ]; - }; -} diff --git a/users/chloe/configuration.nix b/users/clover/configuration.nix similarity index 94% rename from users/chloe/configuration.nix rename to users/clover/configuration.nix index aa0b485..103b011 100644 --- a/users/chloe/configuration.nix +++ b/users/clover/configuration.nix @@ -1,4 +1,4 @@ -# Configuration applied to all of chloe's machines +# Configuration applied to all of clover's machines { pkgs, ... }: { # packages for all machines diff --git a/users/chloe/home.nix b/users/clover/home.nix similarity index 99% rename from users/chloe/home.nix rename to users/clover/home.nix index b46fbf4..3fddc20 100644 --- a/users/chloe/home.nix +++ b/users/clover/home.nix @@ -21,6 +21,7 @@ in # packages to install for desktop environments (non-server) desktop = [ git-town + lazygit ]; # packages to install on all servers server = [ ]; diff --git a/users/clover/paperback/configuration.nix b/users/clover/paperback/configuration.nix new file mode 100644 index 0000000..3d94126 --- /dev/null +++ b/users/clover/paperback/configuration.nix @@ -0,0 +1,9 @@ +_: { + homebrew = { + enable = true; + casks = [ + "eloston-chromium" + "db-browser-for-sqlite" + ]; + }; +} diff --git a/users/chloe/paperback/home.nix b/users/clover/paperback/home.nix similarity index 94% rename from users/chloe/paperback/home.nix rename to users/clover/paperback/home.nix index e2ce2a7..711130f 100644 --- a/users/chloe/paperback/home.nix +++ b/users/clover/paperback/home.nix @@ -4,7 +4,6 @@ # most of these are needed for my work environment. programs = { bun.enable = true; - zed-editor.enable = true; zsh.profileExtra = '' _bun() { local context state line @@ -14,6 +13,7 @@ }; home.packages = with pkgs; [ doppler + deno nodejs_22 rustup typescript diff --git a/users/chloe/sandwich/configuration.nix b/users/clover/sandwich/configuration.nix similarity index 100% rename from users/chloe/sandwich/configuration.nix rename to users/clover/sandwich/configuration.nix diff --git a/users/chloe/user.nix b/users/clover/user.nix similarity index 71% rename from users/chloe/user.nix rename to users/clover/user.nix index 284592d..e76aec6 100644 --- a/users/chloe/user.nix +++ b/users/clover/user.nix @@ -1,18 +1,11 @@ # This definition is used by modules to customize as needed. { username = "clo"; # username - name = "chloe caruso"; + name = "clover caruso"; email = "account@paperclover.net"; timeZone = "America/Los_Angeles"; - dotfilesDir = "~/config"; # absolute path of the local repo - - # Stylix/Theming - theme = null; - #font sexuality = "lesbian"; # hyfetch - - # Default terminal command. NOTE: ghostty is not installed for you term = "ghostty"; # preferred $TERMINAL editor = "nvim"; # preferred $EDITOR } diff --git a/users/clover/vim.nix b/users/clover/vim.nix new file mode 100644 index 0000000..84bac23 --- /dev/null +++ b/users/clover/vim.nix @@ -0,0 +1,20 @@ +_: { + vim = { + options = { + linebreak = true; + }; + git = { + gitsigns.setupOpts = { + current_line_blame = false; + current_line_blame_opts = { + virt_text = true; + virt_text_pos = "right_align"; + delay = 25; + ignore_whitespace = true; + virt_text_priority = 100; + use_focus = true; + }; + }; + }; + }; +} diff --git a/users/julia/cattop/configuration.nix b/users/fish/cattop/configuration.nix similarity index 100% rename from users/julia/cattop/configuration.nix rename to users/fish/cattop/configuration.nix diff --git a/users/julia/cattop/hardware-configuration.nix b/users/fish/cattop/hardware-configuration.nix similarity index 100% rename from users/julia/cattop/hardware-configuration.nix rename to users/fish/cattop/hardware-configuration.nix diff --git a/users/julia/cattop/home.nix b/users/fish/cattop/home.nix similarity index 100% rename from users/julia/cattop/home.nix rename to users/fish/cattop/home.nix diff --git a/users/julia/cattop/home.nix.old b/users/fish/cattop/home.nix.old similarity index 100% rename from users/julia/cattop/home.nix.old rename to users/fish/cattop/home.nix.old diff --git a/users/julia/configuration.nix b/users/fish/configuration.nix similarity index 100% rename from users/julia/configuration.nix rename to users/fish/configuration.nix diff --git a/users/julia/user.nix b/users/fish/user.nix similarity index 93% rename from users/julia/user.nix rename to users/fish/user.nix index edb5aea..f515195 100644 --- a/users/julia/user.nix +++ b/users/fish/user.nix @@ -1,6 +1,6 @@ rec { username = "fish"; # username - name = "Julia"; # name/identifier + name = "Fish"; # name/identifier email = "fish@fishcat.fish"; # email (used for certain configurations) dotfilesDir = "~/config"; # absolute path of the local repo theme = "catppuccin-mocha"; # name of theme that stylix will use diff --git a/users/julia/vim.nix b/users/fish/vim.nix similarity index 100% rename from users/julia/vim.nix rename to users/fish/vim.nix