Files
the_information_nexus/tech_docs/keybindings.md
2024-05-28 21:51:47 -06:00

126 lines
3.9 KiB
Markdown

ertainly! Let's fine-tune the keybindings and ensure they are properly organized and logical for an efficient workflow. Here's a complete guide that covers the keybindings, along with the necessary configuration files and instructions on where to configure them.
# Keybindings Guide for tmux, Vim, and Readline
This guide provides a set of keybindings that work seamlessly across tmux, Vim, and Readline, ensuring a consistent and efficient workflow.
## tmux Keybindings
### Prefix Key
- `Ctrl+b`: tmux prefix key (default)
-
- ### Pane Navigation
- - `Prefix + h/j/k/l`: Navigate between tmux panes (vim-like)
- - `Prefix + H/J/K/L`: Resize tmux panes
-
- ### Window Management
- - `Prefix + c`: Create a new tmux window
- - `Prefix + n/p`: Switch to the next/previous tmux window
- - `Prefix + w`: List and select tmux windows
-
- ### Session Management
- - `Prefix + s`: List and select tmux sessions
- - `Prefix + d`: Detach from the current tmux session
-
- ### Miscellaneous
- - `Prefix + r`: Reload the tmux configuration file
- - `Prefix + :`: Enter the tmux command prompt
-
- To configure these tmux keybindings, update your `~/.tmux.conf` file with the following:
-
- ```tmux
- # Set the prefix key to Ctrl+b
- set -g prefix C-b
- unbind C-a
- bind C-b send-prefix
-
- # Pane navigation
- bind h select-pane -L
- bind j select-pane -D
- bind k select-pane -U
- bind l select-pane -R
-
- # Pane resizing
- bind H resize-pane -L 5
- bind J resize-pane -D 5
- bind K resize-pane -U 5
- bind L resize-pane -R 5
-
- # Window management
- bind c new-window
- bind n next-window
- bind p previous-window
- bind w choose-window
-
- # Session management
- bind s choose-session
- bind d detach-client
-
- # Reload configuration
- bind r source-file ~/.tmux.conf
- ```
-
- ## Vim Keybindings
-
- ### Navigation
- - `h/j/k/l`: Move the cursor left/down/up/right
- - `Ctrl+f/b`: Scroll forward/backward by a page
-
- ### Editing
- - `i`: Enter insert mode and start editing
- - `Esc`: Exit insert mode and return to normal mode
- - `v`: Enter visual mode for text selection
- - `y`: Yank (copy)
- - `p`: Paste
-
- ### Window Management
- - `Ctrl+w + h/j/k/l`: Navigate between Vim windows
- - `Ctrl+w + +/-`: Resize Vim windows
-
- To configure these Vim keybindings, update your `~/.vimrc` file with the following:
-
- ```vim
- " Navigation
- noremap <C-f> <C-d>
- noremap <C-b> <C-u>
-
- " Window management
- nnoremap <C-w>h <C-w>h
- nnoremap <C-w>j <C-w>j
- nnoremap <C-w>k <C-w>k
- nnoremap <C-w>l <C-w>l
- nnoremap <C-w>+ <C-w>+
- nnoremap <C-w>- <C-w>-
- ```
-
- ## Readline Keybindings
-
- - `Ctrl+a`: Move the cursor to the beginning of the line
- - `Ctrl+e`: Move the cursor to the end of the line
- - `Alt+b/f`: Move the cursor backward/forward by a word
- - `Ctrl+w`: Delete the previous word
- - `Ctrl+u`: Delete from the cursor to the beginning of the line
- - `Ctrl+k`: Delete from the cursor to the end of the line
-
- To configure these Readline keybindings, update your `~/.inputrc` file (or `~/.bashrc` if `~/.inputrc` doesn't exist) with the following:
-
- ```bash
- # Readline keybindings
- "\C-a": beginning-of-line
- "\C-e": end-of-line
- "\eb": backward-word
- "\ef": forward-word
- "\C-w": backward-kill-word
- "\C-u": backward-kill-line
- "\C-k": kill-line
- ```
-
- After updating the configuration files, make sure to reload them:
- - For tmux: `tmux source-file ~/.tmux.conf`
- - For Vim: Restart Vim or use `:source ~/.vimrc` within Vim
- - For Readline: Start a new terminal session or use `source ~/.inputrc` (or `source ~/.bashrc`)
-
- These keybindings provide a cohesive and efficient workflow across tmux, Vim, and Readline. They leverage familiar navigation and editing patterns while minimizing conflicts between the tools.
-
- Feel free to customize and adapt these keybindings based on your preferences and specific needs. The key is to maintain consistency and minimize friction when switching between tmux, Vim, and the command line.