1

I have configured UltiSnips for vim as described in the documentation of UltiSnips

" Track the engine.
 Plugin 'SirVer/ultisnips'

" Snippets are separated from the engine. Add this if you want them:
Plugin 'honza/vim-snippets'

" Trigger configuration. Do not use <tab> if you use 
 https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"

" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"

Except that I am using vim-plug and the directory for the plugins is ~/.vim/bundle.

My problem is that it seems as if my snippets won't get triggered every time. I have a test snippet in my all.snippets which I can't execute. But I have added another trigger in my html.snippets which I can execute in html files. I then tried to save a snippet in the vim.snippets which again cannot get executed or triggered. Is there another thing I have to configure?

Although I have added let g:UltiSnipsEditSplit="vertical" to my .vimrc, it just does not want to start my /ultisnips/<filetype>.snippets in a vertical window it always starts in a seperate vim buffer.^

Edit:
Here is my real .vimrc

call plug#begin('~/.vim/bundle')

Plug 'honza/vim-snippets'

Plug 'lervag/vimtex'
let g:tex_flavor='latex'
let g:vimtex_view_method='zathura'
let g:vimtex_quickfix_mode=0
set conceallevel=1
let g:tex_conceal='abdmg'

Plug 'SirVer/ultisnips'
let g:UltiSnipsExpandTrigger='<tab>'
let g:UltiSnipsJumpForwardTrigger='<tab>'
let g:UltiSnipsJumpBackwardTrigger='<s-tab>'
let g:UltiSnipsEditSplit='vertical'

call plug#end()

I have created an html file and added some snippets for html files. These snippets work. Then when I try to add some snippets to my all.snippets file which should be executed no matter in what kind of file I am, if I get that correctly. But this is not the case. Only one snippet file seems to work.

I have found out something about this problem: My test html file is in ~/Projects/learn_vim/testing.html. When I use the :UltiSnipsEdit command, it does not place the html.snippets file where it is usually placing my snippet files: it placed it at this location: ~/Projects/learn_vim/UltiSnips/. And this file seems to work.

So I checked it further and it actually seems like it always creates an folder in the directory I am in with the snippet files. Could I just define one place for all my snippets?

Also I have found out what my "vertical" problem was, see my .vimrc :)

Thank you for the patience

Hotschke
  • 4,740
  • 26
  • 37
Helmut K.
  • 11
  • 2
  • 2
    Please include exactly your code, and not something close to it, unless its an MCVE. Please clarify “snippets wont get triggered every time [sic]” and “it always starts in a separate vim buffer.” Using the [edit] button to spruce up your question with these details will dramatically increase the chance that someone is able to help you. – D. Ben Knoble Mar 26 '19 at 22:02
  • Also see https://vi.stackexchange.com/q/2003/10604 – D. Ben Knoble Mar 26 '19 at 22:02
  • Does it make any difference if you define the g:___ options before calling Plugin? – joeytwiddle Mar 27 '19 at 03:39
  • Do not mix several issues into one question. The "vertical" problem has nothing to do with the original problem. Could you post your runtimepath value for the filetypes it does not work (:set rtp?) which UltiSnips uses to find directories with snippets definitions. You find all the details about this under [`:help UltiSnips-how-snippets-are-loaded](https://github.com/SirVer/ultisnips/blob/6fdc3647f72e0a1f321ea6bd092ecd01f7c187ba/doc/UltiSnips.txt#L523-L585). – Hotschke Mar 28 '19 at 07:17

0 Answers0