Tuesday, June 24, 2014

Re: Set VIM winpos based on file type


On Tue, Jun 24, 2014 at 1:50 PM, James <jjpuzzles@wowway.com> wrote:
I am currently using VIM 7.3 on Windows 7.

I would like my .h files to open on the left side of my screen and .cpp files to open toward the right side of my screen.  I currently have :winpos 0 0 in my _vimrc file, resulting in all files opening on the left.

I assume that I need to place :winpos commands inside "if" conditionals in my _vimrc file, but don't know how to reference the filename extension in the conditional.

Can someone help me out with the correct _vimrc commands or another method that will work?


You can do it with autocmd (untested):

augroup reposition_for_c_files
    autocmd! BufEnter *.c exec 'winpos 0 0'<CR>
    autocmd! BufEnter *.h exec 'winpos 200 200'<CR>
augroup END

Then to remove it and try it again:
:augroup! reposition_for_c_files

HTH,
David


--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment