How to go to file (gf) in vim where extension is not mentioned?

Sam*_*abu 2 vim ansible

在下面的 ansible 代码中,当我将光标移动到 get_service_restart_count.yml 并在 vim 中输入“gf”时,它会打开该文件。

- name: Delete PVC
  include_role:
    name: kube
    tasks_from: delete_pvc

- name: get service restart count again
  include: get_service_restart_count.yml
Run Code Online (Sandbox Code Playgroud)

但是当我尝试同样的操作delete_pvc(缺少扩展名)时,它不会移动到文件。它抛出错误

E447:在路径中找不到文件“delete_pvc”

几乎所有的task_from都没有扩展名。

vim 中有没有选项可以移动到缺少扩展名的文件名?

rom*_*inl 5

当你处理gf没有扩展名的文件名时,Vim 会尝试:help 'suffixesadd'.

~/.vim/after/ftplugin/yaml.vim(Unix 衍生版本)或%userprofile%\vimfiles\after\ftplugin\yaml.vim(Windows)中,添加以下行:

setlocal suffixesadd+=.yml
Run Code Online (Sandbox Code Playgroud)

(IMO,这应该在默认的 ftplugin 中。)