Merge pull request #18 from softinio/softinio/push-smxkvmronkzz

Nixvim and tmux related updates
This commit is contained in:
Salar Rahmanian 2025-10-11 15:16:31 -07:00 committed by GitHub
commit 4ef009472f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 374 additions and 137 deletions

View file

@ -0,0 +1,10 @@
{
"permissions": {
"allow": [
"WebFetch(domain:github.com)",
"WebFetch(domain:raw.githubusercontent.com)"
],
"deny": [],
"ask": []
}
}

30
flake.lock generated
View file

@ -67,11 +67,11 @@
]
},
"locked": {
"lastModified": 1759702766,
"narHash": "sha256-011pCUbIq/fhCiZ20AzqJYNjLzQ1oYkzYEgzcUYVTBg=",
"lastModified": 1760130406,
"narHash": "sha256-GKMwBaFRw/C1p1VtjDz4DyhyzjKUWyi1K50bh8lgA2E=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "5b45dcf4790bb94fec7e550d2915fc2540a3cdd6",
"rev": "d305eece827a3fe317a2d70138f53feccaf890a1",
"type": "github"
},
"original": {
@ -130,11 +130,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1759632233,
"narHash": "sha256-krgZxGAIIIKFJS+UB0l8do3sYUDWJc75M72tepmVMzE=",
"lastModified": 1760103332,
"narHash": "sha256-BMsGVfKl4Q80Pr9T1AkCRljO1bpwCmY8rTBVj8XGuhA=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d7f52a7a640bc54c7bb414cca603835bf8dd4b10",
"rev": "870493f9a8cb0b074ae5b411b2f232015db19a65",
"type": "github"
},
"original": {
@ -146,11 +146,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1759381078,
"narHash": "sha256-gTrEEp5gEspIcCOx9PD8kMaF1iEmfBcTbO0Jag2QhQs=",
"lastModified": 1760038930,
"narHash": "sha256-Oncbh0UmHjSlxO7ErQDM3KM0A5/Znfofj2BSzlHLeVw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "7df7ff7d8e00218376575f0acdcc5d66741351ee",
"rev": "0b4defa2584313f3b781240b29d61f6f9f7e0df3",
"type": "github"
},
"original": {
@ -170,11 +170,11 @@
"systems": "systems_2"
},
"locked": {
"lastModified": 1759670959,
"narHash": "sha256-OjvEGJEZDkAri6m1oUV0DE+pRKqh6KEcVuCIlmLN7QU=",
"lastModified": 1760201666,
"narHash": "sha256-We8VAiO7e8Vy0ptKTSxF5nR9pkm+FaGHkCsIzzsMNEQ=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "e45e9214dcc2ea770418fe407a43902b0438ce78",
"rev": "c66070248254d4efb619c3423d71ab3592b31234",
"type": "github"
},
"original": {
@ -189,11 +189,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1759696599,
"narHash": "sha256-GkGJdNkR9gnVQt9OXwhGrD72EpK185jNVT7qoCh/3q4=",
"lastModified": 1760211868,
"narHash": "sha256-94NlU7LUXuL2fnUoaPDF1Xu9kVOicO+4+DEjIAxggNU=",
"owner": "nix-community",
"repo": "nur",
"rev": "dce08ba6904fcaad93c17ab65cf6b3e5dfc2d301",
"rev": "9e2d8216b3fb1d5963c162a17fe796c8d7f3d112",
"type": "github"
},
"original": {

View file

@ -40,6 +40,7 @@
ast-grep
basedpyright
bash-language-server
bloop
cachix
cmake
coursier
@ -73,7 +74,7 @@
nix-index
nixfmt-rfc-style
nix-prefetch-git
nodejs-slim
nodejs
noto-fonts
noto-fonts-color-emoji
ollama

View file

@ -156,6 +156,113 @@ 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 `<leader>s` | Normal | Save file |
### Window Navigation
| Key | Mode | Action |
|-----|------|--------|
| `<leader>h` | Normal | Move to left window |
| `<leader>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 |
|-----|------|--------|
| `<leader>m` | Normal | Toggle file explorer |
### Fuzzy Finder (Telescope)
| Key | Mode | Action |
|-----|------|--------|
| `<leader>ff` | Normal | Find files |
| `<leader>fg` | Normal | Live grep (search text) |
| `<leader>b` | Normal | List buffers |
| `<leader>fh` | Normal | Help tags |
| `<leader>fd` | Normal | Diagnostics |
| `Ctrl-p` | Normal | Git files |
| `<leader>?` | Normal | Recently opened files |
| `Ctrl-t` | Normal | Search for TODOs |
| `<leader>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 |
| `<leader>j` | Normal | Next diagnostic |
| `<leader>k` | Normal | Previous diagnostic |
### Metals (Scala Development)
| Key | Mode | Action |
|-----|------|--------|
| `<leader>ws` | Normal | Hover Metals Worksheet |
| `<leader>sm` | Normal | Telescope Metals Commands |
| `<leader>tt` | Normal | Toggle tree view |
| `<leader>tr` | Normal | Reveal in tree |
### Terminal (Floaterm)
| Key | Mode | Action |
|-----|------|--------|
| `<leader>,` | 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/)

