shells: some cleanup for bash and zsh
This commit is contained in:
parent
ebf583cb5a
commit
e898af0e0d
4 changed files with 8 additions and 43 deletions
10
dot_bashrc
10
dot_bashrc
|
@ -1,4 +1,4 @@
|
||||||
# shellcheck shell=bash disable=SC1090
|
# shellcheck shell=bash disable=SC1090,SC2164
|
||||||
[[ $- != *i* ]] && return
|
[[ $- != *i* ]] && return
|
||||||
|
|
||||||
HISTSIZE=1000
|
HISTSIZE=1000
|
||||||
|
@ -14,9 +14,6 @@ export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
|
||||||
|
|
||||||
PS1='\[\e[0m\][ \u@\h \[\e[34m\]\w\[\e[0m\] ]\n\$ '
|
PS1='\[\e[0m\][ \u@\h \[\e[34m\]\w\[\e[0m\] ]\n\$ '
|
||||||
|
|
||||||
beep() { printf "\007"; }
|
|
||||||
fixterm() { printf "\u001bc"; }
|
|
||||||
|
|
||||||
diff() { command diff --color "$@"; }
|
diff() { command diff --color "$@"; }
|
||||||
tailf() { command less +F "$@"; }
|
tailf() { command less +F "$@"; }
|
||||||
rgrep() { command grep --exclude-dir=\.git -R "$@"; }
|
rgrep() { command grep --exclude-dir=\.git -R "$@"; }
|
||||||
|
@ -34,7 +31,7 @@ gci() { command git commit "$@"; }
|
||||||
gsl() { command git stash list "$@"; }
|
gsl() { command git stash list "$@"; }
|
||||||
gss() { command git status -sbu "$@"; }
|
gss() { command git status -sbu "$@"; }
|
||||||
gup() { command git pull "$@"; }
|
gup() { command git pull "$@"; }
|
||||||
groot() { cd "$(command git rev-parse --show-cdup)" || return 1; }
|
groot() { cd "$(command git rev-parse --show-cdup)"; }
|
||||||
ggrep() { command git grep "$@"; }
|
ggrep() { command git grep "$@"; }
|
||||||
gsi() { command tig status; }
|
gsi() { command tig status; }
|
||||||
|
|
||||||
|
@ -42,9 +39,6 @@ gsi() { command tig status; }
|
||||||
tmux() { command tmux -2 "$@"; }
|
tmux() { command tmux -2 "$@"; }
|
||||||
atmux() { tmux attach; }
|
atmux() { tmux attach; }
|
||||||
|
|
||||||
# sudo
|
|
||||||
sush() { command sudo -Es; }
|
|
||||||
|
|
||||||
# bash-completion
|
# bash-completion
|
||||||
completion_path='/usr/share/bash-completion/bash_completion'
|
completion_path='/usr/share/bash-completion/bash_completion'
|
||||||
[[ -r "$completion_path" ]] && source "$completion_path"
|
[[ -r "$completion_path" ]] && source "$completion_path"
|
||||||
|
|
|
@ -1,22 +1,6 @@
|
||||||
# Fuck default aliases
|
# Fuck default aliases
|
||||||
unalias -a
|
unalias -a
|
||||||
|
|
||||||
function termcompat {
|
|
||||||
typeset term=$TERM
|
|
||||||
case $term in
|
|
||||||
(alacritty*) ;&
|
|
||||||
(kitty*) ;&
|
|
||||||
(wezterm) ;&
|
|
||||||
(xterm-*)
|
|
||||||
term=xterm;;
|
|
||||||
(rxvt-unicode*)
|
|
||||||
term=rxvt-unicode;;
|
|
||||||
(tmux*)
|
|
||||||
term=screen.xterm-new;;
|
|
||||||
esac
|
|
||||||
TERM=$term command $@
|
|
||||||
}
|
|
||||||
|
|
||||||
function addpath {
|
function addpath {
|
||||||
typeset newpath=$1
|
typeset newpath=$1
|
||||||
if [[ ! $PATH =~ $newpath ]]; then
|
if [[ ! $PATH =~ $newpath ]]; then
|
||||||
|
@ -25,22 +9,13 @@ function addpath {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function fsf {
|
function testbin { whence $@ > /dev/null }
|
||||||
typeset host prompt="SSH Remote > "
|
|
||||||
host=$(cut -d\ -f1 $HOME/.ssh/known_hosts | sort -u | fzf --prompt=$prompt) || return 1
|
|
||||||
|
|
||||||
termcompat ssh $host $@
|
|
||||||
}
|
|
||||||
|
|
||||||
function beep { printf $'\007' }
|
|
||||||
function fixterm { printf $'\u001bc' }
|
|
||||||
|
|
||||||
function cm { command chezmoi $@ }
|
function cm { command chezmoi $@ }
|
||||||
function diff { command diff --color $@ }
|
function diff { command diff --color $@ }
|
||||||
function tailf { command less +F $@ }
|
function tailf { command less +F $@ }
|
||||||
function grep { command grep --color=auto $@ }
|
function grep { command grep --color=auto $@ }
|
||||||
function rgrep { grep --exclude-dir=.git -R $@ }
|
function rgrep { grep --exclude-dir=.git -R $@ }
|
||||||
function s { termcompat ssh $@ }
|
|
||||||
function zj { command zellij $@ }
|
function zj { command zellij $@ }
|
||||||
|
|
||||||
function tmux { command tmux -2 $@ }
|
function tmux { command tmux -2 $@ }
|
||||||
|
|
|
@ -7,10 +7,11 @@ SAVEHIST=10000
|
||||||
HISTSIZE=10000
|
HISTSIZE=10000
|
||||||
HISTFILE=$HOME/.histfile.$UID
|
HISTFILE=$HOME/.histfile.$UID
|
||||||
|
|
||||||
EDITOR=vim
|
for editor in hx nvim vim vi; do
|
||||||
whence hx >/dev/null && EDITOR=hx
|
testbin $editor && break
|
||||||
|
done
|
||||||
|
|
||||||
export EDITOR
|
export EDITOR=$editor
|
||||||
export LESS='i M R'
|
export LESS='i M R'
|
||||||
export PAGER=less
|
export PAGER=less
|
||||||
export TIME_STYLE=long-iso
|
export TIME_STYLE=long-iso
|
||||||
|
@ -42,8 +43,6 @@ zstyle ':completion:*:kill:*:processes' command 'ps --forest -A -o pid,user,cmd'
|
||||||
zstyle ':completion:*:processes-names' command 'ps axho command'
|
zstyle ':completion:*:processes-names' command 'ps axho command'
|
||||||
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
|
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
|
||||||
|
|
||||||
unalias ld ls ll &>/dev/null
|
|
||||||
|
|
||||||
if testbin mise; then
|
if testbin mise; then
|
||||||
eval "$(mise activate zsh)"
|
eval "$(mise activate zsh)"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
[[ $- != *i* ]] && return
|
[[ $- != *i* ]] && return
|
||||||
|
|
||||||
function testbin { whence $@ > /dev/null }
|
|
||||||
|
|
||||||
confdir=$HOME/.config/zsh
|
confdir=$HOME/.config/zsh
|
||||||
conflist=(
|
conflist=(
|
||||||
env.zsh
|
functions.zsh
|
||||||
settings.zsh
|
settings.zsh
|
||||||
prompt.zsh
|
prompt.zsh
|
||||||
functions.zsh
|
|
||||||
local.zsh
|
local.zsh
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue