junegunn / junegunn/fzf.vim

Search in node_modules: How to use prefix property?

Open
#798 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Vim Script
Stars
10.3k
Forks
608
Avg merge
5d 8h
Merged PRs (30d)
2

Description

Can you help me to understand how to use prefix property and when?
I set to it different values, it does not influence anything.
How to conclude result in unary quotes, to add a semicolon and to pass to a new line?
How it is possible to improve my settings?
Now I use the following configuration for search folders and files in node_modules:
```
call plug#begin('~/.vim/plugged')
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' }
Plug 'junegunn/fzf.vim'
Plug 'airblade/vim-rooter'
call plug#end()

set cmdheight=2
let g:rooter_patterns = ['node_modules/', '.git/']
let g:rooter_manual_only = 1

inoremap nm :call FindInNodeModules()

function! FindInNodeModules()
let nodeModulesPath = FindRootDirectory() . "/node_modules"

if !isdirectory(nodeModulesPath)
echo nodeModulesPath . " is not found"
return
endif

:call fzf#vim#complete({
\ 'prefix': "\k*$",
\ 'source': "find \| sed 's/^..//'",
\ "reducer": {lines -> join(lines, ', ')},
\ "options": "--multi --reverse",
\ "dir": nodeModulesPath,
\ "down": 20,
\})
endfunction
```

- Category
- [x] Question
- [ ] Bug
- [ ] Suggestion
- OS
- [x] Linux
- [ ] macOS
- [ ] Windows
- [ ] Etc.
- Vim
- [ ] Vim
- [x] Neovim

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.