简体   繁体   中英

vim mappings nightmare

I am using MacVim and I am trying to change the basic default key mappings, but I am failing miserably. I dont know why it's so complicated. This is what I am trying to do: (please tell me what to put in my .gvimrc)

  • remap Home to ^ (use in imode and end up in imode as well)
  • remap End to $ (use in imode and end up in imode as well)
  • remap Shift+anyArrowKey to the usual select things (use in imode and end up in imode as well)

Basically, I am trying to get usual edit functionality to macvim.

Keep in mind that some kind of unmappings need to happen first. I already tried just adding mappings, but it doesnt work.

If you could paste a section that I could just copy/paste to my .gvimrc file, that would be great.

This is how my mappings look like: (from running :map)

 n  gx            <Plug>NetrwBrowseX
       <M-Down>      }
       <D-Down>    * <C-End>
       <M-Up>        {
       <D-Up>      * <C-Home>
       <M-Right>   * <C-Right>
       <D-Right>   * <End>
       <M-Left>    * <C-Left>
       <D-Left>    * <Home>
    n  <Plug>NetrwBrowseX * :call netrw#NetrwBrowseX(expand("<cWORD>"),0)<CR>
    v  <BS>          "-d
    v  <D-x>         "*d
    v  <D-c>         "*y
    v  <D-v>         "-d"*P
    n  <D-v>         "*P

You shouldn't do that and learn Vim instead: while what you want is very easy to do, it's also a very very bad idea .

Vim draws a large part of its power from a strict separation between what can/should be done in insert mode (inserting text) and what can/should be done in normal mode (navigation, yanking, pasting, deleting…). Modal editing can be weird in the beginning but you'll get used to it soon and swear by it later. It's only a matter of time.

I've done exactly what you ask and more (tried to change all Vim mappings to TM ones) when I switched from TextMate until I realized it was the most counter-productive thing to do.

If you really don't like (or don't want to adjust to) modal editing, there are many text editors out there which will let you use your keyboard "normally" and have lots of powerful features.

That said, here are some pointers:

:h key-notation
:h mapping

and you don't need any unmappings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM