为什么UltiSnips无法识别我自己的片段? [英] Why UltiSnips does not recognize my own snippets?

查看:157
本文介绍了为什么UltiSnips无法识别我自己的片段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我在Vim中使用 YouCompleteMe ,然后我已经安装了 UltiSnips vim-snippets . UltiSnips YouCompleteMe 兼容并且可以正常运行;但是,当我定义自己的代码段时就会出现问题,因为这些代码段无法识别.

Currently I use YouCompleteMe in Vim, then I have installed UltiSnips and vim-snippets with vundler. UltiSnips and YouCompleteMe are compatible and work properly; however, the problem comes when I define my own snippet because these are not recognized.

我怀疑使用UltiSnipsEdit函数时出现问题,因为它在我的主目录中而不是.vim文件夹中创建了UltiSnips文件夹.例如,当我使用R脚本并且使用UltiSnipsEdit时,它将在/home/UltiSnips中创建r.snippets文件.然后定义一个片段以进行测试:

I suspect that the problem comes when I use the UltiSnipsEdit function because it creates the UltiSnips folder in my home directory and not inside the .vim folder. For example, when I am working with R scripts and I use UltiSnipsEdit, it creates the r.snippets file inside /home/UltiSnips. Then I define a snippet just to test:

snippet test "Testing snip for R." 
# snipp is working
endsnippet

保存文件后,该代码段不会出现在 YouCompleteMe 列表中,也不会使用:UltiSnipsExpandTrigger展开(在我的情况下为<c-l>).

After saving the file, the snippet does not apper on the list of YouCompleteMe nor is expanded with :UltiSnipsExpandTrigger (<c-l> in my case).

推荐答案

.vimrc 文件中添加let g:UltiSnipsSnippetDirectories=[$HOME.'/.vim/UltiSnips']使其可以工作.

Adding let g:UltiSnipsSnippetDirectories=[$HOME.'/.vim/UltiSnips'] to the .vimrc file makes it works.

这篇关于为什么UltiSnips无法识别我自己的片段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