Wednesday, June 18, 2014

Re: Key mapping not working in Insert mode of vim

On Wed, Jun 18, 2014 at 2:31 PM, Arup Rakshit <tuka.08@gmail.com> wrote:
> On Wednesday, June 18, 2014 03:23:01 PM David Stanek wrote:
>> I haven't tried it, but this may work:
>> :imap <f6> <esc>:w<cr>:!ruby %<cr><cr>a
>
> This is deadly. :) *insert* to *insert*. Not showing any output :)

According to the following vim.wikia post you should be able to use
Ctrl-O but I cannot seem to make it work.

http://vim.wikia.com/wiki/Use_Ctrl-O_instead_of_Esc_in_insert_mode_mappings

In my testing I have a vim buffer with the following text in it:

from time import sleep
f = open("foo.txt", "w")
for i in range(0,10):
print i
f.write(str(i))
sleep(.1)
f.close()

If I run the command ':!python %' (without the quotes, I never know if
I really need to clarify that or not!) the python snippet runs like
I'd expect to and I get the file foo.txt. However, when I define
':inoremap <F6> <C-o>!python %<CR>' and attempt to use it nothing
seems to happen. Is inoremap not meant to work with external (!)
commands? Can anyone illuminate me? I have not extensively RTFM by the
way.

Cheers,

Ethan Alan

> --
> ================
> Regards,
> Arup Rakshit
> ================
> Debugging is twice as hard as writing the code in the first place. Therefore,
> if you write the code as cleverly as possible, you are, by definition, not
> smart enough to debug it.
>
> --Brian Kernighan
>
> --
> --
> 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.

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