Comments (6)
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.
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.
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.
Thanks for the investigation, I added a short notice in the docs about this.
from vim-move.
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.
@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)
- How to restore the position in the line after moving? HOT 2
- Moving block including indents HOT 4
- Using Ctrl + Shift as a modifier HOT 1
- Moving by multiple lines does not work anymore HOT 2
- [Bug] Does not work on macos HOT 12
- Undoing a move opens folds
- Only first line is indented when moving multiple lines into another indentation level HOT 6
- Can't move to the right when it finds a tilded character HOT 2
- Options to disable all default mappings? HOT 1
- Ridiculously high CPU usage when moving lines horizontally HOT 2
- move_key_modifier='S'
- How to use this Plugin with arrow keys? HOT 5
- How can I map J K to move block down and up? HOT 1
- [Bug] Moveblockleft and down after that makes unexpected behavior. HOT 1
- feat: Allow usage in only a specific mode, i.e. visual mode HOT 1
- Custom key mapping not working properly in neovim HOT 9
- Better default mappings for macOS: use arrow keys HOT 1
- Out-of-box keymaps for moving are not working HOT 5
- The wrong installation method in vim-plug
- Use S as move_key_modifier
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-move.