diff --git a/CHANGELOG.md b/CHANGELOG.md index 04d6e0d..ab1e709 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ All notable changes to this project will be documented in this file. - Basics: [Folding?](README.md#folding) - Commands: [:redir](README.md#redir) - Tips: [Saner command-line history](README.md#saner-command-line-history) +- Tips: [Reload a file on saving](README.md#reload-a-file-on-saving) - Usage: [Editing remote files](README.md#editing-remote-files) - Usage: [Restore cursor position when opening file](README.md#restore-cursor-position-when-opening-file) - Usage: [MatchIt](README.md#matchit) diff --git a/README.md b/README.md index b46aac5..373e6ec 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ added every day. Things about to be added can be found here: - [Quickly change font size in GUI](#quickly-change-font-size-in-gui) - [Change cursor style in insert mode](#change-cursor-style-in-insert-mode) - [Don't lose selection when shifting sidewards](#dont-lose-selection-when-shifting-sidewards) +- [Reload a file on saving](#reload-a-file-on-saving) #### [Commands](#commands-1) @@ -1192,6 +1193,17 @@ Now you can use `>>>>>` on your visual selection without any problems. **NOTE**: The same can be achieved using `.`, which repeats the last change. +#### Reload a file on saving + +Using [autocmds](#autocmds) you can do anything on saving a file, e.g. sourcing +it in case of a dotfile or running a linter to check for syntactical errors in +your source code. + +```viml +autocmd BufWritePost $MYVIMRC source $MYVIMRC +autocmd BufWritePost ~/.Xdefaults call system('xrdb ~/.Xdefaults') +``` + ## Commands Useful commands that are good to know.