shell: fix some aliases, 80c PS1 length

This commit is contained in:
2024-06-02 14:42:51 +02:00
parent 5015a08ab9
commit 450af8d7f7
3 changed files with 9 additions and 1 deletions

View File

@@ -6,8 +6,8 @@
[alias] [alias]
a = add a = add
aa = add . aa = add .
b = branch
bl = blame bl = blame
br = branch
c = commit -v c = commit -v
ca = commit -v --amend ca = commit -v --amend
cm = commit -v -m cm = commit -v -m

View File

@@ -34,6 +34,11 @@ NEWLINE=$'\n'
PROMPT_COMMAND=__prompt_command PROMPT_COMMAND=__prompt_command
__prompt_command() { __prompt_command() {
local EXIT="$?" local EXIT="$?"
if [ $COLUMNS -lt 80 ]; then
export PROMPT_DIRTRIM=1
else
export PROMPT_DIRTRIM=0
fi
export PS1="${HOST} ${DIR} ${GIT_NIX}${NEWLINE}" export PS1="${HOST} ${DIR} ${GIT_NIX}${NEWLINE}"
if [[ $(uname) == "OpenBSD" ]]; then if [[ $(uname) == "OpenBSD" ]]; then

View File

@@ -15,6 +15,8 @@ alias gbl='git show $(git ls-files | fzf -e --reverse --bind "enter:become(git b
alias gg=': | fzf --reverse --bind "change:reload(git grep {q})" --bind "enter:become($EDITOR {1} +{2})" --delimiter :' alias gg=': | fzf --reverse --bind "change:reload(git grep {q})" --bind "enter:become($EDITOR {1} +{2})" --delimiter :'
### Abbreviations ### Abbreviations
alias d='docker'
alias dc='docker compose'
alias dcr='dc down && dc up -d && dc logs -f' alias dcr='dc down && dc up -d && dc logs -f'
alias dh1='du . -h -d1' alias dh1='du . -h -d1'
alias dhs='du . -hs' alias dhs='du . -hs'
@@ -24,6 +26,7 @@ alias l='eza --icons --hyperlink'
alias nd="nix develop ." alias nd="nix develop ."
alias nssh='SSH_AUTH_SOCK= ssh' alias nssh='SSH_AUTH_SOCK= ssh'
alias s='kitten ssh' alias s='kitten ssh'
alias r='. ranger'
alias o='xdg-open' # to change a mime use: `xdg-mime default APPLICATION HANDLE` alias o='xdg-open' # to change a mime use: `xdg-mime default APPLICATION HANDLE`
t() { t() {
tmux new-session -A -s ${1:-dev} tmux new-session -A -s ${1:-dev}