# 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 the 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ploegert.gitbook.io/til/tools/vim/read-in-the-contents-of-a-rails-file.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
