Skip to content

Commit

Permalink
add example for g:localvimrc_sourced_once and g:localvimrc_sourced_on…
Browse files Browse the repository at this point in the history
…ce_for_file
  • Loading branch information
embear committed Feb 6, 2014
1 parent a74ad8c commit 24f8d8e
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion doc/localvimrc.txt
Expand Up @@ -49,7 +49,24 @@ a local vimrc in the root directory of a project modify the behavior of

NOTE: This is only possible if you disable sandbox mode.

Other variables provide a way to prevent multiple execution of commands.
Other variables provide a way to prevent multiple execution of commands. They
can be used to implement guards:

" do stuff you want to do on every buffer enter event

" guard to end loading if it has been loaded for the currently edited file
if g:localvimrc_sourced_once_for_file
finish
endif

" do stuff you want to do only once for a edited file

" guard to end loading if it has been loaded for the running vim instance
if g:localvimrc_sourced_once
finish
endif

" do stuff you want to do only once for a running vim instance

------------------------------------------------------------------------------
*g:localvimrc_file*
Expand Down

0 comments on commit 24f8d8e

Please sign in to comment.