On May 19, 12:24 pm, Christian Brehm <[email protected]> wrote:
> Hi,
>
> I'd like to set the position of a gvim window upon opening a certain file.
>
> Sadly modeline seems to allow only to set parameters rather than
> executing commands such as :winpos X Y.
>
> Is there a way to set the winpos only for a certain file automatically?
> I don't want to change my vimrc or modify any other file than the one
> I'm going to edit.
>

Using a Vim-only solution, without modifying any files other than the
one you're going to edit, there is not any way to do what you ask.

You CAN make a ONE-TIME edit to your .vimrc or a plugin file, to set
up an autocmd that will look for certain text, maybe even in a certain
place in the file, to indicate where to set the window position. This
would be a way of creating your own sort of "extended" modeline.

For example, you could search the last 10 lines on a BufRead, for the
keyword VIMWINPOS:, use getline() and then parse out the numbers you
wish to set. Then, on any file you want to use to set the position
with, just include VIMWINPOS: 44 100 for example.

There may be a plugin that allows this sort of thing already.

It would be a similar idea to that used in the following tip:

http://vim.wikia.com/wiki/Use_eval_to_create_dynamic_templates

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to