Directories for bashrc and vimrc

I used to have .bashrc file with around 400 lines. With ASCII boxes, it was kind of manageable, but it was rather a bunch of little snippets that lack cohesion. So I took inspiration from the various configuration directories (config.d/) of packages like apache and put each snippet into a little 10-name.sh file into ~/.config/bash/. Then in my .bashrc, I just source all those little snippets. Since the globbing gives them in alphabetical order, I can use the number to give the snippets an order.

Bash

My .bashrc now just looks like this:

for file in "$HOME/.config/bash"/*.sh
do
        source "$file"
done

There are quite some snippets in that folder:

$ ls ~/.config/bash
00-guard.sh            10-editor.sh       10-localbin.sh    10-vless.sh
10-bash_completion.sh  10-git_ps1.sh      10-prompt.sh      20-xterm_title.sh
10-color_alias.sh      10-histcontrol.sh  10-python.sh      50-fortune.sh
10-debfullname.sh      10-homebin.sh      10-scm_prompt.sh
10-dirtrim.sh          10-less.sh         10-shopt.sh

Vim

I then did the same for my .vimrc which is composed of even more snippets. All in all, I ended up with some 38 files that were all in my .vimrc before. The new .vimrc just sources all the other files:

for rcfile in split(globpath("~/.vim/rc", "*.vim"), '\n')
    execute('source '.rcfile)
endfor

Then the ~/.vim/rc/ folder contains lots of snippets:

$ ls ~/.vim/rc/
00-nocompatible.vim  10-listchars.vim            10-SCCompile.vim
10-abbrev.vim        10-markdown.vim             10-scrolloff.vim
10-astyle.vim        10-mathmode.vim             10-sort.vim
10-boxes.vim         10-modeline.vim             10-syntax.vim
10-colorcolumn.vim   10-more_colors.vim          10-tabwidth.vim
10-colorscheme.vim   10-nerdtree.vim             10-utf8.vim
10-filetype.vim      10-nomousehide.vim          10-windows_size.vim
10-fold.vim          10-number.vim               10-wrap.vim
10-hidden.vim        10-pathogen.vim             10-Y.vim
10-jk.vim            10-rainbow_parentheses.vim  20-trailing_space.vim
10-line_wrap.vim     10-ruler.vim

Compilation into single file

For faster startup times, I now compile all those files into a single .bashrc with this:

_build/.bashrc: $(wildcard bashrc/*.sh)
    echo '# Generated from ~/Branches/dotfiles/. Do not edit manually.' > $@
    echo "# $$(date --rfc-3339=seconds)" >> $@
    echo >> $@
    grep -hvP '^(\s*#|$$)' $^ >> $@

With that, I have to compile the configuration files after I edit something. However, the first start of Bash or Vim will not load some 30 files, which takes a few seconds.