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

Emacs-like mappings

Expand Messages
  • Matt Rechkemmer
    Just curious if there s a way to map things like C-x+C-s, and C-x+C-c. I googled around for this a bit, but couldn t come up with anything useful. Doing
    Message 1 of 5 , Sep 30, 2005
      Just curious if there's a way to map things like C-x+C-s, and C-x+C-c. I
      googled around for this a bit, but couldn't come up with anything useful.
      Doing <C-xC-s> or <C-x><C-s> doesn't work.

      Any help on this is greatly appreciated!

      Thanks,

      --
      Matt Rechkemmer
      matt@...
    • Tim Chase
      ... Not being an emacs sorta fellow, I couldn t tell you what that action (:echo boink! ) should be doing in the emacs world. The other mapping, using
      Message 2 of 5 , Oct 1, 2005
        > Just curious if there's a way to map things like C-x+C-s, and
        > C-x+C-c. I googled around for this a bit, but couldn't come
        > up with anything useful. Doing <C-xC-s> or <C-x><C-s> doesn't
        > work.

        The following mapping worked for me:

        :inoremap <c-x><c-s> :echo "boink!"<cr>

        Not being an emacs sorta fellow, I couldn't tell you what that
        action (:echo "boink!"<cr>") should be doing in the emacs world.

        The other mapping, using the C-c is going to fail, as Vim seems
        to treat ^C as an "abort this mapping" command. Thus, it sees
        the ^X as a leader for a pending command, and then sees the ^C as
        an "abort this attempt at a command".

        :help ^C

        states "In Normal mode, any pending command is aborted."

        Additionally, depending on which version of Vim, ^S may not be
        mappable (mapable? mapible? mappible? is it a word?), as it,
        along with ^Q are know to be flow-control characters. The
        terminal may intercept them before they get to Vim and prevent
        Vim from seeing them. The mapping worked in my Win32 gvim, and
        likely works on Win32 console vim as well as *nix gvim. However,
        with *nix console vim, you may see problems.

        For a more accurate Emacs experience, I recommend

        :w | !emacs %

        ;-)

        Just a few early Saturday morning thoughts on the matter.

        -tim
      • Matt Rechkemmer
        ... I guess that knocks out my ability to have C-x C-c functionality. ... I m using VIM 6.3 (6.3.071 according to Debian). I couldn t get C-x C-s to work
        Message 3 of 5 , Oct 1, 2005
          On Sat, Oct 01, 2005 at 07:43:58AM -0500, Tim Chase wrote:
          >
          > The other mapping, using the C-c is going to fail, as Vim seems
          > to treat ^C as an "abort this mapping" command. Thus, it sees
          > the ^X as a leader for a pending command, and then sees the ^C as
          > an "abort this attempt at a command".

          I guess that knocks out my ability to have C-x C-c functionality.

          > Additionally, depending on which version of Vim, ^S may not be
          > mappable (mapable? mapible? mappible? is it a word?), as it,
          > along with ^Q are know to be flow-control characters. The
          > terminal may intercept them before they get to Vim and prevent
          > Vim from seeing them. The mapping worked in my Win32 gvim, and
          > likely works on Win32 console vim as well as *nix gvim. However,
          > with *nix console vim, you may see problems.

          I'm using VIM 6.3 (6.3.071 according to Debian). I couldn't get C-x C-s to
          work either. I've been trying to get off my Emacs crutch, and fully move to
          VIM. I suppose I could just get used to the VIM equivalents, but it would
          have been nice to map them...

          Thanks for the help!

          --
          Matt Rechkemmer
          matt@...
        • Göran Gustafsson
          ... Thanks so much for enlightening me on this subject :-) It s something that i find really useful. - Göran Gustafsson - http://www.fulknark.se
          Message 4 of 5 , Oct 2, 2005
            On 10/1/05, Tim Chase <vim@...> wrote:
            > The following mapping worked for me:
            >
            > :inoremap <c-x><c-s> :echo "boink!"<cr>
            >

            This actually did work but just to make things clear it should be:

            :inoremap <c-x><c-s> <esc>:echo "boink!"<cr>
            :noremap <c-x><c-s> :echo "boink!"<cr>

            Thanks so much for enlightening me on this subject :-)
            It's something that i find really useful.

            - Göran Gustafsson - http://www.fulknark.se
          • Yegappan Lakshmanan
            Hi, ... Instead of , you should use : inoremap :echo boink! If you use , after invoking the map, you will be in
            Message 5 of 5 , Oct 2, 2005
              Hi,

              On 10/2/05, Göran Gustafsson <gustafsson.g@...> wrote:
              > On 10/1/05, Tim Chase <vim@...> wrote:
              > > The following mapping worked for me:
              > >
              > > :inoremap <c-x><c-s> :echo "boink!"<cr>
              > >
              >
              > This actually did work but just to make things clear it should be:
              >
              > :inoremap <c-x><c-s> <esc>:echo "boink!"<cr>
              >

              Instead of "<esc>", you should use <CTRL-O>:

              inoremap <c-x><c-s> <c-o>:echo "boink!"<cr>

              If you use <esc>, after invoking the map, you will be in normal
              mode. If you use <c-o>, after invoking the map, you will still
              be in insert mode.

              - Yegappan

              > :noremap <c-x><c-s> :echo "boink!"<cr>
              >
              > Thanks so much for enlightening me on this subject :-)
              > It's something that i find really useful.
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.