Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 1 down vote accepted

Add the following to your .vimrc.

if expand("%.t") =~? 'Activities.txt'
   set lines=50 columns=40
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


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.