google / google/vim-codefmt

Add example to override = mappings in codefmt docs

Abierto
#12 0 comentarios 0 reacciones 0 asignados Ver en GitHub
enhancement
Lenguaje dominante
Vim Script
Estrellas
1.1k
Forks
102
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.