diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index de0aa82..967e337 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -52,12 +52,11 @@ function find_local_directories() { cd_to "$(fd . -t d | fzy -l 20)" } -function edit_local_files() { - file=$(fd . -t f | fzy -l 20) - if [ -z "$file" ]; then - return 0 - fi - nvim "$file" +function push_local_files() { + emulate -L zsh + zle -I + LBUFFER="${LBUFFER}\"$(fd . -t f | fzy -l 20)\"" + zle reset-prompt } function find_global() { @@ -101,6 +100,13 @@ function edit_global_files() { nvim "$file" } +function push_global_directories() { + emulate -L zsh + zle -I + LBUFFER="${LBUFFER}\"$(find_global d)\"" + zle reset-prompt +} + function zvm_after_init() { key[Home]="${terminfo[khome]}" key[End]="${terminfo[kend]}" @@ -154,15 +160,26 @@ function zvm_after_init() { fi zle -N find_global_directories + zle -N push_global_directories + zle -N push_local_files zle -N find_local_directories zle -N edit_global_files - zle -N edit_local_files bindkey "^T" find_global_directories bindkey -M emacs "^T" find_global_directories bindkey -M vicmd "^T" find_global_directories bindkey -M viins "^T" find_global_directories + bindkey "^U" push_global_directories + bindkey -M emacs "^U" push_global_directories + bindkey -M vicmd "^U" push_global_directories + bindkey -M viins "^U" push_global_directories + + bindkey "^W" push_local_files + bindkey -M emacs "^W" push_local_files + bindkey -M vicmd "^W" push_local_files + bindkey -M viins "^W" push_local_files + bindkey "^Y" find_local_directories bindkey -M emacs "^Y" find_local_directories bindkey -M vicmd "^Y" find_local_directories @@ -173,11 +190,6 @@ function zvm_after_init() { bindkey -M vicmd "^E" edit_global_files bindkey -M viins "^E" edit_global_files - bindkey "^W" edit_global_files - bindkey -M emacs "^W" edit_local_files - bindkey -M vicmd "^W" edit_local_files - bindkey -M viins "^W" edit_local_files - if [ "$SSH_SESSION_ID" != "" ]; then mkdir -p /tmp/ssh_sessions