sayth
sayth

Reputation: 7028

Move to the beginning of New Line - VIM

while in insert mode in vim how do i move to a new line correctly indented.

In many editors this action would be CTRL+ENTER

There is a similar stackoverflow question here however this answer takes you back to the start of the current line SO start of current line

So assuming this is my code, my cursor is just at the T in POST and i want to go to the start of the next line or next line with correct indentation if its a function(using snippets for function so now great concern).

@app.route('/add', method=['POST | '])

expected result

@app.route('/add', method=['POST'])
|

Upvotes: 1

Views: 125

Answers (2)

Zam
Zam

Reputation: 377

Search for indentation and map to some keys, so you cannot search for every time.

/^^I 

^I is tab

Upvotes: 1

FDinoff
FDinoff

Reputation: 31419

I would use <esc>o. Assuming you have filetype plugin indent on in your vimrc o will automatically go to the correct indent level.

Upvotes: 2

Related Questions