mirror of
https://github.com/preservim/nerdtree.git
synced 2024-10-18 13:50:21 +03:00
remove the arg from Path#str()
now everything uses the equivalent of Path#str(0)
This commit is contained in:
parent
7051977808
commit
dd38ab8f43
@ -93,7 +93,7 @@ function! NERDTreeMoveNode()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
try
|
try
|
||||||
let bufnum = bufnr(curNode.path.str(0))
|
let bufnum = bufnr(curNode.path.str())
|
||||||
|
|
||||||
call curNode.rename(newNodePath)
|
call curNode.rename(newNodePath)
|
||||||
call NERDTreeRender()
|
call NERDTreeRender()
|
||||||
@ -141,7 +141,7 @@ function! NERDTreeDeleteNode()
|
|||||||
|
|
||||||
"if the node is open in a buffer, ask the user if they want to
|
"if the node is open in a buffer, ask the user if they want to
|
||||||
"close that buffer
|
"close that buffer
|
||||||
let bufnum = bufnr(currentNode.path.str(0))
|
let bufnum = bufnr(currentNode.path.str())
|
||||||
if buflisted(bufnum)
|
if buflisted(bufnum)
|
||||||
let prompt = "\nNode deleted.\n\nThe file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)"
|
let prompt = "\nNode deleted.\n\nThe file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)"
|
||||||
call s:promptToDelBuffer(bufnum, prompt)
|
call s:promptToDelBuffer(bufnum, prompt)
|
||||||
@ -163,7 +163,7 @@ function! NERDTreeCopyNode()
|
|||||||
let newNodePath = input("Copy the current node\n" .
|
let newNodePath = input("Copy the current node\n" .
|
||||||
\ "==========================================================\n" .
|
\ "==========================================================\n" .
|
||||||
\ "Enter the new path to copy the node to: \n" .
|
\ "Enter the new path to copy the node to: \n" .
|
||||||
\ "", currentNode.path.str(0))
|
\ "", currentNode.path.str())
|
||||||
|
|
||||||
if newNodePath != ""
|
if newNodePath != ""
|
||||||
"strip trailing slash
|
"strip trailing slash
|
||||||
|
@ -60,7 +60,7 @@ function! NERDTreeGitMenuEnabled()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:GitRepoPath()
|
function! s:GitRepoPath()
|
||||||
return b:NERDTreeRoot.path.str(0) . ".git"
|
return b:NERDTreeRoot.path.str() . ".git"
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! NERDTreeGitMove()
|
function! NERDTreeGitMove()
|
||||||
@ -99,7 +99,7 @@ endfunction
|
|||||||
|
|
||||||
function! s:execGitCmd(sub_cmd)
|
function! s:execGitCmd(sub_cmd)
|
||||||
let extra_options = '--git-dir=' . s:GitRepoPath() . ' '
|
let extra_options = '--git-dir=' . s:GitRepoPath() . ' '
|
||||||
let extra_options .= '--work-tree=' . b:NERDTreeRoot.path.str(0)
|
let extra_options .= '--work-tree=' . b:NERDTreeRoot.path.str()
|
||||||
let cmd = "git" . ' ' . extra_options . ' ' . a:sub_cmd
|
let cmd = "git" . ' ' . extra_options . ' ' . a:sub_cmd
|
||||||
|
|
||||||
let output = system(cmd)
|
let output = system(cmd)
|
||||||
|
@ -932,7 +932,7 @@ endfunction
|
|||||||
"Args:
|
"Args:
|
||||||
"treenode: the other treenode to compare to
|
"treenode: the other treenode to compare to
|
||||||
function! s:TreeFileNode.equals(treenode)
|
function! s:TreeFileNode.equals(treenode)
|
||||||
return self.path.str(1) ==# a:treenode.path.str(1)
|
return self.path.str() ==# a:treenode.path.str()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: TreeFileNode.findNode(path) {{{3
|
"FUNCTION: TreeFileNode.findNode(path) {{{3
|
||||||
@ -1022,11 +1022,11 @@ function! s:TreeFileNode.getLineNum()
|
|||||||
let totalLines = line("$")
|
let totalLines = line("$")
|
||||||
|
|
||||||
"the path components we have matched so far
|
"the path components we have matched so far
|
||||||
let pathcomponents = [substitute(b:NERDTreeRoot.path.str(0), '/ *$', '', '')]
|
let pathcomponents = [substitute(b:NERDTreeRoot.path.str(), '/ *$', '', '')]
|
||||||
"the index of the component we are searching for
|
"the index of the component we are searching for
|
||||||
let curPathComponent = 1
|
let curPathComponent = 1
|
||||||
|
|
||||||
let fullpath = self.path.str(0)
|
let fullpath = self.path.str()
|
||||||
|
|
||||||
|
|
||||||
let lnum = s:TreeFileNode.GetRootLineNum()
|
let lnum = s:TreeFileNode.GetRootLineNum()
|
||||||
@ -1163,7 +1163,7 @@ function! s:TreeFileNode.open()
|
|||||||
exec ("edit " . self.path.strForEditCmd())
|
exec ("edit " . self.path.strForEditCmd())
|
||||||
catch /^Vim\%((\a\+)\)\=:E37/
|
catch /^Vim\%((\a\+)\)\=:E37/
|
||||||
call s:putCursorInTreeWin()
|
call s:putCursorInTreeWin()
|
||||||
throw "NERDTree.FileAlreadyOpenAndModifiedError: ". self.path.str(0) ." is already open and modified."
|
throw "NERDTree.FileAlreadyOpenAndModifiedError: ". self.path.str() ." is already open and modified."
|
||||||
catch /^Vim\%((\a\+)\)\=:/
|
catch /^Vim\%((\a\+)\)\=:/
|
||||||
echo v:exception
|
echo v:exception
|
||||||
endtry
|
endtry
|
||||||
@ -1219,7 +1219,7 @@ function! s:TreeFileNode.openSplit()
|
|||||||
exec(splitMode." sp " . self.path.strForEditCmd())
|
exec(splitMode." sp " . self.path.strForEditCmd())
|
||||||
catch /^Vim\%((\a\+)\)\=:E37/
|
catch /^Vim\%((\a\+)\)\=:E37/
|
||||||
call s:putCursorInTreeWin()
|
call s:putCursorInTreeWin()
|
||||||
throw "NERDTree.FileAlreadyOpenAndModifiedError: ". self.path.str(0) ." is already open and modified."
|
throw "NERDTree.FileAlreadyOpenAndModifiedError: ". self.path.str() ." is already open and modified."
|
||||||
catch /^Vim\%((\a\+)\)\=:/
|
catch /^Vim\%((\a\+)\)\=:/
|
||||||
"do nothing
|
"do nothing
|
||||||
endtry
|
endtry
|
||||||
@ -1394,7 +1394,7 @@ function! s:TreeDirNode.findNode(path)
|
|||||||
if a:path.equals(self.path)
|
if a:path.equals(self.path)
|
||||||
return self
|
return self
|
||||||
endif
|
endif
|
||||||
if stridx(a:path.str(1), self.path.str(1), 0) ==# -1
|
if stridx(a:path.str(), self.path.str(), 0) ==# -1
|
||||||
return {}
|
return {}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -1423,7 +1423,7 @@ endfunction
|
|||||||
"Args:
|
"Args:
|
||||||
"path: a path object
|
"path: a path object
|
||||||
function! s:TreeDirNode.getChild(path)
|
function! s:TreeDirNode.getChild(path)
|
||||||
if stridx(a:path.str(1), self.path.str(1), 0) ==# -1
|
if stridx(a:path.str(), self.path.str(), 0) ==# -1
|
||||||
return {}
|
return {}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -1459,7 +1459,7 @@ endfunction
|
|||||||
"Args:
|
"Args:
|
||||||
"path: a path object
|
"path: a path object
|
||||||
function! s:TreeDirNode.getChildIndex(path)
|
function! s:TreeDirNode.getChildIndex(path)
|
||||||
if stridx(a:path.str(1), self.path.str(1), 0) ==# -1
|
if stridx(a:path.str(), self.path.str(), 0) ==# -1
|
||||||
return -1
|
return -1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -1967,7 +1967,7 @@ function! s:Path.delete()
|
|||||||
else
|
else
|
||||||
let success = delete(self.strForOS(0))
|
let success = delete(self.strForOS(0))
|
||||||
if success != 0
|
if success != 0
|
||||||
throw "NERDTree.PathDeletionError: Could not delete file: '" . self.str(0) . "'"
|
throw "NERDTree.PathDeletionError: Could not delete file: '" . self.str() . "'"
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -2091,7 +2091,7 @@ endfunction
|
|||||||
"Args:
|
"Args:
|
||||||
"path: the other path obj to compare this with
|
"path: the other path obj to compare this with
|
||||||
function! s:Path.equals(path)
|
function! s:Path.equals(path)
|
||||||
return self.str(0) ==# a:path.str(0)
|
return self.str() ==# a:path.str()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: Path.New() {{{3
|
"FUNCTION: Path.New() {{{3
|
||||||
@ -2196,18 +2196,11 @@ endfunction
|
|||||||
"FUNCTION: Path.str(esc) {{{3
|
"FUNCTION: Path.str(esc) {{{3
|
||||||
"
|
"
|
||||||
"Gets the actual string path that this obj represents.
|
"Gets the actual string path that this obj represents.
|
||||||
"
|
function! s:Path.str()
|
||||||
"Args:
|
|
||||||
"esc: if 1 then all the tricky chars in the returned string will be escaped
|
|
||||||
function! s:Path.str(esc)
|
|
||||||
let toReturn = '/' . join(self.pathSegments, '/')
|
let toReturn = '/' . join(self.pathSegments, '/')
|
||||||
if self.isDirectory && toReturn != '/'
|
if self.isDirectory && toReturn != '/'
|
||||||
let toReturn = toReturn . '/'
|
let toReturn = toReturn . '/'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if a:esc
|
|
||||||
let toReturn = escape(toReturn, s:escape_chars)
|
|
||||||
endif
|
|
||||||
return toReturn
|
return toReturn
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -2238,7 +2231,7 @@ endfunction
|
|||||||
"Return: the string for this path that is suitable to be used with the :edit
|
"Return: the string for this path that is suitable to be used with the :edit
|
||||||
"command
|
"command
|
||||||
function! s:Path.strForEditCmd()
|
function! s:Path.strForEditCmd()
|
||||||
let p = self.str(1)
|
let p = self.str()
|
||||||
let cwd = getcwd()
|
let cwd = getcwd()
|
||||||
|
|
||||||
if s:running_windows
|
if s:running_windows
|
||||||
@ -3122,7 +3115,7 @@ function! s:renderView()
|
|||||||
call cursor(line(".")+1, col("."))
|
call cursor(line(".")+1, col("."))
|
||||||
|
|
||||||
"draw the header line
|
"draw the header line
|
||||||
call setline(line(".")+1, b:NERDTreeRoot.path.str(0))
|
call setline(line(".")+1, b:NERDTreeRoot.path.str())
|
||||||
call cursor(line(".")+1, col("."))
|
call cursor(line(".")+1, col("."))
|
||||||
|
|
||||||
"draw the tree
|
"draw the tree
|
||||||
@ -3919,7 +3912,7 @@ endfunction
|
|||||||
"keepState: 1 if the current root should be left open when the tree is
|
"keepState: 1 if the current root should be left open when the tree is
|
||||||
"re-rendered
|
"re-rendered
|
||||||
function! s:upDir(keepState)
|
function! s:upDir(keepState)
|
||||||
let cwd = b:NERDTreeRoot.path.str(0)
|
let cwd = b:NERDTreeRoot.path.str()
|
||||||
if cwd ==# "/" || cwd =~ '^[^/]..$'
|
if cwd ==# "/" || cwd =~ '^[^/]..$'
|
||||||
call s:echo("already at top dir")
|
call s:echo("already at top dir")
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user