mirror of
https://github.com/preservim/nerdtree.git
synced 2024-11-26 18:30:45 +08:00
Improve the code style in a "Path" method
No functional changes here. Only style improvements were made.
This commit is contained in:
parent
f4df038366
commit
e6a116a9cd
|
@ -14,21 +14,23 @@ lockvar s:NERDTreeSortStarIndex
|
||||||
let s:Path = {}
|
let s:Path = {}
|
||||||
let g:NERDTreePath = s:Path
|
let g:NERDTreePath = s:Path
|
||||||
|
|
||||||
" FUNCTION: Path.AbsolutePathFor(str) {{{1
|
" FUNCTION: Path.AbsolutePathFor(pathStr) {{{1
|
||||||
function! s:Path.AbsolutePathFor(str)
|
function! s:Path.AbsolutePathFor(pathStr)
|
||||||
let prependCWD = 0
|
let l:prependWorkingDir = 0
|
||||||
|
|
||||||
if nerdtree#runningWindows()
|
if nerdtree#runningWindows()
|
||||||
let prependCWD = a:str !~# '^.:\(\\\|\/\)' && a:str !~# '^\(\\\\\|\/\/\)'
|
let l:prependWorkingDir = a:pathStr !~# '^.:\(\\\|\/\)' && a:pathStr !~# '^\(\\\\\|\/\/\)'
|
||||||
else
|
else
|
||||||
let prependCWD = a:str !~# '^/'
|
let l:prependWorkingDir = a:pathStr !~# '^/'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let toReturn = a:str
|
let l:result = a:pathStr
|
||||||
if prependCWD
|
|
||||||
let toReturn = getcwd() . s:Path.Slash() . a:str
|
if l:prependWorkingDir
|
||||||
|
let l:result = getcwd() . s:Path.Slash() . a:pathStr
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return toReturn
|
return l:result
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: Path.bookmarkNames() {{{1
|
" FUNCTION: Path.bookmarkNames() {{{1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user