From 6163b38b42316850e3b8520bc71e6ca5c612ffa0 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Tue, 10 May 2016 18:12:10 -0500 Subject: [PATCH] Add Read In The Contents Of A Rails File as a vim til --- README.md | 3 ++- vim/read-in-the-contents-of-a-rails-file.md | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 vim/read-in-the-contents-of-a-rails-file.md diff --git a/README.md b/README.md index 6ee8d4d..ab3c3c7 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really warrant a full blog post. These are mostly things I learn by pairing with smart people at [Hashrocket](http://hashrocket.com/). -_413 TILs and counting..._ +_414 TILs and counting..._ --- @@ -465,6 +465,7 @@ _413 TILs and counting..._ - [Quick Man Pages](vim/quick-man-pages.md) - [Quick Quickfix List Navigation](vim/quick-quickfix-list-navigation.md) - [Re-indenting Your Code](vim/reindenting-your-code.md) +- [Read In The Contents Of A Rails File](vim/read-in-the-contents-of-a-rails.file.md) - [Rename Current File](vim/rename-current-file.md) - [Repeat The Previous Change](vim/repeat-the-previous-change.md) - [Repeating Characters](vim/repeating-characters.md) diff --git a/vim/read-in-the-contents-of-a-rails-file.md b/vim/read-in-the-contents-of-a-rails-file.md new file mode 100644 index 0000000..de95cc1 --- /dev/null +++ b/vim/read-in-the-contents-of-a-rails-file.md @@ -0,0 +1,15 @@ +# Read In The Contents Of A Rails File + +The [`rails.vim` plugin](https://github.com/tpope/vim-rails) allows you to +quickly navigate to specific types of files with the `E` prefix. For +instance, `:Emodel` will scope you to just the models directory. + +You can use this same approach with the `D` prefix. Instead of navigating to +specified file though, this will read in the contents of that file into the +current buffer. + +Do you need to copy and tweak the contents of a similar view? Open up your +new view file (e.g. `:Eview posts/edit.html.erb`) and then enter `:Dview +posts/new` to quickly copy in its contents. + +h/t Josh Davey