RedditPP Mascot

RedditPP

r/vim • … • u/jthill

`i_ctrl-r` with impossible register names will recognize imaps, two I immediately wanted are NL and ESC.

I was having fits trying to get a make-this-line-a-`.rst`-heading without writing functions, which for some reason I'll put in work to avoid. The trouble was I set `fo+=ta` in text-ish files, my usual commands would trigger the wrapping and a lot of other attempts failed if the first line was the *only* line, the one time you're almost sure to want to make that line a heading.

So I found

:co.|s,.,=,g|start!<NL><NL><NL>

and the imap I'm using for it is

:ino <C-R><NL> <ESC>:co.\|s,.,=,g\|start!<NL><NL><NL>

because my terminal sends ctrl-enter as lf not cr.

Then I realized ctrl-[ is esc and I could

:ino <C-R><ESC> <CR>{<CR>}<C-O>O<C-D><TAB>

to map C function-brace pairs someplace nicer than the `<C-B>` I'd kinda bounced off of.

— 0