This is my attempt at literate GNU/Linux configuration files. To achieve this, I am using org-mode and babel for emacs. I am also using stow to keep everything in a single, version controlled, directory.
I am currently using:
wm (main) | StumpWM |
wm (alt) | qtile |
shell | ZSH |
editor | Emacs |
All configuration is done in .org
files containing code snippets. These code snippets can be copied to a specified path using babels tangle
.
For example, if you wanted to create your StumpWM configuration file and store it in ~/dotfiles/stumpwm/.stumpwm.d/init.lisp
, you would use:
#+BEGIN_SRC lisp :tangle ~/dotfiles/stumpwm/.stumpwm.d/init.lisp
;; Insert code snippet here...
#+END_SRC
You can edit the code in the SRC
block by pressing <C-c '>
This opens the snippet in a new buffer in the languages native mode. Press <C-c '>
again to save the changes or <C-c k>
to cancel the changes. I also have it configured to use evil’s :x
to save the changes or :q
to cancel the changes.
Once you are happy with the changes, press C-c C-v t
to tangle
all the snippets and create init.lisp
inside of ~/dotfiles/stumpwm/.stumpwm.d/
.
To organize my dotfiles, I am using this approach. The ~/dotfiles
directory contains a subdirectory for each applications’ configuration files.
For example, the ~/dotfiles/stumpwm/.stumpwm.d/
directory holds all of the StumpWM configuration files. Once all the files are created, use:
stow stumpwm
to create a symlink, ~/.stumpwm.d
, pointing to ~/dotfiles/stumpwm/.stumpwm.d/
You only need run stow
initially, or if any other new files are added. Once the symlink is created, you can open the file within the home directory and it will use the symlinked file within ~/dotfiles
.