Open p00f opened 4 years ago
Copying the templates to ~/.config/nvim/plugged/vim-sonictemplate/template/java/
works fine
This should be work let g:sonictemplate_vim_template_dir='~/.config/nvim/template'
because the folder must be called template
https://github.com/mattn/vim-sonictemplate/blob/ccba4d71ed2d7603542ff94643b31e1781503cba/autoload/sonictemplate.vim#L17
Nope that doesn't work
It works for me .
b4acf10 2021-10-07T18:56:39+0900 Yasuhiro Matsumoto Add cmake
$ pwd
/home/myuser/.vim/sonictemplate/sh
$ ls
snip-cd.sh
$ cat snip-cd.sh
cd -P $(dirname $0)
$ vim foo.sh # not works
:echo g:sonictemplate_vim_template_dir
['~/.vim/sonictemplate']
:Template cd
Template cd is not exists.
:q
$ mv snip-cd.sh file-cd.sh
$ vim foo.sh # works?
:Template cd
cd -P $(dirname $0)
Probably, You have to expand()
like below
let g:sonictemplate_vim_template_dir = expand(~/.config/nvim/templates')
I had the same error, but it solved by put template into g:sonictemplate_vim_template_dir .. '/java/'
Directory structure should be
.
└── template
├── _
│ ├── file-LICENSE-apache.txt
│ ├── file-LICENSE-mit.txt
│ ├── file-LICENSE-pd.txt
│ └── file-LICENSE-zlib.txt
├── c
│ ├── base-main-gtk.c
│ ├── base-main.c
│ ├── base-socket-server.c
│ ├── snip-comment-block.c
│ ├── snip-for.c
│ ├── snip-win32-formaterror.c
│ └── wrap-if.c
├── changelog
│ ├── base-section
│ └── snip-section
├── clojure
│ ├── base-main.clj
│ └── file-project-base.clj
....
I have created a custom template
base-kickstart.java
in~/.config/nvim/templates
:and added
to
init.vim
. When I create a new file (:e test.java
) and then:Template
and press tab, I getkickstart
in the tab completion.However when I select it, I get
Template kickstart is not exists.