Skip to content
This repository was archived by the owner on Feb 20, 2025. It is now read-only.

Commit 24ca491

Browse files
committed
feat(telescope): add hidden & no_ignore opt
1 parent 533c403 commit 24ca491

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

autoload/SpaceVim/layers/telescope.vim

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ if exists('s:file')
1010
finish
1111
endif
1212

13+
let s:telescope_hidden = v:false
14+
15+
let s:telescope_no_ignore = v:false
16+
1317
""
1418
" @section telescope, layers-telescope
1519
" @parentsection layers
@@ -151,7 +155,7 @@ function! SpaceVim#layers#telescope#config() abort
151155

152156
let lnum = expand('<slnum>') + s:lnum - 1
153157
call SpaceVim#mapping#space#def('nnoremap', ['p', 'f'],
154-
\ 'Telescope find_files',
158+
\ join(['Telescope find_files ', s:telescope_hidden ? 'hidden=true' : 'hidden=false', s:telescope_no_ignore ? 'no_ignore=true' : 'no_ignore=false'], ' '),
155159
\ ['find-files-in-project',
156160
\ [
157161
\ '[SPC p f] is to find files in the root of the current project',
@@ -161,7 +165,7 @@ function! SpaceVim#layers#telescope#config() abort
161165
\ ]
162166
\ , 1)
163167

164-
nnoremap <silent> <C-p> :<C-u>Telescope find_files<cr>
168+
call execute('nnoremap <silent> <C-p> :<C-u>' .. join(['Telescope find_files ', s:telescope_hidden ? 'hidden=true' : 'hidden=false', s:telescope_no_ignore ? 'no_ignore=true' : 'no_ignore=false'], ' ') .. '<cr>')
165169

166170
let lnum = expand('<slnum>') + s:lnum - 1
167171
call SpaceVim#mapping#space#def('nnoremap', ['h', 'i'], 'call call('
@@ -390,7 +394,8 @@ endfunction
390394

391395
function! SpaceVim#layers#telescope#set_variable(var) abort
392396

393-
397+
let s:telescope_hidden = get(a:var, 'hidden', s:telescope_hidden)
398+
let s:telescope_no_ignore = get(a:var, 'no_ignore', s:telescope_no_ignore)
394399

395400
endfunction
396401

docs/layers/telescope.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ This layer is a heavily customized wrapper for [telescope.nvim](https://github.c
1111
The `telescope` layer is only for nvim 0.7 or above.
1212

1313

14+
## Layer option
15+
16+
- `hidden`: show hidden files, default is false
17+
- `no_ignore`: default is false
18+
1419
## Install
1520

1621
To use this configuration layer, update your custom configuration file with:

0 commit comments

Comments
 (0)