let-modeline.vim : Extends the modeline feature to the assignment of variables
| script karma |
Rating 19/7,
Downloaded by 1326
|
Comments, bugs, improvements
|
Vim wiki
|
| created by |
| Luc Hermitte |
| |
| script type |
| utility |
| |
| description |
The file defines the function FirstModeLine().
Its purpose is very simple. It consists in extending VIM modelines (:h modeline for more info) to custom variables -- these variables can then be used to customize other VIM scripts.
For instance, if your file foo.vim has as one of its first or last lines:
" VIM: let b:toto="foo" g:tata=4 g:egal="t=y".&tw $CPPFLAG='-I../../libs'
Then, once the buffer is (re)loaded, one buffer relative variable (b:toto) and two global variables (g:tata and g:egal) are defined to the value specified after the equal sign.
Personnaly, I use it in conjunction with tex-tools.vim in order to know the name of the main file of the current document and then call latex on the main file and not on the currently edited file -- I use intensively \\include{} and \\includeonly{}.
Regarding the security issue, the script forbids calls to functions in the right hand operand -- it prevents from trojans. Nevertheless, it is possible to call functions thanks to a buffer relative callback feature. This time, only one function could be called. Trojans are still possible if the callback functions (that you have accepted in your configuration) want it to be possible -- like calling a function named after the value passed in parameter...
The callback feature has been implemented to be used in conjunction with ftplugins ; cf. tex-maps.vim and tex-tools.vim on my Web site:
http://hermitte.free.fr/vim/tex.php
Note: The version 1.5 is the last one which can be used with Vim 5.x. |
| |
| install details |
Drop this file into your {rtp}/plugin/ directory with VIM 6 ; with VIM 5.x {rtp}/plugin/ is also a good idea if you emulate VIM 6 plugins -- cf. my web site as well.
To use the plugin, my .vimrc contains:
" Loads FirstModeLine() {{{
if !exists('*FirstModeLine')
Runtime plugin/let-modeline.vim
" :Runtime emulates :runtime
endif
if exists('*FirstModeLine')
aug ALL
au!
" To not interfer with Templates loaders like mu-template
au BufNewFile * :let b:this_is_new_buffer=1
" Modeline interpretation
au BufEnter * :call FirstModeLine()
aug END
endif
" }}}
|
| |
script versions (upload new version)
Click on the package to download.
| let-modeline.vim |
1.6 |
2004-03-23 |
6.0 |
Luc Hermitte |
Support for environment variables added ; does not check into folded lines anymore ; does not mess with search history anymore ; no more error messages with 2html.vim |
| let-modeline.vim |
1.3 |
2002-11-08 |
5.7 |
Luc Hermitte |
Parse several lines according to &modelines and &modeline ; the Let-modeline does not need to be at the beginning of the file anymore. |
| let-modeline.vim |
1.1 |
2001-09-13 |
6.0 |
Luc Hermitte |
Initial upload |
ip used for rating: 184.73.74.47
|