开发者

Move lines in Vim

开发者 https://www.devze.com 2023-04-03 18:38 出处:网络
I\'m trying to replicate TextMate\'s move selection command in Vim. I\'ve come up with this: map <C-D-Up> ddkP

I'm trying to replicate TextMate's move selection command in Vim.

I've come up with this:

map <C-D-Up> ddkP
map <C-D-Down> ddp
vmap <C-D-Up> dkP
vmap <C-D-Down> dp

Single lines work just as expected. But visual mode isn't perfect.

I want it to keep (or reselect) the selection in visual mode, so that I开发者_如何学JAVA can move the selection multiple times easily. I found gv but that doesn't work, as it doesn't select the moved lines but something further down the document.

Any ideas?

0

精彩评论

暂无评论...
验证码 换一张
取 消