Skip to content

Commit

Permalink
Move lines nvim, rebind finding open buffers etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-bue committed Dec 7, 2024
1 parent 1c467f1 commit 734d3f7
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 8 deletions.
8 changes: 8 additions & 0 deletions home/dot_config/lazyvim/lua/config/autocmds.lua
Original file line number Diff line number Diff line change
@@ -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",
})
13 changes: 13 additions & 0 deletions home/dot_config/lazyvim/lua/config/keymaps.lua
Original file line number Diff line number Diff line change
@@ -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", "<leader>bb")
vim.keymap.del("n", "<leader>`")

-- Move lines
vim.keymap.set("n", "<C-A-j>", "<cmd>m .+1<cr>==", { desc = "Move Down" })
vim.keymap.set("n", "<C-A-k>", "<cmd>m .-2<cr>==", { desc = "Move Up" })
vim.keymap.set("i", "<C-A-j>", "<esc><cmd>m .+1<cr>==gi", { desc = "Move Down" })
vim.keymap.set("i", "<C-A-k>", "<esc><cmd>m .-2<cr>==gi", { desc = "Move Up" })
vim.keymap.set("v", "<C-A-j>", ":m '>+1<cr>gv=gv", { desc = "Move Down" })
vim.keymap.set("v", "<C-A-k>", ":m '<-2<cr>gv=gv", { desc = "Move Up" })
10 changes: 10 additions & 0 deletions home/dot_config/lazyvim/lua/plugins/telescope.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
return {
"nvim-telescope/telescope.nvim",
keys = {
-- disable the keymap to grep files
{ "<leader>,", false },
-- change a keymap
{ "<leader>bb", "<cmd>Telescope buffers sort_mru=true sort_lastused=true<cr>", desc = "Switch Buffer" },
-- add a keymap to browse plugin files
},
}
33 changes: 25 additions & 8 deletions home/dot_config/tmux/tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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'
17 changes: 17 additions & 0 deletions home/dot_zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -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/tty
exec <&1
local session
session=$(sesh list -t -c | fzf --height 40% --reverse --border-label ' sesh ' --border --prompt '⚡ ')
zle reset-prompt > /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"
Expand Down

0 comments on commit 734d3f7

Please sign in to comment.