From e2fe74863e48c5f05b18fac38b73e7a3e0bf1375 Mon Sep 17 00:00:00 2001 From: Stefan Weigl-Bosker Date: Thu, 20 Mar 2025 19:37:14 -0400 Subject: tmux --- modules/default.nix | 1 + modules/global.nix | 1 + modules/neovim/nvim/lua/config/lsp.lua | 11 +++++ modules/tmux.nix | 79 ++++++++++++++++++++++++++++++++++ 4 files changed, 92 insertions(+) create mode 100644 modules/tmux.nix diff --git a/modules/default.nix b/modules/default.nix index 6087536..e094839 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -4,6 +4,7 @@ ./foot.nix ./mako.nix ./neovide.nix + ./tmux.nix ./zsh ./sway ./neovim diff --git a/modules/global.nix b/modules/global.nix index 0cb44e7..c9fa3b6 100644 --- a/modules/global.nix +++ b/modules/global.nix @@ -32,6 +32,7 @@ in wrapWithNixGL = cfg.notNixOS; }; zsh.enable = true; + tmux.enable = true; }; nixGL = lib.mkIf cfg.notNixOS { diff --git a/modules/neovim/nvim/lua/config/lsp.lua b/modules/neovim/nvim/lua/config/lsp.lua index 887dbe7..3313fff 100644 --- a/modules/neovim/nvim/lua/config/lsp.lua +++ b/modules/neovim/nvim/lua/config/lsp.lua @@ -38,7 +38,18 @@ vim.diagnostic.config({ vim.api.nvim_create_autocmd("LspAttach", { callback = function(args) local client = vim.lsp.get_client_by_id(args.data.client_id) + vim.keymap.set('n', 'grr', function() + vim.lsp.buf.references() + end, { desc = "Code references (LSP)" }) + + vim.keymap.set('n', 'gd', function() + vim.lsp.buf.definition() + end, { desc = "Goto definition (LSP)" }) + vim.keymap.set('n', 'E', 'lua vim.lsp.buf.hover()', { silent = true }) + if client:supports_method(methods.textDocument_inlayHint) then + vim.lsp.inlay_hint.enable() + end if client:supports_method(methods.textDocument_formatting) then vim.api.nvim_create_autocmd("BufWritePre", { diff --git a/modules/tmux.nix b/modules/tmux.nix new file mode 100644 index 0000000..5761120 --- /dev/null +++ b/modules/tmux.nix @@ -0,0 +1,79 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.modules.tmux; +in +{ + options.modules.tmux = { + enable = lib.mkEnableOption "tmux"; + }; + + config = { + programs.tmux = lib.mkIf cfg.enable { + enable = true; + customPaneNavigationAndResize = true; + prefix = "C-Space"; + mouse = true; + keyMode = "vi"; + baseIndex = 1; + escapeTime = 0; + focusEvents = true; + extraConfig = '' + set-option -ga terminal-overrides ",xterm-256color:Tc" + set-option -g default-terminal "screen-256color" + + set -g renumber-windows on + + bind w switch-client -T split + bind t switch-client -T tab + + bind -T tab o choose-tree -Zw + bind -T tab c kill-window # warn? + bind -T tab m previous-window + bind -T tab i next-window + bind -T tab n new-window + + bind -T split i split-window -h + bind -T split n split-window + bind c kill-pane + + bind m select-pane -L + bind n select-pane -D + bind e select-pane -U + bind i select-pane -R + + bind -T copy-mode-vi m send-keys -X cursor-left + bind -T copy-mode-vi n send-keys -X cursor-down + bind -T copy-mode-vi e send-keys -X cursor-up + bind -T copy-mode-vi i send-keys -X cursor-right + + bind -T copy-mode-vi j send-keys -X search-again + bind -T copy-mode-vi J send-keys -X search-reverse + + bind -T copy-mode-vi k send-keys -X next-word-end + bind -T copy-mode-vi K send-keys -X next-space-end + + bind -T copy-mode-vi M send-keys -X top-line + bind -T copy-mode-vi N send-keys -X scroll-down + bind -T copy-mode-vi E send-keys -X scroll-up + bind -T copy-mode-vi I send-keys -X bottom-line + + bind -r M resize-pane -L 10 + bind -r N resize-pane -D 10 + bind -r E resize-pane -U 10 + bind -r I resize-pane -R 10 + + bind h select-pane -m + bind j next-window + bind l display-message + bind K select-layout -E + + set -g status-style bg='#191919',fg='#4c4c4c' + set-window-option -g window-status-style fg='#4c4c4c',bg='#191919' + set-window-option -g window-status-current-style fg='#ac8aac',bg='#191919' + + set -g pane-border-style fg='#191919' + set -g pane-active-border-style fg='#191919' + ''; + }; + }; +} -- cgit v1.2.3