-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.zsh_zle
65 lines (52 loc) · 1.74 KB
/
.zsh_zle
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
57
58
59
60
61
62
63
64
#Use vim keybindings
bindkey -v
source $HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
#Custom prompt for line-editing
function zle-line-init zle-keymap-select {
PS1TMP="${${KEYMAP/vicmd/${PS1_CMD}}/(main|viins)/${PS1_INS}}"
PS1=$PS1TMP
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
unsetopt flowcontrol
# Run heatseeker in the current working directory, appending the selected path, if
# any, to the current command, followed by a space.
function insert-selecta-path-in-command-line() {
local selected_path
# Print a newline or we'll clobber the old prompt.
echo
# Find the path; abort if the user doesn't select anything.
selected_path=$(find * -maxdepth 4 -type d 2>/dev/null | hs) || return
# Append the selection to the current command buffer.
eval 'LBUFFER="$LBUFFER$selected_path "'
# Redraw the prompt since Heatseeker has drawn several new lines of text.
zle reset-prompt
}
function go-back() {
cd ..
zle reset-prompt
}
zle -N go-back
bindkey '^@' go-back
bindkey -a '^@' go-back
# Create the zle widget
zle -N insert-selecta-path-in-command-line
# Bind the key to the newly created widget
bindkey "^[[Z" "insert-selecta-path-in-command-line"
#Ctrl+left/right is back !
bindkey ';5D' backward-word
bindkey ';5C' forward-word
bindkey '^H' backward-delete-char
bindkey '^A' beginning-of-line
bindkey '^E' end-of-line
bindkey -v '^R' history-incremental-search-backward
bindkey -v '\b' backward-delete-char
bindkey -v '^?' backward-delete-char
bindkey -v "^[[3~" delete-char
bindkey -v "jj" vi-cmd-mode
bindkey -a 'gg' beginning-of-buffer-or-history
bindkey -a G end-of-buffer-or-history
bindkey -a u undo
bindkey -a '^R' redo
bindkey -a '\ ' vi-history-search-backward