From 3e217115bc467f1298ef7880fbe7fe74f75d5f8e Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Wed, 16 Jul 2008 18:37:52 +1200 Subject: [PATCH] fix a bug with improper use of bufwinnr function add a '^' and '$' to the end of the file matching pattern so it cant get confused by buffer names that happen to be a substring of buffer we are comparing against --- plugin/NERD_tree.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index cc23e79..f04771c 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -2308,7 +2308,7 @@ function! s:OpenFileNode(treenode) call s:PutCursorInTreeWin() "if the file is already open in this tab then just stick the cursor in it - let winnr = bufwinnr(a:treenode.path.StrForOS(0)) + let winnr = bufwinnr('^' . a:treenode.path.StrForOS(0) . '$') if winnr != -1 exec winnr . "wincmd w"