2012-07-31 87 views
0

我正試圖在vim-rails中使用:A(例如,在控制器和規範之間切換)。如果我瀏覽到我的Rails項目,運行vim .,打開控制文件並運行:A,我得到的錯誤:如何從目錄中打開Vim時自動設置路徑?

E345: Can't find file "app/controllers/widgets_controller.rb" in path 

如果我再設置明確的路徑:

:set path=/Users/me/Documents/Code/my-project 

然後:A作品預期。當我用Vim打開目錄時,如何設置路徑?

回答

1

不完全是在打開目錄時:因爲您似乎正在處理項目,請嘗試使用project plugin

使用它,您可以在進入或離開項目時執行任意命令。

從插件描述:

You can use this plugin's basic functionality to set up a list of frequently-accessed files for easy navigation. The list of files will be displayed in a window on the left side of the Vim window, and you can press or double-click on filenames in the list to open the files. This is similar to how some IDEs I've used work. I find this easier to use than having to navigate a directory hierarchy with the file-explorer. It also obviates the need for a buffer explorer because you have your list of files on the left of the Vim Window.

+0

有趣,感謝eckes - 看起來很有希望。明天會試用這個 – recurser 2012-07-31 14:59:52