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

Re(i)mapping word completion

Expand Messages
  • Tim Johnson
    Hello Vimmers: I d like to remap the functionality for Ctrl-P and Ctrl-N in insert mode. I presume that the default mapping of , are mappings
    Message 1 of 5 , Jul 29, 2003
      Hello Vimmers:
      I'd like to remap the functionality for
      Ctrl-P and Ctrl-N in insert mode.
      I presume that the default mapping of <Ctrl-P>,
      <Ctrl-N> are mappings to vim functions.
      if so:

      1)What are those functions names?
      2)How do I find them?

      Thanks
      tim (ver 6.1 on RH 7.2, python-enabled)

      --
      Tim Johnson <tim@...>
      http://www.alaska-internet-solutions.com
      http://www.johnsons-web.com
    • Andrew Pimlott
      ... No, and , like most vim commands, are just what they are . In other words, they are not bound to functions (as in some other editors),
      Message 2 of 5 , Aug 2, 2003
        On Tue, Jul 29, 2003 at 03:14:07PM -0800, Tim Johnson wrote:
        > I'd like to remap the functionality for
        > Ctrl-P and Ctrl-N in insert mode.
        > I presume that the default mapping of <Ctrl-P>,
        > <Ctrl-N> are mappings to vim functions.

        No, <Ctrl-P> and <Ctrl-N>, like most vim commands, are just "what
        they are". In other words, they are not bound to functions (as in
        some other editors), they are both the keystroke and the function.
        I'm not sure exactly what you want to do. If you want to change
        what <Ctrl-P> and <Ctrl-N> do, you want something like

        :imap <C-P> ...

        If you want to use these "functions" in some other mapping, you want
        something like

        :inoremap ... ...<C-P>...

        noremap ensures that you get the "original" <C-P> command, not
        anything it's been mapped to.

        Andrew
      • Tim Johnson
        ... Hi Andrew: I have done that at times, but it disables word completion. So then - is there a a method whereby I can get Word Completion and at the same time
        Message 3 of 5 , Aug 2, 2003
          * Andrew Pimlott <vim@...> [030802 08:09]:
          > On Tue, Jul 29, 2003 at 03:14:07PM -0800, Tim Johnson wrote:
          > > I'd like to remap the functionality for
          > > Ctrl-P and Ctrl-N in insert mode.
          > > I presume that the default mapping of <Ctrl-P>,
          > > <Ctrl-N> are mappings to vim functions.
          >
          > No, <Ctrl-P> and <Ctrl-N>, like most vim commands, are just "what
          > they are". In other words, they are not bound to functions (as in
          > some other editors), they are both the keystroke and the function.
          > I'm not sure exactly what you want to do. If you want to change
          > what <Ctrl-P> and <Ctrl-N> do, you want something like
          >
          > :imap <C-P> ...
          >
          > If you want to use these "functions" in some other mapping, you want
          > something like
          >
          > :inoremap ... ...<C-P>...

          Hi Andrew:
          I have done that at times, but it disables word completion.

          So then - is there a a method whereby I can get Word Completion
          and at the same time have Emacs-Style navigation in insert mode?

          (I have a greater goal here - not sure that it is noble, but
          I'm trying to put together a "stealth" method of acquainting
          students with vim)

          BTW: Thanks for getting back to me :-)
          Tim

          > noremap ensures that you get the "original" <C-P> command, not
          > anything it's been mapped to.
          >
          > Andrew

          --
          Tim Johnson <tim@...>
          http://www.alaska-internet-solutions.com
          http://www.johnsons-web.com
        • Andrew Pimlott
          ... Forgive me for not knowing exactly the emacs keybinding, but I assume you mean something like, let and move up and down a line in insert mode,
          Message 4 of 5 , Aug 2, 2003
            On Sat, Aug 02, 2003 at 08:24:59AM -0800, Tim Johnson wrote:
            > * Andrew Pimlott <vim@...> [030802 08:09]:
            > > I'm not sure exactly what you want to do. If you want to change
            > > what <Ctrl-P> and <Ctrl-N> do, you want something like
            > >
            > > :imap <C-P> ...
            > >
            > > If you want to use these "functions" in some other mapping, you want
            > > something like
            > >
            > > :inoremap ... ...<C-P>...
            >
            > Hi Andrew:
            > I have done that at times, but it disables word completion.
            >
            > So then - is there a a method whereby I can get Word Completion
            > and at the same time have Emacs-Style navigation in insert mode?

            Forgive me for not knowing exactly the emacs keybinding, but I
            assume you mean something like, let <C-P> and <C-N> move up and down
            a line in insert mode, and let some other key sequences (say, <F9>
            and <F10>) do word completion. You can achieve this with

            :imap <C-P> <C-O>k
            :imap <C-N> <C-O>j
            :inoremap <F9> <C-P>
            :inoremap <F10> <C-N>

            Use :help to read up on any of this that's unfamiliar.

            If you want it more emacs-esque, where you type M-x in insert mode
            and then get to type in a function name, I'm sure you can
            approximate this, but I'll let someone else figure out the details.

            > (I have a greater goal here - not sure that it is noble, but
            > I'm trying to put together a "stealth" method of acquainting
            > students with vim)

            Good luck. ;-)

            Andrew
          • Tim Johnson
            * Andrew Pimlott [030802 09:09]: ... Yes! ... That s what I was looking for. Does the trick alright. ...
            Message 5 of 5 , Aug 2, 2003
              * Andrew Pimlott <vim@...> [030802 09:09]:
              <snip>
              > > Hi Andrew:
              > > I have done that at times, but it disables word completion.
              > >
              > > So then - is there a a method whereby I can get Word Completion
              > > and at the same time have Emacs-Style navigation in insert mode?
              >
              > Forgive me for not knowing exactly the emacs keybinding, but I
              > assume you mean something like, let <C-P> and <C-N> move up and down
              > a line in insert mode, and let some other key sequences (say, <F9>
              > and <F10>) do word completion. You can achieve this with

              Yes!

              >
              > :imap <C-P> <C-O>k
              > :imap <C-N> <C-O>j
              > :inoremap <F9> <C-P>
              > :inoremap <F10> <C-N>

              That's what I was looking for. Does the trick alright.

              > Use :help to read up on any of this that's unfamiliar.
              >
              > If you want it more emacs-esque, where you type M-x in insert mode
              > and then get to type in a function name, I'm sure you can
              > approximate this, but I'll let someone else figure out the details.

              http://www.vim.org/scripts/script.php?script_id=300

              > > (I have a greater goal here - not sure that it is noble, but
              > > I'm trying to put together a "stealth" method of acquainting
              > > students with vim)
              >
              > Good luck. ;-)

              Hahaha! All we can do is try. Right? Thanks for all your
              help.
              ~tj~

              --
              Tim Johnson <tim@...>
              http://www.alaska-internet-solutions.com
              http://www.johnsons-web.com
            Your message has been successfully submitted and would be delivered to recipients shortly.