This commit is contained in:
2026-01-23 01:26:09 +08:00
parent 9aff8bacd7
commit 4316b0344c
13 changed files with 1002 additions and 188 deletions
+11 -4
View File
@@ -22,12 +22,13 @@ in {
# Must be an absolute path
doomLocalDir = "${config.home.homeDirectory}/.local/share/nix-doom";
# Use emacs-pgtk for better Wayland support on Linux
# On macOS, use emacsMacport for yabai compatibility (proper AX roles)
# Use emacs30-pgtk for Wayland support on Linux
# On macOS, use emacs30 from emacs-overlay (native-comp, tree-sitter)
# fix-window-role.patch applied via overlay for yabai compatibility
emacs =
if pkgs.stdenv.isLinux
then pkgs.emacs-pgtk
else pkgs.emacsMacport;
then pkgs.emacs30-pgtk
else pkgs.emacs30;
# Extra packages to make available (tree-sitter grammars, etc.)
# Tree-sitter grammars are not installed automatically by Doom
@@ -68,4 +69,10 @@ in {
# Ensure doom directories exist
home.file.".local/share/nix-doom/.keep".text = "";
# Install fonts referenced in doom.d/config.el
home.packages = with pkgs; [
jetbrains-mono
inter
];
}
+10
View File
@@ -35,5 +35,15 @@
lg = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
};
};
# GitHub CLI configuration
programs.gh = {
enable = true;
settings = {
git_protocol = "ssh";
prompt = "enabled";
};
};
}
@@ -28,19 +28,9 @@
# docker-compose
];
# GitHub CLI configuration
programs.gh = {
enable = true;
settings = {
git_protocol = "ssh";
prompt = "enabled";
};
};
# Direnv for per-directory environments
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
}
+60 -1
View File
@@ -6,9 +6,68 @@
pkgs,
...
}: {
# Alacritty terminal emulator configuration
programs.kitty = {
enable = true;
font = {
name = "Fira Code";
size = 13.0;
};
settings = {
# Fonts
bold_font = "Fira Code Bold";
italic_font = "Maple Mono Italic";
bold_italic_font = "Maple Mono BoldItalic";
symbol_map = "U+e000-U+e00a,U+ea60-U+ebeb,U+e0a0-U+e0c8,U+e0ca,U+e0cc-U+e0d7,U+e200-U+e2a9,U+e300-U+e3e3,U+e5fa-U+e6b1,U+e700-U+e7c5,U+ed00-U+efc1,U+f000-U+f2ff,U+f000-U+f2e0,U+f300-U+f372,U+f400-U+f533,U+f0001-U+f1af0 Symbols Nerd Font Mono";
disable_ligatures = "cursor";
# Cursor
cursor = "none";
cursor_blink_interval = 0;
cursor_trail = 3;
# Window
hide_window_decorations = "titlebar-only";
window_margin_width = 4;
remember_window_size = "yes";
initial_window_width = 1600;
initial_window_height = 1000;
enabled_layouts = "Splits,Stack";
confirm_os_window_close = -2;
# Performance
repaint_delay = 8;
input_delay = 1;
resize_draw_strategy = "blank";
resize_debounce_time = "0.001";
# Tab bar
tab_bar_min_tabs = 1;
tab_bar_edge = "top";
tab_bar_style = "powerline";
tab_powerline_style = "slanted";
tab_separator = "\" \"";
tab_activity_symbol = "";
tab_title_max_length = 30;
tab_title_template = "\"{fmt.fg.red}{bell_symbol}{fmt.fg.tab} {index}: ({tab.active_oldest_exe}) {title}{fmt.bold}{' ' if num_windows > 1 and layout_name == 'stack' else ''}{' :{}:'.format(num_windows) if num_windows > 1 else ''}{activity_symbol}\"";
# Scrollback
scrollback_lines = 10000;
touch_scroll_multiplier = "6.0";
# scrollback_pager = "~/.local/share/bob/nvim-bin/nvim -c \"lua require('util').colorize()\"";
# Misc
copy_on_select = "yes";
background_opacity = "0.5";
dynamic_background_opacity = "yes";
enable_audio_bell = "no";
# macOS specific
macos_quit_when_last_window_closed = "no";
macos_colorspace = "default";
macos_show_window_title_in = "window";
};
};
}
+567 -12
View File
@@ -1,4 +1,4 @@
# Text editor configurations
# Batteries-included Neovim configuration for developer productivity
{
inputs,
lib,
@@ -6,21 +6,576 @@
pkgs,
...
}: {
# Neovim configuration
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
extraConfig = ''
set number
set relativenumber
set expandtab
set tabstop=2
set shiftwidth=2
set smartindent
set clipboard=unnamedplus
defaultEditor = true;
# External tools needed by plugins
extraPackages = with pkgs; [
# LSP servers
lua-language-server
nil # Nix LSP
nodePackages.typescript-language-server
nodePackages.vscode-langservers-extracted # HTML/CSS/JSON/ESLint
pyright
rust-analyzer
gopls
# Formatters & linters
stylua
prettierd
nixpkgs-fmt
black
isort
shfmt
# Telescope dependencies
ripgrep
fd
# Other tools
tree-sitter
];
plugins = with pkgs.vimPlugins; [
# ===================
# Core / Dependencies
# ===================
plenary-nvim
nvim-web-devicons
# ===================
# Treesitter (syntax highlighting & more)
# ===================
{
plugin = nvim-treesitter.withAllGrammars;
type = "lua";
config = ''
require('nvim-treesitter.configs').setup({
highlight = { enable = true },
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = false,
node_decremental = "<bs>",
},
},
})
'';
}
nvim-treesitter-textobjects
nvim-treesitter-context # Show context at top of screen
# ===================
# LSP & Completion
# ===================
{
plugin = nvim-lspconfig;
type = "lua";
config = ''
local lspconfig = require('lspconfig')
local capabilities = require('cmp_nvim_lsp').default_capabilities()
-- Common on_attach function
local on_attach = function(client, bufnr)
local opts = { buffer = bufnr, noremap = true, silent = true }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', '<leader>f', function() vim.lsp.buf.format({ async = true }) end, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, opts)
end
-- LSP servers
local servers = {
'lua_ls', 'nil_ls', 'ts_ls', 'pyright', 'rust_analyzer', 'gopls',
'html', 'cssls', 'jsonls'
}
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup({
on_attach = on_attach,
capabilities = capabilities,
})
end
-- Lua specific settings
lspconfig.lua_ls.setup({
on_attach = on_attach,
capabilities = capabilities,
settings = {
Lua = {
diagnostics = { globals = { 'vim' } },
workspace = { checkThirdParty = false },
telemetry = { enable = false },
},
},
})
'';
}
# Completion engine
{
plugin = nvim-cmp;
type = "lua";
config = ''
local cmp = require('cmp')
local luasnip = require('luasnip')
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'buffer' },
{ name = 'path' },
}),
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
})
'';
}
cmp-nvim-lsp
cmp-buffer
cmp-path
cmp_luasnip
luasnip
friendly-snippets
# ===================
# Telescope (fuzzy finder)
# ===================
{
plugin = telescope-nvim;
type = "lua";
config = ''
local telescope = require('telescope')
local builtin = require('telescope.builtin')
telescope.setup({
defaults = {
file_ignore_patterns = { "node_modules", ".git/", "target/", "dist/" },
mappings = {
i = {
["<C-j>"] = "move_selection_next",
["<C-k>"] = "move_selection_previous",
},
},
},
pickers = {
find_files = { hidden = true },
},
})
telescope.load_extension('fzf')
-- Keymaps
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Find files' })
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Live grep' })
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Find buffers' })
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Help tags' })
vim.keymap.set('n', '<leader>fr', builtin.oldfiles, { desc = 'Recent files' })
vim.keymap.set('n', '<leader>fs', builtin.lsp_document_symbols, { desc = 'Document symbols' })
vim.keymap.set('n', '<leader>fw', builtin.grep_string, { desc = 'Grep word under cursor' })
vim.keymap.set('n', '<C-p>', builtin.find_files, { desc = 'Find files' })
'';
}
telescope-fzf-native-nvim
# ===================
# File Explorer
# ===================
{
plugin = neo-tree-nvim;
type = "lua";
config = ''
require('neo-tree').setup({
close_if_last_window = true,
filesystem = {
follow_current_file = { enabled = true },
use_libuv_file_watcher = true,
filtered_items = {
hide_dotfiles = false,
hide_gitignored = false,
},
},
window = {
width = 35,
mappings = {
["<space>"] = "none",
},
},
})
vim.keymap.set('n', '<leader>e', ':Neotree toggle<CR>', { silent = true, desc = 'Toggle file explorer' })
vim.keymap.set('n', '<leader>o', ':Neotree focus<CR>', { silent = true, desc = 'Focus file explorer' })
'';
}
# ===================
# Git Integration
# ===================
{
plugin = gitsigns-nvim;
type = "lua";
config = ''
require('gitsigns').setup({
signs = {
add = { text = '' },
change = { text = '' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local opts = { buffer = bufnr }
vim.keymap.set('n', ']c', function()
if vim.wo.diff then return ']c' end
vim.schedule(function() gs.next_hunk() end)
return '<Ignore>'
end, { expr = true, buffer = bufnr })
vim.keymap.set('n', '[c', function()
if vim.wo.diff then return '[c' end
vim.schedule(function() gs.prev_hunk() end)
return '<Ignore>'
end, { expr = true, buffer = bufnr })
vim.keymap.set('n', '<leader>hs', gs.stage_hunk, opts)
vim.keymap.set('n', '<leader>hr', gs.reset_hunk, opts)
vim.keymap.set('n', '<leader>hS', gs.stage_buffer, opts)
vim.keymap.set('n', '<leader>hu', gs.undo_stage_hunk, opts)
vim.keymap.set('n', '<leader>hp', gs.preview_hunk, opts)
vim.keymap.set('n', '<leader>hb', function() gs.blame_line({ full = true }) end, opts)
end,
})
'';
}
vim-fugitive
# ===================
# UI Enhancements
# ===================
{
plugin = lualine-nvim;
type = "lua";
config = ''
require('lualine').setup({
options = {
theme = 'auto',
component_separators = { left = '', right = '' },
section_separators = { left = '', right = '' },
globalstatus = true,
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff', 'diagnostics' },
lualine_c = { { 'filename', path = 1 } },
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' },
lualine_z = { 'location' }
},
})
'';
}
{
plugin = bufferline-nvim;
type = "lua";
config = ''
require('bufferline').setup({
options = {
diagnostics = "nvim_lsp",
offsets = {
{ filetype = "neo-tree", text = "File Explorer", highlight = "Directory" }
},
show_buffer_close_icons = true,
show_close_icon = false,
},
})
vim.keymap.set('n', '<S-l>', ':BufferLineCycleNext<CR>', { silent = true })
vim.keymap.set('n', '<S-h>', ':BufferLineCyclePrev<CR>', { silent = true })
vim.keymap.set('n', '<leader>bp', ':BufferLineTogglePin<CR>', { silent = true })
vim.keymap.set('n', '<leader>bc', ':BufferLinePickClose<CR>', { silent = true })
'';
}
{
plugin = indent-blankline-nvim;
type = "lua";
config = ''
require('ibl').setup({
indent = { char = "" },
scope = { enabled = true },
})
'';
}
# Color scheme
{
plugin = catppuccin-nvim;
type = "lua";
config = ''
require('catppuccin').setup({
flavour = 'mocha',
integrations = {
cmp = true,
gitsigns = true,
treesitter = true,
telescope = { enabled = true },
neo_tree = true,
indent_blankline = { enabled = true },
native_lsp = { enabled = true },
},
})
vim.cmd.colorscheme('catppuccin')
'';
}
# ===================
# Editor Enhancements
# ===================
{
plugin = which-key-nvim;
type = "lua";
config = ''
require('which-key').setup({})
'';
}
{
plugin = comment-nvim;
type = "lua";
config = ''
require('Comment').setup()
'';
}
{
plugin = nvim-autopairs;
type = "lua";
config = ''
require('nvim-autopairs').setup({
check_ts = true,
})
-- Integrate with nvim-cmp
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require('cmp')
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
'';
}
{
plugin = nvim-surround;
type = "lua";
config = ''
require('nvim-surround').setup({})
'';
}
{
plugin = todo-comments-nvim;
type = "lua";
config = ''
require('todo-comments').setup({})
vim.keymap.set('n', '<leader>ft', ':TodoTelescope<CR>', { silent = true, desc = 'Find TODOs' })
'';
}
{
plugin = trouble-nvim;
type = "lua";
config = ''
require('trouble').setup({})
vim.keymap.set('n', '<leader>xx', ':Trouble diagnostics toggle<CR>', { silent = true, desc = 'Diagnostics' })
vim.keymap.set('n', '<leader>xd', ':Trouble diagnostics toggle filter.buf=0<CR>', { silent = true, desc = 'Buffer diagnostics' })
'';
}
# Flash for quick navigation
{
plugin = flash-nvim;
type = "lua";
config = ''
require('flash').setup({})
vim.keymap.set({ 'n', 'x', 'o' }, 's', function() require('flash').jump() end, { desc = 'Flash' })
vim.keymap.set({ 'n', 'x', 'o' }, 'S', function() require('flash').treesitter() end, { desc = 'Flash Treesitter' })
'';
}
# Mini.nvim utilities
{
plugin = mini-nvim;
type = "lua";
config = ''
require('mini.ai').setup() -- Better text objects
require('mini.splitjoin').setup() -- Split/join arguments
require('mini.move').setup() -- Move lines/selections
'';
}
# Formatting
{
plugin = conform-nvim;
type = "lua";
config = ''
require('conform').setup({
formatters_by_ft = {
lua = { 'stylua' },
python = { 'isort', 'black' },
javascript = { 'prettierd' },
typescript = { 'prettierd' },
javascriptreact = { 'prettierd' },
typescriptreact = { 'prettierd' },
json = { 'prettierd' },
html = { 'prettierd' },
css = { 'prettierd' },
nix = { 'nixpkgs_fmt' },
sh = { 'shfmt' },
bash = { 'shfmt' },
},
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
},
})
'';
}
];
# Core Neovim options
extraLuaConfig = ''
-- Leader key
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Basic options
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.expandtab = true
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.smartindent = true
vim.opt.clipboard = 'unnamedplus'
vim.opt.mouse = 'a'
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.hlsearch = true
vim.opt.incsearch = true
vim.opt.wrap = false
vim.opt.scrolloff = 8
vim.opt.sidescrolloff = 8
vim.opt.signcolumn = 'yes'
vim.opt.updatetime = 250
vim.opt.timeoutlen = 300
vim.opt.splitright = true
vim.opt.splitbelow = true
vim.opt.cursorline = true
vim.opt.termguicolors = true
vim.opt.undofile = true
vim.opt.completeopt = 'menu,menuone,noselect'
-- Better diagnostics display
vim.diagnostic.config({
virtual_text = true,
signs = true,
underline = true,
update_in_insert = false,
severity_sort = true,
float = {
border = 'rounded',
source = 'always',
},
})
-- Essential keymaps
local opts = { noremap = true, silent = true }
-- Better window navigation
vim.keymap.set('n', '<C-h>', '<C-w>h', opts)
vim.keymap.set('n', '<C-j>', '<C-w>j', opts)
vim.keymap.set('n', '<C-k>', '<C-w>k', opts)
vim.keymap.set('n', '<C-l>', '<C-w>l', opts)
-- Resize windows
vim.keymap.set('n', '<C-Up>', ':resize +2<CR>', opts)
vim.keymap.set('n', '<C-Down>', ':resize -2<CR>', opts)
vim.keymap.set('n', '<C-Left>', ':vertical resize -2<CR>', opts)
vim.keymap.set('n', '<C-Right>', ':vertical resize +2<CR>', opts)
-- Move text up and down in visual mode
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv", opts)
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv", opts)
-- Stay in indent mode
vim.keymap.set('v', '<', '<gv', opts)
vim.keymap.set('v', '>', '>gv', opts)
-- Clear search highlight
vim.keymap.set('n', '<Esc>', ':nohlsearch<CR>', opts)
-- Buffer management
vim.keymap.set('n', '<leader>bd', ':bdelete<CR>', opts)
vim.keymap.set('n', '<leader>bn', ':bnext<CR>', opts)
vim.keymap.set('n', '<leader>bp', ':bprevious<CR>', opts)
-- Quick save/quit
vim.keymap.set('n', '<leader>w', ':w<CR>', opts)
vim.keymap.set('n', '<leader>q', ':q<CR>', opts)
vim.keymap.set('n', '<leader>Q', ':qa!<CR>', opts)
-- Better paste (don't yank replaced text)
vim.keymap.set('v', 'p', '"_dP', opts)
-- Center screen after jumps
vim.keymap.set('n', '<C-d>', '<C-d>zz', opts)
vim.keymap.set('n', '<C-u>', '<C-u>zz', opts)
vim.keymap.set('n', 'n', 'nzzzv', opts)
vim.keymap.set('n', 'N', 'Nzzzv', opts)
'';
};
}
-24
View File
@@ -10,14 +10,6 @@
programs.bash = {
enable = true;
enableCompletion = true;
shellAliases = {
ll = "ls -la";
".." = "cd ..";
"..." = "cd ../..";
gs = "git status";
gd = "git diff";
};
};
# Zsh configuration
@@ -27,26 +19,10 @@
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
shellAliases = {
ll = "ls -la";
".." = "cd ..";
"..." = "cd ../..";
gs = "git status";
gd = "git diff";
nix-gc = "nix-collect-garbage -d";
};
history = {
size = 10000;
path = "${config.home.homeDirectory}/.zsh_history";
};
initContent = ''
# Custom prompt or additional configuration
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_FIND_NO_DUPS
setopt HIST_REDUCE_BLANKS
'';
};
# Fish configuration is in ./fish.nix
+177 -15
View File
@@ -1,4 +1,4 @@
# Terminal multiplexer configurations
# Terminal multiplexer configurations - Batteries-included developer setup
{
inputs,
lib,
@@ -7,40 +7,202 @@
...
}: {
home.packages = with pkgs; [
# Optional multiplexers (tmux enabled by default below)
# Required for some tmux plugins
fzf
# Optional multiplexers
# zellij
];
# Tmux configuration
# Tmux configuration - Optimized for developer productivity
programs.tmux = {
enable = true;
terminal = "tmux-256color";
historyLimit = 10000;
baseIndex = 1;
historyLimit = 50000; # Much larger scrollback
baseIndex = 1; # Windows start at 1
keyMode = "vi";
mouse = true;
prefix = "C-a"; # More ergonomic than C-b
escapeTime = 0; # No delay for escape (important for vim)
sensibleOnTop = true;
plugins = with pkgs.tmuxPlugins; [
# Core essentials
sensible
yank
vim-tmux-navigator
yank # System clipboard integration
vim-tmux-navigator # Seamless vim/tmux pane navigation
better-mouse-mode # Enhanced mouse support
# Session persistence - survive reboots
{
plugin = resurrect;
extraConfig = ''
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-processes 'ssh nvim vim "~rails server" "~rails console"'
'';
}
{
plugin = continuum;
extraConfig = ''
set -g @continuum-restore 'on'
set -g @continuum-save-interval '10'
'';
}
# Fast copy with hints (like vimium)
tmux-thumbs
# Fuzzy session management
{
plugin = sessionx;
extraConfig = ''
set -g @sessionx-bind 'o'
set -g @sessionx-zoxide-mode 'on'
'';
}
# URL opening
fzf-tmux-url
# Theme - Catppuccin (mocha)
{
plugin = catppuccin;
extraConfig = ''
set -g @catppuccin_flavor 'mocha'
set -g @catppuccin_window_status_style 'rounded'
set -g @catppuccin_status_background 'default'
# Window format
set -g @catppuccin_window_number_position 'right'
set -g @catppuccin_window_default_fill 'number'
set -g @catppuccin_window_default_text '#W'
set -g @catppuccin_window_current_fill 'number'
set -g @catppuccin_window_current_text '#W'
# Status bar modules
set -g @catppuccin_status_modules_right 'session date_time'
set -g @catppuccin_status_modules_left ''
set -g @catppuccin_date_time_text '%H:%M'
'';
}
];
extraConfig = ''
# Split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# ============================================
# GENERAL SETTINGS
# ============================================
# True color support
set -ag terminal-overrides ",xterm-256color:RGB"
set -ag terminal-overrides ",*256col*:Tc"
# Undercurl support (for spell checking in nvim)
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
# Renumber windows when one is closed
set -g renumber-windows on
# Enable focus events (for vim autoread)
set -g focus-events on
# Faster command sequences
set -s escape-time 0
# Increase tmux messages display duration
set -g display-time 4000
# Status bar refresh interval
set -g status-interval 5
# Aggressive resize (useful when switching clients)
setw -g aggressive-resize on
# ============================================
# KEY BINDINGS
# ============================================
# Split panes using | and - in current directory
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind '"' split-window -v -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
# New window in current directory
bind c new-window -c "#{pane_current_path}"
# Reload config
bind r source-file ~/.config/tmux/tmux.conf
bind r source-file ~/.config/tmux/tmux.conf \; display-message "Config reloaded!"
# Easy pane switching
# Quick pane switching with Alt+arrow (no prefix needed)
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Quick pane switching with Alt+hjkl (vim style, no prefix)
bind -n M-h select-pane -L
bind -n M-l select-pane -R
bind -n M-k select-pane -U
bind -n M-j select-pane -D
# Resize panes with prefix + HJKL
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Quick window switching with Alt+number
bind -n M-1 select-window -t 1
bind -n M-2 select-window -t 2
bind -n M-3 select-window -t 3
bind -n M-4 select-window -t 4
bind -n M-5 select-window -t 5
bind -n M-6 select-window -t 6
bind -n M-7 select-window -t 7
bind -n M-8 select-window -t 8
bind -n M-9 select-window -t 9
# Switch to last window
bind Space last-window
# Switch to last session
bind -r Tab switch-client -l
# ============================================
# COPY MODE (vi-style)
# ============================================
# Enter copy mode with prefix + v (in addition to [)
bind v copy-mode
# Vi-style selection in copy mode
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel
# ============================================
# POPUP WINDOWS (modern tmux feature)
# ============================================
# Quick terminal popup
bind -n M-t display-popup -E -w 80% -h 80%
# Git status popup
bind g display-popup -E -w 80% -h 80% "lazygit || git status"
# ============================================
# SESSION MANAGEMENT
# ============================================
# Create new session
bind S command-prompt -p "New session name:" "new-session -s '%%'"
# Kill session
bind X confirm-before -p "Kill session #S? (y/n)" kill-session
# Detach other clients (claim session)
bind D detach-client -a
'';
};
}