From f473a8099036ce25b97edde22670ce38b0f99e3e Mon Sep 17 00:00:00 2001 From: joshashtondev Date: Thu, 22 Oct 2026 13:04:43 -0600 Subject: [PATCH] =?UTF-8?q?nixos:=20gen=20101=20@=20lilac=20=E2=80=94=2020?= =?UTF-8?q?26-10-22=2013:04=2026.05.20260918.cf9d2fb=20(Yarara)=20-----=20?= =?UTF-8?q?updating=20nvim=20and=20tmux=20for=20better=20keybinds.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- home/programs/nvim.nix | 34 +++++++++++++++++++++++++++++++++- home/programs/tmux.nix | 21 +++++++++++++++++++-- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/home/programs/nvim.nix b/home/programs/nvim.nix index 9acef7b..b84fcba 100644 --- a/home/programs/nvim.nix +++ b/home/programs/nvim.nix @@ -31,6 +31,10 @@ in vim.opt.foldmethod = "indent" vim.opt.foldlevel = 99 + -- nvim-tree replaces netrw; disable it up front so it never flashes. + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + vim.g.mapleader = " " vim.keymap.set("n", "w", "w", { silent = true }) vim.keymap.set("n", "q", "q", { silent = true }) @@ -53,6 +57,7 @@ in view = { width = 30 }, renderer = { group_empty = true }, filters = { dotfiles = false }, + update_focused_file = { enable = true }, }) require("bufferline").setup({ @@ -72,6 +77,33 @@ in options = { theme = "auto" }, }) + -- e: open the explorer if closed, focus it if open elsewhere, + -- close it if it already has focus. + local tree = require("nvim-tree.api").tree + vim.keymap.set("n", "e", function() + if not tree.is_visible() then + tree.open() + elseif vim.bo.filetype == "NvimTree" then + tree.close() + else + tree.focus() + end + end, { silent = true, desc = "Toggle/focus file explorer" }) + + -- o / p: previous / next buffer in bufferline order + -- (left / right). From the explorer, hop back to the previous window + -- first so the tree window never gets a file loaded into it. + local function cycle(cmd) + return function() + if vim.bo.filetype == "NvimTree" then + vim.cmd("wincmd p") + end + vim.cmd(cmd) + end + end + vim.keymap.set("n", "o", cycle("BufferLineCyclePrev"), { silent = true, desc = "Buffer left" }) + vim.keymap.set("n", "p", cycle("BufferLineCycleNext"), { silent = true, desc = "Buffer right" }) + require("neocord").setup({ logo = "auto", logo_tooltip = "Neovim", @@ -238,7 +270,7 @@ in map("rn", vim.lsp.buf.rename) map("ca", vim.lsp.buf.code_action) map("f", function() vim.lsp.buf.format({ async = true }) end) - map("oi", require("jdtls").organize_imports) + map("ci", require("jdtls").organize_imports) end, }) end diff --git a/home/programs/tmux.nix b/home/programs/tmux.nix index 52b2ef8..8fcf544 100644 --- a/home/programs/tmux.nix +++ b/home/programs/tmux.nix @@ -3,6 +3,8 @@ { programs.tmux = { enable = true; + baseIndex = 1; + extraConfig = '' unbind C-b unbind '"' @@ -16,8 +18,8 @@ set-window-option -g mode-keys vi set -g allow-passthrough on set -s set-clipboard on - set -g @resurrect-strategy-nvim 'session' set -sg escape-time 10 + set -g renumber-windows on bind -n M-h select-pane -L bind -n M-j select-pane -D @@ -32,11 +34,26 @@ bind -n 'M-\' split-window -h -c "#{pane_current_path}" bind -n M-- split-window -v -c "#{pane_current_path}" + 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 + bind -n M-s copy-mode ''; plugins = with pkgs.tmuxPlugins; [ - resurrect + { + plugin = resurrect; + extraConfig = '' + set -g @resurrect-strategy-nvim 'session' + ''; + } { plugin = continuum; extraConfig = ''