Thursday, October 20, 2011

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


Hi Gary, Hi Vimmers.
 
 
Thank you Gary, your command works perfectly, I can evaluate my code when I call F11/F12 and the cursor returns to my source window so it saves me moves.
 
 map <F11> :write \| :split /tmp/eval.ml \| %d \|setlocal ft=omlet \| setlocal autowrite \| exe 'r!ocaml < #' \| wincmd p<CR>
 map <F12> :write \| :dr /tmp/eval.ml \| %d \|setlocal ft=omlet \|setlocal autowrite \| exe 'r!ocaml < #' \| wincmd p<CR>

 
 
 
Thank to you all vim users for your help and assitant.
 
 
Best regards
 
Eddine.

 
2011/10/13 Gary Johnson <garyjohn@spocom.com>
On 2011-10-05, Eddine wrote:
> Hi Marcin,
>
> thank you for your reply.
> I tried your command, but there's somehow a bug
>
>
>     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>
>
>
>
> as the "wincmd" seems to be sent to ms-dos command;
> Im' receiving
> shell returned 255
> "wincmd is not recognized as internal or external command etc.." in the eval.ml
> file.
>
> Can somone help ?

The :r! command sees the bar (|) as part of its argument and
includes it and the following wincmd in the text it passes to the
shell.  See

   :help :bar

The solution is to enclose the :r! command in an :execute command.
I think these versions of your mappings will work, but I have not
tested them.

   map <F11> :write \| :split /tmp/eval.ml \| %d \|setlocal ft=omlet \| setlocal autowrite \| exe 'r!ocaml < #' \| wincmd p<CR>

   map <F12> :write \| :dr /tmp/eval.ml \| %d \|setlocal ft=omlet \|setlocal autowrite \| exe 'r!ocaml < #' \| wincmd p<CR>

See

   :help :exe

Regards,
Gary

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