Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Add the following to your .vimrc.

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

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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