feat(zsh): add ssh-menu and run shmft
This commit is contained in:
		@@ -1,9 +1,8 @@
 | 
			
		||||
alias s="ssh"
 | 
			
		||||
alias z="exec zsh"
 | 
			
		||||
alias t="tmux a || tmux new-session -s $(whoami) -c ~"
 | 
			
		||||
alias n=nvim_ve
 | 
			
		||||
# alias vim=nvim_ve
 | 
			
		||||
alias ssh-hosts="grep -P \"^Host ([^*]+)$\" $HOME/.ssh/config | sed 's/Host //'"
 | 
			
		||||
alias s="ssh-menu"
 | 
			
		||||
 | 
			
		||||
# navigation
 | 
			
		||||
alias cdgit="cd $GGROOT"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,5 @@
 | 
			
		||||
 | 
			
		||||
function nvim_ve {
 | 
			
		||||
  if [[ -e "$VIRTUAL_ENV" && -f "$VIRTUAL_ENV/bin/activate" ]]; then
 | 
			
		||||
    if [[ -e $VIRTUAL_ENV && -f "$VIRTUAL_ENV/bin/activate" ]]; then
 | 
			
		||||
        source "$VIRTUAL_ENV/bin/activate"
 | 
			
		||||
        command nvim $@
 | 
			
		||||
        deactivate
 | 
			
		||||
@@ -35,11 +34,10 @@ function afm {
 | 
			
		||||
        VER=$(echo "$RES" | jq '.[] | select(.name | contains("'"$2"'")).version')
 | 
			
		||||
        # OP=$(echo "$RES" | jq '.[] | select(.name | contains("'"$2"'")).requirement?[0][0]')
 | 
			
		||||
        # echo "$2""$(echo "$OP" | tr -d '"')""$(echo "$VER" | tr -d '"')"
 | 
			
		||||
    echo "$2""==""$(echo "$VER" | tr -d '"')"
 | 
			
		||||
        echo "${2}==$(echo "$VER" | tr -d '"')"
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
function nukepip {
 | 
			
		||||
    pip uninstall $(pip freeze) -y
 | 
			
		||||
    pip install -r $(pyenv root)/default-packages
 | 
			
		||||
@@ -89,7 +87,6 @@ function dps {
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
function get_dump {
 | 
			
		||||
    if [[ -z $1 ]]; then
 | 
			
		||||
        echo "provide ssh host"
 | 
			
		||||
@@ -112,7 +109,8 @@ function get_dump {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function ggcompile {
 | 
			
		||||
  find -L $GGROOT -mindepth 1 -maxdepth 5 -type d -name .git  -prune | xargs -n 1 dirname > "$GGROOT/compiled"
 | 
			
		||||
    find -L "$GGROOT" -mindepth 1 -maxdepth 5 -type d -name .git -prune \
 | 
			
		||||
        -exec dirname {} \; >"$GGROOT/compiled"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function tssh {
 | 
			
		||||
@@ -123,3 +121,18 @@ function tssh {
 | 
			
		||||
 | 
			
		||||
    ssh -t "$@" "command -v tmux && (tmux a || tmux new-session -s gorazd -c ~) || bash"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function ssh-menu {
 | 
			
		||||
    selected=$(
 | 
			
		||||
        grep 'Host .*' ~/.ssh/config \
 | 
			
		||||
            | grep -v '*' \
 | 
			
		||||
            | sed 's/Host \(.*\)/\1/' \
 | 
			
		||||
            | fzf --cycle --bind 'tab:toggle-up,btab:toggle-down'
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    if [[ -z $selected ]]; then
 | 
			
		||||
        return
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    ssh "$selected"
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user