Sourcery now available in Vim!

Instantly refactor your Python code


Sourcery and Vim

We're delighted to announce that Sourcery is now available in Vim 🎉.

This means you can use all of the great features of Sourcery directly in Vim:

  • Instant refactoring suggestions. We're the only tool that will refactor your code for you! As you edit, Sourcery will analyse your code and suggest improvements which you can preview and then apply with a single command.
  • We don't break your code. Sourcery uses extensive static analysis to ensure that its refactorings don't change the existing functionality - backed up by testing on open source repositories.
  • Code Quality Metrics. View the quality of any function and be shown warnings when the quality drops below a threshold.

Installation

Sourcery uses the the excellent coc.nvim LSP plugin to provide its functionality. There are complete installation instruction on our wiki.

Sourcery in Action

Here's a Sourcery refactoring suggestion shown using :call CocAction('doHover')

Suggested diff

Run :CocFix to view the options to fix:

Options to fix

Press 1 and your code is instantly refactored:

Refactored code

Documentation

Check out our wiki for more usage instructions and configuration options.

Thanks

Thanks to Marco Aguiar for working out how to use Sourcery in Vim 🙏!

Example Sourcery refactoring

Hey, have you tried Sourcery?

Write better code faster with Sourcery refactorings in GitHub or your IDE. Try it now to see Sourcery work its magic on your code.