Skip to content

Commit a76ae3b

Browse files
committed
Add configurable find ignore
Use case: ignore custom build/dist directories to filter `gf`'s results (and go straight to the file if there's only one). Since this variable has been exposed, it's customary to prefix with the plugin name.
1 parent 62b869a commit a76ae3b

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ from a template path is the "app" directory (which is a common value for
6666
of these two things don't work for your use case, file a ticket, figure
6767
out why and file a pull request, or [use ctags][ctags].
6868

69+
Results can be filtered by specifying exclusions in your .vimrc like this:
70+
71+
```
72+
let g:angular_find_ignore = ['build', 'dist']
73+
```
74+
6975
### Run the current spec
7076

7177
If you're writing jasmine unit tests for your angular app, they look like

plugin/angular.vim

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,15 @@ let g:syntastic_html_tidy_ignore_errors = g:syntastic_html_tidy_ignore_errors +
2222
\ ]
2323

2424

25-
let g:FindIgnore = ['coverage/', 'test/', '.git']
25+
if !exists('g:angular_find_ignore')
26+
let g:angular_find_ignore = []
27+
endif
28+
29+
let g:angular_find_ignore = g:angular_find_ignore + [
30+
\ 'coverage/',
31+
\ 'test/',
32+
\ '.git'
33+
\ ]
2634

2735
" Helper
2836
" Find file in or below current directory and edit it.
@@ -37,10 +45,10 @@ function! s:Find(...) abort
3745
endif
3846

3947

40-
if !exists("g:FindIgnore")
48+
if !exists("g:angular_find_ignore")
4149
let ignore = ""
4250
else
43-
let ignore = " | egrep -v '".join(g:FindIgnore, "|")."'"
51+
let ignore = " | egrep -v '".join(g:angular_find_ignore, "|")."'"
4452
endif
4553

4654
let l:command="find ".path." -type f -iname '*".query."*'".ignore

0 commit comments

Comments
 (0)