Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore files/folders now include wildignore option settings. #42

Open
wants to merge 4 commits into
base: vim9
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ word under cursor.
- FuzzyFiles uses find command in unix (if not found it will use vim's glob function,
which is blocking) or powershell's Get-ChildItem in windows.
(if [fd](https://github.com/sharkdp/fd) is installed, it will be used)
- Patterns defined in `wildignore` option are excluded from the
search. Patterns ending with `\*` are treated as directories.

## Navigation

Expand Down
23 changes: 11 additions & 12 deletions autoload/fuzzy/files.vim
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ def FilesJobStart(path: string, cmd: string)
return
endif
jid = job_start(cmd, {
out_cb: function('JobHandler'),
out_cb: JobHandler,
out_mode: 'raw',
exit_cb: function('ExitCb'),
err_cb: function('ErrCb'),
exit_cb: ExitCb,
err_cb: ErrCb,
cwd: path
})
enddef
Expand Down Expand Up @@ -196,11 +196,11 @@ export def Start(windows: dict<any>, ...args: list<any>)
cwd = getcwd()
cwdlen = len(cwd)
in_loading = 1
var wids = selector.Start([], {
select_cb: function('Select'),
preview_cb: function('Preview'),
input_cb: function('Input'),
close_cb: function('Close'),
selector.Start([], {
select_cb: Select,
preview_cb: Preview,
input_cb: Input,
close_cb: Close,
preview: windows.preview,
width: windows.width,
preview_ratio: windows.preview_ratio,
Expand All @@ -215,9 +215,8 @@ export def Start(windows: dict<any>, ...args: list<any>)
cmd = cmdstr
endif
FilesJobStart(cwd, cmd)
menu_wid = wids.menu
timer_start(50, function('FilesUpdateMenu'))
files_update_tid = timer_start(400, function('FilesUpdateMenu'), {'repeat': -1})
menu_wid = selector.windows.menu
timer_start(50, FilesUpdateMenu)
files_update_tid = timer_start(400, FilesUpdateMenu, {'repeat': -1})
# Profiling()
enddef

11 changes: 9 additions & 2 deletions autoload/utils/cmdbuilder.vim
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,21 @@ var dir_ignore = exists('g:fuzzyy_files_ignore_dir')
&& type(g:fuzzyy_files_ignore_dir) == v:t_list ?
g:fuzzyy_files_ignore_dir : dir_ignore_default

var has_git = executable('git') ? v:true : v:false
# Handle wildignore option
var wildignore_dir = copy(split(&wildignore, ','))->filter('v:val =~ "\*$"')
var wildignore_files = copy(split(&wildignore, ','))->filter('v:val !~ "\*$"')

extend(file_ignore, wildignore_files)
extend(dir_ignore, wildignore_dir)

var has_git = executable('git') ? true : false

def InsideGitRepo(): bool
if has_git
return stridx(system('git rev-parse --is-inside-work-tree'), 'true') == 0
else
echom 'fuzzyy: git is not installed'
return v:false
return false
endif
enddef

Expand Down