Skip to content
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 @@ -68,8 +68,10 @@ git clone https://github.com/vim-fuzzbox/fuzzbox.vim ~/.vim/pack/plugins/start/f
| --- | ---
| FuzzyFiles | search files in current working directory (CWD)
| FuzzyFilesRoot | search files in the project/vcs root directory
| FuzzyFilesDir [path] | search files in the specified directory
| FuzzyGrep [str] | search for string in CWD, use [str] if provided
| FuzzyGrepRoot [str] | search for string in the project/vcs root directory
| FuzzyGrepDir [path] | search for string in the specified directory
| FuzzyBuffers | search opened buffers
| FuzzyMru | search most recent used files
| FuzzyMruCwd | search most recent used files in CWD
Expand Down
2 changes: 1 addition & 1 deletion autoload/fuzzbox/builtin/files.vim
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export def Start(opts: dict<any> = {})
cur_result = []
cur_pattern = ''
last_pattern = '@!#-='
cwd = len(get(opts, 'cwd', '')) > 0 ? opts.cwd : getcwd()
cwd = len(get(opts, 'cwd', '')) > 0 ? helpers.ParsePath(opts.cwd) : getcwd()
in_loading = 1
var wids = selector.Start([], extend(opts, {
select_cb: actions.OpenFile,
Expand Down
2 changes: 1 addition & 1 deletion autoload/fuzzbox/builtin/grep.vim
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ export def Start(opts: dict<any> = {})
[cmd_template, sep_pattern, ignore_case] = cmdbuilder.Build()
endif

cwd = len(get(opts, 'cwd', '')) > 0 ? opts.cwd : getcwd()
cwd = len(get(opts, 'cwd', '')) > 0 ? helpers.ParsePath(opts.cwd) : getcwd()
cwdlen = len(cwd)
cur_pattern = ''
cur_result = []
Expand Down
4 changes: 4 additions & 0 deletions autoload/fuzzbox/internal/helpers.vim
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,7 @@ export def MoveToUsableWindow(buf: any = null)
c = c + 1
endwhile
enddef

export def ParsePath(path: string): string
return simplify(expand(path))
enddef
2 changes: 2 additions & 0 deletions plugin/fuzzbox.vim
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ import autoload '../autoload/fuzzbox/internal/helpers.vim'

command! -nargs=? FuzzyGrep launcher.Start('grep', { prompt_text: <q-args> })
command! -nargs=? FuzzyGrepRoot launcher.Start('grep', { cwd: helpers.GetRootDir(), prompt_text: <q-args> })
command! -nargs=1 FuzzyGrepDir launcher.Start('grep', { cwd: <q-args> })
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably want -complete=dir here too

command! -nargs=0 FuzzyFiles launcher.Start('files')
command! -nargs=0 FuzzyFilesRoot launcher.Start('files', { cwd: helpers.GetRootDir() })
command! -nargs=1 FuzzyFilesDir launcher.Start('files', { cwd: <q-args> })
command! -nargs=0 FuzzyHelp launcher.Start('help')
command! -nargs=0 FuzzyColors launcher.Start('colors')
command! -nargs=? FuzzyInBuffer launcher.Start('inbuffer', { prompt_text: <q-args> })
Expand Down