Skip to content

Commit b3df8fb

Browse files
committed
make all regex matching case sensitive
1 parent 492f491 commit b3df8fb

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

plugin/NERD_tree.vim

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ endfunction
373373
" FUNCTION: Bookmark.New(name, path) {{{3
374374
" Create a new bookmark object with the given name and path object
375375
function! s:Bookmark.New(name, path)
376-
if a:name =~ ' '
376+
if a:name =~# ' '
377377
throw "NERDTree.IllegalBookmarkNameError: illegal name:" . a:name
378378
endif
379379

@@ -1037,7 +1037,7 @@ endfunction
10371037
"gets the line number of the root node
10381038
function! s:TreeFileNode.GetRootLineNum()
10391039
let rootLine = 1
1040-
while getline(rootLine) !~ '^\(/\|<\)'
1040+
while getline(rootLine) !~# '^\(/\|<\)'
10411041
let rootLine = rootLine + 1
10421042
endwhile
10431043
return rootLine
@@ -1602,7 +1602,7 @@ function! s:TreeDirNode._initChildren(silent)
16021602
"filter out the .. and . directories
16031603
"Note: we must match .. AND ../ cos sometimes the globpath returns
16041604
"../ for path with strange chars (eg $)
1605-
if i !~ '\/\.\.\/\?$' && i !~ '\/\.\/\?$'
1605+
if i !~# '\/\.\.\/\?$' && i !~# '\/\.\/\?$'
16061606

16071607
"put the next file in a new node and attach it
16081608
try
@@ -1739,7 +1739,7 @@ function! s:TreeDirNode.refresh()
17391739
"filter out the .. and . directories
17401740
"Note: we must match .. AND ../ cos sometimes the globpath returns
17411741
"../ for path with strange chars (eg $)
1742-
if i !~ '\/\.\.\/\?$' && i !~ '\/\.\/\?$'
1742+
if i !~# '\/\.\.\/\?$' && i !~# '\/\.\/\?$'
17431743

17441744
try
17451745
"create a new path and see if it exists in this nodes children
@@ -1861,9 +1861,9 @@ let s:Path = {}
18611861
function! s:Path.AbsolutePathFor(str)
18621862
let prependCWD = 0
18631863
if s:running_windows
1864-
let prependCWD = a:str !~ '^.:\(\\\|\/\)'
1864+
let prependCWD = a:str !~# '^.:\(\\\|\/\)'
18651865
else
1866-
let prependCWD = a:str !~ '^/'
1866+
let prependCWD = a:str !~# '^/'
18671867
endif
18681868

18691869
let toReturn = a:str
@@ -1980,7 +1980,7 @@ function! s:Path.Create(fullpath)
19801980
try
19811981

19821982
"if it ends with a slash, assume its a dir create it
1983-
if a:fullpath =~ '\(\\\|\/\)$'
1983+
if a:fullpath =~# '\(\\\|\/\)$'
19841984
"whack the trailing slash off the end if it exists
19851985
let fullpath = substitute(a:fullpath, '\(\\\|\/\)$', '', '')
19861986

@@ -2153,7 +2153,7 @@ endfunction
21532153
function! s:Path.getSortOrderIndex()
21542154
let i = 0
21552155
while i < len(g:NERDTreeSortOrder)
2156-
if self.getLastPathComponent(1) =~ g:NERDTreeSortOrder[i]
2156+
if self.getLastPathComponent(1) =~# g:NERDTreeSortOrder[i]
21572157
return i
21582158
endif
21592159
let i = i + 1
@@ -2169,14 +2169,14 @@ function! s:Path.ignore()
21692169
"filter out the user specified paths to ignore
21702170
if b:NERDTreeIgnoreEnabled
21712171
for i in g:NERDTreeIgnore
2172-
if lastPathComponent =~ i
2172+
if lastPathComponent =~# i
21732173
return 1
21742174
endif
21752175
endfor
21762176
endif
21772177

21782178
"dont show hidden files unless instructed to
2179-
if b:NERDTreeShowHidden ==# 0 && lastPathComponent =~ '^\.'
2179+
if b:NERDTreeShowHidden ==# 0 && lastPathComponent =~# '^\.'
21802180
return 1
21812181
endif
21822182

@@ -2266,7 +2266,7 @@ function! s:Path.readInfoFromDisk(fullpath)
22662266

22672267
let self.isExecutable = 0
22682268
if !self.isDirectory
2269-
let self.isExecutable = getfperm(a:fullpath) =~ 'x'
2269+
let self.isExecutable = getfperm(a:fullpath) =~# 'x'
22702270
endif
22712271

22722272
"grab the last part of the path (minus the trailing slash)
@@ -2285,7 +2285,7 @@ function! s:Path.readInfoFromDisk(fullpath)
22852285

