Friday, March 22, 2013

Re: Moving one line or block more conveniently

On Sat, Mar 23, 2013 at 01:22:07PM +0800, 月忧茗 wrote:
> Yes, I can move one line up and down by using such ddkp Key combination

> But, I made a plugin for doing this action more conveniently.

> For one line, in NORMAL or INSERT mode,

> ctrl-shift-j moving down
> ctrl-shift-k moving up

> For block, (this is in VISUAL mode)

> the same action

> ctrl-shift-j ctrl-shift-k up and down

> https://github.com/yueyoum/vim-linemovement

I use line movers so much I've assigned them to F8 and S-F8, and I
don't need a plugin to do it. With the following lines in my .vimrc:

nnoremap <silent> <F8> :m+<CR>
inoremap <silent> <F8> <ESC>:m+<CR>gi
vnoremap <silent> <F8> :m'>+<CR>
nnoremap <silent> <S-F8> :m-2<CR>
inoremap <silent> <S-F8> <ESC>:m-2<CR>gi
vnoremap <silent> <S-F8> :m-2<CR>
nnoremap <silent> <M-F8> yyp
inoremap <silent> <M-F8> <ESC>yyp$gi

I get all the line movers (and duplicators) I need.

sc

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: