diff --git a/autoload/SpaceVim/layers/telescope.vim b/autoload/SpaceVim/layers/telescope.vim index 959311f97..7ceaaa15b 100644 --- a/autoload/SpaceVim/layers/telescope.vim +++ b/autoload/SpaceVim/layers/telescope.vim @@ -51,6 +51,10 @@ function! SpaceVim#layers#telescope#plugins() abort call add(plugins, [g:_spacevim_root_dir . 'bundle/telescope-ctags-outline.nvim', {'merged' : 0}]) call add(plugins, [g:_spacevim_root_dir . 'bundle/neoyank.vim', { 'merged' : 0}]) call add(plugins, [g:_spacevim_root_dir . 'bundle/telescope-fzf-native.nvim', { 'merged' : 0}]) + if g:spacevim_snippet_engine ==# 'ultisnips' + call add(plugins, ['fhill2/telescope-ultisnips.nvim', { 'merged' : 0}]) + endif + return plugins endfunction @@ -310,6 +314,20 @@ function! s:defind_fuzzy_finder() abort \ ] \ ] + if g:spacevim_snippet_engine ==# 'ultisnips' + nnoremap fs :Telescope ultisnips + let lnum = expand('') + s:unite_lnum - 4 + let g:_spacevim_mappings.f.s = ['Telescope ultisnips', + \ 'fuzzy find ultisnips snippets', + \ [ + \ '[Leader f s] is to fuzzy find ultisnips snippets', + \ '', + \ 'Definition: ' . s:file . ':' . lnum, + \ ] + \ ] + endif + + let lnum = expand('') + s:unite_lnum - 4 call SpaceVim#mapping#space#def('nnoremap', ['f', 'v', 's'], 'Telescope scriptnames', \ ['open-custom-configuration', diff --git a/config/plugins/telescope.vim b/config/plugins/telescope.vim index 76e020238..4f8a4d122 100644 --- a/config/plugins/telescope.vim +++ b/config/plugins/telescope.vim @@ -11,6 +11,10 @@ if filereadable(g:_spacevim_root_dir . 'bundle/telescope-fzf-native.nvim/build/l \ || filereadable(g:_spacevim_root_dir . 'bundle/telescope-fzf-native.nvim/build/libfzf.dll') lua require('telescope').load_extension('fzf') endif +if g:spacevim_snippet_engine ==# 'ultisnips' + lua require('telescope').load_extension('ultisnips') +endif + lua < f s` | Fuzzy find Ultisnips snippets if `snippet_engine = "ultisnips"` and the layer [`telescope`](../telescope) is used. Thanks to [telescope-ultisnips.nvim](https://github.com/fhill2/telescope-ultisnips.nvim)| NOTE: `SPC i s` requires that at least one fuzzy search layer be loaded. If the `snippet_engine` is `neosnippet`. The fuzzy finder layer can be `leaderf`, `denite` or `unite`. For `ultisnips`, you can use `leaderf` or `unite` layer. diff --git a/docs/layers/telescope.md b/docs/layers/telescope.md index 757ea0f7d..a3d3ca863 100644 --- a/docs/layers/telescope.md +++ b/docs/layers/telescope.md @@ -38,3 +38,4 @@ SpaceVim uses `f` as the default customized key binding prefix for telescope lay | ` f t` | Fuzzy find tags | | ` f q` | Fuzzy find quick fix | | ` f r` | Resumes telescope window | +| ` f s` | Fuzzy find Ultisnips snippets (if `snippet_engine = "ultisnips"`). Thanks to [telescope-ultisnips.nvim](https://github.com/fhill2/telescope-ultisnips.nvim)|