[vim] Mapping <C-1> possible? - Editors

This is a discussion on [vim] Mapping <C-1> possible? - Editors ; I would like to map Control-&lt;number&gt; in vim7, but it doesn't work. Example: when I put 'map &lt;F1&gt; atest&lt;ESC&gt;' into my .vimrc the the F1 key is correctly mapped to insert &quot;test&quot;. But 'map &lt;C-1&gt; atest&lt;ESC&gt;' doesn't work. Is there ...

+ Reply to Thread
Results 1 to 6 of 6

[vim] Mapping <C-1> possible?

  1. Default [vim] Mapping <C-1> possible?

    I would like to map Control-<number> in vim7, but it doesn't work.

    Example: when I put 'map <F1> atest<ESC>'
    into my .vimrc the the F1 key is correctly mapped to insert "test".
    But 'map <C-1> atest<ESC>' doesn't work. Is there any way to do this?

    --
    Klaus

  2. Default Re: [vim] Mapping <C-1> possible?

    Klaus Nowikow wrote:
    > I would like to map Control-<number> in vim7, but it doesn't work.


    > Example: when I put 'map <F1> atest<ESC>'
    > into my .vimrc the the F1 key is correctly mapped to insert "test".
    > But 'map <C-1> atest<ESC>' doesn't work. Is there any way to do this?


    These things usually depend on the environment in which you run vim.
    What is your operating system and are you using vim or gvim (and which
    flavour)?

    Peppe
    --
    se nocp cpo=BceFsx!$ hid bs=2 ls=2 hls ic " P. Guldberg /bin/vi@wielders.org
    se scs ai isf-== fdo-=block cino=t0,:0 hi=100 ru so=4 noea lz|if has('unix')
    se sh=/bin/sh|en|syn on|filetype plugin indent on|ono S V/\n^-- $\\|\%$/<CR>
    cno <C-A> <C-B>|au FileType vim,mail se sw=4 sts=4 et|let&tw=72+6*(&ft=~'v')

  3. Default Re: [vim] Mapping <C-1> possible?

    Preben 'Peppe' Guldberg wrote:
    > Klaus Nowikow wrote:
    >> I would like to map Control-<number> in vim7, but it doesn't work.

    >
    >> Example: when I put 'map <F1> atest<ESC>'
    >> into my .vimrc the the F1 key is correctly mapped to insert "test".
    >> But 'map <C-1> atest<ESC>' doesn't work. Is there any way to do this?

    >
    > These things usually depend on the environment in which you run vim.
    > What is your operating system and are you using vim or gvim (and which
    > flavour)?


    I am using gvim 7.0 (patches 1-17, 32 bit with OLE support) on
    Windows XP.

    --
    Klaus

  4. Default Re: [vim] Mapping <C-1> possible?

    Klaus Nowikow wrote:
    > Preben 'Peppe' Guldberg wrote:
    > > Klaus Nowikow wrote:
    > >> I would like to map Control-<number> in vim7, but it doesn't work.


    > >> Example: when I put 'map <F1> atest<ESC>'
    > >> into my .vimrc the the F1 key is correctly mapped to insert "test".
    > >> But 'map <C-1> atest<ESC>' doesn't work. Is there any way to do this?


    > > These things usually depend on the environment in which you run vim.
    > > What is your operating system and are you using vim or gvim (and which
    > > flavour)?


    > I am using gvim 7.0 (patches 1-17, 32 bit with OLE support) on
    > Windows XP.


    OK. That may be possible then. Try inserting the control characrter
    literally in a buffer with

    <C-V><C-1>

    in insert mode. If it generates input, you should be able to map that
    sequence.

    Peppe
    --
    se nocp cpo=BceFsx!$ hid bs=2 ls=2 hls ic " P. Guldberg /bin/vi@wielders.org
    se scs ai isf-== fdo-=block cino=t0,:0 hi=100 ru so=4 noea lz|if has('unix')
    se sh=/bin/sh|en|syn on|filetype plugin indent on|ono S V/\n^-- $\\|\%$/<CR>
    cno <C-A> <C-B>|au FileType vim,mail se sw=4 sts=4 et|let&tw=72+6*(&ft=~'v')

  5. Default Re: [vim] Mapping <C-1> possible?

    Preben 'Peppe' Guldberg wrote:
    > Klaus Nowikow wrote:
    >> Preben 'Peppe' Guldberg wrote:
    >>> Klaus Nowikow wrote:
    >>>> I would like to map Control-<number> in vim7, but it doesn't work.
    >>>> [...]
    >>>
    >>> These things usually depend on the environment in which you run vim.
    >>> What is your operating system and are you using vim or gvim (and which
    >>> flavour)?

    >>
    >> I am using gvim 7.0 (patches 1-17, 32 bit with OLE support) on
    >> Windows XP.

    >
    > OK. That may be possible then. Try inserting the control characrter
    > literally in a buffer with
    >
    > <C-V><C-1>
    >
    > in insert mode. If it generates input, you should be able to map that
    > sequence.


    Thank you for the tip.
    I had to use <C-Q> instead of <C-V> beacause under Windows <C-V>
    is mapped to paste text from the clipboard.
    Alas, <C-Q><C-1> generates nothing. Is there something I can do
    about it?

    --
    Klaus

  6. Default Re: [vim] Mapping <C-1> possible?

    In our last episode, <44e42f51$0$11094$3b214f66@tunews.univie.ac.at>, the
    lovely and talented Klaus Nowikow broadcast on comp.editors:

    > Thank you for the tip.
    > I had to use <C-Q> instead of <C-V> beacause under Windows <C-V>
    > is mapped to paste text from the clipboard.
    > Alas, <C-Q><C-1> generates nothing. Is there something I can do
    > about it?


    First, you do understand, don't you, that there is no such thing as
    Ctrl-1, don't you? There is no such character. Whether you can get
    something out of the combination of hitting the control key and the !/1 key
    or not, you cannot get Ctrl-1, because there is no such thing.

    What you seem to want is to get some kind of string from the combination of
    hitting the control key and the 1 key -- something like the escape string
    you get from hitting one of the Fn keys -- which you can then map to
    something useful. You pretty much have to do that at the system level,
    which means, if you succeed, you'd get that string from hitting the
    combination of the control key and the 1 key in every application, not just
    in your editor. At any rate you cannot do with your editor's configuration
    file.

    It is absurdly simple to do this sort of thing in some BSDs and it is only
    somewhat difficult to do it in X-windows. It is hard in most linux
    consoles, and as for Windows, well, I think you're better off to stop
    wanting to do that.


    --
    Lars Eighner <http://larseighner.com/> <http://myspace.com/larseighner>
    "We have no opinion on your Arab - Arab conflicts, such as your dispute with
    Kuwait." -- Bush's Ambassador April Glaspie, giving Saddam Hussein
    the greenlight to invade Kuwait.

+ Reply to Thread

Similar Threads

  1. 2d to 3d mapping
    By Application Development in forum Graphics
    Replies: 4
    Last Post: 12-15-2007, 01:16 AM
  2. Vim: Re-mapping <ESC> to nothing?
    By Application Development in forum Editors
    Replies: 10
    Last Post: 06-11-2007, 02:36 PM
  3. UV Mapping
    By Application Development in forum Graphics
    Replies: 3
    Last Post: 10-12-2006, 05:29 PM
  4. Key Mapping
    By Application Development in forum Editors
    Replies: 6
    Last Post: 04-20-2006, 04:16 AM
  5. Re: Mapping the IMS/ESA SPA?
    By Application Development in forum ASM x86 ASM 370
    Replies: 0
    Last Post: 06-23-2003, 10:30 AM