vim ale插件

下载flake8
pip install flake8
下载
pip install rstcheck

在vimrc中添加

let g:ale_linters = {'python': ['flake8'], 'reStructuredText': ['rstcheck']}
let g:ale_fixers = {'python': ['remove_trailing_lines', 'trim_whitespace', 'autopep8']}

ale_linters的详细说明

g:ale_linters                                                   
  Type: |Dictionary|
  Default: `{}`

  The |g:ale_linters| option sets a |Dictionary| mapping a filetype to a
  |List| of linter programs to be run when checking particular filetypes.

  This |Dictionary| will be merged with a default dictionary containing the
  following values: >

  {
  \   'csh': ['shell'],
  \   'go': ['gofmt', 'golint', 'go vet'],
  \   'help': [],
  \   'perl': ['perlcritic'],
  \   'python': ['flake8', 'mypy', 'pylint'],
  \   'rust': ['cargo'],
  \   'spec': [],
  \   'text': [],
  \   'zsh': ['shell'],
  \}
<
  This option can be used to enable only a particular set of linters for a
  file. For example, you can enable only `eslint` for JavaScript files: >

  let g:ale_linters = {'javascript': ['eslint']}
<
  If you want to disable all linters for a particular filetype, you can pass
  an empty list of linters as the value: >

  let g:ale_linters = {'javascript': []}
<
  All linters will be run for unspecified filetypes. All available linters can
  be enabled explicitly for a given filetype by passing the string `'all'`,
  instead of a List. >

  let g:ale_linters = {'c': 'all'}
<
  Linters can be configured in each buffer with buffer-local variables. ALE
  will first look for linters for filetypes in the `b:ale_linters` variable,
  then `g:ale_linters`, and then the default Dictionary mentioned above.

  `b:ale_linters` can be set to a List, or the string `'all'`. When linters
  for two different filetypes share the same name, the first linter loaded
  will be used. Any ambiguity can be resolved by using a Dictionary specifying
  which linter to run for which filetype instead. >

  " Use ESLint for the buffer if the filetype includes 'javascript'.
  let b:ale_linters = {'javascript': ['eslint'], 'html': ['tidy']}
  " Use a List for the same setting. This will work in most cases.
  let b:ale_linters = ['eslint', 'tidy']
  " Disable all linters for the buffer.
  let b:ale_linters = []
  " Explicitly enable all available linters for the filetype.
  let b:ale_linters = 'all'

你可能感兴趣的:(vim)