Closed lx93uv closed 6 years ago
Command :UltiSnipsEdit
opens plaintext.snippet
.
@lx93uv The same thing happened for me until my tex file actually had a preamble, at which point :UltiSnipsEdit
opened the appropriate tex.snippet
@chrisrytting in my case it creates $PROJECT/UltiSnips/plaintext.snippets (per project) file.
in my case it creates $PROJECT/UltiSnips/plaintext.snippets (per project) file.
That's because
let g:UltiSnipsSnippetDirectories=$HOME.'/.vim/snippets'
is defined wrong in your vim config. First of all snippets
directory name is reserved for snipMate snippets. Second, it should be list:
let g:UltiSnipsSnippetDirectories=[$HOME.'/.vim/UltiSnips']
Command :UltiSnipsEdit opens plaintext.snippet.
Correct me if I'm wrong, but it opens plaintex.snippets
, not plaintext.snippets
. Plaintex is selected when file is empty on open, but contains .tex
extension. However if tex file contains preamble, vim deduces it as tex
filetype. Therefore snippets will work, because, they are defined for tex
filetype.
The same situation occurs if you will open empty file script.txt
in vim. It will be opened with text
filetype. But if you add #!/bin/bash
to the begining of this file, save it, and reopen, Vim will detect header, and switch to sh
filetype, despite the fact that file has .txt
extension. That's useful because most of files in linux are not containing extensions, and because vim need to know what type of file it opens, to use filetype indent and other ft features, it deduces fyletype from file contents.
I'm closing it, since it is not a bug.
As a workaround I can suggest creating an plaintex.snippets
file, which contains standard Ultisnips facility - extends tex
. Maybe it should be suggested to https://github.com/honza/vim-snippets as PR. I'm not LaTeX vim expert, so i don't know, maybe plaintex and tex are very different, and should use different snippets.
Snippets doesn't expanded with
tex
file format.vim 8
,vim-plug
I am trying to add custom snippets; here is my
.vimrc
excerpt (without extra snippets collection plugins):ultisnips
starts works only after executionUltiSnipsAddFiletypes tex
. With other file types it works ok.I had also check this with
honzo
plugin.