-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeybindings.zsh
More file actions
56 lines (45 loc) · 1.45 KB
/
keybindings.zsh
File metadata and controls
56 lines (45 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env zsh
# Key bindings configuration
# Use emacs key bindings (default)
bindkey -e
# Navigation
bindkey '^A' beginning-of-line
bindkey '^E' end-of-line
bindkey '^[[1;5C' forward-word # Ctrl+Right
bindkey '^[[1;5D' backward-word # Ctrl+Left
bindkey '^[[H' beginning-of-line # Home
bindkey '^[[F' end-of-line # End
# History search
bindkey '^R' history-incremental-search-backward
bindkey '^S' history-incremental-search-forward
bindkey '^P' history-search-backward
bindkey '^N' history-search-forward
bindkey '^[[A' up-line-or-history # Up arrow
bindkey '^[[B' down-line-or-history # Down arrow
# Editing
bindkey '^K' kill-line
bindkey '^U' backward-kill-line
bindkey '^W' backward-kill-word
bindkey '^[[3~' delete-char # Delete
bindkey '^?' backward-delete-char # Backspace
# Completion
bindkey '^I' complete-word # Tab
bindkey '^[[Z' reverse-menu-complete # Shift+Tab
# Undo/Redo
bindkey '^Z' undo
bindkey '^Y' redo
# Accept autosuggestion (if using zsh-autosuggestions)
bindkey '^Space' autosuggest-accept
bindkey '^[[1;2C' autosuggest-accept # Shift+Right
# Clear screen
bindkey '^L' clear-screen
# Edit command line in editor
autoload -U edit-command-line
zle -N edit-command-line
bindkey '^X^E' edit-command-line
# Make search up and down work with arrow keys
bindkey '^[[A' up-line-or-search
bindkey '^[[B' down-line-or-search
# Better word movement (treating paths as single words)
autoload -U select-word-style
select-word-style bash