Adds alt+m zle shortcut to create the directory for the current arg
This commit is contained in:
parent
35cffff6f9
commit
72f8fa04cd
2 changed files with 39 additions and 0 deletions
|
@ -29,6 +29,8 @@ key[ShiftTab]="${terminfo[kcbt]}"
|
||||||
[[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history
|
[[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history
|
||||||
[[ -n "${key[ShiftTab]}" ]] && bindkey -- "${key[ShiftTab]}" reverse-menu-complete
|
[[ -n "${key[ShiftTab]}" ]] && bindkey -- "${key[ShiftTab]}" reverse-menu-complete
|
||||||
|
|
||||||
|
bindkey -M viins "^q" push-input
|
||||||
|
|
||||||
# Finally, make sure the terminal is in application mode, when zle is
|
# Finally, make sure the terminal is in application mode, when zle is
|
||||||
# active. Only then are the values from $terminfo valid.
|
# active. Only then are the values from $terminfo valid.
|
||||||
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
|
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
|
||||||
|
@ -89,3 +91,33 @@ rationalise-dot() {
|
||||||
}
|
}
|
||||||
zle -N rationalise-dot
|
zle -N rationalise-dot
|
||||||
bindkey . rationalise-dot
|
bindkey . rationalise-dot
|
||||||
|
|
||||||
|
make_current_word_directory(){
|
||||||
|
tokens=(${(z)LBUFFER})
|
||||||
|
local folder="${tokens[-1]}" output
|
||||||
|
if [ "${folder[1]}" = '"' ] || [ "${folder[1]}" = "'" ]; then
|
||||||
|
folder=${folder:1}
|
||||||
|
else
|
||||||
|
folder="${folder//\\ / }"
|
||||||
|
fi
|
||||||
|
#folder="${folder%/*}"
|
||||||
|
if [ -e "$folder" ]; then
|
||||||
|
zle -M "$folder already exists"
|
||||||
|
else
|
||||||
|
output="$(mkdir -p "$folder" 2>&1)"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
zle -M "$folder created"
|
||||||
|
else
|
||||||
|
zle -M "$output"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
zle -N make_current_word_directory
|
||||||
|
# Alt + m
|
||||||
|
bindkey '\em' make_current_word_directory
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
7
shells/zsh/includes/urls.zsh
Normal file
7
shells/zsh/includes/urls.zsh
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# This makes zsh automatically escape certain characters when typing a url
|
||||||
|
autoload -Uz url-quote-magic
|
||||||
|
zle -N self-insert url-quote-magic
|
||||||
|
|
||||||
|
# This does the same for pasting a url
|
||||||
|
autoload -Uz bracketed-paste-magic
|
||||||
|
zle -N bracketed-paste bracketed-paste-magic
|
Loading…
Add table
Add a link
Reference in a new issue