3

Is there a way to expand a UltiSnips snippet while in vim command-line mode? I can only expand a snippet in insert mode.

I am using UltiSnips to help inserting unicode characters. And I need to write these characters in the command-line for searching. I do not want to insert them using <C-v>u. I also prefer not to use digraphs.

  • Digraphs are made exactly for this purpose (IMO using snippets is a bit overkill to insert a single character). Why don't you want to use them? – statox Sep 13 '15 at 16:39
1

While I didn't achieve to trigger the completion from the command-line mode you can work this like this :

Prepare your command inside insert mode (or at least the part you cannot create from command-line mode). Yank it and insert it inside your command using <C-r> and the " register like so :

Insert Mode

tec<Tab>yiw

Commande-line Mode

:/<C-r>"

In command-line mode, there are only a set of word you can expand, for example : Command names, Tags, File names, ...

See : http://vimdoc.sourceforge.net/htmldoc/cmdline.html#cmdline-completion

  • I don't know how to use your answer, can you explain it further, please? E.g. I have a snippet ec that expands to ê and I use <Tab> key to expand snippets. In insert mode, I type tec<Tab> and get . In command-line mode to search, I type /tec<Tab> but get nothing. How do I use this :call UltiSnips#ExpandSnippetOrJump()? – Nasolo Andrianoelina Aug 14 '15 at 14:15
  • Oh ok I didn't understand your question, let me update my answer :) – nobe4 Aug 14 '15 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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