Commit d4bfb3f79294

Vincent Demeester <vincent@sbr.pm>
2026-02-02 17:06:20
Adopt patterns from chmouel's rc-config
Implement three key improvements inspired by chmouel's configuration: 1. Disable Mason in LazyVim - Explicitly disable mason.nvim and mason-lspconfig.nvim - Prevents conflicts with Nix-managed LSPs (gopls, nil, nixd, ruff) - LSPs are managed via home-manager, not Mason 2. Configure OSC 52 clipboard in tmux - Add smart clipboard script that detects environment - OSC 52 for SSH sessions (works over network!) - Falls back to pbcopy/wl-copy/xclip for local sessions - Enable set-clipboard and allow-passthrough in tmux - Universal clipboard that works everywhere 3. Add Kitty hints and popups - Hints system with bépo-optimized alphabet (sadfjklewcmpgh) - Word/path/line/linenum hints for quick selection - Popup overlays for lazygit (kitty_mod+g) and git diff (kitty_mod+r) - Tmux-style overlays without leaving context All keybindings respect bépo layout and existing workflows. Related to TODO: "Adopt patterns from chmouel's rc-config" Ref: https://gitlab.com/chmouel/rc-config
1 parent 9364a62
Changed files (5)
dots
.config
nvim
lua
plugins
home
dots/.config/nvim/lua/plugins/extras.lua
@@ -1,5 +1,15 @@
 -- Extra plugins and customizations
 return {
+  -- Disable Mason - use Nix-managed LSPs instead
+  {
+    "williamboman/mason.nvim",
+    enabled = false,
+  },
+  {
+    "williamboman/mason-lspconfig.nvim",
+    enabled = false,
+  },
+
   -- Colorscheme
   {
     "folke/tokyonight.nvim",
home/common/desktop/kitty.nix
@@ -80,12 +80,41 @@
       map --when-focus-on title:tmux alt+a send_text all \x02a
       map --when-focus-on title:tmux alt+d send_text all \x02d
       map --when-focus-on title:tmux alt+shift+r send_text all \x02R
-    '';
 
-    # Automatic theme switching enabled via xdg.configFile below
-    # Removed hardcoded themeFile to allow dark/light auto-switching
-    # action_alias mkh kitten hints --alphabet asdfghjklqwertyuiopzxcvbnmASDFGHJKLQWERTYUIOPZXCVBNM
-    # map kitty_mod+n    mkh --type=linenum emacsclient -c -nw +{line} {path}
+      # ============================================================================
+      # KITTY HINTS SYSTEM (bépo-optimized home row alphabet)
+      # ============================================================================
+      # Home-row optimized alphabet: sadfjklewcmpgh
+      # Prioritizes most accessible keys on bépo layout
+
+      # Define hints action with custom alphabet and colors
+      action_alias mkh kitten hints --alphabet sadfjklewcmpgh --hints-background-color=black --hints-foreground-color=green --hints-text-color=magenta
+
+      # Word hints - select and copy words
+      map kitty_mod+d mkh --type word --program -
+
+      # Path hints - select and copy file paths
+      map kitty_mod+f mkh --type path --program -
+
+      # Line hints - select and copy entire lines
+      map kitty_mod+l mkh --type=line --program -
+
+      # Line number hints - open file at specific line in nvim
+      map kitty_mod+n mkh --type=linenum nvim +{line} {path}
+
+      # URL hints - open URLs (already exists via kitty_mod+e but added for completeness)
+      # map kitty_mod+u mkh --type url
+
+      # ============================================================================
+      # KITTY POPUPS (tmux-style overlays)
+      # ============================================================================
+
+      # LazyGit popup - full-featured git UI
+      map kitty_mod+g launch --type=overlay --title="  LazyGit" --cwd=current zsh -i -c lazygit
+
+      # Git diff popup - quick diff viewer
+      map kitty_mod+r launch --type=overlay --title="  Git Diff" --cwd=current zsh -i -c 'git diff 2>/dev/null; git diff --staged 2>/dev/null'
+    '';
   };
 
   # Create automatic theme files for dark/light mode switching
home/common/shell/tmux/scripts/smart-clipboard.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+# Smart clipboard script for tmux
+# Detects environment and uses appropriate clipboard backend
+# - OSC 52 for SSH sessions (works over network)
+# - pbcopy for macOS
+# - wl-copy for Wayland (Linux)
+# - xclip for X11 (Linux)
+
+if [ -n "$SSH_CONNECTION" ] || [ -n "$SSH_TTY" ]; then
+  # Remote session → use OSC 52 escape sequence
+  # This sends clipboard data to the local terminal
+  base64 | tr -d "\n" | sed "s/.*/\x1b]52;c;&\x07/"
+elif command -v pbcopy >/dev/null 2>&1; then
+  # macOS
+  pbcopy
+elif command -v wl-copy >/dev/null 2>&1; then
+  # Wayland (Linux)
+  wl-copy
+elif command -v xclip >/dev/null 2>&1; then
+  # X11 (Linux)
+  xclip -selection clipboard
+else
+  # Fallback: discard (no clipboard available)
+  cat >/dev/null
+fi
home/common/shell/tmux/tmux.conf
@@ -37,6 +37,10 @@ set -g renumber-windows on
 set -g default-terminal "tmux-256color"
 set -ga terminal-overrides ",*256col*:Tc"
 
+# Clipboard support
+set -g set-clipboard on        # Enable clipboard integration
+set -g allow-passthrough on    # Allow OSC 52 escape sequences
+
 # ============================================================================
 # BÉPO NAVIGATION - CTSR (matches vim-bepo)
 # ============================================================================
@@ -140,9 +144,9 @@ bind -T copy-mode M-r send-keys -X cursor-right
 bind -T copy-mode M-é send-keys -X next-word
 bind -T copy-mode M-É send-keys -X previous-word
 
-# Copy to clipboard (using wl-copy for Wayland)
+# Copy to clipboard (smart detection: OSC 52 for SSH, wl-copy/pbcopy for local)
 # In emacs mode, M-w is the standard copy binding
-bind -T copy-mode M-w send-keys -X copy-pipe-and-cancel "wl-copy"
+bind -T copy-mode M-w send-keys -X copy-pipe-and-cancel "~/.config/tmux/scripts/smart-clipboard.sh"
 
 # Alternative: Keep standard Emacs bindings available too
 # C-Space to set mark (begin selection) - already works in emacs mode
home/common/shell/tmux.nix
@@ -15,4 +15,8 @@
     '';
   };
   xdg.configFile."tmux/tmux.conf".source = ./tmux/tmux.conf;
+  xdg.configFile."tmux/scripts/smart-clipboard.sh" = {
+    source = ./tmux/scripts/smart-clipboard.sh;
+    executable = true;
+  };
 }