1

In netbeans with CTRL+LEFT, CTRL+UP, CTRL+RIGHT, CTRL+DOWN we can move the line and it contents to LEFT, UP, RIGHT, DOWN ... how can I do this with vim !?

In linux netbeans is ALT+SHIFT ARROW LEFT, RIGHT to move !

Hulk1991
  • 3,079
  • 13
  • 31
  • 46
  • Duplicate: http://stackoverflow.com/questions/741814/move-entire-line-up-and-down-in-vim. Also what do you mean by move a line to the left/right? – Mateusz Dymczyk Feb 06 '12 at 00:13
  • You have netbeans ? if yes ... try CTRL LEFT, RIGHT –  Feb 06 '12 at 00:17

3 Answers3

2

The following key maps your indentions in a Vim way (using alt + j and k keys) and formats the moved lines as according to their new position. Code stolen from http://vim.wikia.com/wiki/Moving_lines_up_or_down.

nnoremap <A-j> :m+<CR>==
nnoremap <A-k> :m-2<CR>==
inoremap <A-j> <Esc>:m+<CR>==gi
inoremap <A-k> <Esc>:m-2<CR>==gi
vnoremap <A-j> :m'>+<CR>gv=gv
vnoremap <A-k> :m-2<CR>gv=gv
suhair
  • 10,895
  • 11
  • 52
  • 63
1

Well I do not have NetBeans but I guess (after googling) that by ctrl+right/left you mean to indent the selected block?

In that case you can use the >> and << commands. Just either go the line you want to indent or select a block (using "v") and press > twice (remember about the shift key :)).

The others (move up/down) are clearly described here.

Hope that's what you're looking for!

Community
  • 1
  • 1
Mateusz Dymczyk
  • 14,969
  • 10
  • 59
  • 94
0

Adding to Zenzen's answer, you can do for example Esc+5+<< to have 5 lines below the cursor shifted to the left by a tab space.

Ambidextrous
  • 810
  • 6
  • 14