2

I have been trying to make UltiSnips work with VimWiki to no avail, as they share mappings for expand snippet/next link (on <tab>).

I tried setting VimWiki's bindings to something else by using the following, which sadly didn't work, as the snippets didn't expand:

" vimwiki plugin settings
filetype plugin on
let g:vimwiki_list = [{'path': '~/Wiki/', 'syntax': 'markdown', 'ext': '.md'}]
nmap <C-j> <Plug>VimwikiNextLink
nmap <C-k> <Plug>VimwikiPrevLink

" ultisnips plugin settings
let g:UltiSnipsSnippetsDir=$HOME.'/.vim/UltiSnips/'
let g:UltiSnipsSnippetDirectories=["UltiSnips"]

let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"

The link to my entire vimrc can be found here.

If I set UltiSnips' expand trigger to anything else (like <c-j>), it works without a problem, but I am quite used to expanding on <tab> from other apps that I use.

Is there anything I can do to fix this problem?

Thanks in advance!

2 Answers 2

1

I managed to fix my vimwiki ultisnippets by changing the vimwiki file extension to .mdvimwiki and registering it with @ranebrown the UltisnipsAddFiletypes tip.

I did not need the let g:vimwiki_table_mappings = 0.

This is what I added to my vim.init:

autocmd FileType mdvimwiki UltiSnipsAddFiletypes vimwiki

" use my custom folder, markdown syntax and custom extension
let g:vimwiki_list = [{'path': '~/.config/mynotes/',
                    \ 'syntax': 'markdown', 'ext': '.mdvimwiki'}]
0

The solution to this issue can be found in this thread.

The only thing one has to do is to add this line to ~/.vimrc, which allows to both use Tab in normal mode to cycle through links, and to expand links in Insert mode:

let g:vimwiki_table_mappings = 0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.