1 *localvimrc.txt* For Vim version 7.3 Last change: 2012 September 25
3 localvimrc Version 2.1.0 *localvimrc* *lvimrc*
5 |localvimrc-description| Description
6 |localvimrc-commands| Commands
7 |localvimrc-settings| Settings
8 |localvimrc-contribute| Contribute
9 |localvimrc-credits| Credits
10 |localvimrc-changelog| Changelog
12 ==============================================================================
13 DESCRIPTION *localvimrc-description*
15 This plugin searches for local vimrc files in the file system tree of the
16 currently opened file. By default it searches for all ".lvimrc" files from the
17 file's directory up to the root directory and loads them in reverse order. The
18 filename and amount of loaded files are customizable through global variables.
20 For security reasons it the plugin asks for confirmation before loading a
21 local vimrc file and loads it using |:sandbox| command. The plugin asks once
22 per session and local vimrc before loading it, if the file didn't change since
25 It is possible to define a whitelist and a blacklist of local vimrc files that
26 are loaded or ignored unconditionally.
29 ==============================================================================
30 COMMANDS *localvimrc-commands*
32 ------------------------------------------------------------------------------
35 Clear all stored decisions made in the past, when the plugin asked about
36 sourcing a local vimrc file.
38 ==============================================================================
39 SETTINGS *localvimrc-settings*
42 let g:option_name=option_value
44 to set them in your global vimrc.
46 ------------------------------------------------------------------------------
49 Filename of local vimrc files.
53 ------------------------------------------------------------------------------
56 On the way from root, the last localvimrc_count files are sourced.
60 ------------------------------------------------------------------------------
61 *g:localvimrc_sandbox*
63 Source the found local vimrc files in a sandbox for security reasons.
66 0 Don't load vimrc file in a sandbox.
67 1 Load vimrc file in a sandbox.
71 ------------------------------------------------------------------------------
74 Ask before sourcing any local vimrc file. In a vim session the question is
75 only asked once as long as the local vimrc file has not been changed.
78 0 Don't ask before loading a vimrc file.
79 1 Ask before loading a vimrc file.
83 ------------------------------------------------------------------------------
84 *g:localvimrc_persistent*
86 Make the decisions given when asked before sourcing local vimrc files
87 persistent over multiple vim runs. This is done by storing the decisions in
88 viminfo. Therefore it is required to include the |viminfo-!| flag in your
92 0 Don't store and restore any decisions.
93 1 Store and restore decisions only if the answer was given in upper
95 2 Store and restore all decisions.
99 ------------------------------------------------------------------------------
100 *g:localvimrc_whitelist*
102 If a local vimrc file matches the regular expression given by
103 |g:localvimrc_whitelist| this file is loaded unconditionally.
105 Files matching |g:localvimrc_whitelist| are sourced even if they are matched
106 by |g:localvimrc_blacklist|.
108 See |regular-expression| for patterns that are accepted.
112 " whitelist all local vimrc files in users project foo and bar
113 let g:localvimrc_whitelist='/home/user/projects/\(foo\|bar\)/.*'
115 Default: No whitelist
117 ------------------------------------------------------------------------------
118 *g:localvimrc_blacklist*
120 If a local vimrc file matches the regular expression given by
121 |g:localvimrc_blacklist| this file is skipped unconditionally.
123 Files matching |g:localvimrc_whitelist| are sourced even if they are matched
124 by |g:localvimrc_blacklist|.
126 See |regular-expression| for patterns that are accepted.
130 " blacklist all local vimrc files in shared project directory
131 let g:localvimrc_whitelist='/share/projects/.*'
133 Default: No blacklist
135 ------------------------------------------------------------------------------
138 Debug level for this script.
142 ==============================================================================
143 CONTRIBUTE *localvimrc-contribute*
145 To contact the author (Markus Braun), please email: markus.braun@krawel.de
147 If you think this plugin could be improved, fork on GitHub and send a pull
148 request or just tell me your ideas.
150 GitHub: https://github.com/embear/vim-localvimrc
152 ==============================================================================
153 CREDITS *localvimrc-credits*
155 - Simon Howard for his hint about "sandbox"
156 - Mark Weber for the idea of using checksums
157 - Daniel Hahler for various patches
159 ==============================================================================
160 CHANGELOG *localvimrc-changelog*
163 - add possibility to make decisions persistent
164 - use full file path when storing decisions
167 - added g:localvimrc_whitelist and g:localvimrc_blacklist settings.
168 - ask only once per session and local vimrc before loading it, if it didn't
172 - source .lvimrc in a sandbox to better maintain security, configurable
173 using g:localvimrc_sandbox.
174 - ask user before sourcing any local vimrc file, configurable using
178 - new configuration variable g:localvimrc_name to change filename.
179 - new configuration variable g:localvimrc_count to limit number of loaded
183 - switched to arrays in vim 7.
184 - escape file/path names correctly.
189 ==============================================================================
191 vim:tw=78:ts=8:ft=help:norl: