configuring ultisnips

Took 3 hours ish to finally configure ultisnips. Not sure why everything is difficult. In vim I can now press <leader>ue and an ultisnips edit window will vertically split to the left.

WTF IS ULTISNIPS?

Ultisnips allows vim to have code snippets.

http://vimcasts.org/episodes/meet-ultisnips/

Installation

https://github.com/SirVer/ultisnips

Configuration #1: by default, ultisnips saves the snips in the wrong directory… it was saving the snips in my local project…

I want my snips to be global, not on a project based.

Stackoverflow question with answer to fix Configuration #1

Configuration #2: YouCompleteMe and Ultisnips need to play nicely together

http://stackoverflow.com/questions/14896327/ultisnips-and-youcompleteme

also add that into your vimrc file. <leader>k to go the the back

Configuration #3: When creating a new snip, Ultisnips takes over the current window which is almost NEVER what I want…

Add this to your $MYVIMRC

" vertically split ultisnips edit window
let g:UltiSnipsEditSplit="vertical"

Create New Snips

  1. Open the file type you want to create a snip for
  2. :UltiSnipsEdit

example snip –

snippet fmatter
---
title: $1
date: ${2:`date +%Y/%m/%d` 07:30 MST}
tags: ${3: coding}
---

$0
endsnippet

Add this to your $MYVIMRC file

"Open UltiSnips edit function
nmap <leader>ue :UltiSnipsEdit<cr>

or open with :UltiSnipsEdit

Post Content