Loading ...
Sorry, an error occurred while loading the content.

CTRL-S functionality to a letter combo like i.e. cs

Expand Messages
  • Eric Leenman
    Hi, I m using gvim on windows, which is behaving like windows shortcuts: For example: CTRL-S for save CTRL-X for cut, ect. When using vim on Linux these don t
    Message 1 of 4 , Feb 1, 2007
    • 0 Attachment
      Hi,

      I'm using gvim on windows, which is behaving like windows shortcuts:
      For example:
      CTRL-S for save
      CTRL-X for cut,
      ect.

      When using vim on Linux these don't work anymore because of linux "windows
      managers".

      Is it possible to put the same functionality of the CTRL-key (and/or ALT) to
      a key which is not linux "windows manager " sensitive?
      In other words: Is it possible to remap the ctrl key to for example the
      letter c?

      So that when you are in insert-mode you can press cs as a replacement for
      CTRL-S?
      (
      Is this possible without using the Function Keys F1 till F12?

      Rgds,

      Eric

      _________________________________________________________________
      Get live scores and news about your team: Add the Live.com Football Page
      http://www.live.com/?addtemplate=football
    • Kim Schulz
      On Thu, 01 Feb 2007 20:48:52 +0000 ... get the vim setup called cream. http://cream.sf.net -- Kim Schulz | Private : http://www.schulz.dk Kim@schulz.dk |
      Message 2 of 4 , Feb 1, 2007
      • 0 Attachment
        On Thu, 01 Feb 2007 20:48:52 +0000
        "Eric Leenman" <eric.leenman@...> wrote:

        > Hi,
        >
        > I'm using gvim on windows, which is behaving like windows shortcuts:
        > For example:
        > CTRL-S for save
        > CTRL-X for cut,
        > ect.
        >
        > When using vim on Linux these don't work anymore because of linux
        > "windows managers".
        >
        > Is it possible to put the same functionality of the CTRL-key (and/or
        > ALT) to a key which is not linux "windows manager " sensitive?
        > In other words: Is it possible to remap the ctrl key to for example
        > the letter c?
        >
        > So that when you are in insert-mode you can press cs as a replacement
        > for CTRL-S?
        > (
        > Is this possible without using the Function Keys F1 till F12?
        >

        get the vim setup called cream.
        http://cream.sf.net

        --
        Kim Schulz | Private : http://www.schulz.dk
        Kim@... | Business: http://www.devteam.dk
        +45 5190 4262 | Sparetime: http://www.fundanemt.com
      • A.J.Mechelynck
        ... AFAIK they do work but they aren t mapped because they aren t standard on Linux. ... Since you re apparently not going to use the same keys as on Windows,
        Message 3 of 4 , Feb 1, 2007
        • 0 Attachment
          Eric Leenman wrote:
          > Hi,
          >
          > I'm using gvim on windows, which is behaving like windows shortcuts:
          > For example:
          > CTRL-S for save
          > CTRL-X for cut,
          > ect.
          >
          > When using vim on Linux these don't work anymore because of linux
          > "windows managers".

          AFAIK they do work but they aren't mapped because they aren't standard on Linux.

          >
          > Is it possible to put the same functionality of the CTRL-key (and/or
          > ALT) to a key which is not linux "windows manager " sensitive?
          > In other words: Is it possible to remap the ctrl key to for example the
          > letter c?
          >
          > So that when you are in insert-mode you can press cs as a replacement
          > for CTRL-S?
          > (
          > Is this possible without using the Function Keys F1 till F12?
          >
          > Rgds,
          >
          > Eric

          Since you're apparently not going to use the same keys as on Windows, why not
          use "real" Vim keys?

          Save
          :w
          Save As
          :saveas filename.txt
          Delete (cut) to default register
          d
          Delete (cut) to clipboard
          "+d
          Delete lines 22 to 33
          :22,33d
          ...to clipboard
          :22,33d +
          Yank (copy) to default register
          y
          Yank (copy) to clipboard
          "+y
          Yank from current line to end of file
          :.,$y
          ... to clipboard
          :.,$y +
          Put (paste) before cursor
          P
          Put (paste) after cursor
          p
          Put from clipboard
          "+p
          "+P
          Put linewise after current line
          :put
          ... from clipboard
          :put +
          Put at end of file
          :$put
          :$put +
          Undo
          u
          Redo
          Ctrl-R
          etc. etc. etc.


          Best regards,
          Tony.
        • DervishD
          Hi Eric :) ... Well, that s not exact: the window manager may have its key mappings for internal use, but it s X which is managing the keyboard. If the window
          Message 4 of 4 , Feb 4, 2007
          • 0 Attachment
            Hi Eric :)

            * Eric Leenman <eric.leenman@...> dixit:
            > When using vim on Linux these don't work anymore because of linux "windows
            > managers".

            Well, that's not exact: the window manager may have its key mappings
            for internal use, but it's X which is managing the keyboard. If the
            window manager is using Ctrl-S, for example, you won't be able to use it
            in your gvim, unfortunately. Well behaved window managers should allow
            you to change the mappings (the Gnome window manager *is* well behaved,
            for example).

            > Is it possible to put the same functionality of the CTRL-key (and/or ALT)
            > to a key which is not linux "windows manager " sensitive?

            Of course, use the mapping commands. See below for an example.

            > In other words: Is it possible to remap the ctrl key to for example the
            > letter c?

            Not a good idea in insert mode ;) but you can do it. For example,
            even in insert mode, I've mapped "çç" to "gqip", but I'm still able to
            type a "ç" or even a double "ç". Vim allows that :)

            > So that when you are in insert-mode you can press cs as a replacement for
            > CTRL-S?

            Let's say you don't use so much "cs", so you can afford to wait a
            bit between "c" and "s" when you *actually* have to type that in insert
            mode. Then, you can do this (for saving):

            imap cs <C-O>:w

            But I suggest you to use the "Vim" keys for the task unless you're
            very used to the C-S, C-X, C-V and C-C, because the vim keys work
            everywhere and because things like "C-S" and "C-C" usually have other
            meanings under Linux (namely, stop the character flow to the terminal,
            and the keyboard interrupt, respectively). Vim keys and the vim way of
            doing things is easy to learn. Believe it or not, after using vim for
            only a month in my entire life, I'm so used to it that most of the time
            I hit ":q" to exit from "elinks" or "Mutt"!

            Raúl Núñez de Arenas Coronado

            --
            Linux Registered User 88736 | http://www.dervishd.net
            It's my PC and I'll cry if I want to... RAmen!
          Your message has been successfully submitted and would be delivered to recipients shortly.