Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shortcut key to indent a block of text with IdeaVim and Phpstorm

Without IdeaVim in PhpStorm, the tab key can be used to indent a selected block of text. However, I'm interested to know if there's a shortcut key that does the same thing with the IdeaVim plugin installed (without losing any functionality that the tab key otherwise has).

like image 305
Highly Irregular Avatar asked Oct 20 '14 00:10

Highly Irregular


People also ask

How do I indent a block of text in Vim?

To indent the current line, or a visual block: ctrl-t, ctrl-d - indent current line forward, backwards (insert mode) visual > or < - indent block by sw (repeat with . )

How do I indent multiple lines in Linux?

To tab or add the indentation at multiple lines, try “shift+dot” i.e., “.” Shortcut once. You will see it will add an indentation of one character at each selected line from the start. If you want to add indentation without stopping, then you have to try the “.” Key from the keyword after using “shift+.”.


2 Answers

See Indent multiple lines quickly in vi

You must be in normal mode, i.e. go Esc before indenting.

You can select a block of lines with Shift+V, then up/down arrows, then > to indent (< reverses indent).

like image 186
Niloct Avatar answered Oct 21 '22 11:10

Niloct


I think following settings are what you want! :)

Put the followings to ~/.ideavimrc

nnoremap <Tab> >>_
nnoremap <S-Tab> <<_
inoremap <S-Tab> <C-D>
vnoremap <Tab> >gv
vnoremap <S-Tab> <gv

ideavim support vimrc with .ideavimrc

also see: Is there a way to get IdeaVIM to honor the mappings from my .vimrc file?

like image 15
doortts Avatar answered Oct 21 '22 10:10

doortts