22862286
"we always wanna treat MS windows shortcuts as files for
22872287
"simplicity
2288-
if hardPath !~ '\.lnk$'
2288+
if hardPath !~# '\.lnk$'
22892289

22902290
let self.symLinkDest = self.symLinkDest . '/'
22912291
endif
@@ -2517,7 +2517,7 @@ endfunction
25172517
" FUNCTION: s:completeBookmarks(A,L,P) {{{2
25182518
" completion function for the bookmark commands
25192519
function! s:completeBookmarks(A,L,P)
2520-
return filter(s:Bookmark.BookmarkNames(), 'v:val =~ "^' . a:A . '"')
2520+
return filter(s:Bookmark.BookmarkNames(), 'v:val =~# "^' . a:A . '"')
25212521
endfunction
25222522
" FUNCTION: s:exec(cmd) {{{2
25232523
" same as :exec cmd but eventignore=all is set for the duration
@@ -2564,7 +2564,7 @@ function! s:initNerdTree(name)
25642564
let dir = a:name ==# '' ? getcwd() : a:name
25652565

25662566
"hack to get an absolute path if a relative path is given
2567-
if dir =~ '^\.'
2567+
if dir =~# '^\.'
25682568
let dir = getcwd() . s:Path.Slash() . dir
25692569
endif
25702570
let dir = resolve(dir)
@@ -3068,7 +3068,7 @@ function! s:getPath(ln)
30683068
endif
30693069

30703070
" in case called from outside the tree
3071-
if line !~ '^ *[|`]' || line =~ '^$'
3071+
if line !~# '^ *[|`]' || line =~# '^$'
30723072
return {}
30733073
endif
30743074

@@ -3082,7 +3082,7 @@ function! s:getPath(ln)
30823082
let curFile = s:stripMarkupFromLine(line, 0)
30833083

30843084
let wasdir = 0
3085-
if curFile =~ '/$'
3085+
if curFile =~# '/$'
30863086
let wasdir = 1
30873087
let curFile = substitute(curFile, '/\?$', '/', "")
30883088
endif
@@ -3099,7 +3099,7 @@ function! s:getPath(ln)
30993099
let dir = b:NERDTreeRoot.path.str({'format': 'UI'}) . dir
31003100
break
31013101
endif
3102-
if curLineStripped =~ '/$'
3102+
if curLineStripped =~# '/$'
31033103
let lpindent = s:indentLevelFor(curLine)
31043104
if lpindent < indent
31053105
let indent = indent - 1
@@ -3218,7 +3218,7 @@ function! s:putCursorOnBookmarkTable()
32183218
let rootNodeLine = s:TreeFileNode.GetRootLineNum()
32193219

32203220
let line = 1
3221-
while getline(line) !~ '^>-\+Bookmarks-\+$'
3221+
while getline(line) !~# '^>-\+Bookmarks-\+$'
32223222
let line = line + 1
32233223
if line >= rootNodeLine
32243224
throw "NERDTree.BookmarkTableNotFoundError: didnt find the bookmarks table"
@@ -3476,7 +3476,7 @@ function! s:stripMarkupFromLine(line, removeLeadingSpaces)
34763476
let line = substitute (line, '*\ze\($\| \)', "","")
34773477

34783478
let wasdir = 0
3479-
if line =~ '/$'
3479+
if line =~# '/$'
34803480
let wasdir = 1
34813481
endif
34823482
let line = substitute (line,' -> .*',"","") " remove link to
@@ -3634,14 +3634,14 @@ function! s:checkForActivate()
36343634
"if they clicked a dir, check if they clicked on the + or ~ sign
36353635
"beside it
36363636
if currentNode.path.isDirectory
3637-
if startToCur =~ s:tree_markup_reg . '$' && char =~ '[+~]'
3637+
if startToCur =~# s:tree_markup_reg . '$' && char =~# '[+~]'
36383638
call s:activateNode(0)
36393639
return
36403640
endif
36413641
endif
36423642

36433643
if (g:NERDTreeMouseMode ==# 2 && currentNode.path.isDirectory) || g:NERDTreeMouseMode ==# 3
3644-
if char !~ s:tree_markup_reg && startToCur !~ '\/$'
3644+
if char !~# s:tree_markup_reg && startToCur !~# '\/$'
36453645
call s:activateNode(0)
36463646
return
36473647
endif
@@ -4041,7 +4041,7 @@ endfunction
40414041
"re-rendered
40424042
function! s:upDir(keepState)
40434043
let cwd = b:NERDTreeRoot.path.str({'format': 'UI'})
4044-
if cwd ==# "/" || cwd =~ '^[^/]..$'
4044+
if cwd ==# "/" || cwd =~# '^[^/]..$'
40454045
call s:echo("already at top dir")
40464046
else
40474047
if !a:keepState

0 commit comments

Comments
 (0)