Merge branch 'master' into riva
This commit is contained in:
		
						commit
						b0e15a2eef
					
				| 
						 | 
					@ -19,6 +19,11 @@ setopt autocd
 | 
				
			||||||
# to add other keys to this hash, see: man 5 terminfo
 | 
					# to add other keys to this hash, see: man 5 terminfo
 | 
				
			||||||
typeset -g -A key
 | 
					typeset -g -A key
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# We need this here since it's used below
 | 
				
			||||||
 | 
					if command -v fdfind &> /dev/null; then
 | 
				
			||||||
 | 
					    alias fd="fdfind"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Use vi-mode
 | 
					# Use vi-mode
 | 
				
			||||||
source ${XDG_CONFIG_HOME}/zsh/zsh-vi-mode/zsh-vi-mode.plugin.zsh
 | 
					source ${XDG_CONFIG_HOME}/zsh/zsh-vi-mode/zsh-vi-mode.plugin.zsh
 | 
				
			||||||
ZVM_VI_INSERT_ESCAPE_BINDKEY=jj
 | 
					ZVM_VI_INSERT_ESCAPE_BINDKEY=jj
 | 
				
			||||||
| 
						 | 
					@ -48,15 +53,8 @@ function cd_to() {
 | 
				
			||||||
    zle reset-prompt
 | 
					    zle reset-prompt
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function find_local_directories() {
 | 
					function find_local() {
 | 
				
			||||||
    cd_to "$(fd . -t d | fzy -l 20)"
 | 
					    fd . -t $1 | fzy -l 20
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function push_local_files() {
 | 
					 | 
				
			||||||
    emulate -L zsh
 | 
					 | 
				
			||||||
	zle -I
 | 
					 | 
				
			||||||
	LBUFFER="${LBUFFER}\"$(fd . -t f | fzy -l 20)\""
 | 
					 | 
				
			||||||
	zle reset-prompt
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function find_global() {
 | 
					function find_global() {
 | 
				
			||||||
| 
						 | 
					@ -77,34 +75,39 @@ function find_global() {
 | 
				
			||||||
        search_dirs=(~/Workspace/ ~/Containers/ /home/server/Storage/Thomas/)
 | 
					        search_dirs=(~/Workspace/ ~/Containers/ /home/server/Storage/Thomas/)
 | 
				
			||||||
        for i in "$search_dirs[@]"; do
 | 
					        for i in "$search_dirs[@]"; do
 | 
				
			||||||
            if [ -d $i ]; then
 | 
					            if [ -d $i ]; then
 | 
				
			||||||
                PATHS="$PATHS$i\n"
 | 
					                PATHS="$PATHS\n$i"
 | 
				
			||||||
                PATHS+="$(fd . $i -t $file_type -d 8)"
 | 
					                PATHS+="\n$(fd . $i -t $file_type -d 8)"
 | 
				
			||||||
            fi
 | 
					            fi
 | 
				
			||||||
        done
 | 
					        done
 | 
				
			||||||
        echo -e "$PATHS" > $FZY_CACHE
 | 
					        echo -e "$PATHS" > $FZY_CACHE
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    file="$(cat $FZY_CACHE | fzy -l 20)"
 | 
					    file="$(cat $FZY_CACHE | fzy -l 20)"
 | 
				
			||||||
 | 
					    echo $file | cat - $FZY_CACHE | awk '!x[$0]++' > /tmp/fzy_paths_$file_type && mv /tmp/fzy_paths_$file_type $FZY_CACHE
 | 
				
			||||||
    echo $file
 | 
					    echo $file
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function find_global_directories() {
 | 
					function open_path() {
 | 
				
			||||||
    cd_to "$(find_global d)"
 | 
					    file_type=$1
 | 
				
			||||||
}
 | 
					    search_fn=$2
 | 
				
			||||||
 | 
					    selection="$($search_fn $file_type)"
 | 
				
			||||||
function edit_global_files() {
 | 
					    if [ "$selection" = "" ]; then
 | 
				
			||||||
    file="$(find_global f)"
 | 
					        zle reset-prompt
 | 
				
			||||||
    if [ -z "$file" ]; then
 | 
					        return
 | 
				
			||||||
        return 0
 | 
					 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    cd_to "$(dirname $file)"
 | 
					    if [ "$LBUFFER" = "" ]; then
 | 
				
			||||||
    nvim "$file"
 | 
					        if [ "$file_type" = "d" ]; then
 | 
				
			||||||
}
 | 
					            cd_to "$selection"
 | 
				
			||||||
 | 
					        else
 | 
				
			||||||
function push_global_directories() {
 | 
					            selection=$(realpath "$selection")
 | 
				
			||||||
 | 
					            cd_to "$(dirname $selection)"
 | 
				
			||||||
 | 
					            nvim "$selection"
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
        emulate -L zsh
 | 
					        emulate -L zsh
 | 
				
			||||||
        zle -I
 | 
					        zle -I
 | 
				
			||||||
	LBUFFER="${LBUFFER}\"$(find_global d)\""
 | 
					        LBUFFER="${LBUFFER}\"$selection\""
 | 
				
			||||||
        zle reset-prompt
 | 
					        zle reset-prompt
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function zvm_after_init() {
 | 
					function zvm_after_init() {
 | 
				
			||||||
| 
						 | 
					@ -159,37 +162,24 @@ function zvm_after_init() {
 | 
				
			||||||
        source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
 | 
					        source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    zle -N find_global_directories
 | 
					    function open_global_path_d() { open_path d find_global }
 | 
				
			||||||
    zle -N push_global_directories
 | 
					    function open_global_path_f() { open_path f find_global }
 | 
				
			||||||
 | 
					    function open_local() { open_path f find_local }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    zle -N push_local_files
 | 
					    zle -N push_local_files
 | 
				
			||||||
    zle -N find_local_directories
 | 
					    zle -N find_local_directories
 | 
				
			||||||
    zle -N edit_global_files
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bindkey "^T" find_global_directories
 | 
					    function register_key() {
 | 
				
			||||||
    bindkey -M emacs "^T" find_global_directories
 | 
					        zle -N $2
 | 
				
			||||||
    bindkey -M vicmd "^T" find_global_directories
 | 
					        bindkey "^$1" $2
 | 
				
			||||||
    bindkey -M viins "^T" find_global_directories
 | 
					        bindkey -M emacs "^$1" $2
 | 
				
			||||||
 | 
					        bindkey -M vicmd "^$1" $2
 | 
				
			||||||
    bindkey "^U" push_global_directories
 | 
					        bindkey -M viins "^$1" $2
 | 
				
			||||||
    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
 | 
					 | 
				
			||||||
    bindkey -M viins "^Y" find_local_directories
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    bindkey "^E" edit_global_files
 | 
					 | 
				
			||||||
    bindkey -M emacs "^E" edit_global_files
 | 
					 | 
				
			||||||
    bindkey -M vicmd "^E" edit_global_files
 | 
					 | 
				
			||||||
    bindkey -M viins "^E" edit_global_files
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    register_key "T" open_global_path_d
 | 
				
			||||||
 | 
					    register_key "E" open_global_path_f
 | 
				
			||||||
 | 
					    register_key "W" open_local
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [ "$SSH_SESSION_ID" != "" ]; then
 | 
					    if [ "$SSH_SESSION_ID" != "" ]; then
 | 
				
			||||||
        mkdir -p /tmp/ssh_sessions
 | 
					        mkdir -p /tmp/ssh_sessions
 | 
				
			||||||
| 
						 | 
					@ -283,10 +273,6 @@ else
 | 
				
			||||||
    alias lf="cd \"\$(/usr/bin/lf -print-selection -print-last-dir)\""
 | 
					    alias lf="cd \"\$(/usr/bin/lf -print-selection -print-last-dir)\""
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if command -v fdfind &> /dev/null; then
 | 
					 | 
				
			||||||
    alias fd="fdfind"
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function o () {
 | 
					function o () {
 | 
				
			||||||
	xdg-open "$1" &!
 | 
						xdg-open "$1" &!
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -309,6 +295,7 @@ alias mallorea="run_waypipe mallorea"
 | 
				
			||||||
alias vault="run_waypipe vault"
 | 
					alias vault="run_waypipe vault"
 | 
				
			||||||
alias riva="run_waypipe riva"
 | 
					alias riva="run_waypipe riva"
 | 
				
			||||||
alias kell="run_waypipe kell"
 | 
					alias kell="run_waypipe kell"
 | 
				
			||||||
 | 
					alias aloria="run_waypipe aloria"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
alias ls="ls --color=auto"
 | 
					alias ls="ls --color=auto"
 | 
				
			||||||
alias gdb='gdb -q'
 | 
					alias gdb='gdb -q'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue