by xuejie · 3y ago · 0 comments
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 :)It could use a fix for saving hidden files on Windows :-(