diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 4446bb29a..44c3420a6 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -355,3 +355,15 @@ endfunction " step 3: compile YouCompleteMe with the feature you want. if you just want " support c family, you need run `./install.py --clang-completer`. " < +" +" 2. How to add custom snippt? +" +" SpaceVim use neosnippet as default snippet engine. If you want to add +" snippet for vim filetype, open a vim file, run `:NeoSnippetEdit` command, a +" buffer will be opened, you can add your custom snippet, by default this +" buffer will be save in `~/.SpaceVim.d/snippets`, if you want to use other +" directory: +" > +" let g:neosnippet#snippets_directory = '~/path/to/snip_dir' +" < +" for more info about how to write snippet, please read ||neosnippet-snippet-syntax|. diff --git a/autoload/SpaceVim/layers/default.vim b/autoload/SpaceVim/layers/default.vim new file mode 100644 index 000000000..2c3eca768 --- /dev/null +++ b/autoload/SpaceVim/layers/default.vim @@ -0,0 +1,13 @@ +"" +" @section Default, default +" @parentsection layers + +function! SpaceVim#layers#default#plugins() abort + let plugins = [] + + return plugins +endfunction + +function! SpaceVim#layers#default#config() abort + +endfunction diff --git a/autoload/SpaceVim/layers/lang.vim b/autoload/SpaceVim/layers/lang.vim index ec2e50632..9c2b06a71 100644 --- a/autoload/SpaceVim/layers/lang.vim +++ b/autoload/SpaceVim/layers/lang.vim @@ -1,6 +1,6 @@ function! SpaceVim#layers#lang#plugins() abort let plugins = [ - \ ['Shougo/neosnippet.vim', { 'on_i' : 1 , 'on_ft' : 'neosnippet', 'loadconf' : 1}], + \ ['Shougo/neosnippet.vim', { 'on_i' : 1 , 'on_ft' : 'neosnippet', 'loadconf' : 1, 'on_cmd' : 'NeoSnippetEdit'}], \ ['m2mdas/phpcomplete-extended', { 'on_ft' : 'php'}], \ ['groenewege/vim-less', { 'on_ft' : ['less']}], \ ['cakebaker/scss-syntax.vim', { 'on_ft' : ['scss','sass']}], diff --git a/config/plugins/neosnippet.vim b/config/plugins/neosnippet.vim index 07cc6fd6c..1c0667eca 100644 --- a/config/plugins/neosnippet.vim +++ b/config/plugins/neosnippet.vim @@ -1,6 +1,14 @@ -let g:neosnippet#snippets_directory = [expand('~/.SpaceVim.d/snippets/'), expand('~/.SpaceVim/snippets/')] +let g:neosnippet#snippets_directory = get(g:,'neosnippet#snippets_directory', '') +if empty(g:neosnippet#snippets_directory) + let g:neosnippet#snippets_directory = [expand('~/.SpaceVim/snippets/'), expand('~/.SpaceVim.d/snippets/')] +elseif type(g:spacevim_force_global_config) == type('') + let g:neosnippet#snippets_directory = [expand('~/.SpaceVim/snippets/'), expand('~/.SpaceVim.d/snippets/')] + [g:neosnippet#snippets_directory] +elseif type(g:spacevim_force_global_config) == type([]) + let g:neosnippet#snippets_directory = [expand('~/.SpaceVim/snippets/'), expand('~/.SpaceVim.d/snippets/')] + g:neosnippet#snippets_directory +endif + if g:spacevim_force_global_config == 0 - call add(g:neosnippet#snippets_directory, getcwd() . '/.Spacevim.d/snippets') + let g:neosnippet#snippets_directory = [getcwd() . '/.Spacevim.d/snippets'] + g:neosnippet#snippets_directory endif let g:neosnippet#enable_snipmate_compatibility=1 let g:neosnippet#enable_complete_done = 1 diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index f82dd67c1..2d662abaa 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -7,18 +7,19 @@ CONTENTS *SpaceVim-contents* 2. CONFIGURATION...........................................|SpaceVim-config| 3. Functions............................................|SpaceVim-functions| 4. Layers..................................................|SpaceVim-layers| - 1. autocomplete..................................|SpaceVim-autocomplete| - 2. checkers....................................|SpaceVim-layer-checkers| - 3. colorscheme....................................|SpaceVim-colorscheme| - 4. lang#c........................................|SpaceVim-layer-lang-c| - 5. lang#elixir..............................|SpaceVim-layer-lang-elixir| - 6. lang#go......................................|SpaceVim-layer-lang-go| - 7. lang#java..................................|SpaceVim-layer-lang-java| - 8. lang#php....................................|SpaceVim-layer-lang-php| - 9. lang#python..............................|SpaceVim-layer-lang-python| - 10. lang#rust.................................|SpaceVim-layer-lang-rust| - 11. lang#xml...................................|SpaceVim-layer-lang-xml| - 12. shell.........................................|SpaceVim-layer-shell| + 1. Default............................................|SpaceVim-default| + 2. autocomplete..................................|SpaceVim-autocomplete| + 3. checkers....................................|SpaceVim-layer-checkers| + 4. colorscheme....................................|SpaceVim-colorscheme| + 5. lang#c........................................|SpaceVim-layer-lang-c| + 6. lang#elixir..............................|SpaceVim-layer-lang-elixir| + 7. lang#go......................................|SpaceVim-layer-lang-go| + 8. lang#java..................................|SpaceVim-layer-lang-java| + 9. lang#php....................................|SpaceVim-layer-lang-php| + 10. lang#python.............................|SpaceVim-layer-lang-python| + 11. lang#rust.................................|SpaceVim-layer-lang-rust| + 12. lang#xml...................................|SpaceVim-layer-lang-xml| + 13. shell.........................................|SpaceVim-layer-shell| 5. FAQ........................................................|SpaceVim-faq| ============================================================================== @@ -255,6 +256,9 @@ LAYERS *SpaceVim-layers* SpaceVim support such layers: +============================================================================== +DEFAULT *SpaceVim-default* + ============================================================================== AUTOCOMPLETE *SpaceVim-autocomplete* @@ -599,5 +603,17 @@ it is hard to manager by vim plugin manager.) support c family, you need run `./install.py --clang-completer`. < + 2. How to add custom snippt? + +SpaceVim use neosnippet as default snippet engine. If you want to add snippet +for vim filetype, open a vim file, run `:NeoSnippetEdit` command, a buffer +will be opened, you can add your custom snippet, by default this buffer will +be save in `~/.SpaceVim.d/snippets`, if you want to use other directory: +> + let g:neosnippet#snippets_directory = '~/path/to/snip_dir' +< +for more info about how to write snippet, please read +||neosnippet-snippet-syntax|. + vim:tw=78:ts=8:ft=help:norl: