-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
How to make fzf with Ag not display files and folders from .gitignore in vim? #4168
Comments
If I'm not mistaken, cd /tmp
mkdir foo
cd foo
ag --hidden --ignore dist node_modules .git -g "" gives errors
Anyway, having To make sure that let $FZF_DEFAULT_COMMAND = 'seq 100; ag --ignore dist -g ""; seq 100' and yes, |
@junegunn does not work for me =*(( |
I can't reproduce the problem. fzf simply reads the output of the command. You should make sure that the command itself is working as expected. i.e. |
@junegunn this command eval |
You should check if the command in the variable works as expected on your shell. Not on vim. |
Checklist
man fzf
)Output of
fzf --version
0.57.0 (0476a65)
OS
Shell
Problem / Steps to reproduce
I have specified
let $FZF_DEFAULT_COMMAND = 'ag -g ""'
in vim and in .zshrc i haveexport FZF_DEFAULT_COMMAND='ag --hidden --ignore dist node_modules .git -g ""'
but still getting an output with files from
dist
folderthe
dist
folder is in .gitignoreMac M2
macvim
at the end if it will be ignored , how can i make it include if i need ?
the only way (from here mileszs/ack.vim#210 (comment)) i have made it work is to add .ignore file in my project with
but how to make it work for all projects
this solution does not work junegunn/fzf.vim#453 (comment)
Here is parts for fzf in my config
let g:go_imports_autosave = 0
Plug 'drmikehenry/vim-fontsize'
nmap = FontsizeBegin
nmap + FontsizeInc
nmap - FontsizeDec
nmap 0 FontsizeDefault
" {{{
let g:fzf_nvim_statusline = 0 " disable statusline overwriting
" nnoremap :GFiles
nnoremap :Files
nnoremap a :Buffers
nnoremap A :Windows
nnoremap ; :BLines
nnoremap o :BTags
nnoremap O :Tags
nnoremap ? :History
nnoremap / :execute 'Ag ' . input('Ag/')
nnoremap . :AgIn
nnoremap K :call SearchWordWithAg()
vnoremap K :call SearchVisualSelectionWithAg()
nnoremap gl :Commits
nnoremap ga :BCommits
nnoremap ft :Filetypes
" https://vi.stackexchange.com/questions/31012/what-does-plug-do-in-vim
imap (fzf-complete-file-ag)
imap (fzf-complete-line)
imap (fzf-complete-word)
function! SearchWordWithAg()
execute 'Ag' expand('')
endfunction
function! SearchVisualSelectionWithAg() range
let old_reg = getreg('"')
let old_regtype = getregtype('"')
let old_clipboard = &clipboard
set clipboard&
normal! ""gvy
let selection = getreg('"')
call setreg('"', old_reg, old_regtype)
let &clipboard = old_clipboard
execute 'Ag' selection
endfunction
function! SearchWithAgInDirectory(...)
call fzf#vim#ag(join(a:000[1:], ' '), extend({'dir': a:1}, g:fzf#vim#default_layout))
endfunction
command! -nargs=+ -complete=dir AgIn call SearchWithAgInDirectory()
" }}}
nnoremap f :FZF -q =expand("")
function! s:getVisualSelection()
let [line_start, column_start] = getpos("'<")[1:2]
let [line_end, column_end] = getpos("'>")[1:2]
let lines = getline(line_start, line_end)
endfunction
vnoremap f :FZF -q =getVisualSelection()
let g:fzf_history_dir = '~/.local/share/fzf-history'
let $FZF_DEFAULT_COMMAND = 'ag --ignore dist -g ""'
" Open files in horizontal split
nnoremap s :call fzf#run({
\ 'down': '40%',
\ 'sink': 'botright split' })
" Open files in vertical horizontal split
nnoremap v :call fzf#run({
\ 'right': winwidth('.') / 2,
\ 'sink': 'vertical botright split' })
The text was updated successfully, but these errors were encountered: