I am investigating the minisnip plug in and I thought I would use it to learn some vimscript as well.
Since minisnip doesn't use file extensions for its snippets, it defines a global path for them (g:minisnip_dir).
I created the following ftdetect file:
" get the snippets directory
let snippet_dir = expand(g:minisnip_dir) . "*"
execute 'autocmd BufRead,BufNewFile ' . snippet_dir . ' set filetype=minisnip'
macOS:
works as is
Windows:
I have to add to following in my vimrc for it to work:
let g:minisnip_dir = '/path/to/minisnip'
Someone else testing gets the following error:
Error detected while processing /home/joe/.config/nvim/plugged/vim-minisnip/ftdetect/minisnip.vim:
line 11:
E121: Undefined variable: g:minisnip_dir
E116: Invalid arguments for function expand
E15: Invalid expression: expand(g:minisnip_dir) . "**/*"
line 13:
E121: Undefined variable: snippet_dir
E15: Invalid expression: 'autocmd BufRead,BufNewFile ' . snippet_dir . ' set filetype=minisnip'
Press ENTER or type command to continue
If I do:
:let snippet_dir = expand(g:minisnip_dir) . "*"
:echo snippet_dir
It expands to the correct directory in ALL of the cases. :(
So I am stumped.
Help?
Thanks!
Bob
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment