Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Go to last file with rails.vim

I am just getting into rails.vim as my ROR IDE and I am really liking it. The only thing I don't know how to do, that I wish I could, is hop back to the last file I was editing.

For example, if I am editing one file, say a view and I use :Rcontroller to hop over the the corresponding controller, is there a way to quickly go back to the model (without :Rmodel)? I'm looking for some functionality like that of CTRL-TAB in visual studio.

like image 615
Matthew Avatar asked Oct 20 '11 07:10

Matthew


2 Answers

This isn't actually related to Rails.vim plugin. Add the following line to your .vimrc file

map <Leader>p <C-^> " Go to previous file

Assuming <Leader> is mapped to , then you can just press ,p to go to the previous file.

This is how I've mapped my leader:

let mapleader = ","
like image 151
Sunny Avatar answered Oct 31 '22 02:10

Sunny


To go back just hit ctrl+o in command mode, ctrl+i to go forward in opened file history.

like image 2
Eugene Petrov Avatar answered Oct 31 '22 00:10

Eugene Petrov