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/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, } 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/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, +} 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, 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/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}" 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 diff --git a/zsh/.zshrc b/zsh/.zshrc index e17a3bf..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" @@ -118,3 +121,9 @@ 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 +