[英]Get Vimwiki working with SnipMate (the vim plugins)
My issue is that <Tab>
completion for SnipMate does not work when I'm in a vimwiki file. 我的问题是,当我在vimwiki文件中时,SnipMate的
<Tab>
完成不起作用。 I am testing by typing APACHE<Tab>
in insert mode, but I don't get the snippet as I do when I'm in, say, .vimrc
. 我在插入模式下键入
APACHE<Tab>
进行测试,但是当我进入.vimrc
时,我没有像我那样得到代码片段。
And even though i_<Tab>
doesn't work in a vimwikie file, i_<CR><Tab>
does. 即使
i_<Tab>
在vimwikie文件中不起作用, i_<CR><Tab>
也可以。 I get a list of available snippets. 我得到了一个可用的片段列表。 Strange.
奇怪。
To make it stranger (well, to me at least), here's the partial output of :imap
in a vimwiki file: 为了让它更陌生(至少对我来说),这里是vimwiki文件中的部分输出
:imap
:
i <Tab> * <C-G>u<C-R>=snipMate#TriggerSnippet()<CR>
i <C-R><Tab> * <C-R>=snipMate#ShowAvailableSnips()<CR>
I think these are correct, and in other files where <Tab>
completion does work, the mappings are the same. 我认为这些是正确的,并且在
<Tab>
完成确实起作用的其他文件中,映射是相同的。
oh, and in case you are thinking to suggest putting let g:vimwiki_table_auto_fmt = 0
in my .vimrc
as suggested in http://code.google.com/p/vimwiki/wiki/ChangeLog , I tried it and it doesn't solve my problem. 哦,如果你
let g:vimwiki_table_auto_fmt = 0
建议按照http://code.google.com/p/vimwiki/wiki/ChangeLog中的建议在我的.vimrc
放置let g:vimwiki_table_auto_fmt = 0
,我试过了它并没有解决我的问题。 That's the only suggestion I found in my search, so that's why I'm here. 这是我在搜索中找到的唯一建议,所以这就是我在这里的原因。
I don't know how much of my .vimrc
you would want, so I'm just going to give you the ones I think are relevant to keep this question short: 我不知道你想要多少我的
.vimrc
,所以我只想给你一些我认为与这个问题保持一致的相关内容:
" Vundle: The plugin manager for vim.
set runtimepath+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
" SnipMate: TextMate snippets for vim.
Bundle "MarcWeber/vim-addon-mw-utils"
Bundle "tomtom/tlib_vim"
Bundle "honza/snipmate-snippets"
Bundle "garbas/vim-snipmate"
" Vimwiki: A personal wiki for vim.
Bundle 'vim-scripts/vimwiki'
let g:vimwiki_hl_headers = 1
let g:vimwiki_hl_cb_checked = 1
let g:vimwiki_folding = 1
let g:vimwiki_fold_lists = 1
let s:vimwiki = {}
let s:vimwiki.path = '~/Vimwiki/wiki'
let s:vimwiki.path_html = '~/Vimwiki/html'
let s:vimwiki.ext = '.md'
let s:vimwiki.syntax = 'markdown'
let s:vimwiki.maxhi = 1
let s:vimwiki.diary_rel_path = 'Journal/'
let s:vimwiki.diary_index = 'index'
let s:vimwiki.diary_header = 'Journal'
let s:vimwiki.diary_sort = 'asc'
let g:vimwiki_list = [s:vimwiki]
Thanks 谢谢
Edit: 编辑:
I don't know why I forgot about this while writing the above. 我不知道为什么在写这些内容时我忘记了这一点。 The output of
:imap
above is incomplete. 上面的输出
:imap
不完整。 It also shows: 它还显示:
i <Tab> *@vimwiki#tbl#kbd_tab()
Regardless of the value of g:vimwiki_table_auto_fmt
. 无论
g:vimwiki_table_auto_fmt
的值g:vimwiki_table_auto_fmt
。 It's probably the source of my problem.. and if so I'd like to get rid of it from .vimrc
somehow. 它可能是我的问题的根源..如果是这样的话我想以某种方式从
.vimrc
删除它。
The @
in the :imap
output shows that Vimwiki defines a buffer-local <Tab>
mapping that overrides snipMate's global one. :imap
输出中的@
表示Vimwiki定义了一个缓冲区本地<Tab>
映射,它覆盖了snipMate的全局映射。 A 一种
:iunmap <buffer> <Tab>
should fix that. 应该解决这个问题 You can put that command into
~/.vim/after/ftplugin/vimwiki.vim
to make it permanent. 您可以将该命令放入
~/.vim/after/ftplugin/vimwiki.vim
以使其永久化。 But apparently Vimwiki allows customization: 但显然Vimwiki允许定制:
" Table mappings
if g:vimwiki_table_mappings
inoremap <expr> <buffer> <Tab> vimwiki#tbl#kbd_tab()
inoremap <expr> <buffer> <S-Tab> vimwiki#tbl#kbd_shift_tab()
endif
So, :let g:vimwiki_table_mappings = 0
in your .vimrc should work, too. 所以,
:let g:vimwiki_table_mappings = 0
你的.vimrc中的:let g:vimwiki_table_mappings = 0
也可以。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.