pacdiffvim is a pacnew/pacorig/pacsave file updater for vim enthusiasts. The shell script locates all .pacnew, .pacorig, .pacsave files and opens a tab for each diff in Vim. Furthermore the script defines a special Vim function to deal with the diff.
###Audience Users of Linux distributions which uses pacman as the systems package manager (e.g. Arch Linux)
###Dependencies
- Bash 4.x
- Vim 7.x
###Installation You can put pacdiffvim to your $PATH and make the script executable or you can simply copy-paste the following code:
wget https://raw.github.com/jens-na/pacdiffvim/master/pacdiffvim -O /usr/local/bin/pacdiffvim; \
chmod +x /usr/local/bin/pacdiffvim
AUR Package: https://aur.archlinux.org/packages/pacdiffvim-git/
###Command line options If you start pacdiffvim without any parameters, the script tries to locate all pacnew/pacorig/pacsave files with find in the directory /etc and starts vim with the found diff candidates. If there is nothing to do the script will exit with return code 0.
- -r, --root - You can update your configuration files in another directory if you specify an alternative root path with -r or --root. The default directory is /etc.
- -V, --version - Shows the version and copyright info for pacdiffvim.
- -h, --help - Shows the help for the script and exits.
Environment variables
If $VIMPROG is specified, the script uses this value to start vim. The default value is
vim. For example if you like to use gvim to compare the files you can set VIMPROG
to gvim.
Example:
# VIMPROG=gvim pacdiffvim
###Runtime pacdiffvim starts Vim with the special Vim command :OK to deal with the pacnew/pacorig/pacsave diff.
- :OK - if you have finished the diff between the pacnew/pacorig/pacsave file and the configuration file
you should invoke this command. This function specifically does:
- saves the configuration file
- tries to delete the .pacnew/.pacsave/.pacorig file
- opens your next diff (if any)
You can navigate between the diffs with standard Vim functions :tabn (next tab) or :tabp (previous tab)
Remove the .pacnew file (ignore):
:OK (diff finished)
Overwrite your configuration file with the latest .pacnew file:
:%diffput (standard vim command)
:OK (diff finished)
Skip and go to the next diff:
:tabn (next tab - standard vim command)
Licensed under the GNU General Public License 3.
(C) Jens Nazarenus, 2013