20 Apr '16, 12am

Lists, Vim, and You

Vim truly excels at editing text, but some common text-editing tasks are more daunting than others to do from our favorite text editor. Today, we are going to cover the various ways you can search and replace bits of text, in your shell and beyond to Vim. From the shell From our dotfiles you can find a script named replace , which takes three arguments - the word you want to replace, its replacement, and the pattern for where you want to replace within. Easy, right? % replace ugly funny-looking **/*.txt If you do not want to install yet another script to your dotfiles, you can use sed(1) , which is used under the hood by replace . % git grep -l ugly | xargs sed -i "" "s/ugly/funny-looking/g" For an extended overview on sed(1) and replacing text in your shell, I suggest reading sed 102: Replace In-Place . Using Vim, from the shell As you might be aware, Vim lets you search ...

Full article: https://robots.thoughtbot.com/lists-vim-and-you

Tweets