Update editor, fzf, git and tmux global aliases
This commit is contained in:
parent
1e36b0a2f8
commit
968e39fb03
33
aliases
33
aliases
|
@ -14,6 +14,13 @@ if [[ "$OSTYPE" == linux* ]]; then
|
||||||
DL=~/dl
|
DL=~/dl
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Editors
|
||||||
|
is-callable 'nvim' && alias vim=nvim
|
||||||
|
if is-callable 'emacs'; then
|
||||||
|
alias emacs='emacs -nw'
|
||||||
|
ediff() { e --eval "(ediff-files \"$1\" \"$2\")"; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
## Fast folder navigation ####################################################
|
## Fast folder navigation ####################################################
|
||||||
|
|
||||||
|
@ -39,9 +46,9 @@ if is-callable 'fasd' && is-callable 'fzf'; then
|
||||||
local t
|
local t
|
||||||
t=$(fasd -lf "$*" |\
|
t=$(fasd -lf "$*" |\
|
||||||
fzf --tac +s -m -1 -e --query="$*") && \
|
fzf --tac +s -m -1 -e --query="$*") && \
|
||||||
$EDITOR "${t[@]}"
|
${EDITOR[@]} ${FLAGS:-} "${t[@]}"
|
||||||
else
|
else
|
||||||
$EDITOR $*
|
$EDITOR ${FLAGS:-} $*
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,20 +57,20 @@ if is-callable 'fasd' && is-callable 'fzf'; then
|
||||||
(($#>0)) && local args="-f$*"
|
(($#>0)) && local args="-f$*"
|
||||||
local dir
|
local dir
|
||||||
dir=$({
|
dir=$({
|
||||||
local _path="$PWD"
|
local _path=$PWD
|
||||||
while [[ -n "$_path" && "$_path" != "/" ]]; do
|
while [[ -n "$_path" && "$_path" != "/" ]]; do
|
||||||
_path="${_path%/*}"
|
_path=$(dirname "$_path")
|
||||||
echo $_path
|
echo "$_path"
|
||||||
done
|
done
|
||||||
} | fzf +s -e -0 -1 $args --query="$*") && cd "$dir"
|
} | fzf +s -e $args --query="$*" | tail -1) && cd "$dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Emacs version of v
|
# Emacs version of v
|
||||||
e() {
|
e() {
|
||||||
if pgrep Emacs 2>&1 >/dev/null; then
|
if pgrep Emacs 2>&1 >/dev/null; then
|
||||||
EDITOR='emacsclient -n' v $@
|
EDITOR=emacsclient FLAGS=-n v $@
|
||||||
else
|
else
|
||||||
EDITOR='/Applications/Emacs.app/Contents/MacOS/Emacs' v $@ &
|
EDITOR=/Applications/Emacs.app/Contents/MacOS/Emacs v $@ &
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -71,11 +78,6 @@ else
|
||||||
alias e='emacs'
|
alias e='emacs'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Editors
|
|
||||||
is-callable 'emacs' && alias emacs='emacs -nw'
|
|
||||||
is-callable 'nvim' && alias vim=nvim
|
|
||||||
ediff() { e --eval "(ediff-files \"$1\" \"$2\")"; }
|
|
||||||
|
|
||||||
|
|
||||||
## Redefined tools ###########################################################
|
## Redefined tools ###########################################################
|
||||||
# Always enable colored `grep` output
|
# Always enable colored `grep` output
|
||||||
|
@ -221,8 +223,9 @@ alias gbr='git browse'
|
||||||
alias gi='git init'
|
alias gi='git init'
|
||||||
alias gs='git status'
|
alias gs='git status'
|
||||||
alias gsu='git submodule'
|
alias gsu='git submodule'
|
||||||
alias gsq='git squash'
|
alias gsq='git rebase -i origin/master'
|
||||||
alias gco='git checkout'
|
alias gco='git checkout'
|
||||||
|
alias gcoo='git checkout --'
|
||||||
alias gc='git commit'
|
alias gc='git commit'
|
||||||
alias gcm='noglob git commit -m'
|
alias gcm='noglob git commit -m'
|
||||||
alias gcma='noglob git commit --amend -m'
|
alias gcma='noglob git commit --amend -m'
|
||||||
|
@ -260,6 +263,8 @@ if is-callable 'tmux'; then
|
||||||
alias tf='tmux find-window'
|
alias tf='tmux find-window'
|
||||||
# Detach all other clients to this session
|
# Detach all other clients to this session
|
||||||
alias mine='tmux detach -a'
|
alias mine='tmux detach -a'
|
||||||
|
# Send command to other tmux window
|
||||||
|
tt() { tmux send-keys -t .+ C-u && tmux set-buffer "$*" && tmux paste-buffer -t .+ && tmux send-keys -t .+ Enter; }
|
||||||
# Create new session (from inside one)
|
# Create new session (from inside one)
|
||||||
tn() {
|
tn() {
|
||||||
local name="${1:-`basename $PWD`}"
|
local name="${1:-`basename $PWD`}"
|
||||||
|
|
Loading…
Reference in a new issue