View file

@ -30,5 +30,12 @@
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()";
}
];
}

View file

@ -30,6 +30,11 @@
"<C-Right>" = ":vertical resize -2<CR>";
"<M-k>" = ":move-2<CR>";
"<M-j>" = ":move+<CR>";
# Metals (Scala) keybindings
"<leader>ws" = "<cmd>lua require('metals').hover_worksheet()<CR>";
"<leader>sm" = "<cmd>lua require('telescope').extensions.metals.commands()<CR>";
"<leader>tt" = "<cmd>lua require('metals.tvp').toggle_tree_view()<CR>";
"<leader>tr" = "<cmd>lua require('metals.tvp').reveal_in_tree()<CR>";
};
visual =
lib.mapAttrsToList

View file

@ -4,14 +4,33 @@
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-slim}/bin/node";
copilot_node_command = lib.mkForce "${pkgs.nodejs}/bin/node";
copilot_no_tab_map = true;
copilot_assume_mapped = true;
};
# Copilot keymapping - use Ctrl+J to accept suggestion
keymaps = [
{
mode = "i";
key = "<C-J>";
action = "copilot#Accept(\"\\<CR>\")";
options = {
silent = true;
script = true;
expr = true;
replace_keycodes = false;
};
}
];
};
}
}

View file

@ -8,7 +8,7 @@
# Python
basedpyright = {
enable = true;
settings.settings.basedpyright = {
config.settings.basedpyright = {
analysis = {
autoImportCompletions = true;
autoSearchPaths = true;
@ -45,14 +45,49 @@
# Lua
lua_ls = {
enable = true;
settings.settings.diagnostics.globals = [ "vim" ];
config.settings.diagnostics.globals = [ "vim" ];
};
# Documentation
marksman.enable = true;
# Scala
metals.enable = true;
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;
};
};
};
# Nix
nil_ls.enable = true;
@ -64,7 +99,7 @@
# Swift/iOS development
sourcekit = {
enable = true;
settings = {
config = {
cmd = [
"xcrun"
"sourcekit-lsp"
@ -76,4 +111,4 @@
tinymist.enable = true;
};
};
}
}

View file

@ -14,11 +14,13 @@
plugins.neo-tree = {
enable = true;
closeIfLastWindow = true;
window = {
width = 30;
autoExpandWidth = true;
position = "right";
settings = {
close_if_last_window = true;
window = {
width = 30;
autoExpandWidth = true;
position = "right";
};
};
};
};

78
programs/tmux/README.md Normal file
View file

@ -0,0 +1,78 @@
# 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

View file

@ -1,12 +1,92 @@
{ pkgs, ... }:
let
tmuxConfig = builtins.readFile ./tmux.conf;
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
'';
in
{
programs.tmux = {
enable = true;
baseIndex = 1;
resizeAmount = 10;
escapeTime = 10;
historyLimit = 10000;
keyMode = "vi";
@ -30,11 +110,6 @@ 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"
'';
}
{

View file

@ -1,102 +0,0 @@
##########################
# 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