Skip to content

Commit 8e082fc

Browse files
committed
Merge pull request #205 from ctrlpvim/fix-indent
Fix indentation(s)
2 parents 328f785 + b4d80bc commit 8e082fc

2 files changed

Lines changed: 90 additions & 89 deletions

File tree

autoload/ctrlp.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ fu! ctrlp#files()
359359
if !ctrlp#igncwd(s:dyncwd)
360360
cal s:InitCustomFuncs()
361361
cal s:GlobPath(s:fnesc(s:dyncwd, 'g', ','), 0)
362-
cal s:CloseCustomFuncs()
362+
cal s:CloseCustomFuncs()
363363
en
364364
el
365365
sil! cal ctrlp#progress('Indexing...')

autoload/ctrlp/autoignore.vim

Lines changed: 89 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,32 @@
88
" Global Settings {{{
99

1010
if exists('g:ctrlp_autoignore_loaded') && g:ctrlp_autoignore_loaded
11-
\ && !g:ctrlp_autoignore_debug
12-
finish
11+
\ && !g:ctrlp_autoignore_debug
12+
finish
1313
endif
1414
let g:ctrlp_autoignore_loaded = 1
1515

1616
if !exists('g:ctrlp_autoignore_debug')
17-
let g:ctrlp_autoignore_debug = 0
17+
let g:ctrlp_autoignore_debug = 0
1818
endif
1919

2020
if !exists('g:ctrlp_autoignore_trace')
21-
let g:ctrlp_autoignore_trace = 0
21+
let g:ctrlp_autoignore_trace = 0
2222
endif
2323

2424
" }}}
2525

2626
" Initialization {{{
2727

2828
if !exists('g:ctrlp_custom_ignore')
29-
let g:ctrlp_custom_ignore = {}
29+
let g:ctrlp_custom_ignore = {}
3030
endif
3131
let g:ctrlp_custom_ignore['func'] = 'ctrlp#autoignore#ignore'
3232
let g:ctrlp_custom_ignore['func-init'] = 'ctrlp#autoignore#ignore_init'
3333
let g:ctrlp_custom_ignore['func-close'] = 'ctrlp#autoignore#ignore_close'
3434

3535
if !exists('g:ctrlp_root_markers')
36-
let g:ctrlp_root_markers = []
36+
let g:ctrlp_root_markers = []
3737
endif
3838
call add(g:ctrlp_root_markers, '.ctrlpignore')
3939

@@ -55,44 +55,44 @@ let s:changed_wildignore = 0
5555
let s:prev_wildignore = ''
5656

5757
function! s:load_project_patterns(root_dir) abort
58-
let l:ign_path = a:root_dir . '/.ctrlpignore'
59-
if !filereadable(l:ign_path)
60-
call s:trace("No pattern file at: " . l:ign_path)
61-
return []
62-
endif
63-
let l:cursyntax = 'regexp'
64-
let l:knownsyntaxes = ['regexp', 'wildignore']
65-
let l:patterns = []
66-
let l:lines = readfile(l:ign_path)
67-
for line in l:lines
68-
" Comment line?
69-
if match(line, '\v^\s*$') >= 0 || match(line, '\v^\s*#') >= 0
70-
continue
71-
endif
72-
" Syntax change?
73-
let l:matches = matchlist(line, '\v^syntax:\s?(\w+)\s*$')
74-
if len(l:matches) > 0
75-
let l:cursyntax = l:matches[1]
76-
if index(l:knownsyntaxes, l:cursyntax) < 0
77-
echoerr "ctrlp_autoignore: Unknown syntax '".l:cursyntax."' in: ".l:ign_path
78-
endif
79-
continue
80-
endif
81-
" Patterns!
82-
let l:matches = matchlist(line, '\v^((dir|file|link)\:)?(.*)')
83-
let l:mtype = l:matches[2]
84-
let l:mpat = l:matches[3]
85-
call add(l:patterns, {'syn': l:cursyntax, 'type': l:mtype, 'pat': l:mpat})
86-
endfor
87-
call s:trace("Loaded " . len(l:patterns) . " patterns from: " . l:ign_path)
88-
return l:patterns
58+
let l:ign_path = a:root_dir . '/.ctrlpignore'
59+
if !filereadable(l:ign_path)
60+
call s:trace("No pattern file at: " . l:ign_path)
61+
return []
62+
endif
63+
let l:cursyntax = 'regexp'
64+
let l:knownsyntaxes = ['regexp', 'wildignore']
65+
let l:patterns = []
66+
let l:lines = readfile(l:ign_path)
67+
for line in l:lines
68+
" Comment line?
69+
if match(line, '\v^\s*$') >= 0 || match(line, '\v^\s*#') >= 0
70+
continue
71+
endif
72+
" Syntax change?
73+
let l:matches = matchlist(line, '\v^syntax:\s?(\w+)\s*$')
74+
if len(l:matches) > 0
75+
let l:cursyntax = l:matches[1]
76+
if index(l:knownsyntaxes, l:cursyntax) < 0
77+
echoerr "ctrlp_autoignore: Unknown syntax '".l:cursyntax."' in: ".l:ign_path
78+
endif
79+
continue
80+
endif
81+
" Patterns!
82+
let l:matches = matchlist(line, '\v^((dir|file|link)\:)?(.*)')
83+
let l:mtype = l:matches[2]
84+
let l:mpat = l:matches[3]
85+
call add(l:patterns, {'syn': l:cursyntax, 'type': l:mtype, 'pat': l:mpat})
86+
endfor
87+
call s:trace("Loaded " . len(l:patterns) . " patterns from: " . l:ign_path)
88+
return l:patterns
8989
endfunction
9090

