From ff1cc83de8cd16dc279af318d87deca05361c82d Mon Sep 17 00:00:00 2001 From: tobias gasslander Date: Sun, 10 Aug 2025 20:13:08 +0200 Subject: [PATCH 1/7] improve navigation --- tmux/.config/tmux/tmux.conf | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tmux/.config/tmux/tmux.conf b/tmux/.config/tmux/tmux.conf index a219f67..c5a9d51 100644 --- a/tmux/.config/tmux/tmux.conf +++ b/tmux/.config/tmux/tmux.conf @@ -60,6 +60,26 @@ bind-key -T copy-mode-vi v send-keys -X begin-selection bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel +# tmux-nvim-navigator +vim_pattern='(\\S+\\/)?g?\.?(view|l?n?vim?x?|fzf)(diff)?(-wrapped)?$' +is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ + | grep -iqE '^[^TXZ ]+ +${vim_pattern}'" +bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' +bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' +bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' +bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' +tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' +if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" +if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" + +bind-key -T copy-mode-vi 'C-h' select-pane -L +bind-key -T copy-mode-vi 'C-j' select-pane -D +bind-key -T copy-mode-vi 'C-k' select-pane -U +bind-key -T copy-mode-vi 'C-l' select-pane -R +bind-key -T copy-mode-vi 'C-\' select-pane -l + bind H split-window -v -c "#{pane_current_path}" bind v split-window -h -c "#{pane_current_path}" From 133f853fc2419df2967aea12d598bf40479a169e Mon Sep 17 00:00:00 2001 From: tgasslander Date: Thu, 29 May 2025 15:43:14 +0200 Subject: [PATCH 2/7] add docker CLI completion --- zsh/.zshrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zsh/.zshrc b/zsh/.zshrc index e17a3bf..ce28280 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -118,3 +118,8 @@ export PYENV_ROOT="$HOME/.pyenv" if command -v pyenv 1>/dev/null 2>&1; then eval "$(pyenv init -)" fi +# The following lines have been added by Docker Desktop to enable Docker CLI completions. +fpath=(/Users/toga/.docker/completions $fpath) +autoload -Uz compinit +compinit +# End of Docker CLI completions From 52cde164774d25ae6c8d273772e95f957524ec1c Mon Sep 17 00:00:00 2001 From: tgasslander Date: Thu, 29 May 2025 15:54:56 +0200 Subject: [PATCH 3/7] add swagger preview at LEADER+SW --- nvim/.config/nvim/lua/toga/core/keybindings.lua | 8 ++++++++ nvim/.config/nvim/lua/toga/plugins/swagger.lua | 6 ++++++ 2 files changed, 14 insertions(+) create mode 100644 nvim/.config/nvim/lua/toga/plugins/swagger.lua diff --git a/nvim/.config/nvim/lua/toga/core/keybindings.lua b/nvim/.config/nvim/lua/toga/core/keybindings.lua index 859a0c4..65bd8f0 100644 --- a/nvim/.config/nvim/lua/toga/core/keybindings.lua +++ b/nvim/.config/nvim/lua/toga/core/keybindings.lua @@ -68,3 +68,11 @@ vim.api.nvim_set_keymap( ":MarkdownPreviewToggle", { noremap = true, silent = true, desc = "Toggle markdown preview" } ) + +-- SwaggerPreview settings +vim.api.nvim_set_keymap( + "n", + "sw", + ":SwaggerPreviewToggle", + { noremap = true, silent = true, desc = "Toggle Swagger preview" } +) diff --git a/nvim/.config/nvim/lua/toga/plugins/swagger.lua b/nvim/.config/nvim/lua/toga/plugins/swagger.lua new file mode 100644 index 0000000..dc2063f --- /dev/null +++ b/nvim/.config/nvim/lua/toga/plugins/swagger.lua @@ -0,0 +1,6 @@ +return { + "vinnymeller/swagger-preview.nvim", + cmd = { "SwaggerPreview", "SwaggerPreviewStop", "SwaggerPreviewToggle" }, + build = "npm i", + config = true, +} From a96a67fb8f330acb4169b16e74305a7f4013724b Mon Sep 17 00:00:00 2001 From: tgasslander Date: Sun, 29 Jun 2025 13:30:24 +0200 Subject: [PATCH 4/7] better golang support --- nvim/.config/nvim/lua/toga/plugins/go.lua | 26 +++++++++++++++++++ .../nvim/lua/toga/plugins/treesitter.lua | 3 +++ 2 files changed, 29 insertions(+) create mode 100644 nvim/.config/nvim/lua/toga/plugins/go.lua diff --git a/nvim/.config/nvim/lua/toga/plugins/go.lua b/nvim/.config/nvim/lua/toga/plugins/go.lua new file mode 100644 index 0000000..bfafde3 --- /dev/null +++ b/nvim/.config/nvim/lua/toga/plugins/go.lua @@ -0,0 +1,26 @@ +return { + "ray-x/go.nvim", + dependencies = { -- optional packages + "ray-x/guihua.lua", + "neovim/nvim-lspconfig", + "nvim-treesitter/nvim-treesitter", + }, + opts = { + -- lsp_keymaps = false, + -- other options + }, + config = function(lp, opts) + require("go").setup(opts) + local format_sync_grp = vim.api.nvim_create_augroup("GoFormat", {}) + vim.api.nvim_create_autocmd("BufWritePre", { + pattern = "*.go", + callback = function() + require("go.format").goimports() + end, + group = format_sync_grp, + }) + end, + event = { "CmdlineEnter" }, + ft = { "go", "gomod" }, + build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries +} diff --git a/nvim/.config/nvim/lua/toga/plugins/treesitter.lua b/nvim/.config/nvim/lua/toga/plugins/treesitter.lua index da1637b..d8e44b2 100644 --- a/nvim/.config/nvim/lua/toga/plugins/treesitter.lua +++ b/nvim/.config/nvim/lua/toga/plugins/treesitter.lua @@ -44,6 +44,9 @@ return { "c", "rust", "go", + "gomod", + "gowork", + "gosum", }, incremental_selection = { enable = true, From b79bc40452a0690ce1c2696c9d32c8b5256984c3 Mon Sep 17 00:00:00 2001 From: tgasslander Date: Mon, 28 Jul 2025 10:56:55 +0200 Subject: [PATCH 5/7] exclude go and... unfortunately fix the formatting of the file at the same time... go formatting will be handled by the go.nvim plugin --- .../nvim/lua/toga/plugins/formatting.lua | 77 ++++++++++--------- 1 file changed, 41 insertions(+), 36 deletions(-) diff --git a/nvim/.config/nvim/lua/toga/plugins/formatting.lua b/nvim/.config/nvim/lua/toga/plugins/formatting.lua index 074c931..0d593a6 100644 --- a/nvim/.config/nvim/lua/toga/plugins/formatting.lua +++ b/nvim/.config/nvim/lua/toga/plugins/formatting.lua @@ -1,39 +1,44 @@ return { - "stevearc/conform.nvim", - event = { "BufReadPre", "BufNewFile" }, - config = function() - local conform = require("conform") + "stevearc/conform.nvim", + event = { "BufReadPre", "BufNewFile" }, + config = function() + local conform = require("conform") - conform.setup({ - formatters_by_ft = { - javascript = { "prettier" }, - typescript = { "prettier" }, - javascriptreact = { "prettier" }, - typescriptreact = { "prettier" }, - svelte = { "prettier" }, - css = { "prettier" }, - html = { "prettier" }, - json = { "prettier" }, - yaml = { "prettier" }, - markdown = { "prettier" }, - graphql = { "prettier" }, - liquid = { "prettier" }, - lua = { "stylua" }, - python = { "isort", "black" }, - }, - format_on_save = { - lsp_fallback = true, - async = false, - timeout_ms = 1000, - }, - }) - - vim.keymap.set({ "n", "v" }, "mp", function() - conform.format({ - lsp_fallback = true, - async = false, - timeout_ms = 1000, - }) - end, { desc = "Format file or range (in visual mode)" }) - end, + conform.setup({ + formatters_by_ft = { + javascript = { "prettier" }, + typescript = { "prettier" }, + javascriptreact = { "prettier" }, + typescriptreact = { "prettier" }, + svelte = { "prettier" }, + css = { "prettier" }, + html = { "prettier" }, + json = { "prettier" }, + yaml = { "prettier" }, + markdown = { "prettier" }, + graphql = { "prettier" }, + liquid = { "prettier" }, + lua = { "stylua" }, + python = { "isort", "black" }, + }, + format_on_save = function(bufnr) + -- Disable formatting for Go files since go.nvim handles it + if vim.bo[bufnr].filetype == "go" then + return + end + return { + lsp_fallback = true, + async = false, + timeout_ms = 1000, + } + end, + }) + vim.keymap.set({ "n", "v" }, "mp", function() + conform.format({ + lsp_fallback = true, + async = false, + timeout_ms = 1000, + }) + end, { desc = "Format file or range (in visual mode)" }) + end, } From c76b5387ab54ca78b9966107d3e466e65b698ecb Mon Sep 17 00:00:00 2001 From: tgasslander Date: Thu, 7 Aug 2025 14:22:55 +0200 Subject: [PATCH 6/7] add `dev` alias for tmux dev session --- scripts/.local/bin/tmux-dev-session.sh | 18 ++++++++++++++++++ zsh/.zshrc | 4 ++++ 2 files changed, 22 insertions(+) create mode 100755 scripts/.local/bin/tmux-dev-session.sh diff --git a/scripts/.local/bin/tmux-dev-session.sh b/scripts/.local/bin/tmux-dev-session.sh new file mode 100755 index 0000000..5e7acc2 --- /dev/null +++ b/scripts/.local/bin/tmux-dev-session.sh @@ -0,0 +1,18 @@ +#!/bin/bash +tmux kill-session -t coder 2>/dev/null + +tmux new-session -s coder \; \ + split-window -v -p 15 \; \ + select-pane -t 2 \; \ + split-window -h -p 67 \; \ + split-window -h -p 50 \; \ + select-pane -t 1 \; \ + send-keys 'nvim .' Enter + +# tmux new-session -s coder \; \ +# split-window -v -p 90 \; \ +# select-pane -t 1 \; \ +# split-window -h -p 67 \; \ +# split-window -h -p 50 \; \ +# select-pane -t 4 \; \ +# send-keys 'nvim .' Enter diff --git a/zsh/.zshrc b/zsh/.zshrc index ce28280..1c8e3ca 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -96,6 +96,9 @@ alias t=talosctl # kubernetes alias k=kubectl +# Tmux +alias dev="tmux-dev-session.sh" + # Java stuff DEV_TOOLS="/home/$USER/JavaInstall" JAVA_HOME="$DEV_TOOLS/JDK/jdk-11.0.13+8" @@ -123,3 +126,4 @@ fpath=(/Users/toga/.docker/completions $fpath) autoload -Uz compinit compinit # End of Docker CLI completions + From d1d0478a3e42afa5b6c67c33e1867dbbe964eac2 Mon Sep 17 00:00:00 2001 From: tobias gasslander Date: Thu, 11 Sep 2025 10:56:44 +0200 Subject: [PATCH 7/7] add CTRL+k to clear the terminal --- wezterm/.config/wezterm/wezterm.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wezterm/.config/wezterm/wezterm.lua b/wezterm/.config/wezterm/wezterm.lua index ebca7fd..c452c42 100644 --- a/wezterm/.config/wezterm/wezterm.lua +++ b/wezterm/.config/wezterm/wezterm.lua @@ -16,6 +16,12 @@ config.keys = { mods = "CMD|SHIFT", action = wezterm.action.ReloadConfiguration, }, + -- CTRL+K to send string 'clear\n' + { + key = "k", + mods = "CTRL", + action = wezterm.action.SendString("clear\n"), + }, } return config