From c6d44a542f15245f332c7f343ae0e7a21b392455 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Thu, 16 Aug 2018 00:21:51 -0400 Subject: Rearrange kshrc, fix right prompt Including the \r in the delimeters works properly in every version of ksh I have. Awesome. Also switch to emacs editing mode because it works better and I know how to use it now. And set CDPATH with an empty item so it doesn't print the expansion all the time. --- home/.kshrc | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/home/.kshrc b/home/.kshrc index 7f2d60c8..da2cd2c6 100644 --- a/home/.kshrc +++ b/home/.kshrc @@ -1,25 +1,24 @@ -set -o nounset -o noclobber -o braceexpand -o vi +set -o nounset -o noclobber -o braceexpand -o emacs HISTFILE=~/.ksh_history HISTSIZE=5000 +GPG_TTY=$(tty) -function colon { +function colonize { IFS=: print "$*" } system_path=$PATH -PATH=$(colon {,/usr{/local,/pkg,},$HOME/.local}/{s,}bin /usr/games) +PATH=$(colonize {,/usr{/local,/pkg,},$HOME/.local}/{s,}bin /usr/games) +CDPATH=:$HOME -export PAGER=less MANPAGER=less EDITOR=vim GIT_EDITOR=vim +export PAGER=less +export EDITOR=vim if type nvim > /dev/null; then - EDITOR=nvim GIT_EDITOR=nvim MANPAGER="nvim -c 'set ft=man' -" + EDITOR=nvim alias vim=nvim + export MANPAGER="nvim -c 'set ft=man' -" fi -export GPG_TTY=$(tty) - +export GIT_EDITOR=$EDITOR export CLICOLOR=1 -if [[ $(uname) = 'Linux' ]]; then - alias ls='ls --color=auto' grep='grep --color' rm='rm -I' -fi - export NETHACKOPTIONS=' name:June, role:Valkyrie, race:Human, gender:female, align:neutral, dogname:Moro, catname: Baron, pickup_types:$!?+/=, @@ -35,19 +34,16 @@ alias gc='git commit' gca='gc --amend' gt='git tag' alias gp='git push' gu='git pull' gf='git fetch' alias gr='git rebase' gra='gr --abort' grc='gr --continue' grs='gr --skip' alias rand='openssl rand -base64 33' +if [[ $(uname) = 'Linux' ]]; then + alias ls='ls --color=auto' grep='grep --color' rm='rm -I' +fi function colors { typeset sgr0=sgr0 setaf=setaf [[ -f /usr/share/misc/termcap ]] && sgr0=me setaf=AF set -A fg \ - $(tput $sgr0) \ - $(tput $setaf 1) \ - $(tput $setaf 2) \ - $(tput $setaf 3) \ - $(tput $setaf 4) \ - $(tput $setaf 5) \ - $(tput $setaf 6) \ - $(tput $setaf 7) + $(tput $sgr0) $(tput $setaf 1) $(tput $setaf 2) $(tput $setaf 3) \ + $(tput $setaf 4) $(tput $setaf 5) $(tput $setaf 6) $(tput $setaf 7) } colors @@ -79,6 +75,7 @@ function prompt { [[ -n ${COLUMNS:-} ]] && cols=$COLUMNS || cols=$(tput cols) typeset -R $(( cols / 2 )) right typeset -R $(( cols - 1 )) right - print "\01\r\01$title\01\n\01${fg[7]}\01$right\01$fg\01\r$left" + print "\01\r\01$title\01\n\01${fg[7]}$right$fg\r\01$left" } + PS1='$(prompt)' -- cgit 1.4.1