Giter Club home page Giter Club logo

Comments (6)

ejoubaud avatar ejoubaud commented on August 12, 2024 14

FTR, one problem I was having after adding the lines from @matze 's .vimrc was that esc would then wait for new keys to be typed. That was especially painful to escape visual mode, where typing <ESC>k would move my selection down instead of escaping visual and going down one line.

The only way I was able to solve this was with the fast keycodes hack. My config looks something like this

" vim-move config
" for terms that send Alt as Escape sequence
" see http://vim.wikia.com/wiki/Mapping_fast_keycodes_in_terminal_Vim
" for why the <F20> hack. Keeps Esc from waiting for other keys to exit visual
set <F20>=^[j
set <F21>=^[k
vmap <F20> <Plug>MoveBlockDown
vmap <F21> <Plug>MoveBlockUp
nmap <F20> <Plug>MoveLineDown
nmap <F21> <Plug>MoveLineUp

Note: Don't just copy/paste this: ^[ in the above should be replaced with the escape sequence for escape. You can get it (in vim) by typing <C-v><ESC> in insert mode. I used regular ^ and [ here because the textarea won't let me use escape codes but it won't work in your vimrc if you have regular ^[ instead of the escape sequence.

With this, my escape key is back to being snappy to exit visual mode, and I can use <A-j> and <A-k> for vim-move in iterm2 (after setting left and right option key acts as: to +Esc)

(Off-topic Note: for a really snappy escape, you'll want to set ttimeoutlen=0 in .vimrc and, if you use tmux, you'll also want to add set -s escape-time 0 to .tmux.conf for the escape key to be really snappy)

@matze: This issue (and these workarounds) might be worth a "troubleshooting" mention in the readme, linking to this and #8. I guess the problem would be encountered by most terminal vim users and they generated 3 issues already. I had given up on vim-move once before I eventually found the issues. What do you think?

from vim-move.

matze avatar matze commented on August 12, 2024

You could try disabling automatic mapping with

let g:move_map_keys = 0

and map them yourself using <C-v> M-j et al. I do the same (GitHub does not display the escape sequence well) because I also have problems with Ubuntu's gnome-terminal.

from vim-move.

robertdj avatar robertdj commented on August 12, 2024

Your suggestion worked!

For future reference I had to clone your config repository to see the escape sequence -- even a raw view did not display the keybinding as superscript left-bracket.

On Linux Mint it worked out of the box, but on Mac I had to change the interpretation of the alt key:

  • In Terminal: Profiles -> Keyboard -> "Use Option as Meta key"
  • In iTerm: Profiles -> Keys -> "Left option key acts as" +Esc

Thanks a lot for your help!

from vim-move.

matze avatar matze commented on August 12, 2024

Thanks for the investigation, I added a short notice in the docs about this.

from vim-move.

matze avatar matze commented on August 12, 2024

Thanks for the elaborate investigation. Do you want to open a PR for the change to the README or should I take care of that?

from vim-move.

kiprasmel avatar kiprasmel commented on August 12, 2024

@ejoubaud the fix didn't help me, but I went down the rabbit hole to [1] -> [2] -> [3] and [3] finally fixed it!

tl;dr: install tpope/vim-rsi [3] 🎉

[1] https://stackoverflow.com/a/27206531/9285308
[2] https://github.com/vim-utils/vim-alt-mappings#thanks
[3] https://github.com/tpope/vim-rsi

see also https://www.dfurnes.com/notes/binding-command-in-iterm

from vim-move.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.