Add example to override = mappings in codefmt docs
- Dominant language
- Vim Script
- Stars
- 1.1k
- Forks
- 102
- PR merge metrics
- No merged PRs in 30d
Description
Some filetypes have terrible default indenting logic (using the = mapping) and also have a formatter fast enough and robust enough to drop in as the formatting implementation for the = mapping. You can do this by adding something like the following to your vimrc:
``` VimL
function s:AddCodefmtEqualMapping() abort
" Replace all the various ={motion} keys to codefmt
nnoremap = :set opfunc=codefmt#FormatMapg@
nnoremap == :FormatLines
vnoremap = :FormatLines
endfunction
augroup codefmt_equal
autocmd FileType cpp,proto call s:AddCodefmtEqualMapping()
augroup END
```
We should add an example like this into the codefmt help and explain what to expect + caveats when you use it.
Contributor guide
Research direction
Start with the codefmt help documentation and its existing formatting guidance. Add the supplied VimL example for overriding the = mappings, then document what users should expect and the caveats of applying it to selected filetypes; confirm the example is readable and consistent with the surrounding help text.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- vim
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100