Snippets are incredibly useful in the process of going from _though to code_ as quickly as possible.
The goal is for Oni to have snippets support, and a native UX. UltiSnips is the de-facto standard for snippets in the Vim world, and as opposed to waiting for #55, it might be better to bring in UltiSnips so that snippet support can work out-of-the-box today.
UltiSnips has an anonymous snippet capability, which may allow some interesting bridging from Oni <-> snippets (ie, the _js interpolation_ feature).
In any case, any snippet functionality Oni has would need to support the use cases UltiSnips has today.
UltiSnips is the first dependency that we'd bundle that would have a Python dependency.
Linux and OSX would mostly work out-of-the-box, since python is installed - but issues like #649 may need to be addressed if python is in a non-standard path.
For Windows, python doesn't come standard - so we'd have to bundle a standalone python with Oni. We could unpack this during install, but not include it in the system path so as not to conflict with other installed Python dependencies.
If snippet support would require extra dependencies, how about we make it an external plugin instead? I know snippets aren't nearly as heavyweight or niche as C# but I like the idea of making the "heavy" features optional so users don't need to pull in (e.g.) python if they just want to use Oni as a text editor.
Would be interested in knowing what needs to be done for this. Lack of snippets is driving me a tad insane recently with boilerplate 馃槀
@MikaAK you can use it right now as normal vim plugin without problems, this ticket is more for bundling it with Oni and deeper integration I believe
Oh interesting, I do have it enabled but am unable to get it to work. The snippets don't expand when using my snip expansion command.
I've set
let g:UltiSnipsExpandTrigger='<shift-c-e>' I normally use <m-e> but that didn't seem to work either so I tried switching it up. I came from macvim and just brought my config over. Not sure if there's oni specifics that I need
"--------------------
" ultisnips
"--------------------
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
"
" ATTENTION: don't map this to keys which are the first part of a 'two part'
" command. E.g. don't map to `<c-g>` because `g` is part of `gt`, `gT`, ...
" This will slow down jupming between tab stops, but only when 'vim-surround'
" is installed.
let g:UltiSnipsExpandTrigger="<c-j>"
let g:UltiSnipsJumpForwardTrigger="<c-j>"
let g:UltiSnipsJumpBackwardTrigger="<c-h>"
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"
let g:UltiSnipsSnippetDirectories=["mysnippets", "copiedsnippets"]
this works fine for me.
@MikaAK Does it work for you yet? I have a similar problem. If yes could you please share a config.js along with init.vim?
I haven't been able to get it working @Miszo97, @hoschi are there extra steps you needed to take?
After talking with @Miszo97 it probably wasn't clear that the snippets are not in the completion popup, but expanding works. I did nothing additional when switching from nvim to Oni @MikaAK .
Actually I did notice that my snippets do work, for some reason the <M-e> doesn't work however this might need investigation. I've tried to unbind it and yet still that combo deletes one character back and moves my cursor down a line.
I also wonder if there's a way to add it to completion as remembering all of ones snippets is a PITA, @bryphe any recommendations?
there is #1284
@bryphe has this vscode-snippet-parser the same feature set as UltiSnips? The README.md of the corresponding repo is pretty empty and I never used VSCode.
@bryphe has this vscode-snippet-parser the same feature set as UltiSnips? The README.md of the corresponding repo is pretty empty and I never used VSCode.
Ya, sorry for the bare repo - it's just extracting out the snippet parsing logic from VSCode. VSCode's snippet parsing handles TextMate snippets / variables. It's a similiar feature set to UltiSnips, except no python interpolation (I'd like to add javascript interpolation later). The snippet 'session' management is custom though, as managing selection is different in Oni/Neovim vs VSCode.
We have built-in snippet integration now. However, it uses the VSCode/TextMate format, and doesn't recognize UltiSnips today. I created #1735 to track implementing an UltiSnips provider.
Let's make sure ultisnips is not loaded if snippets are disabled.
@bryphe It seems having a provider implemented instead of bundling UltiSnips with Oni is the direction you want to go. Unless I understood incorrectly, let's close this one and track progress on #1735
Most helpful comment
If snippet support would require extra dependencies, how about we make it an external plugin instead? I know snippets aren't nearly as heavyweight or niche as C# but I like the idea of making the "heavy" features optional so users don't need to pull in (e.g.) python if they just want to use Oni as a text editor.