view plugins/globalsearch.vim @ 13:027a85d0e60e

[x] M .vimrc [x] M plugins/hghelp/hghelp.vim [x] M plugins/vim-ai.vim [ ] ? tmp
author Luka Sitas <lsitas@avatarasoftware.com>
date Tue, 02 Dec 2025 11:53:47 -0500
parents 34930197e9d4
children
line wrap: on
line source

function! GrepIncludingIgnored(pattern, path = '**/*')
   if a:pattern =~ '^/.*/[a-z]*$'
       let search_pattern = a:pattern
   else
       let search_pattern = '/' . a:pattern . '/g'
   endif

   execute 'vimgrep ' . search_pattern . ' ' . a:path
endfunction

" Map it to a command for easy use
command! -nargs=+ GlobalSearch call GrepIncludingIgnored(<f-args>)
command! -nargs=+ GS call GrepIncludingIgnored(<f-args>)