Configuration files

Last updated 2020-02-29

I often use console programs and I have accumulated quite some configuration files which might be useful to others. They are commented and therefore quite useful to newcomers as well. The major features of the configuration files are listed in each section.

Available files (anchors on this page): Vim, Zsh, GNU readline, Git, tig, GNU screen, Tmux, xmonad, Elinks, OpenSSH, GnuPG, lftp. Other useful programs.


If you have any suggestions/improvements/fixes/questions please tell me at simon@ruderich.org.

Also available as Git repository with additional configuration files for shell and X11 related programs and tasks (also browsable as Gitweb).

git clone https://ruderich.org/simon/config/dotfiles.git
  • Vim, one of the best text editors: vimrc (updated 2020-02-29)

    • jk (jj is too slow to type) as <Esc> to exit insert and command mode

    • all cursors keys disabled ;-) (Ctrl-N/Ctrl-P in command mode as replacement and Ctrl-F of course)

    • :set hidden for efficient handling of multiple buffers (called tabs in other editors; Vim’s tabs are used for different window layouts, not multiple buffers)

    • go to last position when reopening a file

    • UTF-8 as default encoding, ISO-Latin automatically detected

    • auto correction of :W to :w (and similar mistakes)

    • highlighting of TODO, FIXME, CHANGED, XXX, NOTE, etc.

    • highlight unicode whitespace

    • highlight lines longer than 78 characters

    • disable spell checking while diffing (vimdiff)

    • custom statusline similar to default one, with the following additions:

      • current buffer number

      • highest buffer number if there’s more than one buffer

      • modified %f which always uses the shortest path, either relative or absolute (including \~) if it’s shorter

      • warnings for unexpected 'fileformat', 'fileencoding' and 'bomb' values

      • hex value of character under cursor

    • gb/gB as shortcut for :bnext/:bprevious (like gt/gT for tabs), display a message when visiting the first buffer a second time

    • * and # for visual mode (matches case)

    • Y yanks to the end of the line for consistency with C, D, etc.

    • 'ignorecase' (and 'smartcase') while searching, but honor case when completing in insert-mode (<C-N>, <C-P>) and * and #

    • highlight search matches, <C-L> to clear the highlights

    • automatically disable paste after leaving insert mode

    • write current file when suspending (Ctrl-Z) or all files when running :make

    • add undo breakpoints for insert mode commands which change a lot: <C-U>, <C-@>, <C-A>, <C-W>.

    • 'nostartofline' only for <C-F>, <C-B>, <C-D>, <C-U>

    • hidden vertical split separator (still uses one column though)

    • use 'list' to display tabs, trailing whitespace, etc.

    • 'wildignore' updated to include generated files (e.g. .o, .pyc, etc.) when completing files with <Tab> (also ignore case)

    • display a warning when editing template files (containing "do not edit" and similar, ignoring case) to prevent lost changes (when it’s regenerated)

    • compatibility with older Vim versions (>= 6.4)

    • useful plugins:

      • CtrlP: powerful fuzzy finder for files, buffers, etc.

      • fswitch: switch between header (e.g. .h) and implementation (e.g. c) files

      • matchit: extend matching with % for multiple languages, e.g. if elif endif in Python

      • NERDCommenter: comment/uncomment lines quickly, supports many languages

      • repeat: support . (repeat the last command) with plugin mappings, used by e.g. surround

      • surround: quickly modify pairs of "surroundings", e.g. ds" removes the quotes from a string, cs"' changes a double-quoted string to a single-quoted one

      • XPTemplate: powerful snippet engine

  • Zsh, one of the best shells: zshrc (updated 2020-02-29)

    • set terminal title to running program (working in xterm, rxvt, screen - window title here), works with fg (uses the correct program name)

    • vi bindings, including vi-like Ctrl-N/Ctrl-P history completion, jk to exit insert mode.

    • incremental search mode with Ctrl-R (like in bash); with glob support, e.g. Ctrl-R iptables*host to list iptables commands for host

    • colored multi-line prompt including vcs_info (including number of git stashes), different prompt color when running as root

    • colored stderr (not working perfectly, for a better solution see coloredstderr which is automatically used if available)

    • global aliases for less (L), grep (G), sort (S), etc.; example usage: program G test S L instead of program | grep test | sort | less

    • very short aliases (e.g. g = git, m = make, s = mpc, v = vim, mu = mutt, etc.)

    • don’t complete unimportant files for vim (like .log, .aux - useful when using LaTeX); provide Ctrl-F as fallback to complete all files

    • well documented completion settings

    • tab on empty input line lists all files in the current directory

    • automatically run rehash when a command wasn’t found, fixes tab completion when installing new programs

    • automatically add visited directories to directory stack

    • automatically reattach to running GNU screen or Tmux (configurable) session or open a new one

    • display running time of long-running processes and send bell to the terminal so GNU screen/Tmux can mark the window as active; useful to quickly spot when a program is done

    • restart zsh (exec zsh) when ~/.zshrc was modified; restart is skipped if there are active background jobs or if the new config fails to load

    • Automatically re-run ~/.zsh/env.update on changes; useful to update e.g. SSH_AGENT_PID in multiple running zsh shells

    • compatibility with older Zsh versions

  • GNU readline, command-line editing library with history support, used by bash and many other programs: inputrc (updated 2015-06-14)

    • A single <Tab> lists all available matches.

    • List all available matches and use a pager in case they don’t fit on the current screen.

    • Use Vi editing-mode, jk exits insert mode.

    • <Ctrl-P>/<Ctrl-N> work like <Up>/<Down> but list only history lines starting with the current input line. Very useful to recall old commands quickly.

    • Support <Ctrl-L> to redraw screen in Vi mode.

  • Git, one of the best DVCS: gitconfig (updated 2020-02-29)

    • very short aliases (e.g. ap = add -p, c = commit -v, d = diff, dc = diff --cached, dcw = diff --cached --color-words, s = status, ss = stash save, sa = stash apply, etc.)

    • alias to describe a commit, to be used in commit messages; for example: 37ad33e ("vcs: gitconfig: fix typos in comment", 2018-12-29)

    • aliases to push/fetch many remotes in parallel for increased speed (rp, ru), needs xargs

    • alias to list all untracked files and their contents

    • improved wordregex for IMHO better --color-words diffs

    • display diff in commit message file (commit --verbose)

    • show moved changes in diff in a separate color

    • custom colors for diffs

    • use pager for some commands (branch, status, tag)

    • allow diffing of gzip, PDFs and SQLite files using .gitattributes

    • don’t require <Enter> for interactive commands which require only a single key, for example git add --patch

  • tig, a gitk like viewer for the console: tigrc (updated 2020-02-29)

    • gitk-like colors

    • map J/K to move in the log window while looking at a diff

    • disable mappings which modify the repository, use tig as read-only viewer

    • ignore case when searching

    • don’t write ~/.tig_history

  • GNU Screen, terminal multiplexer: screenrc (updated 2020-02-29)

    • readable hardstatus and caption settings ;-)

    • display window flags in the hardstatus

    • fast switching to windows 10 to 19 (Ctrl-A ; 0 to Ctrl-A ; 9), same for windows 20-29 with Ctrl-A ;;

    • large scrollback buffer

    • support for urlview to open URLs quickly

    • disable unused keybindings

    • additional digraphs

  • Tmux, an improved rewrite of GNU screen: tmux.conf (updated 2014-01-06)

    • GNU Screen-like setup (Ctrl-A as escape and Ctrl-* for many mappings)

    • fast switching to windows 10 to 19 (Ctrl-A ; 0 to Ctrl-A ; 9), same for windows 20-29 with Ctrl-A ;; - mappings created by a small script (Tmux doesn’t support mappings with multiple keys by default yet)

    • large scrollback buffer

    • support for urlview to open URLs quickly

  • xmonad, powerful tiling window manager: xmonad.hs (updated 2011-06-19)

    • horizontal split workspace

    • switch to vertical split/horizontal split with only one window at the bottom with bindings - meta-space skips these layouts

    • special layout for Gimp

    • some programs are spawned on specific workspaces

    • new windows are not opened in the master pane (thus not stealing focus)

    • when using multiple screens switching to visible workspaces doesn’t move them to the current screen, but switches to the workspace on the other screen

    • works with xmonad 0.9 and newer versions (most settings should work with 0.7)

  • Elinks, powerful console based browser: elinks.conf (updated 2011-03-15)

    • vi-like bindings

    • URI rewriting rules for fast browsing, e.g. "s string" to search for string, "w name" to look up name in wikipedia, "d word" to translate word etc.

    • Session support

  • OpenSSH, encrypted connections to remote computers: .ssh/config /etc/ssh/sshd_config (updated 2020-02-29)

    • Protocol 2 only (for security reasons)

    • share multiple sessions over a single connection (ControlMaster), enabled automatically

    • disable unused authentication methods, only enable passwords and public keys

    • disable weak hashes, ciphers, exchanges and hostkeys

  • GnuPG, OpenPGP implementation to encrypt and sign data: .gnupg/gpg.conf (updated 2020-02-29)

    • long keyids to reduce risk of collisions

    • stronger preferences (cipher, digest and compression) when signing/encrypting mails (if the recipient supports them), SHA512 preferred, SHA1 and MD5 disabled

    • stronger preferences as defaults when creating new keys

    • improved key stretching for private keys

  • lftp, powerful FTP client: lftprc (updated 2013-04-07)

    • colored prompt and directory listings

    • sync alias which syncs a local directory with one on a server

    • encrypt all connections when using TLS

Other useful console programs include:

  • Mutt, powerful mail user agent (MUA)

  • t-prot, display filter for MUAs

  • Irssi, very powerful IRC client; supports Vi(m) modes using the vim_mode.pl script (documentation at the beginning of the file, additional documentation)
    Other useful scripts for irssi include:

  • rss2email, RSS to mail converter, very useful in combination with mutt to read RSS feeds

  • htop, top improvement for Linux

  • MPD, Music Player Daemon, a server to play audio files

  • cdparanoia, audio extraction tool for sampling CDs

  • lltag, command-line ogg/flac/mp3 file tagger and renamer

  • bc, arbitrary precision calculator supporting different input and output bases

Last updated 2020-02-29

Impressum Datenschutzerklärung