Skip to content

Instantly share code, notes, and snippets.

Last active Feb 11, 2017
What would you like to do?
Refactor from functions to class functions by adding `self` to all function arguments (VIM search and replace command)
# For functions with existing arguments
:%s/def \(.\+\)(\(.\+\)):/def \1(self, \2):/
# For functions with no arguments
:%s/def \(.\+\)():/def \1(self):/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment