Skip to content

Instantly share code, notes, and snippets.

@rgo
Created October 29, 2011 10:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgo/1324325 to your computer and use it in GitHub Desktop.
Save rgo/1324325 to your computer and use it in GitHub Desktop.
Convert files to utf-8 with vim
## From http://stackoverflow.com/questions/2311750/change-file-encoding-to-utf-8-via-vim-in-a-script
#This is the simplest way I know of to do this easily from the command line:
vim +"argdo se bomb | se fileencoding=utf-8 | w" $(find . -type f -name *.rb)
#Or better yet if the number of files is expected to be pretty large:
find . -type f -name *.rb | xargs vim +"argdo se bomb | se fileencoding=utf-8 | w"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment