Closed erlonbie closed 2 years ago
The source name in your second screenshot is ultisnisp
, is that typo only in that screenshot or also in your configuration? :smile:
The source name in your second screenshot is
ultisnisp
, is that typo only in that screenshot or also in your configuration? smile
Yes it is 😆, but it dit not resolve the issue 🥲
do I need to require/import honza/vim-snippets
somewhere in my cmp configuration other than the plugins file?
do I need to require/import
honza/vim-snippets
somewhere in my cmp configuration other than the plugins file?
No, you only need to add it to your list of plugins. The snippets should be imported by UltiSnips automatically.
Can you share the output of :call UltiSnips#ListSnippets()
?
1: (#if) "#if #endif" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/c.snippets:43) 2: (#ifndef) "#ifndef ... #define ... #endif" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/c.snippets:37) 3: (.) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:372) 4: (AGPL) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/.snippets:265) 5: (AGPL3) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/.snippets:86) 6: (APACHE) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/.snippets:219) 7: (BEERWARE) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/.snippets:235) 8: (BSD2) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/.snippets:112) 9: (BSD3) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/.snippets:140) 10: (BSD4) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/.snippets:167) 11: (GMGPL) linking exception (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/.snippets:103) 12: (GPL2) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/.snippets:18) 13: (GPL3) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/.snippets:52) 14: (ISC) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/.snippets:281) 15: (Inc) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:22) 16: (LGPL2) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/.snippets:35) 17: (LGPL3) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/.snippets:69) 18: (MIT) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/.snippets:197) 19: (MPL2) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/.snippets:260) 20: (WTFPL) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/.snippets:244) 21: (af) auto function (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:220) 22: (amsp) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:65) 23: (amup) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:70) 24: (anl) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:342) 25: (ans) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:153) 26: (array) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:13) 27: (asm) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:375) 28: (asr) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:339) 29: (bbox) "A nice box over the full width" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/all.snippets:34) 30: (beginend) "$1.begin(), $1.end() (beginend)" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/cpp.snippets:47) 31: (binc) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:8) 32: (boost_suite) "Boost test suite module" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/cpp.snippets:136) 33: (boost_suite_fixture) "Boost test suite with fixture" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/cpp.snippets:167) 34: (boost_test) "Boost test module" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/cpp.snippets:125) 35: (boost_testfixture) "Boost test module with fixture" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/cpp.snippets:150) 36: (box) "A nice box with the current comment symbol" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/all.snippets:22) 37: (c)) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/.snippets:4) 38: (case) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:108) 39: (cca) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:177) 40: (cin) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:163) 41: (cl) "class .. (class)" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/cpp.snippets:51) 42: (cla) "An entire .h generator" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/cpp.snippets:93) 43: (clc) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:349) 44: (clcd) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:358) 45: (cout) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:160) 46: (date) "YYYY-MM-DD" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/all.snippets:82) 47: (datetime) "YYYY-MM-DD hh:mm" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/all.snippets:98) 48: (dca) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:171) 49: (ddate) "Month DD, YYYY" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/all.snippets:86) 50: (def) "#define ..." (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/c.snippets:33) 51: (deque) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:19) 52: (dfun0) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:151) 53: (dfun1) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:169) 54: (dfun2) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:188) 55: (dfun3) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:208) 56: (diso) "ISO format datetime" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/all.snippets:90) 57: (dmfun0) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:113) 58: (dmfun1) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:124) 59: (dmfun2) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:136) 60: (do) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:132) 61: (el) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:76) 62: (eli) "else if .. (eli)" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/c.snippets:108) 63: (elif) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:81) 64: (enum) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:251) 65: (flist) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:22) 66: (fnc) "Basic c++ doxygen function template" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/cpp.snippets:111) 67: (fold) "Insert a vim fold marker" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/all.snippets:48) 68: (foldc) "Insert a vim fold close marker" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/all.snippets:52) 69: (foldp) "Insert a vim fold marker pair" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/all.snippets:56) 70: (for) "for loop (for)" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/c.snippets:66) 71: (fora) "for-loop" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/c.snippets:78) 72: (forc) "general for loop (for)" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/cpp.snippets:41) 73: (fore) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:187) 74: (fori) "for int loop (fori)" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/c.snippets:72) 75: (forr) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:122) 76: (fpr) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:272) 77: (fprintf) "fprintf ..." (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/c.snippets:104) 78: (fr) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:84) 79: (fre) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:361) 80: (fun) "function" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/c.snippets:125) 81: (fun0) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:145) 82: (fun1) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:163) 83: (fun2) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:182) 84: (fun3) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:202) 85: (func) "Function Header" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/c.snippets:165) 86: (fund) "function declaration" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/c.snippets:132) 87: (getopt) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:281) 88: (head) "File Header" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/c.snippets:153) 89: (if) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:65) 90: (ifdef) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:33) 91: (ife) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:69) 92: (ifi) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:86) 93: (inc) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:19) 94: (incc) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:6) 95: (iter) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:192) 96: (itera) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:198) 97: (ld) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:205) 98: (list) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:25) 99: (lld) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:208) 100: (lorem) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/_.snippets:16) 101: (main) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/cpp.snippets:33) 102: (mainn) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:10) 103: (map) "std::map (map)" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/cpp.snippets:81) 104: (mark) "#pragma mark (mark)" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/c.snippets:49) 105: (mfun) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:108) 106: (mlc) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:346) 107: (mlcd) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:355) 108: (mmap) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:37) 109: (modeline) "Vim modeline" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/all.snippets:75) 110: (mset) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:34) 111: (msp) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:63) 112: (mu) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:87) 113: (mup) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:68) 114: (ndef) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:25) 115: (nocxx) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:52) 116: (ns) "namespace .. (namespace)" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/cpp.snippets:63) 117: (once) "Include header once only guard" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/c.snippets:88) 118: (pqueue) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:58) 119: (pr) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:269) 120: (prd) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:274) 121: (prf) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:276) 122: (pri) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:75) 123: (pro) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:78) 124: (prx) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:278) 125: (pub) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:81) 126: (queue) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:55) 127: (rca) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:174) 128: (readfile) "read file (readF)" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/cpp.snippets:70) 129: (ret) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:112) 130: (rlc) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:352) 131: (sca) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:168) 132: (set) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:28) 133: (st) "struct" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/c.snippets:119) 134: (stack) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:52) 135: (switch) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:92) 136: (switchndef) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:101) 137: (t) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:89) 138: (td) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:228) 139: (tde) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:258) 140: (tds) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:241) 141: (time) "hh:mm" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/all.snippets:94) 142: (todo) "TODO comment" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/all.snippets:102) 143: (tp) "template <typename ..> (template)" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/cpp.snippets:89) 144: (try) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:213) 145: (umap) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:43) 146: (ummap) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:49) 147: (umset) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:46) 148: (uset) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/cpp.snippets:40) 149: (uuid) "Random UUID" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/all.snippets:109) 150: (vector) "std::vector (v)" (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/UltiSnips/cpp.snippets:85) 151: (wh) (/home/erlonbie/.local/share/nvim/site/pack/packer/start/vim-snippets/snippets/c.snippets:127)
It was a typo at all... ðŸ«
ultisnisp
to ultisnip
(but I forgot the s at the end), so the final one is ultisnips
Sorry for taking your time
My new issue is that I can't get the preview of the snippet, i can only see it's discription. I saw some PRs from the end of last year providing this functionality, but I don't know if that should be the default behavior.
If this change of subject is not aproprieated, I can create a new issue asking for this
thanks in advance!
Sorry for taking your time
No worries, I'm happy to help :) Glad that it's working now for you!
My new issue is that I can't get the preview of the snippet, i can only see it's discription.
That sounds like the ghost_text
feature in nvim-cmp. You can enable it like this:
require("cmp").setup {
sources = {
-- ...
},
-- Add the next three lines to your nvim-cmp setup code
experimental = {
ghost_text = true,
},
}
That sounds like the
ghost_text
feature in nvim-cmp. You can enable it like this:
It's not exactly ghost text, it's the snippet preview, the part that I can see something like this: for $1; $1 < $2
and so on
Oh, nvm I should have looked at your screenshot... You can do this by customizing the documentation
key in the setup (see readme for details). Can you add the following to your config?
require("cmp_nvim_ultisnips").setup {
documentation = function(snippet)
return snippet.value
end
}
Or maybe you'd prefer this one:
require("cmp_nvim_ultisnips").setup {
documentation = function(snippet)
return snippet.description .. "\n\n" .. snippet.value
end
}
Now it all makes sense, thank you so much @smjonas !
Hi, I've checked a lot of issues before creating this one, although it is related to some.
I'm using
honza/vim-snippets
withUltiSnips
this is what I'm sourcing in
cmp.setup
Some snippets do not show in the cmp list, I don't know why, but I still can expand them somehow, for example:
if I type "fore", press escape then press "a" (to the end of the word) and press "tab", it expands to a foreach loop. This is valid for any other snippet that does not appear in the list but exists in
honza/vim-snippets
(If it is not clear, I can post a clip showing this behavior)The image bellow is showing neovim (top) and vim (bottom), both using the same snippets
I don't mind showing different things between neovim and vim, as long the snippets shown are the same