mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-10 20:33:50 -05:00
Fix lint warnings: use robust operators
This commit is contained in:
@@ -15,7 +15,7 @@ function! nerdtree#version(...)
|
||||
let l:changelog = readfile(join([s:rootNERDTreePath, 'CHANGELOG.md'], nerdtree#slash()))
|
||||
let l:line = 0
|
||||
while l:line <= len(l:changelog)
|
||||
if l:changelog[l:line] =~ '\d\+\.\d\+'
|
||||
if l:changelog[l:line] =~# '\d\+\.\d\+'
|
||||
let l:text = substitute(l:changelog[l:line], '.*\(\d\+.\d\+\).*', '\1', '')
|
||||
let l:text .= substitute(l:changelog[l:line+1], '^.\{-}\(\.\d\+\).\{-}:\(.*\)', a:0>0 ? '\1:\2' : '\1', '')
|
||||
break
|
||||
@@ -122,15 +122,15 @@ function! nerdtree#compareNodesBySortKey(n1, n2)
|
||||
" Compare chunks upto common length.
|
||||
" If chunks have different type, the one which has
|
||||
" integer type is the lesser.
|
||||
if type(sortKey1[i]) == type(sortKey2[i])
|
||||
if type(sortKey1[i]) ==# type(sortKey2[i])
|
||||
if sortKey1[i] <# sortKey2[i]
|
||||
return - 1
|
||||
elseif sortKey1[i] ># sortKey2[i]
|
||||
return 1
|
||||
endif
|
||||
elseif type(sortKey1[i]) == v:t_number
|
||||
elseif type(sortKey1[i]) ==# v:t_number
|
||||
return -1
|
||||
elseif type(sortKey2[i]) == v:t_number
|
||||
elseif type(sortKey2[i]) ==# v:t_number
|
||||
return 1
|
||||
endif
|
||||
let i = i + 1
|
||||
@@ -175,7 +175,7 @@ endfunction
|
||||
|
||||
" FUNCTION: nerdtree#has_opt(options, name) {{{2
|
||||
function! nerdtree#has_opt(options, name)
|
||||
return has_key(a:options, a:name) && a:options[a:name] == 1
|
||||
return has_key(a:options, a:name) && a:options[a:name] ==# 1
|
||||
endfunction
|
||||
|
||||
" FUNCTION: nerdtree#loadClassFiles() {{{2
|
||||
|
||||
@@ -146,7 +146,7 @@ endfunction
|
||||
" Associate the current node with the given name
|
||||
function! nerdtree#ui_glue#bookmarkNode(...)
|
||||
let currentNode = g:NERDTreeFileNode.GetSelected()
|
||||
if currentNode != {}
|
||||
if currentNode !=# {}
|
||||
let name = a:1
|
||||
if empty(name)
|
||||
let name = currentNode.path.getLastPathComponent(0)
|
||||
@@ -187,7 +187,7 @@ endfunction
|
||||
function! nerdtree#ui_glue#clearBookmarks(bookmarks)
|
||||
if a:bookmarks ==# ''
|
||||
let currentNode = g:NERDTreeFileNode.GetSelected()
|
||||
if currentNode != {}
|
||||
if currentNode !=# {}
|
||||
call currentNode.clearBookmarks()
|
||||
endif
|
||||
else
|
||||
@@ -236,7 +236,7 @@ endfunction
|
||||
" FUNCTION: s:closeTreeWindow() {{{1
|
||||
" close the tree window
|
||||
function! s:closeTreeWindow()
|
||||
if b:NERDTree.isWinTree() && b:NERDTree.previousBuf() != -1
|
||||
if b:NERDTree.isWinTree() && b:NERDTree.previousBuf() !=# -1
|
||||
exec 'buffer ' . b:NERDTree.previousBuf()
|
||||
else
|
||||
if winnr('$') > 1
|
||||
@@ -258,7 +258,7 @@ function! s:deleteBookmark(bookmark)
|
||||
echo | redraw
|
||||
let l:selection = confirm(l:message, l:choices, 1, 'Warning')
|
||||
|
||||
if l:selection != 1
|
||||
if l:selection !=# 1
|
||||
call nerdtree#echo('bookmark not deleted')
|
||||
return
|
||||
endif
|
||||
@@ -335,7 +335,7 @@ endfunction
|
||||
"Checks if the click should open the current node
|
||||
function! s:handleLeftClick()
|
||||
let currentNode = g:NERDTreeFileNode.GetSelected()
|
||||
if currentNode != {}
|
||||
if currentNode !=# {}
|
||||
|
||||
"the dir arrows are multibyte chars, and vim's string functions only
|
||||
"deal with single bytes - so split the line up with the hack below and
|
||||
|
||||
Reference in New Issue
Block a user