Dup Goto 📝

StuffFile

PT2/linux/setup-notes 02-14 21:39:01
To Pop
54 lines, 182 words, 1000 chars Wednesday 2024-02-14 21:39:01

I organise my bashrc into a number of small 'stuff' files. This isn't the most efficient thing (prompt takes 0.5-1s to appear), but it is better than one massive flat .bashrc. It also allows .stuff files to be optional, and loaded via .s conda for exmaple.

So in my bashrc I have

# I have all my stuff stored under $JDA
.stuff() { 
  if [ $# = 0 ]; then
    ( cd "$JDA"/stuff; ls *.stuff | cut -f1 -d.; )
  else
    for s; do 
      [ -e "$JDA"/stuff/"$s".stuff ] && . "$JDA"/stuff/"$s".stuff; 
    done; 
  fi
}
alias .s=.stuff
.s cmds
.s dircolors
.s completion
.s cd
.s cdh
.s zoxide
.s mpd
.s hist
.s mvdesc
.s cygwin
.s git
.s ssh
.s antlr
.s python
.s x11
.s shopt
.s perl
.s stuff
.s aliases
.s dot_commands
.s clip
.s cargo
.s nvm
.s go
.s tmux
.s vim
.s my_stuff
. my_prompt
complete -c viw catw batw lessw

# This checks all dirs in the PATH exist, and removes duplicates
NEWPATH="$("$JDA"/bin/tidypath "$PATH")"
[ -n "$NEWPATH" ] && PATH="$NEWPATH"

.if "$HOME/.bash_aliases"