ruby-on-rails - 从目录打开Vim时如何自动返回 'set path'?

标签 ruby-on-rails macos vim macvim

我正在尝试让 :A (例如在 Controller 和规范之间切换)在 vim-rails 中工作。如果我导航到我的 Rails 项目,运行 vim .,打开 Controller 文件并运行 :A,我收到错误:

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

如果我明确设置路径:

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

然后 :A 按预期工作。使用 Vim 打开目录时如何设置初始路径?

最佳答案

不完全是在打开目录时:因为您似乎正在处理项目,所以给出 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.

关于ruby-on-rails - 从目录打开Vim时如何自动返回 'set path'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11732876/

相关文章:

ruby-on-rails - Rails ActiveModel 序列化程序 : Retrieving Deeply Nested ActiveRecord Association

objective-c - 扩展坞显示或隐藏时的事件

vim - 在neovim中将自动缩进设置为空格?

css - 使用 <div class=> 进行 ajax 刷新加载时如何避免开始换行?

php - 为什么散列(不使用盐)随机数?

macos - 无法在 Mac 上测试 Mosquitto 服务器

vim - 如何在gvim中更改左页边距

vim - 使用寄存器值作为搜索模式

ruby-on-rails - 如何实现 :with_trait using Fabrication

python - 为什么 Streamlit 找不到我的 python 文件?