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

Mapping to the "numerical" - and + and *

Expand Messages
  • Eric Leenman
    Hi, Is it possible to map the - and + and * keys on the nummerical section of a keyboard (in other words the keys in the group where the num-lock key is
    Message 1 of 8 , Feb 28, 2007
    View Source
    • 0 Attachment
      Hi,

      Is it possible to map the - and + and * keys on the "nummerical section of a
      keyboard" (in other words the keys in the group where the num-lock key is
      also)
      to functioan as cut, paste and copy?
      If so, how do you this?

      Rgds,
      Eric

      _________________________________________________________________
      Refi Now: Rates near 39yr lows! $430,000 Mortgage for $1,399/mo - Calculate
      new payment
      http://www.lowermybills.com/lre/index.jsp?sourceid=lmb-9632-17727&moid=7581
    • Georg Dahn
      ... Don t forget the black hole register _ Thus, just do _x on the visual selection and the selected text is deleted to nirvana. Best wishes, Georg
      Message 2 of 8 , Feb 28, 2007
      View Source
      • 0 Attachment
        --- Jean-Rene David <jrdavid@...> wrote:
        > In vim, "delete" always saves the deleted data
        > somewhere.

        Don't forget the black hole register "_

        Thus, just do "_x on the visual selection and
        the selected text is deleted to nirvana.

        Best wishes,
        Georg








        ___________________________________________________________
        The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html
      • Marc Weber
        ... Have look at :h keypad-plus etc. But I don t know wether it works everywhere. Try a :helpgrep keypad to get all information.. Marc
        Message 3 of 8 , Feb 28, 2007
        View Source
        • 0 Attachment
          On Wed, Feb 28, 2007 at 12:41:22PM +0000, Eric Leenman wrote:
          > Hi,
          >
          > Is it possible to map the - and + and * keys on the "nummerical section of
          > a keyboard" (in other words the keys in the group where the num-lock key is
          > also)
          > to functioan as cut, paste and copy?
          > If so, how do you this?
          Have look at :h keypad-plus etc.
          But I don't know wether it works everywhere. Try a :helpgrep keypad to
          get all information..

          Marc
        • Eric Leenman
          ... I want to use these as cut, paste and copy iso CTRL-X, V and C. I assume that the keypad keys by linux-windows managers are not used. and therefor it s
          Message 4 of 8 , Mar 1, 2007
          View Source
          • 0 Attachment
            >How were you planning to use those?
            >
            >--
            >JR

            I want to use these as cut, paste and copy iso CTRL-X, V and C.
            I assume that the keypad keys by linux-windows managers are not used.
            and therefor it's easier to move between the windows and linux .

            [...]
            Trying to extend the hints that Tony send
            >:vnoremap <kMinus> "+d
            >:noremap <kPlus> "+p
            >:inoremap <kPlus> <C-R>+
            >:vnoremap <kMultiply> "+y
            [...]

            I now got
            :vnoremap <kPlus> "+p
            :vnoremap <kMinus> "+d
            :vnoremap <kMultiply> "+y
            :noremap <kPlus> "+p
            :noremap <kMinus> "+d
            :noremap <kMultiply> "+y
            :inoremap <kMinus> "+d
            :inoremap <kPlus> "+p
            :inoremap <kMultiply> "+y

            But that is not working, especially not in insert-mode where I get "+d as
            text in my code when I press the kMinus.
            I tried the help CTRL-R but I don't follow that.
            What is wrong with these mappings?

            Rgds,
            Eric

            _________________________________________________________________
            Win a Zune��make MSN� your homepage for your chance to win!
            http://homepage.msn.com/zune?icid=hmetagline
          • Jean-Rene David
            ... Cutting and copying are compound operations in the sense that you need to specify /what/ they are going to act on. There are many ways to do this,
            Message 5 of 8 , Mar 1, 2007
            View Source
            • 0 Attachment
              * Eric Leenman [2007.03.01 13:30]:
              > >How were you planning to use those?
              >
              > I want to use these as cut, paste and copy iso
              > CTRL-X, V and C.

              Cutting and copying are compound operations in the
              sense that you need to specify /what/ they are
              going to act on. There are many ways to do this,
              depending on the mode you are in.

              > I now got
              > :vnoremap <kPlus> "+p
              > :vnoremap <kMinus> "+d
              > :vnoremap <kMultiply> "+y

              This looks fine.

              What you want to act on is implicitly the visual
              selection.

              > :noremap <kPlus> "+p

              This is fine.

              > :noremap <kMinus> "+d
              > :noremap <kMultiply> "+y

              Here you will need to specify *what* you want to
              "cut" or "paste" with a motion command after you
              have pressed <kMinus> of <kMultiply>.

              > :inoremap <kMinus> "+d
              > :inoremap <kMultiply> "+y

              These are "insert-mode" mappings. So of course you
              get "+d in your text. This is exactly what you
              told vim to do.

              What do you *mean* when you are in insert mode and
              want to "cut" or "copy"? "Copy" what?

              One possibility is to revert to normal mode and
              follow the command with a motion:

              :inoremap <kMinus> <C-O>"+d
              :inoremap <kPlus> <C-O>"+p

              > :inoremap <kPlus> "+p

              This is meaningful but the syntax is incorrect.
              Tony gave you the answer for this one.

              > I tried the help CTRL-R but I don't follow that.

              It would help if were more explicit about the
              parts you don't understand.

              In normal mode, pressing "+p means:
              'put the content of register + after the cursor'.

              In insert mode, pressing "+p means:
              'insert " then + then p'.

              It has nothing whatsoever to do with registers.
              This is where CTRL-R helps you. <CTRL-R>+ is the
              insert-mode equivalent of "+p in normal-mode.

              --
              JR
            • Eric Leenman
              Thanks all. I got it working what I wanted by copying the mswin.vim file and stripping it to what I wanted. When you don t understand vim-scripting as I do
              Message 6 of 8 , Mar 2, 2007
              View Source
              • 0 Attachment
                Thanks all.
                I got it working what I wanted by copying the mswin.vim file and stripping
                it to what I wanted.
                When you don't understand vim-scripting as I do then good copying is beter
                then bad designing .

                Rgds,
                Eric


                "---<START>
                " kMinus and CTRL-X and SHIFT-Del are Cut
                vnoremap <kMinus> "+x
                vnoremap <S-Del> "+x
                vnoremap <C-X> "+x

                " kMultiply and CTRL-C and CTRL-Insert are Copy
                vnoremap <kMultiply> "+y
                vnoremap <C-Insert> "+y
                vnoremap <C-C> "+y

                " kPlus and CTRL-V and SHIFT-Insert are Paste
                map <kPlus> "+gP
                map <S-Insert> "+gP
                map <C-V> "+gP

                cmap <kPlus> <C-R>+
                cmap <S-Insert> <C-R>+
                cmap <C-V> <C-R>+

                " Pasting blockwise and linewise selections is not possible in Insert and
                " Visual mode without the +virtualedit feature. They are pasted as if they
                " were characterwise instead.
                " Uses the paste.vim autoload script.

                exe 'inoremap <script> <kPlus>' paste#paste_cmd['i']
                exe 'vnoremap <script> <kPlus>' paste#paste_cmd['v']
                exe 'inoremap <script> <C-V>' paste#paste_cmd['i']
                exe 'vnoremap <script> <C-V>' paste#paste_cmd['v']

                imap <S-Insert> <kPlus>
                vmap <S-Insert> <kPlus>
                imap <S-Insert> <C-V>
                vmap <S-Insert> <C-V>

                " Use CTRL-Q to do what CTRL-V used to do
                noremap <C-Q> <C-V>
                "---<END>

                _________________________________________________________________
                Win a Zune��make MSN� your homepage for your chance to win!
                http://homepage.msn.com/zune?icid=hmetagline
              Your message has been successfully submitted and would be delivered to recipients shortly.