diff --git a/_init/macos/iterm2/com.googlecode.iterm2.plist b/_init/macos/iterm2/com.googlecode.iterm2.plist index f0c324f..44f9241 100644 --- a/_init/macos/iterm2/com.googlecode.iterm2.plist +++ b/_init/macos/iterm2/com.googlecode.iterm2.plist @@ -2,6 +2,8 @@ + Actions + AdjustWindowForFontSizeChange Custom Color Presets @@ -709,7 +711,19 @@ EnableDivisionView GlobalKeyMap - + + 0x69-0x40000-0x22 + + Action + 13 + Label + + Text + + Version + 1 + + HapticFeedbackForEsc HideScrollbar @@ -1302,6 +1316,17 @@ Version 1 + 0x4b-0x120000-0x28 + + Action + 38 + Label + + Text + \<C-K> + Version + 1 + 0x5b-0x80000-0x21 Action @@ -1335,6 +1360,17 @@ Version 1 + 0x62-0x100000-0xb + + Action + 38 + Label + + Text + \<C-b> + Version + 1 + 0x63-0x100000-0x8 Action @@ -1412,6 +1448,17 @@ Version 1 + 0x69-0x100000-0x22 + + Action + 38 + Label + + Text + \<C-i> + Version + 1 + 0x6a-0x100000-0x26 Action diff --git a/bash/.bash/plugins/fzf.sh b/bash/.bash/plugins/fzf.sh index 9dfdb9b..22fdf51 100644 --- a/bash/.bash/plugins/fzf.sh +++ b/bash/.bash/plugins/fzf.sh @@ -11,10 +11,10 @@ if [ -n "${BASH_VERSION}" ]; then fi # FZF finders -export FZF_FIND_ANY="fd --hidden --exclude .git --strip-cwd-prefix $FZF_PATHS" +export FZF_FIND_ANY="fd --exclude .git --strip-cwd-prefix $FZF_PATHS" if [ -f "$HOME/.fzf-paths" ] && [ -x "$HOME/.fzf-paths" ]; then # To limit paths define ~/.fzf-paths - export FZF_FIND_ANY="fd --hidden --exclude .git . \$($HOME/.fzf-paths)" + export FZF_FIND_ANY="fd --exclude .git . \$($HOME/.fzf-paths)" fi export FZF_FIND_FILE="$FZF_FIND_ANY --type f" @@ -31,6 +31,8 @@ export FZF_DEFAULT_OPTS='--height 80% --layout=reverse --info=inline --color hea export FZF_CTRL_T_COMMAND="$FZF_FIND_ANY" export FZF_CTRL_T_OPTS=" --multi + --color header:italic + --header='C-f find file / C-d find dir ╱ C-g find any ╱ C-y copy ╱ C-e vim ╱ C-/ preview' --bind='ctrl-g:reload($FZF_FIND_ANY)' --bind='ctrl-g:+change-prompt()' --bind='ctrl-g:+change-preview($FZF_PREVIEW_ANY)' @@ -57,11 +59,14 @@ export FZF_CTRL_T_OPTS=" export FZF_ALT_C_COMMAND="$FZF_FIND_DIR" export FZF_ALT_C_OPTS_ARR=" --preview='$FZF_PREVIEW_DIR' - --bind='ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort' + --color header:italic + --header='C-e vim ╱ C-y copy ╱ C-/ preview' + --bind='ctrl-y:execute-silent(echo -n {1..} | pbcopy)+abort' --bind='ctrl-e:become(nvim {+})' --bind='ctrl-/:change-preview-window(down|hidden|)' " export FZF_ALT_C_OPTS="${FZF_ALT_C_OPTS_ARR[*]}" +export _ZO_FZF_OPTS="$FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS" # CTRL-R - Search history # CTRL-/ to toggle small preview window to see the full command @@ -71,7 +76,7 @@ export FZF_CTRL_R_OPTS=" --bind 'ctrl-/:toggle-preview' --bind 'ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort' --color header:italic - --header 'C-y copy, C-/ preview'" + --header 'C-y copy ╱ C-/ preview'" # https://github.com/junegunn/fzf/blob/master/ADVANCED.md#switching-between-ripgrep-mode-and-fzf-mode export FZF_RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case " @@ -82,7 +87,6 @@ export FZF_RG_OPTS=" --bind='ctrl-f:unbind(change,ctrl-f)+change-prompt(fzf > )+enable-search+rebind(ctrl-r)+transform-query(echo {q} > /tmp/rg-fzf-r; cat /tmp/rg-fzf-f)' --bind='ctrl-r:unbind(ctrl-r)+change-prompt(rg > )+disable-search+reload($FZF_RG_PREFIX {q} || true)+rebind(change,ctrl-f)+transform-query(echo {q} > /tmp/rg-fzf-f; cat /tmp/rg-fzf-r)' --bind='start:unbind(ctrl-r)' - --bind='ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort' --bind='ctrl-e:become(nvim {+})' --bind='ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort' --bind='ctrl-a:select-all' @@ -90,7 +94,7 @@ export FZF_RG_OPTS=" --bind='ctrl-e:become(nvim {1} +{2})' --prompt='rg > ' --delimiter=':' - --header='C-r (ripgrep mode) ╱ C-f (fzf mode) ╱' + --header='C-r ripgrep ╱ C-f fzf mode' --preview='bat --color=always {1} --highlight-line {2}' --preview-window='up,60%,border-bottom,+{2}+3/3,~3' " @@ -152,21 +156,41 @@ fcd() { fz() { local -r dir="$( INITIAL_QUERY="${1}" - FZF_DEFAULT_COMMAND="zoxide query $(printf %q "$INITIAL_QUERY")" \ - FZF_DEFAULT_OPTS="$FZF_CTRL_T_OPTS --bind='change:reload:sleep 0.1; zoxide query {q} || true'" \ + FZF_DEFAULT_COMMAND="zoxide query $(printf %q "$INITIAL_QUERY") -l | grep -v \"^\$(pwd)/$\" | sed \"s|\$(pwd)/|./|\" " \ + FZF_DEFAULT_OPTS=" + --multi + --color header:italic + --header='C-y copy ╱ C-e vim ╱ C-/ preview' + --bind='ctrl-y:execute-silent(echo -n {1..} | pbcopy)+abort' + --bind='ctrl-a:select-all' + --bind='ctrl-n:deselect-all' + --bind='ctrl-e:become(echo @nvim@{1})' + --bind='ctrl-/:change-preview-window(down|hidden|right)' + --preview='$FZF_PREVIEW_ANY' + --height='50%' + --layout='reverse' + --bind='change:reload:sleep 0.1; zoxide query {q} -l | grep -v \"^\$(pwd)$\" | sed \"s|\$(pwd)/|./|\" || true' + " \ fzf \ --disabled --query "$INITIAL_QUERY" )" - if [ -n "$dir" ]; then + if [ "${dir:0:6}" = "@nvim@" ]; then + nvim "${dir:6}" + elif [ -n "$dir" ]; then z "$dir" fi } +# Fzf file traversal with preview fcde() { selection="$( - FZF_DEFAULT_COMMAND="echo .. && $FZF_FIND_ANY --exact-depth 1" \ + FZF_DEFAULT_COMMAND="$FZF_FIND_ANY --exact-depth 1" \ FZF_DEFAULT_OPTS="$FZF_CTRL_T_OPTS" \ fzf \ + --color header:italic \ + --header=$'C-c cd ╱ C-o out ╱ C-i in ╱ C-e vim\n' \ + --bind='ctrl-c:become(echo @cd@{1})' \ + --bind='ctrl-c:become(echo @nvim@{1})' \ --bind='ctrl-o:become(echo ..)' \ --bind='ctrl-i:become(echo {1})' )" @@ -179,11 +203,16 @@ fcde() { fi if [ "$n" = 1 ] && [ -d "$selection" ]; then cd "$selection" && fcde + elif [ "${selection:0:6}" = "@nvim@" ]; then + nvim "${selection:6}" + elif [ "$n" = 1 ] && [ "${selection:0:4}" = "@cd@" ]; then + cd "${selection:4}" else nvim "$selection" fi } +# Fzf file frg() { INITIAL_QUERY="${*:-}" FZF_DEFAULT_COMMAND="$FZF_RG_PREFIX $(printf %q "$INITIAL_QUERY")" \ @@ -191,6 +220,7 @@ frg() { fzf --disabled --query "$INITIAL_QUERY" } +# Fzf file content fgrepp() { local -r name="${1:?Expected file name}" INITIAL_QUERY="" @@ -208,6 +238,7 @@ fgrepp() { fzf --disabled --query "$INITIAL_QUERY" } +# Fzf all processes fproc() { procs="ps -ef" killcmd="for d in {+}; do echo \"\$d\" | awk '{ print \$2 }' | xargs kill -9; done" @@ -220,6 +251,7 @@ fproc() { --bind="ctrl-r:reload(date; $procs)" \ --bind="enter:become($killcmd)" \ --bind="ctrl-x:execute-silent($killcmd)+reload(date; $procs)" \ + --color header:italic \ --header=$'C-r reload / C-x kill\n' \ --header-lines=2 \ --preview='echo {}' \ @@ -227,6 +259,7 @@ fproc() { --layout=reverse --height=80% } +# Fzf network processes fnproc() { procs="lsof -i -P -n | head -n 1 && lsof -i -P -n | grep IPv4 | grep LISTEN" killcmd="for d in {+}; do echo \"\$d\" | awk '{ print \$2 }' | xargs kill -9; done" @@ -239,6 +272,7 @@ fnproc() { --bind="ctrl-r:reload(date; $procs)" \ --bind="enter:become($killcmd)" \ --bind="ctrl-x:execute-silent($killcmd)+reload(date; $procs)" \ + --color header:italic \ --header=$'C-r reload / C-x kill\n' \ --header-lines=2 \ --preview='echo {}' \ diff --git a/nvim/.nvim/lua/keybindings.lua b/nvim/.nvim/lua/keybindings.lua index 4c94c86..93c97dc 100644 --- a/nvim/.nvim/lua/keybindings.lua +++ b/nvim/.nvim/lua/keybindings.lua @@ -21,7 +21,7 @@ map("x", "§", "") -- ]c - next change -- [c - previous change map("n", "ml", ":diffget LOCAL") -map("n", "mr", ":diffget BASE") +map("n", "mb", ":diffget BASE") map("n", "mr", ":diffget REMOTE") -- Movement @@ -96,7 +96,7 @@ map("i", "", ":m .+1gi") map("i", "", ":m .-2gi") map("x", "", ":m '>+1gv") map("x", "", ":m '<-2gv") --- -- Skip buffer on delete - controversial +-- Skip buffer on delete - controversial -- map("n", "d", '"_d') -- map("n", "D", '"_D') -- map("x", "d", '"_d') @@ -173,4 +173,9 @@ map("n", "s", ":wa") -- Quit -- map('n', 'Q', ':qall!') map("n", "Q", ":confirm qall") -map("n", "q", "q") +map("n", "q", function() + local win = vim.api.nvim_get_current_win() + local jump_back = vim.api.nvim_replace_termcodes("", true, false, true) + vim.api.nvim_feedkeys(jump_back, "n", false) + vim.api.nvim_win_close(win, false) +end) diff --git a/nvim/.nvim/lua/plugin/indent.lua b/nvim/.nvim/lua/plugin/indent.lua index 7fc3fb9..36343a1 100644 --- a/nvim/.nvim/lua/plugin/indent.lua +++ b/nvim/.nvim/lua/plugin/indent.lua @@ -1,4 +1,4 @@ -require("indent_blankline").setup({ +require("ibl").setup({ char = "|", buftype_exclude = { "terminal", "dashboard", "help", "lspinfo", "lspsaga", "NvimTree" }, filetype_exclude = { "help", "dashboard", "packer" }, diff --git a/nvim/.nvim/lua/plugin/lsp/on-attach.lua b/nvim/.nvim/lua/plugin/lsp/on-attach.lua index 9053c19..673c963 100644 --- a/nvim/.nvim/lua/plugin/lsp/on-attach.lua +++ b/nvim/.nvim/lua/plugin/lsp/on-attach.lua @@ -57,7 +57,7 @@ return function(client, bufnr) local opts = { noremap = true, silent = true } buf_set_keymap("n", prefix .. "D", "lua vim.lsp.buf.declaration()", opts) buf_set_keymap("n", prefix .. "d", "lua vim.lsp.buf.definition()", opts) - buf_set_keymap("n", prefix .. "t", "lua vim.lsp.buf.implementation()", opts) + buf_set_keymap("n", prefix .. "i", "lua vim.lsp.buf.implementation()", opts) buf_set_keymap("n", prefix .. "s", "lua vim.lsp.buf.signature_help()", opts) buf_set_keymap("n", prefix .. "f", 'lua require("plugin/lsp/actions").format()', opts) -- buf_set_keymap('n', prefix .. 'f', 'lua vim.lsp.buf.format()', opts) @@ -69,7 +69,7 @@ return function(client, bufnr) "lua vim.lsp.buf.clear_references() vim.lsp.buf.document_highlight()", opts ) - buf_set_keymap("n", prefix .. "T", "lua vim.lsp.buf.type_definition()", opts) + buf_set_keymap("n", prefix .. "t", "lua vim.lsp.buf.type_definition()", opts) buf_set_keymap("n", prefix .. "n", "lua vim.lsp.buf.rename()", opts) buf_set_keymap("n", prefix .. "a", "lua vim.lsp.buf.code_action()", opts) buf_set_keymap("n", prefix .. "r", "lua vim.lsp.buf.references()", opts) diff --git a/nvim/.nvim/lua/plugin/nvim-cmp.lua b/nvim/.nvim/lua/plugin/nvim-cmp.lua index 862fef4..ae5d934 100644 --- a/nvim/.nvim/lua/plugin/nvim-cmp.lua +++ b/nvim/.nvim/lua/plugin/nvim-cmp.lua @@ -24,6 +24,8 @@ local has_words_before = function() return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil end +local bordered = cmp.config.window.bordered({ border = { "┌", "─", "┐", "│", "┘", "─", "└", "│" } }) + cmp.setup({ preselect = cmp.PreselectMode.None, snippet = { @@ -31,6 +33,10 @@ cmp.setup({ luasnip.lsp_expand(args.body) end, }, + window = { + completion = bordered, + documentation = bordered, + }, formatting = { format = function(entry, vim_item) -- fancy icons and a name of kind @@ -46,9 +52,7 @@ cmp.setup({ end, }, mapping = { - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.complete(), [""] = cmp.mapping.close(), diff --git a/nvim/.nvim/lua/plugin/telescope.lua b/nvim/.nvim/lua/plugin/telescope.lua index cfad4f8..2e73cbc 100644 --- a/nvim/.nvim/lua/plugin/telescope.lua +++ b/nvim/.nvim/lua/plugin/telescope.lua @@ -33,9 +33,9 @@ function _M.keymap() map("n", "cr", ":Telescope lsp_references") map("n", "ca", ":Telescope lsp_code_actions") map("n", "cx", ":Telescope diagnostics") - map("n", "ci", ":Telescope lsp_incomming_calls") + map("n", "cO", ":Telescope lsp_incomming_calls") map("n", "co", ":Telescope lsp_outgoing_calls") - map("n", "ct", ":Telescope lsp_implementations") + map("n", "ci", ":Telescope lsp_implementations") map("n", "cd", ":Telescope lsp_definitions") -- git map("n", "g", "") -- added to not trigger a command by mistake @@ -102,15 +102,15 @@ function _M.config() mappings = { i = { [""] = actions.close, + [""] = actions.close, [""] = trouble.open_with_trouble, [""] = actions.cycle_history_prev, [""] = actions.cycle_history_next, + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, [""] = actions.preview_scrolling_up, [""] = actions.preview_scrolling_down, [""] = "which_key", - [""] = lga.quote_prompt(), - [""] = lga.quote_prompt({ postfix = " --iglob " }), - [""] = actions.close, }, n = { ["q"] = actions.close, @@ -142,6 +142,16 @@ function _M.config() -- even more opts }), }, + live_grep_args = { + auto_quoting = true, -- enable/disable auto-quoting + mappings = { + -- extend mappings + i = { + [""] = lga.quote_prompt(), + [""] = lga.quote_prompt({ postfix = " --iglob *." }), + }, + }, + }, }, pickers = { lsp_document_symbols = { diff --git a/nvim/.nvim/lua/plugin/terminal.lua b/nvim/.nvim/lua/plugin/terminal.lua index c8b03e0..b9a4ec9 100644 --- a/nvim/.nvim/lua/plugin/terminal.lua +++ b/nvim/.nvim/lua/plugin/terminal.lua @@ -85,10 +85,9 @@ map("t", "", 'lua require("plugin/terminal").toggle("termin map("n", "", 'lua require("plugin/terminal").toggle_active()') map("t", "", 'lua require("plugin/terminal").toggle_active()') map("t", "", 'lua require("plugin/terminal").close_active()') -map("t", "", 'lua require("plugin/terminal").close_active()') +-- map("t", "", 'lua require("plugin/terminal").close_active()') -- doesnt play well when opening nvim inside fterm map("t", "", "") map("t", "", "") --- map('t', '', '') -- go to normal mode map("n", "th", 'lua require("plugin/terminal").toggle("htop")') map("n", "tb", 'lua require("plugin/terminal").toggle("bpytop")') map("n", "tg", 'lua require("plugin/terminal").toggle("lazygit")') diff --git a/nvim/.nvim/lua/plugin/treesitter.lua b/nvim/.nvim/lua/plugin/treesitter.lua index f7258ea..5b691ff 100644 --- a/nvim/.nvim/lua/plugin/treesitter.lua +++ b/nvim/.nvim/lua/plugin/treesitter.lua @@ -46,6 +46,95 @@ require("nvim-treesitter.configs").setup({ matchup = { enable = true }, indent = { enable = true }, autotag = { enable = true }, + textobjects = { + select = { + enable = true, + -- Automatically jump forward to textobj, similar to targets.vim + lookahead = true, + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ap"] = "@parameter.outer", + ["ip"] = "@parameter.inner", + ["ac"] = "@class.outer", + -- You can optionally set descriptions to the mappings (used in the desc parameter of + -- nvim_buf_set_keymap) which plugins like which-key display + ["ic"] = { query = "@class.inner", desc = "Select inner part of a class region" }, + -- You can also use captures from other query groups like `locals.scm` + ["as"] = { query = "@scope", query_group = "locals", desc = "Select language scope" }, + }, + -- You can choose the select mode (default is charwise 'v') + -- + -- Can also be a function which gets passed a table with the keys + -- * query_string: eg '@function.inner' + -- * method: eg 'v' or 'o' + -- and should return the mode ('v', 'V', or '') or a table + -- mapping query_strings to modes. + selection_modes = { + ["@parameter.outer"] = "v", -- charwise + ["@function.outer"] = "V", -- linewise + ["@class.outer"] = "", -- blockwise + }, + -- If you set this to `true` (default is `false`) then any textobject is + -- extended to include preceding or succeeding whitespace. Succeeding + -- whitespace has priority in order to act similarly to eg the built-in + -- `ap`. + -- + -- Can also be a function which gets passed a table with the keys + -- * query_string: eg '@function.inner' + -- * selection_mode: eg 'v' + -- and should return true of false + include_surrounding_whitespace = true, + }, + swap = { + enable = true, + swap_next = { + ["g>"] = "@parameter.inner", + }, + swap_previous = { + ["g<"] = "@parameter.inner", + }, + }, + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + ["]m"] = "@function.outer", + ["]]"] = { query = "@class.outer", desc = "Next class start" }, + -- + -- You can use regex matching (i.e. lua pattern) and/or pass a list in a "query" key to group multiple queires. + ["]o"] = "@loop.*", + -- ["]o"] = { query = { "@loop.inner", "@loop.outer" } } + -- + -- You can pass a query group to use query from `queries//.scm file in your runtime path. + -- Below example nvim-treesitter's `locals.scm` and `folds.scm`. They also provide highlights.scm and indent.scm. + ["]s"] = { query = "@scope", query_group = "locals", desc = "Next scope" }, + ["]z"] = { query = "@fold", query_group = "folds", desc = "Next fold" }, + }, + goto_next_end = { + ["]M"] = "@function.outer", + ["]["] = "@class.outer", + }, + goto_previous_start = { + ["[m"] = "@function.outer", + ["[["] = "@class.outer", + }, + goto_previous_end = { + ["[M"] = "@function.outer", + ["[]"] = "@class.outer", + }, + -- Below will go to either the start or the end, whichever is closer. + -- Use if you want more granular movements + -- Make it even more gradual by adding multiple queries and regex. + goto_next = { + ["]d"] = "@conditional.outer", + }, + goto_previous = { + ["[d"] = "@conditional.outer", + }, + }, + }, }) -- Folding diff --git a/nvim/.nvim/lua/plugins.lua b/nvim/.nvim/lua/plugins.lua index 91255e7..2545def 100644 --- a/nvim/.nvim/lua/plugins.lua +++ b/nvim/.nvim/lua/plugins.lua @@ -121,16 +121,6 @@ packer.startup({ "psliwka/vim-dirtytalk", run = ":DirtytalkUpdate", }) - -- Debugging - use({ - "mfussenegger/nvim-dap", - config = [[require("plugin/dap/config")]], - }) - use({ - "rcarriga/nvim-dap-ui", - requires = { "mfussenegger/nvim-dap" }, - config = [[require("plugin/dap/ui")]], - }) -- Syntax hightligting use({ "nvim-treesitter/nvim-treesitter", @@ -155,11 +145,6 @@ packer.startup({ event = "BufWinEnter", config = [[require("plugin/comments")]], }) - -- Argument swapping - use({ - "machakann/vim-swap", - event = "BufWinEnter", - }) -- LSP use({ "neovim/nvim-lspconfig", @@ -242,6 +227,16 @@ packer.startup({ ft = { "css", "html", "javascript", "lua", "typescript" }, config = [[require("colorizer").setup()]], }) + -- Debugging + use({ + "mfussenegger/nvim-dap", + config = [[require("plugin/dap/config")]], + }) + use({ + "rcarriga/nvim-dap-ui", + requires = { "mfussenegger/nvim-dap" }, + config = [[require("plugin/dap/ui")]], + }) end, config = config, }) diff --git a/nvim/.nvim/lua/util.lua b/nvim/.nvim/lua/util.lua index a408ce3..b96cc76 100644 --- a/nvim/.nvim/lua/util.lua +++ b/nvim/.nvim/lua/util.lua @@ -5,7 +5,7 @@ function _M.keymap(mode, lhs, rhs, opts) if opts then options = vim.tbl_extend("force", options, opts) end - vim.api.nvim_set_keymap(mode, lhs, rhs, options) + vim.keymap.set(mode, lhs, rhs, options) end function _M.execute(cmd, raw) diff --git a/nvim/readme.md b/nvim/readme.md index 31368ce..fef0fd0 100644 --- a/nvim/readme.md +++ b/nvim/readme.md @@ -9,6 +9,9 @@ See [vim readme](../vim) to recall the basics. ## Movement +Great [post](https://www.barbarianmeetscoding.com/boost-your-coding-fu-with-vscode-and-vim/moving-blazingly-fast-with-the-core-vim-motions/) +about effective movements in vim. + | Keybinding | Action | | --------------- | ---------------------------------------------------------------------------------------- | | `h`/`j`/`k`/`l` | **move** left/down/up/right | diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index d8f4a5f..aa76972 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -88,5 +88,6 @@ run-shell ~/.tmux/deps/tmux-prefix-highlight/prefix_highlight.tmux set-option -g @logging-path "$HOME/.tmux/tmp/logging" set-option -g @screen-capture-path "$HOME/.tmux/tmp/logging" set-option -g @save-complete-history-path "$HOME/.tmux/tmp/logging" +set-option -g @logging_key "O" # instead of P run-shell "mkdir -p $HOME/.tmux/tmp/logging" run-shell ~/.tmux/deps/tmux-logging/logging.tmux diff --git a/tmux/.tmux/keybindings.conf b/tmux/.tmux/keybindings.conf index 0bbe536..c0f7f27 100644 --- a/tmux/.tmux/keybindings.conf +++ b/tmux/.tmux/keybindings.conf @@ -70,6 +70,11 @@ bind K confirm kill-session # bind c new-window -c "#{pane_current_path}" # Skip confirmation bind & kill-window +# Move window left/right +bind P swap-window -t -1\; select-window -t -1 +bind N swap-window -t +1\; select-window -t +1 +# Improved reorder +bind . command-prompt -p "Move to index:" "run-shell '~/.tmux/scripts/tmux-mv-win.sh %%'" # Panes # ===== @@ -86,7 +91,7 @@ bind -n M-Down select-pane -D # Synchronize all panes in a window bind _ setw synchronize-panes\; display "Toggle pane synchronization" # Swap panes in window -bind -n C-S-Up swap-pane -t '{up-of}' -bind -n C-S-Down swap-pane -t '{down-of}' -bind -n C-S-Left swap-pane -t '{left-of}' -bind -n C-S-Right swap-pane -t '{right-of}' +# bind -n C-S-Up swap-pane -t '{up-of}' +# bind -n C-S-Down swap-pane -t '{down-of}' +# bind -n C-S-Left swap-pane -t '{left-of}' +# bind -n C-S-Right swap-pane -t '{right-of}' diff --git a/tmux/.tmux/scripts/tmux-mv-win.sh b/tmux/.tmux/scripts/tmux-mv-win.sh new file mode 100755 index 0000000..354b1da --- /dev/null +++ b/tmux/.tmux/scripts/tmux-mv-win.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +function moveWindow() { + local index="${1:?Expected window index}" + local currentIndex="$(tmux display-message -p '#I')" + if [ -z "$currentIndex" ]; then + echo "Not a tmux session" >&2 + return 1 + fi + if tmux list-windows | grep -q "^$index:"; then + while [ "$currentIndex" -lt "$index" ]; do + tmux swap-window -t +1 + tmux select-window -t +1 + currentIndex=$((currentIndex + 1)) + done + while [ "$currentIndex" -gt "$index" ]; do + tmux swap-window -t -1 + tmux select-window -t -1 + currentIndex=$((currentIndex - 1)) + done + else + tmux move-window -t "$index" + fi +} + +moveWindow "$1" diff --git a/zsh/.zsh/lib/bindings.zsh b/zsh/.zsh/lib/bindings.zsh index 040531d..f1b60c3 100644 --- a/zsh/.zsh/lib/bindings.zsh +++ b/zsh/.zsh/lib/bindings.zsh @@ -67,7 +67,7 @@ autoload -U edit-command-line zle -N edit-command-line bindkey '\C-x\C-e' edit-command-line -# file rename magick +# file rename magic bindkey "^[m" copy-prev-shell-word # Toggle process fg/bg diff --git a/zsh/.zsh/lib/history.zsh b/zsh/.zsh/lib/history.zsh index 215a3ed..da318ad 100644 --- a/zsh/.zsh/lib/history.zsh +++ b/zsh/.zsh/lib/history.zsh @@ -16,7 +16,7 @@ setopt hist_expire_dups_first # When trimming history, lose oldest duplicates setopt hist_ignore_dups # Do not write events to history that are duplicates of previous events setopt hist_ignore_space # Remove command line from history list when first character on the line is a space setopt hist_find_no_dups # When searching history don't display results already cycled through twice -setopt hist_reduce_blanks # Remove extra blanks from each command line being added to history +# setopt hist_reduce_blanks # Remove extra blanks from each command line being added to history (removed new lines used for cmd arguments) setopt hist_verify # Don't execute, just expand history setopt inc_append_history # Add comamnds as they are typed, don't wait until shell exit diff --git a/zsh/.zsh/plugins/zsh-autosuggestions.zsh b/zsh/.zsh/plugins/zsh-autosuggestions.zsh index 21f05b9..341d129 100644 --- a/zsh/.zsh/plugins/zsh-autosuggestions.zsh +++ b/zsh/.zsh/plugins/zsh-autosuggestions.zsh @@ -12,3 +12,7 @@ if [[ $(echotc Co) -gt 8 ]];then else ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=5" fi + +# Fix autosuggestions on paste +# https://github.com/zsh-users/zsh-autosuggestions/issues/511#issuecomment-1005375484 +ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(bracketed-paste)