Commits

Markus Braun committed 9ff6783

add example for g:localvimrc_sourced_once and g:localvimrc_sourced_once_for_file

Comments (0)

Files changed (1)

doc/localvimrc.txt

 
 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*