Skip to main content

Making UltiSnips work with VimWiki

A quick solution to make UltiSnips work properly with VimWiki by adjusting key mappings.

Introduction

When working with Vim as your text editor, plugins like VimWiki and UltiSnips can significantly enhance your productivity. VimWiki transforms Vim into a personal wiki system, while UltiSnips provides powerful snippet functionality. However, these two excellent tools don't always play nicely together out of the box.

This quick guide addresses a common issue: UltiSnips snippets failing to expand when editing VimWiki files.

Prerequisites

  • Vim with VimWiki and UltiSnips plugins installed
  • Basic familiarity with Vim configuration

The problem

When trying to use UltiSnips snippets within VimWiki files, the snippets don't expand as expected. This happens because VimWiki and UltiSnips have conflicting key mappings that prevent UltiSnips from triggering properly in VimWiki contexts.

Note

This issue has been documented in the VimWiki GitHub repository as issue #357: ["How to make vimwiki works with UltilSnips?"](https://github.com/vimwiki/vimwiki/issues/357)

The solution

The fix is surprisingly simple and requires just a small adjustment to your Vim configuration. Add the following line to your vimrc file:

let g:vimwiki_key_mappings = { 'table_mappings': 0, }

This configuration disables VimWiki's table mappings, which conflict with UltiSnips' trigger keys, allowing both plugins to coexist peacefully.

Conclusion

With these simple changes, you can enjoy the powerful combination of VimWiki for knowledge management and UltiSnips for efficient text insertion. This small configuration tweak demonstrates how minor adjustments can resolve conflicts between Vim plugins, allowing you to build a customized editing environment tailored to your workflow.

For more Vim productivity tips, check out our other articles on text editor customization and workflow optimization.