0

I'm using the current PHP Storm EAP (138.1505) and IdeaVim 0.35.

Suppose I just want to type:

print_r($foo);
  • I press i to go into Vim insert mode.
  • I type p r and I can choose print_r via the autocomplete.
  • It'll add open and close braces () for me.
  • I start typing my variable, it'll let me autocomplete that too.
  • At this stage I have print_r($foo) with my cursor positioned before the closing bracket.

What I'd like now is a single key combination that'll finish the line for me - i.e. add a semi-colon and a carriage return. At the moment I either have to type );[return] by hand as if the autocomplete wasn't there, or for some reason I've got in the habit of doing esc to leave insert mode then A to continue at the end of the line and ;[return][esc]to finish it off, which is even longer.

Any better way?

William Turrell
  • 3,227
  • 7
  • 39
  • 57

2 Answers2

3

I don't use PHP Storm. but I do use Intellij + ideavim.

Here I can press Ctrl-Shift-Enter to complete a line. It is a kind of default setting. You can find it under menu: Edit: complete current statement

You may want to give it a try.

Kent
  • 189,393
  • 32
  • 233
  • 301
0

You can add this line to ~/.ideavimrc:

imap <C-e> <Esc>A;<CR>

Replace <C-e> with your desired key.

romainl
  • 186,200
  • 21
  • 280
  • 313