9191
function! s:get_project_patterns(root_dir) abort
9292
let l:ign_path = a:root_dir . '/.ctrlpignore'
9393
let l:ign_mtime = getftime(l:ign_path)
94-
let l:patterns = get(s:proj_cache, a:root_dir)
95-
if type(l:patterns) == type({})
94+
let l:patterns = get(s:proj_cache, a:root_dir)
95+
if type(l:patterns) == type({})
9696
" Check that these patterns are still valid.
9797
if l:ign_mtime < 0
9898
" File got deleted! :(
@@ -102,71 +102,72 @@ function! s:get_project_patterns(root_dir) abort
102102
" File hasn't changed! :)
103103
return l:patterns['pats']
104104
endif
105-
endif
106-
107-
call s:trace("Loading patterns for project: " . a:root_dir)
108-
let l:loaded = s:load_project_patterns(a:root_dir)
109-
let s:proj_cache[a:root_dir] = {
110-
\'mtime': localtime(),
111-
\'pats': l:loaded}
112-
return l:loaded
105+
endif
106+
107+
call s:trace("Loading patterns for project: " . a:root_dir)
108+
let l:loaded = s:load_project_patterns(a:root_dir)
109+
let s:proj_cache[a:root_dir] = {
110+
\'mtime': localtime(),
111+
\'pats': l:loaded}
112+
return l:loaded
113113
endfunction
114114

115115
" The custom ignore function that CtrlP will be using in addition to
116116
" normal pattern-based matching.
117117
function! ctrlp#autoignore#ignore(item, type) abort
118-
let l:cnv_item = tr(strpart(a:item, s:active_cwd_len), "\\", "/")
119-
for pat in s:active_patterns
120-
if pat['syn'] != 'regexp'
121-
continue
122-
endif
123-
if pat['type'] == '' || pat['type'] == a:type
124-
if match(l:cnv_item, pat['pat']) >= 0
125-
call s:trace("Ignoring ".l:cnv_item." because of ".pat['pat'])
126-
return 1
127-
endif
128-
endif
129-
endfor
130-
return 0
118+
let l:cnv_item = tr(strpart(a:item, s:active_cwd_len), "\\", "/")
119+
for pat in s:active_patterns
120+
if pat['syn'] != 'regexp'
121+
continue
122+
endif
123+
if pat['type'] == '' || pat['type'] == a:type
124+
if match(l:cnv_item, pat['pat']) >= 0
125+
call s:trace("Ignoring ".l:cnv_item." because of ".pat['pat'])
126+
return 1
127+
endif
128+
endif
129+
endfor
130+
return 0
131131
endfunction
132132

133133
function! ctrlp#autoignore#ignore_init() abort
134-
let l:root = getcwd()
135-
let s:active_cwd = l:root
136-
" len+1 is for including the next separator after the root.
137-
let s:active_cwd_len = len(l:root) + 1
138-
let s:active_patterns = s:get_project_patterns(l:root)
139-
call s:trace("Got ".len(s:active_patterns)." patterns for ".l:root)
140-
141-
let s:changed_wildignore = 0
142-
let s:prev_wildignore = &wildignore
143-
for pat in s:active_patterns
144-
if pat['syn'] == 'wildignore'
145-
execute 'set wildignore+='.pat['pat']
146-
let s:changed_wildignore = 1
147-
endif
148-
endfor
149-
if s:changed_wildignore
150-
call s:trace("Set wildignore to ".&wildignore)
151-
endif
134+
let l:root = getcwd()
135+
let s:active_cwd = l:root
136+
" len+1 is for including the next separator after the root.
137+
let s:active_cwd_len = len(l:root) + 1
138+
let s:active_patterns = s:get_project_patterns(l:root)
139+
call s:trace("Got ".len(s:active_patterns)." patterns for ".l:root)
140+
141+
let s:changed_wildignore = 0
142+
let s:prev_wildignore = &wildignore
143+
for pat in s:active_patterns
144+
if pat['syn'] == 'wildignore'
145+
execute 'set wildignore+='.pat['pat']
146+
let s:changed_wildignore = 1
147+
endif
148+
endfor
149+
if s:changed_wildignore
150+
call s:trace("Set wildignore to ".&wildignore)
151+
endif
152152
endfunction
153153

154154
function! ctrlp#autoignore#ignore_close() abort
155-
if s:changed_wildignore
156-
execute 'set wildignore='.s:prev_wildignore
157-
let s:prev_wildignore = ''
158-
call s:trace("Set wildignore back to ".&wildignore)
159-
endif
155+
if s:changed_wildignore
156+
execute 'set wildignore='.s:prev_wildignore
157+
let s:prev_wildignore = ''
158+
call s:trace("Set wildignore back to ".&wildignore)
159+
endif
160160
endfunction
161161

162162
" List patterns for a given project's root.
163163
function! ctrlp#autoignore#get_patterns(root_dir) abort
164-
let l:patterns = s:get_project_patterns(a:root_dir)
165-
for pat in l:patterns
166-
let l:prefix = pat['type'] == '' ? '(all)' : pat['type']
167-
echom l:prefix . ':' . pat['pat']
168-
endfor
164+
let l:patterns = s:get_project_patterns(a:root_dir)
165+
for pat in l:patterns
166+
let l:prefix = pat['type'] == '' ? '(all)' : pat['type']
167+
echom l:prefix . ':' . pat['pat']
168+
endfor
169169
endfunction
170170

171171
" }}}
172172

173+
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2

0 commit comments

Comments
 (0)