diff --git a/.claude/settings.local.json b/.claude/settings.local.json deleted file mode 100644 index 0b0dade..0000000 --- a/.claude/settings.local.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "permissions": { - "allow": [ - "WebFetch(domain:github.com)", - "WebFetch(domain:raw.githubusercontent.com)" - ], - "deny": [], - "ask": [] - } -} diff --git a/flake.lock b/flake.lock index 7e6de40..f838378 100644 --- a/flake.lock +++ b/flake.lock @@ -67,11 +67,11 @@ ] }, "locked": { - "lastModified": 1760130406, - "narHash": "sha256-GKMwBaFRw/C1p1VtjDz4DyhyzjKUWyi1K50bh8lgA2E=", + "lastModified": 1759702766, + "narHash": "sha256-011pCUbIq/fhCiZ20AzqJYNjLzQ1oYkzYEgzcUYVTBg=", "owner": "nix-community", "repo": "home-manager", - "rev": "d305eece827a3fe317a2d70138f53feccaf890a1", + "rev": "5b45dcf4790bb94fec7e550d2915fc2540a3cdd6", "type": "github" }, "original": { @@ -130,11 +130,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1760103332, - "narHash": "sha256-BMsGVfKl4Q80Pr9T1AkCRljO1bpwCmY8rTBVj8XGuhA=", + "lastModified": 1759632233, + "narHash": "sha256-krgZxGAIIIKFJS+UB0l8do3sYUDWJc75M72tepmVMzE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "870493f9a8cb0b074ae5b411b2f232015db19a65", + "rev": "d7f52a7a640bc54c7bb414cca603835bf8dd4b10", "type": "github" }, "original": { @@ -146,11 +146,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1760038930, - "narHash": "sha256-Oncbh0UmHjSlxO7ErQDM3KM0A5/Znfofj2BSzlHLeVw=", + "lastModified": 1759381078, + "narHash": "sha256-gTrEEp5gEspIcCOx9PD8kMaF1iEmfBcTbO0Jag2QhQs=", "owner": "nixos", "repo": "nixpkgs", - "rev": "0b4defa2584313f3b781240b29d61f6f9f7e0df3", + "rev": "7df7ff7d8e00218376575f0acdcc5d66741351ee", "type": "github" }, "original": { @@ -170,11 +170,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1760201666, - "narHash": "sha256-We8VAiO7e8Vy0ptKTSxF5nR9pkm+FaGHkCsIzzsMNEQ=", + "lastModified": 1759670959, + "narHash": "sha256-OjvEGJEZDkAri6m1oUV0DE+pRKqh6KEcVuCIlmLN7QU=", "owner": "nix-community", "repo": "nixvim", - "rev": "c66070248254d4efb619c3423d71ab3592b31234", + "rev": "e45e9214dcc2ea770418fe407a43902b0438ce78", "type": "github" }, "original": { @@ -189,11 +189,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1760211868, - "narHash": "sha256-94NlU7LUXuL2fnUoaPDF1Xu9kVOicO+4+DEjIAxggNU=", + "lastModified": 1759696599, + "narHash": "sha256-GkGJdNkR9gnVQt9OXwhGrD72EpK185jNVT7qoCh/3q4=", "owner": "nix-community", "repo": "nur", - "rev": "9e2d8216b3fb1d5963c162a17fe796c8d7f3d112", + "rev": "dce08ba6904fcaad93c17ab65cf6b3e5dfc2d301", "type": "github" }, "original": { diff --git a/home.nix b/home.nix index b08dcf3..465616e 100644 --- a/home.nix +++ b/home.nix @@ -40,7 +40,6 @@ ast-grep basedpyright bash-language-server - bloop cachix cmake coursier @@ -74,7 +73,7 @@ nix-index nixfmt-rfc-style nix-prefetch-git - nodejs + nodejs-slim noto-fonts noto-fonts-color-emoji ollama diff --git a/programs/nixvim/README.md b/programs/nixvim/README.md index 31a628d..03efadd 100644 --- a/programs/nixvim/README.md +++ b/programs/nixvim/README.md @@ -156,113 +156,6 @@ Adjust these in `options.nix` and `completion.nix` respectively. 2. Adjust completion performance settings in `completion.nix` 3. Disable unused language servers in `lsp/servers.nix` -## Keyboard Shortcuts Cheatsheet - -### Leader Key -**Leader:** `Space` - -### General Keybindings - -| Key | Mode | Action | -|-----|------|--------| -| `Esc` | Normal | Clear search highlighting | -| `Y` | Normal | Yank to end of line | -| `H` | Normal | Go to beginning of line | -| `L` | Normal | Go to end of line | -| `Ctrl-c` | Normal | Switch to alternate buffer | -| `Ctrl-x` | Normal | Close window | -| `Ctrl-s` or `s` | Normal | Save file | - -### Window Navigation - -| Key | Mode | Action | -|-----|------|--------| -| `h` | Normal | Move to left window | -| `l` | Normal | Move to right window | -| `Ctrl-Up` | Normal | Decrease window height | -| `Ctrl-Down` | Normal | Increase window height | -| `Ctrl-Left` | Normal | Increase window width | -| `Ctrl-Right` | Normal | Decrease window width | - -### Text Manipulation - -| Key | Mode | Action | -|-----|------|--------| -| `Alt-k` | Normal | Move line up | -| `Alt-j` | Normal | Move line down | -| `>` | Visual | Indent (dot-repeatable) | -| `<` | Visual | Unindent (dot-repeatable) | -| `Tab` | Visual | Indent and keep selection | -| `Shift-Tab` | Visual | Unindent and keep selection | -| `J` | Visual | Move selected lines down | -| `K` | Visual | Move selected lines up | - -### File Explorer (Neo-tree) - -| Key | Mode | Action | -|-----|------|--------| -| `m` | Normal | Toggle file explorer | - -### Fuzzy Finder (Telescope) - -| Key | Mode | Action | -|-----|------|--------| -| `ff` | Normal | Find files | -| `fg` | Normal | Live grep (search text) | -| `b` | Normal | List buffers | -| `fh` | Normal | Help tags | -| `fd` | Normal | Diagnostics | -| `Ctrl-p` | Normal | Git files | -| `?` | Normal | Recently opened files | -| `Ctrl-t` | Normal | Search for TODOs | -| `t` | Normal | TODO comments (Telescope) | - -### LSP (Language Server) - -| Key | Mode | Action | -|-----|------|--------| -| `gd` | Normal | Go to definition | -| `gD` | Normal | Go to references | -| `gt` | Normal | Go to type definition | -| `gi` | Normal | Go to implementation | -| `K` | Normal | Hover documentation | -| `F2` | Normal | Rename symbol | -| `j` | Normal | Next diagnostic | -| `k` | Normal | Previous diagnostic | - -### Metals (Scala Development) - -| Key | Mode | Action | -|-----|------|--------| -| `ws` | Normal | Hover Metals Worksheet | -| `sm` | Normal | Telescope Metals Commands | -| `tt` | Normal | Toggle tree view | -| `tr` | Normal | Reveal in tree | - -### Terminal (Floaterm) - -| Key | Mode | Action | -|-----|------|--------| -| `,` | Normal | Toggle floating terminal | - -### AI Assistants - -#### Avante -- Enabled with Claude Sonnet 4.5 model -- Default Avante keybindings apply (check `:help avante` for full list) - -#### GitHub Copilot -- Enabled with default keybindings -- Check `:help copilot` for keybinding details - -### Other Utilities - -| Feature | Command/Key | -|---------|-------------| -| Which-key | Automatically shows available keybindings when you pause | -| Oil file manager | `:Oil` command | -| Trouble diagnostics | `:Trouble` command | - ## Resources - [Nixvim Documentation](https://nix-community.github.io/nixvim/) diff --git a/programs/nixvim/autocommands.nix b/programs/nixvim/autocommands.nix index 4900037..71cf023 100644 --- a/programs/nixvim/autocommands.nix +++ b/programs/nixvim/autocommands.nix @@ -30,12 +30,5 @@ pattern = ["swift" "json" "lua" "nix"]; command = "setlocal shiftwidth=2 tabstop=2 softtabstop=2 expandtab"; } - - # Metals (Scala) - Refresh codelens - { - event = ["BufEnter" "CursorHold" "InsertLeave"]; - pattern = ["*.scala" "*.sbt" "*.java"]; - command = "lua vim.lsp.codelens.refresh()"; - } ]; } diff --git a/programs/nixvim/keymappings.nix b/programs/nixvim/keymappings.nix index b4075df..23e0df3 100644 --- a/programs/nixvim/keymappings.nix +++ b/programs/nixvim/keymappings.nix @@ -30,11 +30,6 @@ "" = ":vertical resize -2"; "" = ":move-2"; "" = ":move+"; - # Metals (Scala) keybindings - "ws" = "lua require('metals').hover_worksheet()"; - "sm" = "lua require('telescope').extensions.metals.commands()"; - "tt" = "lua require('metals.tvp').toggle_tree_view()"; - "tr" = "lua require('metals.tvp').reveal_in_tree()"; }; visual = lib.mapAttrsToList diff --git a/programs/nixvim/plugins/ai.nix b/programs/nixvim/plugins/ai.nix index 0f1e653..b887537 100644 --- a/programs/nixvim/plugins/ai.nix +++ b/programs/nixvim/plugins/ai.nix @@ -4,33 +4,14 @@ programs.nixvim = { plugins = { # GitHub Copilot - copilot-vim = { - enable = true; - }; + copilot-vim.enable = true; # Avante AI assistant (imported from separate file) # avante config is in avante.nix }; globals = { - copilot_node_command = lib.mkForce "${pkgs.nodejs}/bin/node"; - copilot_no_tab_map = true; - copilot_assume_mapped = true; + copilot_node_command = lib.mkForce "${pkgs.nodejs-slim}/bin/node"; }; - - # Copilot keymapping - use Ctrl+J to accept suggestion - keymaps = [ - { - mode = "i"; - key = ""; - action = "copilot#Accept(\"\\\")"; - options = { - silent = true; - script = true; - expr = true; - replace_keycodes = false; - }; - } - ]; }; -} +} \ No newline at end of file diff --git a/programs/nixvim/plugins/lsp/servers.nix b/programs/nixvim/plugins/lsp/servers.nix index 73279e1..6e35c82 100644 --- a/programs/nixvim/plugins/lsp/servers.nix +++ b/programs/nixvim/plugins/lsp/servers.nix @@ -8,7 +8,7 @@ # Python basedpyright = { enable = true; - config.settings.basedpyright = { + settings.settings.basedpyright = { analysis = { autoImportCompletions = true; autoSearchPaths = true; @@ -45,49 +45,14 @@ # Lua lua_ls = { enable = true; - config.settings.diagnostics.globals = [ "vim" ]; + settings.settings.diagnostics.globals = [ "vim" ]; }; # Documentation marksman.enable = true; # Scala - metals = { - enable = true; - config = { - filetypes = [ - "scala" - "sbt" - "sc" - "mill" - ]; - settings.metals = { - defaultBspToBuildTool = true; - defaultShell = "fish"; - enableBestEffort = true; - enableSemanticHighlighting = false; - excludedPackages = [ - "akka.actor.typed.javadsl" - "com.github.swagger.akka.javadsl" - ]; - initOptions = { - statusBarProvider = "on"; - }; - inlayHints = { - typeParameters.enable = true; - hintsInPatternMatch.enable = true; - }; - mcpClient = "claude"; - serverVersion = "latest.snapshot"; - showImplicitArguments = true; - showImplicitConversionsAndClasses = true; - showInferredType = true; - startMcpServer = true; - superMethodLensesEnabled = true; - useGlobalExecutable = true; - }; - }; - }; + metals.enable = true; # Nix nil_ls.enable = true; @@ -99,7 +64,7 @@ # Swift/iOS development sourcekit = { enable = true; - config = { + settings = { cmd = [ "xcrun" "sourcekit-lsp" @@ -111,4 +76,4 @@ tinymist.enable = true; }; }; -} +} \ No newline at end of file diff --git a/programs/nixvim/plugins/neo-tree.nix b/programs/nixvim/plugins/neo-tree.nix index 0d36ad5..73c1ee6 100644 --- a/programs/nixvim/plugins/neo-tree.nix +++ b/programs/nixvim/plugins/neo-tree.nix @@ -14,13 +14,11 @@ plugins.neo-tree = { enable = true; - settings = { - close_if_last_window = true; - window = { - width = 30; - autoExpandWidth = true; - position = "right"; - }; + closeIfLastWindow = true; + window = { + width = 30; + autoExpandWidth = true; + position = "right"; }; }; }; diff --git a/programs/tmux/README.md b/programs/tmux/README.md deleted file mode 100644 index 0e66e06..0000000 --- a/programs/tmux/README.md +++ /dev/null @@ -1,78 +0,0 @@ -# Tmux Cheatsheet - -## Prefix Key -**Prefix:** `Ctrl-a` - -All commands below require pressing the prefix first, unless otherwise noted. - -## Copy Mode (Vi-style) - -| Key | Action | -|-----|--------| -| `Esc` or `Ctrl-[` | Enter copy mode | -| `v` | Begin selection (in copy mode) | -| `y` or `Enter` | Copy selection to macOS clipboard | -| `p` | Paste from tmux buffer | - -## Pane Management - -### Creating Panes - -| Key | Action | -|-----|--------| -| `'` | Split pane horizontally (side by side) | -| `-` | Split pane vertically (top/bottom) | - -### Navigating Panes (Dvorak-optimized) - -| Key | Action | -|-----|--------| -| `d` | Move to left pane | -| `h` | Move to down pane | -| `t` | Move to up pane | -| `n` | Move to right pane | -| `Ctrl-h` | Cycle to next pane | - -### Resizing Panes - -| Key | Action | -|-----|--------| -| `Ctrl-Left` | Resize pane left (10 units) | -| `Ctrl-Down` | Resize pane down (10 units) | -| `Ctrl-Up` | Resize pane up (10 units) | -| `Ctrl-Right` | Resize pane right (10 units) | - -## Window Management - -| Key | Action | -|-----|--------| -| `Ctrl-d` | Previous window | -| `Ctrl-n` | Next window | - -## Session Management (TMS Integration) - -| Key | Action | -|-----|--------| -| `(` | Previous session (with refresh) | -| `)` | Next session (with refresh) | -| `Ctrl-o` | Open TMS popup for session switching | - -## Configuration Details - -- **Base Index:** Windows and panes start at 1 (not 0) -- **Escape Time:** 10ms (for vim responsiveness) -- **History Limit:** 10,000 lines -- **Key Mode:** Vi -- **Terminal:** xterm-256color -- **Mouse:** Disabled -- **Repeat Time:** 1000ms for repeatable commands -- **Auto-renumber:** Windows are renumbered when one is closed -- **Activity Monitoring:** Visual alerts when window has activity - -## Plugins - -- **sensible:** Sensible default settings -- **tokyo-night-tmux:** Tokyo Night theme with transparency -- **yank:** Better clipboard integration -- **resurrect:** Save/restore tmux sessions -- **continuum:** Auto-save sessions every 60 minutes diff --git a/programs/tmux/default.nix b/programs/tmux/default.nix index a74348a..ac2275f 100644 --- a/programs/tmux/default.nix +++ b/programs/tmux/default.nix @@ -1,92 +1,12 @@ { pkgs, ... }: let - tmuxConfig = '' - # disable mouse - set -g mouse off - - # increase repeat time for repeatable commands - set -g repeat-time 1000 - - # highlight window when it has new activity - setw -g monitor-activity on - set -g visual-activity on - - # re-number windows when one is closed - set -g renumber-windows on - - ########################### - # Key Bindings - ########################### - - # Copy vim style - # create 'v' alias for selecting text - bind Escape copy-mode - bind C-[ copy-mode - bind -T copy-mode-vi 'v' send -X begin-selection - # copy with 'enter' or 'y' and send to mac os clipboard - unbind -T copy-mode-vi Enter - bind -T copy-mode-vi Enter send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" - bind -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" - # paste - bind p paste-buffer - - # panes: window splitting - unbind % - bind "'" split-window -h - unbind '"' - bind - split-window -v - - # Switch panes with Dvorak-friendly keys (dhtn) - bind d select-pane -L - bind h select-pane -D - bind t select-pane -U - bind n select-pane -R - - # Quick window selection (Dvorak-friendly) - bind -r C-d select-window -t :- - bind -r C-n select-window -t :+ - - # resize panes (Ctrl + Dvorak navigation to avoid conflicts with neovim) - bind -r C-Left resize-pane -L 10 - bind -r C-Down resize-pane -D 10 - bind -r C-Up resize-pane -U 10 - bind -r C-Right resize-pane -R 10 - - # Quickly switch panes (using Dvorak 'h' for down) - unbind ^H - bind ^H select-pane -t :.+ - - ############################ - ## Status Bar - ############################ - - # enable UTF-8 support in status bar - set -gq status-utf8 on - - # center the status bar - set -g status-justify centre - - # show session, window, pane in left status bar - set -g status-left-length 40 - set -g status-left '#[fg=green] #S #[fg=yellow]#I/#[fg=cyan]#P ' - - # update status bar info - set -g status-interval 60 - - set -g status-right " #(tms sessions)" - bind -r '(' switch-client -p\; refresh-client -S - bind -r ')' switch-client -n\; refresh-client -S - bind C-o display-popup -E "tms" - - set -g default-command /etc/profiles/per-user/salar/bin/fish - ''; + tmuxConfig = builtins.readFile ./tmux.conf; in { programs.tmux = { enable = true; baseIndex = 1; - resizeAmount = 10; escapeTime = 10; historyLimit = 10000; keyMode = "vi"; @@ -110,6 +30,11 @@ in # No extra spaces between icons set -g @tokyo-night-tmux_window_tidy_icons 0 + + set -g status-right " #(tms sessions)" + bind -r '(' switch-client -p\; refresh-client -S + bind -r ')' switch-client -n\; refresh-client -S + bind C-o display-popup -E "tms" ''; } { diff --git a/programs/tmux/tmux.conf b/programs/tmux/tmux.conf new file mode 100644 index 0000000..9aef545 --- /dev/null +++ b/programs/tmux/tmux.conf @@ -0,0 +1,102 @@ +########################## +# Configuration +########################### + +# use 256 xterm for pretty colors. This enables same colors from iTerm2 within tmux. +# This is recommended in neovim :healthcheck +# set -g default-terminal "screen-256color" +# set -ga terminal-overrides ",xterm-256color:Tc" + +# disable mouse +set -g mouse off + +# decrease command delay (increases vim responsiveness) +set -sg escape-time 1 + +# increase repeat time for repeatable commands +set -g repeat-time 1000 + +# start pane index at 1 instead of 0 +setw -g pane-base-index 1 + +# highlight window when it has new activity +setw -g monitor-activity on +set -g visual-activity on + +# re-number windows when one is closed +set -g renumber-windows on + +# enable pbcopy and pbpaste +# https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/blob/master/README.md +# set-option -g default-command "reattach-to-user-namespace -l zsh" + +########################### +# Key Bindings +########################### + +# Tmux prefix +# Current solution is to keep the default +# and have term map C-; to C-b. This is the nicest +# bind I've found and this is the only way to enable it in tmux +# unbind C-b +# set -g prefix C-a +# bind C-a send-prefix + +# Copy vim style +# create 'v' alias for selecting text +bind Escape copy-mode +bind C-[ copy-mode +bind -T copy-mode-vi 'v' send -X begin-selection +# copy with 'enter' or 'y' and send to mac os clipboard: http://goo.gl/2Bfn8 +unbind -T copy-mode-vi Enter +bind -T copy-mode-vi Enter send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" +bind -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" +# paste +bind p paste-buffer +# paste from system clipboard MacOS +# bind C-v run \"tmux set-buffer \"$(reattach-to-user-namespace pbpaste)\"; tmux paste-buffer" + +# panes: window splitting +unbind % +bind "'" split-window -h +unbind '"' +bind - split-window -v + +# Switch panes with hjkl +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +# Quick window selection +bind -r C-h select-window -t :- +bind -r C-l select-window -t :+ + +# resize panes +bind -r H resize-pane -L 10 +bind -r J resize-pane -D 10 +bind -r K resize-pane -U 10 +bind -r L resize-pane -R 10 + +## Quickly switch panes +unbind ^J +bind ^J select-pane -t :.+ + +############################ +## Status Bar +############################ + +# enable UTF-8 support in status bar +set -gq status-utf8 on + +# center the status bar +set -g status-justify centre + +# show session, window, pane in left status bar +set -g status-left-length 40 +set -g status-left '#[fg=green] #S #[fg=yellow]#I/#[fg=cyan]#P ' + +# update status bar info +set -g status-interval 60 + +set -g default-command /etc/profiles/per-user/salar/bin/fish