[ubuntu-uk] Vim keybinding for filter

Kris Marsh moogman at gmail.com
Sun Aug 17 22:36:29 BST 2008

On Sun, Aug 17, 2008 at 7:40 PM, DarkOtter <hello at darkotter.com> wrote:
> Sorry to ask what is probably a silly question (I bet i've just missed one vital
> detail in this). Anyways, I am trying to set a keybinding for a filter in vim. I
> can use the filter normally (i.e by typing :%!~/Scripts/Signature <enter>) but
> when I try to map it to a key it does not worked. The command I tried using to
> map it was as follows:
> :map ^s :%!~/Scripts/Signature
> this does not give me an error message, but then when I press ^s nothing
> happens. I couldn't quite remember whether ^s was alt+s or ctrl+s in vim, so I
> tried both and neither seemed to do anything.
> Thanks in advance for any help.
> Version: GnuPG v1.4.6 (GNU/Linux)
> iD8DBQFIqHCwicQOwhfgu7kRAthZAKCU7tpWz/9llBX+1t0azGdorm1RlACeLQy6
> yCzJ+bmoGKtUxfsJHy73L+c=
> =P6iz
> --
> ubuntu-uk at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
> https://wiki.ubuntu.com/UKTeam/

A couple of comments:

* I'm not entirely sure why ^s doesn't resolve to Ctrl-S, but I would
generally use the <C-s> form.
* Ctrl-S is a terminal command meaning "stop terminal output", so you
probably won't be able to use it in Vim.
* You'll need to get your mapping to do a Carriage Return at the end
of the command, otherwise you'll have to manually press Enter every

Give this a go (for Ctrl-x, running the output of `ls`):

:map <C-x> :%!ls<CR>

You can add this into your ~/.vimrc file (create a new one if it
doesn't exist), to auto-load vim options on startup.

HTH :-)

More information about the ubuntu-uk mailing list