News for hackers. Stuff that matters.
Re:micro – A Modern Alternative to nano by cmrdporcupine on Friday August 18, 2023 @09:19AM (#37175216)
I keep trying stripped down terminal editors as alternatives to emacs -- because these days I use like 1% of emacs anyways -- but I always severely miss the common emacs major modes for C/C++ etc and especially its approach to indentation there (tab to force correct indent). I really wish other editors would follow this convention.
Re:micro – A Modern Alternative to nano by drbaba on Saturday August 19, 2023 @04:38AM (#37186773)
> 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 :)