- g:neosnippet#snippets_directory allows list.

This commit is contained in:
Shougo Matsushita 2013-11-12 17:31:06 +09:00
parent a21e139296
commit 294bcf2ff0
3 changed files with 11 additions and 8 deletions

View File

@ -31,7 +31,7 @@ set cpo&vim
call neosnippet#util#set_default(
\ 'g:neosnippet#disable_runtime_snippets', {})
call neosnippet#util#set_default(
\ 'g:neosnippet#snippets_directory', '')
\ 'g:neosnippet#snippets_directory', [])
call neosnippet#util#set_default(
\ 'g:neosnippet#disable_select_mode_mappings', 1)
call neosnippet#util#set_default(
@ -1360,7 +1360,7 @@ function! s:initialize_script_variables() "{{{
" Set snippets_dir.
let s:snippets_dir = []
for dir in split(g:neosnippet#snippets_directory, '\s*,\s*')
for dir in neosnippet#util#option2list(g:neosnippet#snippets_directory)
let dir = neosnippet#util#expand(dir)
if !isdirectory(dir) && !neosnippet#util#is_sudo()
call mkdir(dir, 'p')

View File

@ -1,7 +1,7 @@
"=============================================================================
" FILE: util.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 26 Sep 2013.
" Last Modified: 12 Nov 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@ -117,6 +117,9 @@ function! neosnippet#util#is_sudo() "{{{
\ && $HOME ==# expand('~'.$SUDO_USER)
endfunction"}}}
function! neosnippet#util#option2list(str) "{{{
return type(a:str) == type('') ? split(a:str, '\s*,\s*') : a:str
endfunction"}}}
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@ -129,8 +129,8 @@ VARIABLES *neosnippet-variables*
g:neosnippet#snippets_directory *g:neosnippet#snippets_directory*
This variable appoints a path to user-defined snippet files.
You can set multiple values in comma-separated form. Non
existing directories are ignored.
You can set multiple values in comma-separated string or list.
Non existing directories are ignored.
User defined snippet files are read after the built-in snippet
files. If redundant snippets occur they get overwritten and
@ -141,10 +141,10 @@ g:neosnippet#snippets_directory *g:neosnippet#snippets_directory*
file it loads the snippets from:
- "vim.snip*"
- "vim_*.snip*"
- "vim/**/*.snip"
- "vim_*.snip*"
- "vim/**/*.snip"
This variable doesn't exist unless you declare it.
The default value is [].
*g:neosnippet#disable_select_mode_mappings*
g:neosnippet#disable_select_mode_mappings