Add example to override = mappings in codefmt docs
- 主要语言
- Vim Script
- 星标
- 1.1k
- 派生
- 102
- PR 合并指标
- 30 天内没有已合并 PR
描述
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.
贡献指南
调研方向
从 codefmt 帮助文档及其现有的格式化指南开始。添加所提供的用于覆盖 = mappings 的 VimL 示例,然后说明用户应有的预期,以及将其应用于选定 filetype 时的注意事项;确认该示例易于阅读,并且与周围的帮助文本保持一致。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- vim
- 领域
- documentation
- Issue 类型
- 文档
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 55/100