I wish to set some gVIM settings based on the file I am opening. Specifically, when I open my file Activities.txt I want to set the window width to 40 columns and the height to 50 rows. I believe I would use in my _vimrc file the setting

set lines=50 columns=40

but I was wondering how to test if I am opening the specific file.

link|improve this question

feedback

2 Answers

up vote 1 down vote accepted

Add the following to your .vimrc.

if expand("%.t") =~? 'Activities.txt'
   set lines=50 columns=40
endif
link|improve this answer
feedback

Enable modelines:

:set modeline

and put in your file, in the top or bottom 5 lines (assuming 'modelines' is set to 5):

 vi:set lines=50 columns=40:

with at least one whitespace char before the vi:set

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.