diff options
| author | Mitch Riedstra <mitch@riedstra.us> | 2018-02-11 17:37:04 -0500 |
|---|---|---|
| committer | Mitch Riedstra <mitch@riedstra.us> | 2018-02-11 17:37:04 -0500 |
| commit | 6d105ee1d9f2737493cdb4c5d1317d066a5a5304 (patch) | |
| tree | f0125df24d29039f0bd3fa26840b03731b9990c4 /mkshrc | |
| parent | 4a208e375dd99a32fd7947c6a11bfefa06f75ea4 (diff) | |
| parent | 2b12e822f32fd4320600cb999138a16fe3c93d8e (diff) | |
| download | dotfiles-6d105ee1d9f2737493cdb4c5d1317d066a5a5304.tar.gz dotfiles-6d105ee1d9f2737493cdb4c5d1317d066a5a5304.tar.xz | |
Merge branch 'master' of git.riedstra.us:/mitch/dotfiles
Diffstat (limited to 'mkshrc')
| -rw-r--r-- | mkshrc | 44 |
1 files changed, 24 insertions, 20 deletions
@@ -8,6 +8,10 @@ # # Personally I use this with mksh, .mkshrc is auto loaded by mksh +# Nifty little line that will force the script to return if it's not runnking KSH +# Automatically uncommented if installed system-wide with "install_mkshrc_system" +# [ -z "$KSH_VERSION" ] && return + # This will hopefully fix the bullshit with zsh if \ [ $SHELL = "/bin/zsh" ] || \ @@ -38,12 +42,12 @@ precmd() { (( e )) && print -n "$e|" } set_ps1() { - PS1='$(precmd)${BG}${ACCENT_C}${ACCENT_P}${USER_C}${USER:=$(id -un)}@$(hostname -s)${ACCENT_C}${ACCENT_P} ${ACCENT_P}${PATH_C}${PWD:-?}${ACCENT_C}${ACCENT_P}${END_C} + PS1='$(precmd)${BG}${ACCENT_C}${ACCENT_P}${USER_C}${USER:=$(id -un)}@$(hostname)${ACCENT_C}${ACCENT_P} ${ACCENT_P}${PATH_C}${PWD:-?}${ACCENT_C}${ACCENT_P}${END_C} ${END_P} [0m' export PS1; } set_root_ps1() { -PS1='$(precmd)${BG}${ACCENT_C}${ACCENT_P}${HOST_C}$(hostname -s)${ACCENT_C}${ACCENT_P} ${ACCENT_P}${PATH_C}${PWD:-?}${ACCENT_C}${ACCENT_P}${END_C} +PS1='$(precmd)${BG}${ACCENT_C}${ACCENT_P}${HOST_C}$(hostname)${ACCENT_C}${ACCENT_P} ${ACCENT_P}${PATH_C}${PWD:-?}${ACCENT_C}${ACCENT_P}${END_C} ${END_P} [0m' export PS1; } @@ -52,7 +56,7 @@ set_prompt() { if [ `id -u` -eq 0 ] ; then # Previously # Red for root, and no username - # PS1="[1;31m[1;40m$(hostname -s)[1;33m \$PWD + # PS1="[1;31m[1;40m$(hostname)[1;33m \$PWD BG="[1;40m" ACCENT_C="[0;31m" ACCENT_P="|" @@ -63,7 +67,7 @@ set_prompt() { set_root_ps1 else # Previously - # PS1="[1;32m[1;40m${USER:=$(id -un)}@$(hostname -s)[1;33m \$PWD + # PS1="[1;32m[1;40m${USER:=$(id -un)}@$(hostname)[1;33m \$PWD BG="[1;40m" ACCENT_C="[1;34m" ACCENT_P="|" @@ -75,7 +79,7 @@ set_prompt() { fi } set_basic_prompt() { - PS1="$(precmd)${USER:=$(id -un)}@$(hostname -s) \$PWD $ " + PS1="$(precmd)${USER:=$(id -un)}@$(hostname) \$PWD $ " export PS1; } set_super_basic_prompt() { @@ -103,17 +107,15 @@ fi #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% setaliases() { alias ls="ls -F"; - alias l="ls -lh"; - alias ll="ls -l"; + alias l="ls -lhF"; + alias ll="ls -lhF"; alias g="grep"; alias m="$PAGER"; alias j="jobs"; alias p="pwd"; alias gdb='gdb -q' alias bc='bc -q' - alias egrep='egrep --color=auto' alias eg='egrep' - alias egf='egrep --color=force' alias search='egrep -rniI' } @@ -127,7 +129,8 @@ setcoloraliases() { fi alias grep="grep --color=auto"; - alias diff='colordiff'; + alias egrep='egrep --color=auto' + alias diff="$(which diff colordiff 2>/dev/null | tail -n 1)"; alias search='egrep --color=auto -rnI'; alias t='tree -CdL' } @@ -135,16 +138,20 @@ setcoloraliases() { setsudoaliases() { if which sudo > /dev/null 2>&1 && [ -x "$(which sudo)" ] ; then # Package managers + # Isn't it amazing how many distros you end up using? alias apt-get='sudo apt-get' alias yum='sudo dnf' alias dnf='sudo dnf' alias pacman='sudo pacman' + alias xbps-install='sudo xbps-install' + alias xbps-remove='sudo xbps-remove' alias pkg='sudo pkg' # Filesystem utilities alias zfs='sudo zfs' alias btrfs='sudo btrfs' alias mount='sudo mount' + alias umount='sudo umount' fi } @@ -543,13 +550,10 @@ colormanpages() { #|_| |_|_|___/\___| |_| \__,_|_| |_|\___|\__|_|\___/|_| |_|___/ #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% set_editor() { - export EDITOR="vi" + # export EDITOR="vi" - if [ -x "$(which nvim)" ] ; then - export EDITOR="$(which nvim)" - elif [ -x "$(which vim)" ] ; then - export EDITOR="$(which vim)" - fi + export EDITOR="$(which ed mg nano vi vim nvim 2>/dev/null | tail -n1)" + export VISUAL="$EDITOR" # Set an alias for our editor of choice alias vi="$EDITOR" @@ -589,11 +593,12 @@ export LANG="$1"; NEWLINE='$(printf "\n")' SHELL_CONFIG=".mkshrc" -PRELOAD="$HOME/${SHELL_CONFIG}.pre" -LOCAL="$HOME/${SHELL_CONFIG}.local" -UPDATE_URL="https://www.rygel.us/etc/" FANCY_PROMPT=1 COLOR=1 +UPDATE_URL="https://www.rygel.us/etc/" + +PRELOAD="$HOME/${SHELL_CONFIG}.pre" +LOCAL="$HOME/${SHELL_CONFIG}.local" # For use with SSL functions # Just use easy-rsa, it's less hassle @@ -607,7 +612,6 @@ COLOR=1 set_pager set_editor export PATH="$HOME/bin:$PATH" -export VISUAL="$EDITOR" export GOPATH=$HOME/go export PATH=$PATH:$GOPATH/bin |
