1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 07:20:04 +08:00

feat(telescope): add :Telescope ultisnips command

add `<Leader> f s` key binding for telescope ultisnips.
this key binding is definded only when telescope layer
is loaded and snippet engine is ultisnips
This commit is contained in:
ChasingZenith 2023-04-22 22:10:04 +08:00 committed by GitHub
parent 07ef56b433
commit ce69cb81a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 0 deletions

View File

@ -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 <silent> <Leader>fs :<C-u>Telescope ultisnips<CR>
let lnum = expand('<slnum>') + 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('<slnum>') + s:unite_lnum - 4
call SpaceVim#mapping#space#def('nnoremap', ['f', 'v', 's'], 'Telescope scriptnames',
\ ['open-custom-configuration',

View File

@ -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 <<EOF
local actions = require("telescope.actions")
require("telescope").setup{

View File

@ -178,6 +178,7 @@ To disable this feature, set the variable `auto_completion_enable_snippets_in_po
| ----------- | -------------------------------------------------------------- |
| `M-/` | Expand a snippet if text before point is a prefix of a snippet |
| `SPC i s` | List all current snippets for inserting |
| `<Leader> 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.

View File

@ -38,3 +38,4 @@ SpaceVim uses `f` as the default customized key binding prefix for telescope lay
| `<Leader> f t` | Fuzzy find tags |
| `<Leader> f q` | Fuzzy find quick fix |
| `<Leader> f r` | Resumes telescope window |
| `<Leader> f s` | Fuzzy find Ultisnips snippets (if `snippet_engine = "ultisnips"`). Thanks to [telescope-ultisnips.nvim](https://github.com/fhill2/telescope-ultisnips.nvim)|