Skip to content

Instantly share code, notes, and snippets.

@alfredodeza
Last active August 29, 2015 14:02
Show Gist options
  • Save alfredodeza/88ea216f2cd57797b737 to your computer and use it in GitHub Desktop.
Save alfredodeza/88ea216f2cd57797b737 to your computer and use it in GitHub Desktop.
Run a Vim command on a bunch of files
# For a bunch of Python files
vim -c "bufdo! set eventignore-=Syntax| %s/original/replacement/gce" *.py
# if you want to save as you go
vim -c "bufdo! set eventignore-=Syntax| %s/original/replacement/gce | update" *.py
# Breaking it down:
# bufdo! -> so that it doesn't complain about erroring
# set eventignore-=Syntax -> so that every buffer gets syntax highlighting
# /gce -> optional, global search in the line with confirmation and eating up the errors
# | update -> optional update to save every buffer as you move
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment