From 734d3f7529e17ac07ccd1a05890e938c8c150659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20B=C3=BCscher?= Date: Sat, 7 Dec 2024 13:33:58 +0100 Subject: [PATCH] Move lines nvim, rebind finding open buffers etc. --- .../lazyvim/lua/config/autocmds.lua | 8 +++++ .../dot_config/lazyvim/lua/config/keymaps.lua | 13 ++++++++ .../lazyvim/lua/plugins/telescope.lua | 10 ++++++ home/dot_config/tmux/tmux.conf | 33 ++++++++++++++----- home/dot_zshrc | 17 ++++++++++ 5 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 home/dot_config/lazyvim/lua/plugins/telescope.lua diff --git a/home/dot_config/lazyvim/lua/config/autocmds.lua b/home/dot_config/lazyvim/lua/config/autocmds.lua index 27e9e06..3bf5ab0 100644 --- a/home/dot_config/lazyvim/lua/config/autocmds.lua +++ b/home/dot_config/lazyvim/lua/config/autocmds.lua @@ -1,3 +1,11 @@ -- Autocmds are automatically loaded on the VeryLazy event -- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua -- Add any additional autocmds here + +-- Disable New Line Comment +vim.api.nvim_create_autocmd("BufEnter", { + callback = function() + vim.opt.formatoptions:remove({ "c", "r", "o" }) + end, + desc = "Disable New Line Comment", +}) diff --git a/home/dot_config/lazyvim/lua/config/keymaps.lua b/home/dot_config/lazyvim/lua/config/keymaps.lua index 2c134f7..5491480 100644 --- a/home/dot_config/lazyvim/lua/config/keymaps.lua +++ b/home/dot_config/lazyvim/lua/config/keymaps.lua @@ -1,3 +1,16 @@ -- Keymaps are automatically loaded on the VeryLazy event -- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua -- Add any additional keymaps here + +-- Unset LazyVim keybindings +-- buffers +vim.keymap.del("n", "bb") +vim.keymap.del("n", "`") + +-- Move lines +vim.keymap.set("n", "", "m .+1==", { desc = "Move Down" }) +vim.keymap.set("n", "", "m .-2==", { desc = "Move Up" }) +vim.keymap.set("i", "", "m .+1==gi", { desc = "Move Down" }) +vim.keymap.set("i", "", "m .-2==gi", { desc = "Move Up" }) +vim.keymap.set("v", "", ":m '>+1gv=gv", { desc = "Move Down" }) +vim.keymap.set("v", "", ":m '<-2gv=gv", { desc = "Move Up" }) diff --git a/home/dot_config/lazyvim/lua/plugins/telescope.lua b/home/dot_config/lazyvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..69e2d8a --- /dev/null +++ b/home/dot_config/lazyvim/lua/plugins/telescope.lua @@ -0,0 +1,10 @@ +return { + "nvim-telescope/telescope.nvim", + keys = { + -- disable the keymap to grep files + { ",", false }, + -- change a keymap + { "bb", "Telescope buffers sort_mru=true sort_lastused=true", desc = "Switch Buffer" }, + -- add a keymap to browse plugin files + }, +} diff --git a/home/dot_config/tmux/tmux.conf b/home/dot_config/tmux/tmux.conf index 4ad4984..b7d1faf 100644 --- a/home/dot_config/tmux/tmux.conf +++ b/home/dot_config/tmux/tmux.conf @@ -4,7 +4,7 @@ set -g mouse on # Set prefix key unbind C-b set -g prefix C-space -bind C-Space send-prefix +bind-key C-Space send-prefix # Next and prev window navigation bind-key -n C-M-n next-window @@ -16,18 +16,21 @@ set -g pane-base-index 1 set-window-option -g pane-base-index 1 set-option -g renumber-windows on +bind-key x kill-pane # skip "kill-pane 1? (y/n)" prompt +set -g detach-on-destroy off # don't exit from tmux when closing a session + # Split panes -bind | split-window -h -c "#{pane_current_path}" -bind - split-window -v -c "#{pane_current_path}" +bind-key | split-window -h -c "#{pane_current_path}" +bind-key - split-window -v -c "#{pane_current_path}" # Better resizing -bind-key -n C-M-j resize-pane -D 5 -bind-key -n C-M-k resize-pane -U 5 -bind-key -n C-M-h resize-pane -L 5 -bind-key -n C-M-l resize-pane -R 5 +bind-key C-j resize-pane -D 5 +bind-key C-k resize-pane -U 5 +bind-key C-h resize-pane -L 5 +bind-key C-l resize-pane -R 5 # Clear with Ctrl-l -bind C-l send-keys 'C-l' +bind-key C-l send-keys 'C-l' # Copy mode set-window-option -g mode-keys vi @@ -54,6 +57,20 @@ set -g @sessionx-filter-current 'false' set -g @sessionx-bind-select-up 'alt-n' set -g @sessionx-bind-select-down 'alt-p' +# for sesh +bind-key "k" run-shell "sesh connect \"$( + sesh list --icons | fzf-tmux -p 55%,60% \ + --no-sort --ansi --border-label ' sesh ' --prompt '⚡ ' \ + --header ' ^a all ^t tmux ^g configs ^x zoxide ^d tmux kill ^f find' \ + --bind 'tab:down,btab:up' \ + --bind 'ctrl-a:change-prompt(⚡ )+reload(sesh list --icons)' \ + --bind 'ctrl-t:change-prompt(🪟 )+reload(sesh list -t --icons)' \ + --bind 'ctrl-g:change-prompt(⚙️ )+reload(sesh list -c --icons)' \ + --bind 'ctrl-x:change-prompt(📁 )+reload(sesh list -z --icons)' \ + --bind 'ctrl-f:change-prompt(🔎 )+reload(fd -H -d 2 -t d -E .Trash . ~)' \ + --bind 'ctrl-d:execute(tmux kill-session -t {2..})+change-prompt(⚡ )+reload(sesh list --icons)' \ +)\"" + set-environment -g PATH "/opt/homebrew/bin:/usr/local/bin:/bin:/usr/bin" run '~/.config/tmux/plugins/tpm/tpm' diff --git a/home/dot_zshrc b/home/dot_zshrc index 09a712e..458dfb7 100644 --- a/home/dot_zshrc +++ b/home/dot_zshrc @@ -62,6 +62,23 @@ preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt. autoload edit-command-line; zle -N edit-command-line bindkey '^e' edit-command-line # CTRL-E to edit cli prompt in NVIM +# sesh keybinding +function sesh-sessions() { + { + exec /dev/null 2>&1 || true + [[ -z "$session" ]] && return + sesh connect $session + } +} +zle -N sesh-sessions +bindkey -M emacs '^k' sesh-sessions +bindkey -M vicmd '^k' sesh-sessions +bindkey -M viins '^k' sesh-sessions + # load modules source "$HOME/.config/shell/aliases.sh" source "$HOME/.config/shell/exports.sh"