vim-autoformat / vim-autoformat

Provide easy code formatting in Vim by integrating existing code formatters.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Do not format the file if no Default formatprograms is found or the language is not supported

c02y opened this issue · comments

commented

I just started to use vim-autoformat, and set au BufWrite * :Autoformat in my init file, and I found two issues:

  1. If the language is supported but the formatprogram is not installed, vim will autoformat the file depending on the rules I don't know
  2. If the language is not supported, vim will autoformat the file depending on the rules I don't know

Example:

  1. When I edit ~/.config/sxhkd/sxhkdrc, the :set filetype? of it is markdown by my config(I use github space-vim config), but in README file, you said remark is supported for markdown, the thing is I don't get remark installed, so vim shouldn't autofomat it.
  2. When I edit ~/.config/ranger/rc.conf, the :set filetype? of it is conf by my config, conf is not supported by vim-autoformat, so vim shouldn't format the buffer.

You can control this behavior with

let g:autoformat_autoindent = 0
let g:autoformat_retab = 0
let g:autoformat_remove_trailing_spaces = 0

as explained in the readme

commented

Oh, I thought they are global variables that working for all buffers.

Thanks, it seems working.