Wednesday, October 5, 2011

Re: Replacing the cursor into the initial window after calling of split or drop.

On 08:43 Wed 05 Oct , Eddine wrote:
> Ah one other question
> is it also possible to have my source file automatically saved when I call
> F11/F12.
>
> Thanks.
> Eddine.
> 2011/10/5 Eddine <bmokadem@googlemail.com>
>
> >
> > Hello Vimmers,
> >
> >
> >
> > for my Ocaml developments I use those mappings so I can evaluate my code
> > interactively with ocaml
> >
> >
> > map <F11> :split /tmp/eval.ml \| %d \|setlocal ft=omlet \| setlocal
> > autowrite \| r!ocaml < # <CR>
> >
> >
> >
> > I want to improve the behavior of those commands so my cursor remains into
> > my source window instead
> > of going in the new splitted window eval.ml.
> >
> > Is there a convenient and elegant way to do this ?
> >
> >
> >
> > Thank you in advance for your help.
> >
> > Eddine
> >
> >
>
> --
> 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 can try to use ':wincmd p' and ':write' commands
map <F11> :write \| :split /tmp/eval.ml \| %d \|setlocal ft=omlet \| setlocal autowrite \| r!ocaml < # \| wincmd p<CR>
map <F12> :write \| :dr /tmp/eval.ml \| %d \|setlocal ft=omlet \|setlocal autowrite \| r!ocaml < # \| wincmd p<CR>

Best regards,
Marcin

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

No comments: