Tuesday, 18 November 2014

Edit bashrc, vimrc, tmux.conf and zshrc from vim

I have found that I am playing a lot with vim, tmux, zsh and bash, and I needed a fast way to edit this files as well as source them (reload them). So I added the following lines to vimrc:

let mapleader = " "
nmap ev :e $MYVIMRC             " edit vimrc
nmap sv :so $MYVIMRC           " source vimrc
nmap eb :e ~/.bashrc               " edit bashrc
nmap sb :! source ~/.bashrc   " source bashrc
nmap ez :e ~/.zshrc                  " edit zshrc
nmap et :e ~/.tmux.conf          " edit tmux
nmap st :!tmux source-file ~/.tmux.conf  " source tmux


Leader key is but it can be configured to any key. So, for example, to edit tmux config file I press et. To source it, I press st. Simple as that. I save a lot of time when fiddling and testing new ideas in these configuration files.

No comments:

Post a Comment