Add local edit

This commit is contained in:
Thomas Avé 2024-04-21 15:47:29 +02:00
parent 02597dde99
commit bd3fbd2566
1 changed files with 15 additions and 0 deletions

View File

@ -134,6 +134,15 @@ function zvm_after_init() {
cd_to "$(fd . -t d | fzy -l 20)"
}
function edit_local_files() {
zle -I
file=$(fd . -t f | fzy -l 20)
if [ -z "$file" ]; then
return 0
fi
nvim "$file"
}
function edit_global_files() {
zle -I
FZY_CACHE=~/.cache/fzy_file_paths
@ -168,6 +177,7 @@ function zvm_after_init() {
zle -N find_global_files
zle -N find_local_files
zle -N edit_global_files
zle -N edit_local_files
bindkey "^T" find_global_files
bindkey -M emacs "^T" find_global_files
@ -184,6 +194,11 @@ 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