[英]VIm snipmate <TAB> auto completion not working
This is the first time 'm trying snipmate with VIm 7.3 in ubuntu 12.04 . 这是第一次“M在Ubuntu 12.04与VIM 7.3试图snipmate。
.vimrc
configuration is : 我的.vimrc
配置是 : " kill vi compatibility
set nocompatible " be iMproved
" -------------------------------------
" ---------snipmate--------------------
" -------------------------------------
Bundle "MarcWeber/vim-addon-mw-utils"
Bundle "tomtom/tlib_vim"
Bundle "honza/vim-snippets"
Bundle "garbas/vim-snipmate"
" -------------------------------------
filetype plugin on
I believe thats all I want followed by :BundleInstall
. 我相信这就是我想要的,然后是:BundleInstall
。
The tree structure of my .vim/bundle
is 我的.vim/bundle
的树结构是
prayag@prayag:~$ tree -d .vim/bundle/
.vim/bundle/
|-- vim-colors-solarized
| |-- autoload
| |-- bitmaps
| |-- colors
| `-- doc
|-- vim-snipmate
| |-- after
| | `-- plugin
| |-- autoload
| |-- doc
| |-- ftplugin
| |-- plugin
| `-- syntax
|-- vim-snippets
| |-- UltiSnips
| |-- autoload
| `-- snippets
| |-- coffee
| `-- javascript
`-- vundle
|-- after
| |-- ftplugin
| `-- plugin
|-- autoload
| `-- vundle
|-- doc
|-- ftplugin
|-- plugin
|-- syntax
`-- test
`-- files
139 directories
main
snippet, 但是,当我尝试一些Java代码来测试main
代码段时, $ vi App.java
main
After pressing <TAB>
gives me following result/error 按<TAB>
,出现以下结果/错误
main<Plug>snipMateNextOrTrigger
:verbose imap <Plug>snipMateNextOrTrigger
gives me :verbose imap <Plug>snipMateNextOrTrigger
给了我 No mapping found
finish
section commented in plugin/snipMate.vim
, :verbose imap <Plug>snipMateNextOrTrigger
gives me following information, 在plugin/snipMate.vim
注释了finish
部分, :verbose imap <Plug>snipMateNextOrTrigger
给了我以下信息, i <Plug>snipMateNextOrTrigger * <C-R>=snipMate#TriggerSnippet()<CR>
Last set from ~/.vim/bundle/vim-snipmate/plugin/snipMate.vim
and On pressing <TAB>
然后按<TAB>
Error detected while processing /home/prayag/.vim/bundle/vundle/autoload/snipMate.vim:
line 15:
E122: Function <SNR>84_RemoveSnippet already exists, add ! to replace it
.vimrc
, 我在.vimrc
进行以下配置时得到的结果/错误相同, :imap <C-J> <Plug>snipMateNextOrTrigger
:smap <C-J> <Plug>snipMateNextOrTrigger
Same configuration worked fine for another ubuntu 13.04 machine. 对于另一台ubuntu 13.04机器,相同的配置工作正常。
I must be doing something wrong but couldn't figure it out. 我一定做错了,但无法弄清楚。
Vim: snipMate plug-in does not trigger snippet completion Vim:snipMate插件不会触发代码段完成
First of all, I suggest that you remove :set nocompatible
from your vimrc file. 首先,我建议您从vimrc文件中删除:set nocompatible
。 Vim automatically resets the 'cp'
option if it finds a personal vimrc file (not a system vimrc file) on startup, and if you ever :source ~/.vimrc
then it can have confusing results. 如果Vim在启动时发现了个人vimrc文件(而不是系统vimrc文件),并且如果您:source ~/.vimrc
它会产生令人困惑的结果,则Vim会自动重置'cp'
选项。
A complete answer to your question would be a very large troubleshooting flowchart. 对于您的问题的完整答案将是非常大的故障排除流程图。 That would be a good thing to have, but I am not going to work that hard. 那将是一件好事,但我不会那么努力。 Here is a summary of the conversation we had in the comments to diagnose this problem. 这是我们在评论中用于诊断此问题的对话的摘要。
I have snipMate installed, but when I enter
"main<Tab>"
in Insert mode, I get"main<Plug>snipMateNextOrTrigger"
. 我已经安装了snipMate ,但是当我在“插入”模式下输入"main<Tab>"
时,会出现"main<Plug>snipMateNextOrTrigger"
。
What do :verbose imap <Tab>
and :verbose set cpo?
:verbose imap <Tab>
和:verbose set cpo?
tell you? 告诉你? Check :version
for the "<size> version", where <size> is one of Tiny, Small, Big, Huge (I may be missing some). 检查:version
以获取“ <size>版本”,其中<size>是Tiny,Small,Big,Huge(我可能会缺少一些)之一。 (The problem may be how <Tab>
is mapped, or you may be in compatible mode, or your version of vim may not support maps or may not support the <Tab>
notation in maps.) (问题可能是<Tab>
的映射方式,或者您处于兼容模式,或者您的vim版本可能不支持映射,或者可能不支持映射中的<Tab>
表示法。)
":verbose imap <Tab>"
shows that "<Tab>"
is mapped to"<Plug>snipMateNextOrTrigger"
in"~/.vim/bundle/vim-snipmate/after/plugin/snipMate.vim"
, and the other stuff looks right.":verbose imap <Tab>"
显示“<Tab>"
映射到"~/.vim/bundle/vim-snipmate/after/plugin/snipMate.vim"
"<Plug>snipMateNextOrTrigger"
以及其他内容看起来不错。
How about :verbose imap <Plug>snipMateNextOrTrigger
? :verbose imap <Plug>snipMateNextOrTrigger
怎么:verbose imap <Plug>snipMateNextOrTrigger
? (The problem seems to be that <Tab>
is mapped to something; that something is supposed to be remapped, but it is not.) (问题似乎是<Tab>
映射到某个对象;应该重新映射某个对象,但事实并非如此。)
":verbose imap <Plug>snipMateNextOrTrigger"
gives me "No mapping found".":verbose imap <Plug>snipMateNextOrTrigger"
给了我“找不到映射”。
That is the problem. 那就是问题所在。 The file plugin/snipMate.vim contains the line inoremap <silent> <Plug>snipMateNextOrTrigger <CR>=snipMate#TriggerSnippet()<CR>
. 文件plugin / snipMate.vim包含inoremap行inoremap <silent> <Plug>snipMateNextOrTrigger <CR>=snipMate#TriggerSnippet()<CR>
。 Either you do not have that file, it is missing that line, or it is not being :source
d when vim starts up. 您可能没有该文件,或者该行丢失了,或者在vim启动时不是:source
d。 Or maybe the variable loaded_snips
is defined somewhere else. 或者,也许在其他地方定义了变量loaded_snips
。 Look at the file, check :scriptnames
right after starting vim, and search for "loaded_snips" in your other startup files. 查看文件,在启动vim后立即检查:scriptnames
,然后在其他启动文件中搜索“ loaded_snips”。 I guess there are other possibilities, too, like :imapclear
, but that seems unlikely. 我想还有其他可能性,例如:imapclear
,但这似乎不太可能。
The file is there, and has the right line. 该文件在那里,并在右行。 (At first I looked at "after/plugin/snipMate.vim" instead of "plugin/snipMate.vim".) I checked ":scriptnames" and it is listed. (起初,我查看的是“ after / plugin / snipMate.vim”,而不是“ plugin / snipMate.vim”。)我检查了“:scriptnames”并列出了它。 I did not check for other files defining "loaded_snips", but I commented out 我没有检查定义“ loaded_snips”的其他文件,但我注释掉了
if exists('loaded_snips') || &cp || version < 700
finish
endif
and got an error from "snipMate.vim" in another directory. 并从另一个目录中的“ snipMate.vim”获得错误。 I removed that file, re-installed snipMate, and now it works. 我删除了该文件,重新安装了snipMate,现在它可以工作了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.