Skip to content

vim plugin hijacks the comma, and for all filetypes too #415

Description

@dimbleby

version 18.6b4, also true on master.

black.vim contains:

nmap ,= :Black<CR>
vmap ,= :Black<CR>

But there are problems with this:

  • First, this hijacks the comma - which is a standard vim command, that some of us find useful. It's not OK for for plugins to do this!
  • Second, this mapping applies to all files - so even when I'm not doing anything python-related at all, black.vim has hijacked my comma

I'd suggest a couple of options:

  • My preference: simply don't provide a mapping at all. Users can perfectly well set up their own mapping for :Black according to what works for them.

    • Suggest a mapping in the README, if you like
  • If you think it's important to provide a mapping out of the box, then my understanding of the conventions (though I'm not completely sure of this) is that:

    • black.vim should be filetype-specific - that is, you should move it to ftplugin/python.vim
    • the mapping that you provide should be scoped to the current <buffer>
    • the mapping should begin with <localleader>

That way your mapping will only affect python files, and not clash with any standard mappings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions