Tips: reload your file on saving

This commit is contained in:
Marco Hinz 2016-01-18 12:36:25 +01:00
parent 58fd7a7691
commit bc67c92407
2 changed files with 13 additions and 0 deletions

View File

@ -17,6 +17,7 @@ All notable changes to this project will be documented in this file.
- Basics: [Folding?](README.md#folding) - Basics: [Folding?](README.md#folding)
- Commands: [:redir](README.md#redir) - Commands: [:redir](README.md#redir)
- Tips: [Saner command-line history](README.md#saner-command-line-history) - 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: [Editing remote files](README.md#editing-remote-files)
- Usage: [Restore cursor position when opening file](README.md#restore-cursor-position-when-opening-file) - Usage: [Restore cursor position when opening file](README.md#restore-cursor-position-when-opening-file)
- Usage: [MatchIt](README.md#matchit) - Usage: [MatchIt](README.md#matchit)

View File

@ -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) - [Quickly change font size in GUI](#quickly-change-font-size-in-gui)
- [Change cursor style in insert mode](#change-cursor-style-in-insert-mode) - [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) - [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) #### [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. **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 ## Commands
Useful commands that are good to know. Useful commands that are good to know.