Hacker News new | ask | show | jobs
by drbaba 1034 days ago
> I really wish other editors would follow this convention.

In editors with configurable keyboard shortcuts, you can bind this to tab yourself. For example, in Vim, the normal-mode command `==` would correctly reindent the current line. (Here, `=` is an operator, so you can also apply it to other regions like `=i{` to reindent correctly everything inside braces.)

To bind tab to reindent correctly in normal and visual mode, you can put this in your vimrc:

    nnoremap <tab> ==
    vnoremap <tab> =
You can also remap it in insert mode if you want, but then you might want to throw some if-statements in there to determine when to indent and when to reindent :)