From: Andrew Date: Sat, 30 Aug 2025 16:33:55 +0000 (-0400) Subject: tmux and neovim config X-Git-Url: http://git.skullheadx.com/nixos/static/projects.html?a=commitdiff_plain;h=08e6294366ed9a42b5b08e4d38f60567b91d858c;p=nixos.git tmux and neovim config --- diff --git a/flake.lock b/flake.lock index e2aaa78..a186a73 100644 --- a/flake.lock +++ b/flake.lock @@ -83,7 +83,44 @@ "type": "github" } }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1751685974, + "narHash": "sha256-NKw96t+BgHIYzHUjkTK95FqYRVKB8DHpVhefWSz/kTw=", + "ref": "refs/heads/main", + "rev": "549f2762aebeff29a2e5ece7a7dc0f955281a1d1", + "revCount": 92, + "type": "git", + "url": "https://git.lix.systems/lix-project/flake-compat.git" + }, + "original": { + "type": "git", + "url": "https://git.lix.systems/lix-project/flake-compat.git" + } + }, "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nvf", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1754487366, + "narHash": "sha256-pHYj8gUBapuUzKV/kN/tR3Zvqc7o6gdFB9XKXIp1SQ8=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "af66ad14b28a127c5c0f3bbb298218fc63528a18", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { "inputs": { "nixpkgs-lib": [ "stylix", @@ -144,11 +181,11 @@ ] }, "locked": { - "lastModified": 1755442500, - "narHash": "sha256-RHK4H6SWzkAtW/5WBHsyugaXJX25yr5y7FAZznxcBJs=", + "lastModified": 1756022458, + "narHash": "sha256-J1i35r4HfNDdPpwL0vOBaZopQudAUVtartEerc1Jryc=", "owner": "nix-community", "repo": "home-manager", - "rev": "d2ffdedfc39c591367b1ddf22b4ce107f029dcc3", + "rev": "9e3a33c0bcbc25619e540b9dfea372282f8a9740", "type": "github" }, "original": { @@ -157,13 +194,28 @@ "type": "github" } }, + "mnw": { + "locked": { + "lastModified": 1748710831, + "narHash": "sha256-eZu2yH3Y2eA9DD3naKWy/sTxYS5rPK2hO7vj8tvUCSU=", + "owner": "Gerg-L", + "repo": "mnw", + "rev": "cff958a4e050f8d917a6ff3a5624bc4681c6187d", + "type": "github" + }, + "original": { + "owner": "Gerg-L", + "repo": "mnw", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1755186698, - "narHash": "sha256-wNO3+Ks2jZJ4nTHMuks+cxAiVBGNuEBXsT29Bz6HASo=", + "lastModified": 1755615617, + "narHash": "sha256-HMwfAJBdrr8wXAkbGhtcby1zGFvs+StOp19xNsbqdOg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "fbcf476f790d8a217c3eab4e12033dc4a0f6d23c", + "rev": "20075955deac2583bb12f07151c2df830ef346b4", "type": "github" }, "original": { @@ -173,6 +225,22 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1755049066, + "narHash": "sha256-ANrc15FSoOAdNbfKHxqEJjZLftIwIsenJGRb/04K41s=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e45f8f193029378d0aaee5431ba098dc80054e9a", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nur": { "inputs": { "flake-parts": [ @@ -198,10 +266,33 @@ "type": "github" } }, + "nvf": { + "inputs": { + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "mnw": "mnw", + "nixpkgs": "nixpkgs_2", + "systems": "systems" + }, + "locked": { + "lastModified": 1755463179, + "narHash": "sha256-5Ggb1Mhf7ZlRgGi2puCa2PvWs6KbMnWBlW6KW7Vf79Y=", + "owner": "notashelf", + "repo": "nvf", + "rev": "03833118267ad32226b014b360692bdce9d6e082", + "type": "github" + }, + "original": { + "owner": "notashelf", + "repo": "nvf", + "type": "github" + } + }, "root": { "inputs": { "home-manager": "home-manager", "nixpkgs": "nixpkgs", + "nvf": "nvf", "stylix": "stylix" } }, @@ -212,13 +303,13 @@ "base16-helix": "base16-helix", "base16-vim": "base16-vim", "firefox-gnome-theme": "firefox-gnome-theme", - "flake-parts": "flake-parts", + "flake-parts": "flake-parts_2", "gnome-shell": "gnome-shell", "nixpkgs": [ "nixpkgs" ], "nur": "nur", - "systems": "systems", + "systems": "systems_2", "tinted-foot": "tinted-foot", "tinted-kitty": "tinted-kitty", "tinted-schemes": "tinted-schemes", @@ -226,11 +317,11 @@ "tinted-zed": "tinted-zed" }, "locked": { - "lastModified": 1755378131, - "narHash": "sha256-0GKZEzTUcaoama56xaagKnMk5hqMbTUfGF4KfzLwje4=", + "lastModified": 1755997543, + "narHash": "sha256-/fejmCQ7AWa655YxyPxRDbhdU7c5+wYsFSjmEMXoBCM=", "owner": "nix-community", "repo": "stylix", - "rev": "82242e0f9b1d91b6f170807a6ec622cfdb816eac", + "rev": "f47c0edcf71e802378b1b7725fa57bb44fe85ee8", "type": "github" }, "original": { @@ -254,6 +345,21 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "tinted-foot": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index 5d97a42..7b3bb7e 100644 --- a/flake.nix +++ b/flake.nix @@ -11,44 +11,51 @@ url = "github:nix-community/stylix"; inputs.nixpkgs.follows = "nixpkgs"; }; + nvf = { + url = "github:notashelf/nvf"; + }; }; - outputs = - { - self, - nixpkgs, - home-manager, - stylix, - ... - }@inputs: - let - lib = nixpkgs.lib; - system = "x86_64-linux"; - pkgs = import nixpkgs { + outputs = { + self, + nixpkgs, + home-manager, + stylix, + nvf, + ... + } @ inputs: let + lib = nixpkgs.lib; + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + }; + skullNeovim = nvf.lib.neovimConfiguration { + inherit pkgs; + modules = [ + ./neovim.nix + ]; + }; + in { + nixosConfigurations = { + home = lib.nixosSystem { inherit system; - config.allowUnfree = true; - }; - in - { - nixosConfigurations = { - home = lib.nixosSystem { - inherit system; - modules = [ ./configuration.nix ]; - specialArgs = { - inherit inputs; - }; + modules = [./configuration.nix]; + specialArgs = { + inherit inputs; }; }; - homeConfigurations = { - andrew = home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = [ - stylix.homeModules.stylix - ./home.nix - ]; - extraSpecialArgs = { inherit inputs; }; - }; + }; + homeConfigurations = { + andrew = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = [ + stylix.homeModules.stylix + ./home.nix + ]; + extraSpecialArgs = {inherit inputs skullNeovim;}; }; - }; + packages.${system}.skull-neovim = skullNeovim.neovim; + }; } diff --git a/home.nix b/home.nix index 36baaec..a74ffe5 100644 --- a/home.nix +++ b/home.nix @@ -3,6 +3,7 @@ lib, pkgs, inputs, + skullNeovim, ... }: @@ -51,7 +52,6 @@ audacity mpc discord - neovim catppuccin-gtk inter prismlauncher @@ -76,7 +76,8 @@ slurp swappy - tmux + skullNeovim.neovim + # # It is sometimes useful to fine-tune packages, for example, by applying # # overrides. You can do that directly here, just don't forget the @@ -140,7 +141,8 @@ # /etc/profiles/per-user/andrew/etc/profile.d/hm-session-vars.sh # home.sessionVariables = { - EDITOR = "neovim"; + EDITOR = "nvim"; + VISUAL = "nvim"; NIXOS_OZONE_WL = "1"; }; diff --git a/hyprland/hyprland.nix b/hyprland/hyprland.nix index 74b4a43..4ac79db 100644 --- a/hyprland/hyprland.nix +++ b/hyprland/hyprland.nix @@ -10,6 +10,8 @@ systemd.enable = false; settings = { env = [ + "EDITOR,nvim" + "VISUAL,nvim" "HYPRCURSOR_THEME,Bibata-Original-Classic" "HYPRCURSOR_SIZE,24" ]; diff --git a/neovim.nix b/neovim.nix new file mode 100644 index 0000000..a6562d9 --- /dev/null +++ b/neovim.nix @@ -0,0 +1,269 @@ +{inputs, pkgs, ...}: { + config.vim = { + viAlias = true; + vimAlias = true; + debugMode = { + enable = false; + level = 16; + logFile = "/tmp/nvim.log"; + }; + + spellcheck = { + enable = true; + programmingWordlist.enable = true; + }; + + lsp = { + # This must be enabled for the language modules to hook into + # the LSP API. + enable = true; + + formatOnSave = true; + lspkind.enable = false; + lightbulb.enable = true; + lspsaga.enable = false; + trouble.enable = true; + lspSignature.enable = !true; # conflicts with blink in maximal + otter-nvim.enable = true; + nvim-docs-view.enable = true; + }; + + debugger = { + nvim-dap = { + enable = true; + ui.enable = true; + }; + }; + + # This section does not include a comprehensive list of available language modules. + # To list all available language module options, please visit the nvf manual. + languages = { + enableFormat = true; + enableTreesitter = true; + enableExtraDiagnostics = true; + + # Languages that will be supported in default and maximal configurations. + nix.enable = true; + markdown.enable = true; + + # Languages that are enabled in the maximal configuration. + bash.enable = true; + clang.enable = true; + css.enable = true; + html.enable = true; + sql.enable = true; + java.enable = true; + kotlin.enable = true; + ts.enable = true; + go.enable = true; + lua.enable = true; + zig.enable = true; + python.enable = true; + typst.enable = true; + rust = { + enable = true; + crates.enable = true; + }; + + # Language modules that are not as common. + assembly.enable = false; + astro.enable = false; + nu.enable = false; + csharp.enable = false; + julia.enable = false; + vala.enable = false; + scala.enable = false; + r.enable = false; + gleam.enable = false; + dart.enable = false; + ocaml.enable = false; + elixir.enable = false; + haskell.enable = false; + ruby.enable = false; + fsharp.enable = false; + + tailwind.enable = false; + svelte.enable = false; + + # Nim LSP is broken on Darwin and therefore + # should be disabled by default. Users may still enable + # `vim.languages.vim` to enable it, this does not restrict + # that. + # See: + nim.enable = false; + }; + + visuals = { + nvim-scrollbar.enable = true; + nvim-web-devicons.enable = true; + nvim-cursorline.enable = true; + cinnamon-nvim.enable = true; + fidget-nvim.enable = true; + + highlight-undo.enable = true; + indent-blankline.enable = true; + + # Fun + cellular-automaton.enable = false; + }; + + statusline = { + lualine = { + enable = true; + theme = "catppuccin"; + }; + }; + + theme = { + enable = true; + name = "catppuccin"; + style = "mocha"; + transparent = false; + }; + + autopairs.nvim-autopairs.enable = true; + + # nvf provides various autocomplete options. The tried and tested nvim-cmp + # is enabled in default package, because it does not trigger a build. We + # enable blink-cmp in maximal because it needs to build its rust fuzzy + # matcher library. + autocomplete = { + nvim-cmp.enable = !true; + blink-cmp.enable = true; + }; + + snippets.luasnip.enable = true; + + filetree = { + neo-tree = { + enable = true; + }; + }; + + tabline = { + nvimBufferline.enable = true; + }; + + treesitter.context.enable = true; + + binds = { + whichKey.enable = true; + cheatsheet.enable = true; + }; + + telescope.enable = true; + + git = { + enable = true; + gitsigns.enable = true; + gitsigns.codeActions.enable = false; # throws an annoying debug message + neogit.enable = true; + }; + + minimap = { + minimap-vim.enable = false; + codewindow.enable = true; # lighter, faster, and uses lua for configuration + }; + + dashboard = { + dashboard-nvim.enable = false; + alpha.enable = true; + }; + + notify = { + nvim-notify.enable = true; + }; + + projects = { + project-nvim.enable = true; + }; + + utility = { + ccc.enable = false; + vim-wakatime.enable = false; + diffview-nvim.enable = true; + yanky-nvim.enable = false; + icon-picker.enable = true; + surround.enable = true; + leetcode-nvim.enable = true; + multicursors.enable = true; + smart-splits.enable = true; + undotree.enable = true; + nvim-biscuits.enable = true; + + motion = { + hop.enable = true; + leap.enable = true; + precognition.enable = true; + }; + images = { + image-nvim.enable = false; + img-clip.enable = true; + }; + }; + + notes = { + obsidian.enable = false; # FIXME: neovim fails to build if obsidian is enabled + neorg.enable = false; + orgmode.enable = false; + mind-nvim.enable = true; + todo-comments.enable = true; + }; + + terminal = { + toggleterm = { + enable = true; + lazygit.enable = true; + }; + }; + + ui = { + borders.enable = true; + noice.enable = true; + colorizer.enable = true; + modes-nvim.enable = false; # the theme looks terrible with catppuccin + illuminate.enable = true; + breadcrumbs = { + enable = true; + navbuddy.enable = true; + }; + smartcolumn = { + enable = true; + setupOpts.custom_colorcolumn = { + # this is a freeform module, it's `buftype = int;` for configuring column position + nix = "110"; + ruby = "120"; + java = "130"; + go = ["90" "130"]; + }; + }; + fastaction.enable = true; + }; + + assistant = { + chatgpt.enable = false; + copilot = { + enable = false; + cmp.enable = true; + }; + codecompanion-nvim.enable = false; + avante-nvim.enable = true; + }; + + session = { + nvim-session-manager.enable = false; + }; + + gestures = { + gesture-nvim.enable = false; + }; + + comments = { + comment-nvim.enable = true; + }; + + presence = { + neocord.enable = false; + }; + }; +} diff --git a/sh.nix b/sh.nix index 5e0402a..23c4ba8 100644 --- a/sh.nix +++ b/sh.nix @@ -69,12 +69,17 @@ in gco = "git checkout"; gs = "git status"; }; + shellAliases = { + tms = "bash ~/.config/tmux/setup-sessions.sh"; + }; interactiveShellInit = '' fish_vi_key_bindings set -U fish_greeting zoxide init fish | source fzf --fish | source starship init fish | source + set -gx EDITOR nvim + set -gx VISUAL nvim ''; }; diff --git a/tmux.nix b/tmux.nix index 130c204..4d8eb56 100644 --- a/tmux.nix +++ b/tmux.nix @@ -3,26 +3,83 @@ { programs.tmux = { enable = true; + shell = "${pkgs.fish}/bin/fish"; terminal = "xterm-256color"; - historyLimit = 5000; + historyLimit = 10000; + sensibleOnTop = false; + plugins = with pkgs.tmuxPlugins; [ + sensible + yank + vim-tmux-navigator # Deep Neovim integration for seamless pane navigation + { + plugin = resurrect; # Session persistence + extraConfig = '' + set -g @resurrect-capture-pane-contents 'on' + set -g @resurrect-strategy-nvim 'session' + ''; + } + { + plugin = continuum; # Auto-save sessions + extraConfig = '' + set -g @continuum-restore 'on' + set -g @continuum-save-interval '10' # Save every 10 minutes + ''; + } + ]; extraConfig = '' - # Split panes using | and - - bind | split-window -h - bind - split-window -v - unbind '"' - unbind % - - # Enable mouse support + # Basic settings for usability set -g mouse on - - # Set prefix to Ctrl-a - unbind C-b + set -g base-index 1 + set -g pane-base-index 1 + set -g status-style bg=black,fg=cyan set -g prefix C-a + unbind C-b bind C-a send-prefix - # Improve colors - set -g default-terminal "tmux-256color" - set -ag terminal-overrides ",xterm-256color:RGB" + # Keybindings for easier navigation + bind -n C-h select-pane -L + bind -n C-j select-pane -D + bind -n C-k select-pane -U + bind -n C-l select-pane -R + + # Fish-friendly clipboard integration + set -g set-clipboard on + bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard" + + # Session initialization script + set -g @tmux-resurrect-restore-script '${config.home.homeDirectory}/.config/tmux/setup-sessions.sh' ''; }; + + home.packages = with pkgs; [ + tmux + xclip + ]; + + + # Create session setup script + home.file.".config/tmux/setup-sessions.sh" = { + executable = true; + text = '' + #!/usr/bin/env bash + + # Ensure tmux is running + if ! tmux has-session 2>/dev/null; then + # Dev session: terminal with Fish + tmux new-session -d -s dev -c $HOME + tmux send-keys -t dev:1 "fish" C-m + + # Music session: rmpc + tmux new-session -d -s music -c $HOME + tmux send-keys -t music:1 "rmpc" C-m + + # NixOS config session: open ~/.dotfiles/nixos with Neovim + tmux new-session -d -s nixos -c $HOME/.dotfiles/nixos + tmux send-keys -t nixos:1 "nvim ." C-m + fi + + # Attach to dev session by default + tmux attach-session -t dev + ''; +}; }