Add example to override = mappings in codefmt docs
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 55/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- vim
- Domain
- documentation
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.
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:
function s:AddCodefmtEqualMapping() abort
" Replace all the various ={motion} keys to codefmt
nnoremap <buffer> = :set opfunc=codefmt#FormatMap<CR>g@
nnoremap <buffer> == :FormatLines<CR>
vnoremap <buffer> = :FormatLines<CR>
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.
- Dominant language
- Vim Script
- Stars
- 1.1k
- Forks
- 102
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from google/vim-codefmt
-
Write a codefmt FAQ Openenhancement
Difficulty 1/5 1-3 hours Newbie friendliness 68/100
google/vim-codefmt#53 ·
-
Add meson format Opennew formatter
Difficulty 3/5 1-2 days Newbie friendliness 45/100
google/vim-codefmt#243 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
google/vim-codefmt#240 · 1 comment ·
-
Add `:CodefmtInfo` command to report diagnostics to help users check config / diagnose problems Openenhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
google/vim-codefmt#234 · 2 comments ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 45/100
google/vim-codefmt#222 · 3 comments ·
All issues in google/vim-codefmt
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
agilepathway/label-checker#640 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
BasedHardware/omi#15662 · 1 comment ·
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
amponce/archive-movie-browser#167 ·
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·