rename 2 sort key related vars

rename s:format to s:sortKeyFormat - purely for descriptive reasons

rename self.sortKey to self._sortKey - the convention is to use leading
underscores to indicate private vars
This commit is contained in:
Martin Grenfell 2015-05-13 20:29:03 +01:00
parent 99fa465b5d
commit af85499eda

View File

@ -2,7 +2,7 @@
"once here "once here
let s:NERDTreeSortStarIndex = index(g:NERDTreeSortOrder, '*') let s:NERDTreeSortStarIndex = index(g:NERDTreeSortOrder, '*')
" used in formating sortKey, e.g. '%04d' " used in formating sortKey, e.g. '%04d'
let s:format = "%0" . float2nr(ceil(log10(len(g:NERDTreeSortOrder)))) . "d" let s:sortKeyFormat = "%0" . float2nr(ceil(log10(len(g:NERDTreeSortOrder)))) . "d"
"CLASS: Path "CLASS: Path
@ -367,7 +367,7 @@ endfunction
"FUNCTION: Path.getSortKey() {{{1 "FUNCTION: Path.getSortKey() {{{1
"returns a string used in compare function for sorting "returns a string used in compare function for sorting
function! s:Path.getSortKey() function! s:Path.getSortKey()
if !exists("self.sortKey") if !exists("self._sortKey")
let path = self.getLastPathComponent(1) let path = self.getLastPathComponent(1)
if !g:NERDTreeSortHiddenFirst if !g:NERDTreeSortHiddenFirst
let path = substitute(path, '^[._]', '', '') let path = substitute(path, '^[._]', '', '')
@ -375,10 +375,10 @@ function! s:Path.getSortKey()
if !g:NERDTreeCaseSensitiveSort if !g:NERDTreeCaseSensitiveSort
let path = tolower(path) let path = tolower(path)
endif endif
let self.sortKey = printf(s:format, self.getSortOrderIndex()) . path let self._sortKey = printf(s:sortKeyFormat, self.getSortOrderIndex()) . path
endif endif
return self.sortKey return self._sortKey
endfunction endfunction