On 14/04/13 23:48, michael raba wrote:
hello,
I want to do the following with gvim:
Hold down the 's' key, then press 1.
Type "hello world"
Note1: if I just press s, it acts like normal.
Note2: If I hold down 1 and press s, it should not do anything
Is this possible to do natively?
No. Vim gets its keyboard input in "cooked" mode, and that means that if
you hold down the s key, after a short time (configurable in the BIOS at
boot time) the keyboard repeat will kick in and you will get a string of
s letters. That string will stop if you press 1 but Vim will have no way
to know that the s key is still down.
What you can do is have Vim type "Hello world" if you press and release
s then press and release 1. See :help "map.txt" and check both mappings
and abbreviations. If, in addition, you want Vim not to do its usual
when you press 1 followed by s (which is the same as s i.e. delete the
character at the cursor and start Insert mode) you will have to define
an additional mapping to override that:
:nnoremap s1 :echomsg "Hello world"<CR>
:nnoremap 1s <Nop>
Thanks in advance
Michael Raba
Best regards,
Tony.
--
You are the only person to ever get this message.
--
--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.