From 28b9612acfbeb73dfa9c48a291c4894fcc6f2edb Mon Sep 17 00:00:00 2001 From: Bruno Pinto Date: Fri, 7 Nov 2014 16:47:50 -0200 Subject: [PATCH] replace plugin --- plugins/README.markdown | 1 + plugins/replace/replace.fish | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 plugins/replace/replace.fish diff --git a/plugins/README.markdown b/plugins/README.markdown index 4eb0214..048654a 100644 --- a/plugins/README.markdown +++ b/plugins/README.markdown @@ -27,6 +27,7 @@ * __rails__ – Alias for executing database migrations. * __rake__ – Completions for rake tasks. * __rbenv__ – [rbenv](https://github.com/sstephenson/rbenv) Ruby environment/version manager. +* __replace__ – A port of [replace](https://github.com/thoughtbot/dotfiles/blob/master/bin/replace). * __rvm__ – [RVM](http://rvm.io) Ruby version manager. * __sublime__ – Creates `subl` command line shortcut to launch [Sublime Text editor](http://sublimetext.com/). * __tmux__ – Plugin to start tmux with support for 256 colours. diff --git a/plugins/replace/replace.fish b/plugins/replace/replace.fish new file mode 100644 index 0000000..fcc30ed --- /dev/null +++ b/plugins/replace/replace.fish @@ -0,0 +1,6 @@ +function replace --description 'Find and replace by a given list of files.' + set find_this $argv[1] + set replace_with $argv[2] + + ag -l $find_this $argv[3..-1] | xargs sed -i '' "s/$find_this/$replace_with/g" +end