diff --git a/shells/zsh/includes/keybindings.zsh b/shells/zsh/includes/keybindings.zsh index bfe19799..d6ec02c9 100644 --- a/shells/zsh/includes/keybindings.zsh +++ b/shells/zsh/includes/keybindings.zsh @@ -29,6 +29,8 @@ key[ShiftTab]="${terminfo[kcbt]}" [[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history [[ -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 # active. Only then are the values from $terminfo valid. if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then @@ -89,3 +91,33 @@ rationalise-dot() { } zle -N 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 + + + + + + diff --git a/shells/zsh/includes/urls.zsh b/shells/zsh/includes/urls.zsh new file mode 100644 index 00000000..1b2559f0 --- /dev/null +++ b/shells/zsh/includes/urls.zsh @@ -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