News for hackers. Stuff that matters.
Re:Vim Boss by smueller1234 on Friday August 11, 2023 @02:56AM (#37085885)
While we're at sharing neat vim configs, here's the one I was quite happy with at the time: I got tired of indent style arguments. I don't care. So I wrote a little heuristic to detect indent style, then configured vim with my preferences, and added this to .vimrc:

> map <F5> <Esc> :perl use Text::FindIndent;VIM::DoCommand($_) for Text::FindIndent->to_vim_commands(join "\n", $curbuf->Get(1..$curbuf->Count()));<CR>

Text::FindIndent is the aforementioned heuristic as a Perl module. Sorry for the mangled quote, original at https://metacpan.org/pod/Text::FindIndent

When I work on existing code, I hit F5 and work within the author's preferences.

There are no comments on this comment yet.