Commit Graph

1077 Commits

Author SHA1 Message Date
Jason Cheatham
1d83e4c1ce Handle non-relative globDir properly in Windows
In Windows, fnamemodify with ':.' will strip the drive letter from a
path that isn't under CWD. This update ensures such a path has the drive
letter.

references #709
2017-06-18 21:23:17 -04:00
Phil Runninger (mac)
5f3a44d066 Document the :NERDTreeFocus command. Closes #706. 2017-06-16 08:50:21 -04:00
Phil Runninger
2c3249de68 Merge pull request #675 from jason0x43/relative-paths
Use relative path with globpath
2017-06-13 09:54:42 -04:00
Phil Runninger
17713ee293 Merge pull request #704 from lifecrisis/bookmarks-markers
FEATURE: The g:NERDTreeMarkBookmarks setting
2017-06-11 23:56:34 -04:00
Phil Runninger
9bd34f9424 Merge pull request #703 from lifecrisis/issue677
BUGFIX: Repair the broken ":OpenBookmark" command
2017-06-11 23:25:09 -04:00
Jason Franklin
9b3487db64 Update the option summary
It came to my attention that the option summary has been neglected for
the past few commits. I added the new option in this feature branch and
updated the descriptions of two nearby options.

This section could use some focused editing.
2017-06-11 09:47:50 -04:00
Jason Franklin
471a03c9d9 Implement the g:NERDTreeMarkBookmarks setting
The setting is self-explanatory. See the added documentation for further
details.
2017-06-10 17:07:57 -04:00
Jason Franklin
3063dfb766 Refactor the :OpenBookmark command
I altered the behavior of the ":OpenBookmark" command to match that of
the "NERDTree-o" mapping. This is acceptable for the following reasons:

 1. It was broken, so no one was using it.
 2. The name matches its behavior.

If a bookmark is to be opened in an explorer window, we should have a
command with a matching name for that behavior (":ExploreBookmark", for
example). This can be added later if there is enough demand for the
feature. Otherwise, this is a perfectly valid change.
2017-06-10 15:59:56 -04:00
Jason Franklin
a03a639390 Refactor and re-document Bookmark.getNode()
A few minor changes were made to the "Bookmark.getNode()" function for
the purposes of improving readability and documentation clarity.

This process also led me to the conclusion that the "findNode()"
function should be refactored to throw an error if a node cannot be
found. This would lead to greater uniformity in the reporting of
failures to find a node. It is generally better style to have an error
thrown as close to the source as possible. A substantial change like
this should wait for now.
2017-06-10 13:29:27 -04:00
Jason Franklin
c0b90811b0 Add an argument sigil in a Bookmark class method
A missing argument sigil is effectively a syntax error in VimL. The
function in which the error occurred was called in the execution of at
least three buffer-local NERDTree commands:

 1. :Bookmark (specifically, when trying to overwrite a Bookmark)
 2. :OpenBookmark
 3. :RevealBookmark

Only one specific type of error message associated with these commands
is fixed here (see issue #677).

The problems with the above commands are not fully addressed by this
commit, and their behavior can be improved immensely by further
refactoring. However, no one has been able to even use these commands at
all before now because the fix given here was not in place.

More work will need to be done to improve the behavior of these commands
so that they truly function as any reasonable user would expect.

Fixes #677.
2017-06-10 11:18:14 -04:00
Jason Franklin
b0f60552ea Rewrite and expand the header in bookmark.vim
The header in "bookmark.vim" was pretty weak. It provided no description
of the class it contains and no direction for the reader. In particular
it did not note the dual purpose of the "Bookmark" class.

The fact that the "Bookmark" class serves two purposes must be noted
because many readers will expect class definitions to obey the single
responsibility principle!

If there is a chance for a major refactor of this class in the future, a
priority would be splitting the class in two so that a "BookmarkList"
class can assume the responsibility for providing a container for all
"Bookmark" objects.
2017-06-10 09:57:18 -04:00
Jason Franklin
81a42acb97 Refactor the bookmark query function
The function in "bookmark.vim" that allows the caller to query the list
of Bookmarks by name had stale commentary. In addition, the internals of
the function needed to be reworked to improve readability. Making this
function very clean is important because it is heavily used elsewhere.

As a side note, it might be beneficial to later rename this function to
something like "GetBookmarkByName" to further improve readability. That
change is not critical and can be safely delayed.
2017-06-10 09:28:14 -04:00
Phil Runninger (mac)
a9ab90198b Update CHANGELOG, giving contributors their due. 2017-06-05 09:00:31 -04:00
Phil Runninger
84c681989d Merge pull request #699 from asnr/add-keymaps-to-docs
Update docs with already existing mapping variables
2017-06-04 08:43:13 -04:00
asnr
3a7293d450 Update docs with already existing mapping variables 2017-06-04 19:11:46 +10:00
Phil Runninger
c11affabb4 Merge pull request #696 from lifecrisis/issue361
BUGFIX: Broken "g:NERDTreeBookmarksSort" setting fixed.
2017-05-26 14:27:14 -04:00
Jason Franklin
2a7a375729 Remove code duplication from sorting bookmarks
It makes the most sense to sort the global bookmarks list just before
rendering them in the NERDTree window. Since Vim's sort function is fast
and stable, and since users are very unlikely to have a number of
bookmarks that is too large, we can sort before rendering without
concern for the negligible performance penalty.

This has two benefits:
  1. Users can change their sort settings and have them take effect
     on the next render or refresh.
  2. As mentioned, code duplication is avoided.
2017-05-26 13:46:09 -04:00
Jason Franklin
0b65089122 Reimplement the bookmark comparison method
Sorting the list of user bookmarks requires care to ensure that Vim's
builtin sort function is called correctly. Previously, this function was
called incorrectly. This is why the sorting of bookmarks never worked.

The offending functions have been removed here and replaced with
"s:Bookmark.CompareBookmarksByName". To understand the necessity for
this change, read ":h sort()" for the requirements of the function
reference argument (esp., note that it must return -1, 0, or 1).

In addition to fixing this problem, the new comparison function will
inspect the "g:NERDTreeBookmarksSort" setting to determine whether
case-sensitivity is preferred in the sort. The documentation has been
modified to accurately reflect this adjustment. The change is also made
in such a way as not to break any existing configurations.

Fixes #361 ("My bookmarks aren't sorted").
2017-05-26 13:23:05 -04:00
Jason Franklin
5aec5ecfef Rename the class method for sorting bookmarks
A more intention-revealing name was chosen for the script-local sorting
function. The function comment was also rewritten.
2017-05-26 08:48:38 -04:00
Jason Franklin
519436ad20 Apply consistent spacing before fold markers
The trailing fold markers in "bookmark.vim" varied in how far they were
from the end of the line. This created an unpleasant visual effect when
folding was in use.
2017-05-26 08:27:14 -04:00
Phil Runninger
66e00e61a2 Merge pull request #695 from scrooloose/revert-626-win32unix
Revert "Determine if we're running in Cygwin on Windows."
2017-05-23 07:16:53 -04:00
Phil Runninger
d99967cadd Revert "Determine if we're running in Cygwin on Windows." 2017-05-23 07:15:35 -04:00
Phil Runninger
0b84d458d6 Merge pull request #648 from cntoplolicon/master
correct NERDTreeIgnore pattern in doc
2017-05-20 03:26:05 -04:00
Phil Runninger
fce10d1b10 Merge pull request #626 from scrooloose/win32unix
Determine if we're running in Cygwin on Windows.
2017-05-20 03:25:38 -04:00
Phil Runninger
925627536e Merge pull request #574 from sooth-sayer/master
Remove empty segments
2017-05-20 03:07:36 -04:00
Phil Runninger
23ba97d263 Merge pull request #691 from wincent/patch-1
Update stale comments
2017-05-18 12:33:11 -04:00
Greg Hurrell
0c0bde3106 Update stale comments
@lifecrisis pointed out this stale comment here:

https://github.com/scrooloose/nerdtree/pull/578#issuecomment-302392831

Closes: #640
2017-05-18 07:02:02 -07:00
Jason Cheatham
0caa466854 Use relative path with globpath
Wildignore rules that involve directories aren't handled properly (or at
least as one might expect) when globpath uses absolute paths. For
example, when wildignore contains `src/*.js`, `globpath("src", "*")`
works as expected, while `globpath("/home/user/project/src", "*")`
doesn't.
2017-04-19 10:17:45 -04:00
Phil Runninger
45f4d61f04 Merge pull request #578 from wincent/eventignore
Suppress autocmds less aggressively
2017-04-12 09:50:28 -04:00
Phil Runninger (mac)
97d2d70f6c Add an Issue template to ask for more information up front. 2017-03-29 11:27:04 -04:00
Phil Runninger
649d31384c Merge pull request #676 from josephfrazier/patch-1
Fix headers in readme
2017-03-27 09:39:22 -04:00
Joseph Frazier
bf193320f8 Fix headers in readme 2017-03-26 14:51:09 -04:00
Martin Grenfell
e671e403dd don't touch @o and @h registers when rendering
This just isn't needed, and leaves traces as it turns out:
http://stackoverflow.com/questions/42455953/ho-automatically-writes-vim-registers

Thanks @romainl
2017-02-25 15:23:12 +00:00
Phil Runninger
281701021c Merge pull request #649 from alegen/master
fix bug with files and directories that have dollar sign in name
2017-01-02 08:34:15 -05:00
Alex Geana
9c73a19f56 fix bug with files and directories that have dollar sign in name 2016-12-29 23:22:48 +01:00
cntoplolicon
dee152d08f correct NERDTreeIgnore pattern in doc 2016-12-23 17:51:36 +08:00
Martin Grenfell
eee431dbd4 really fix the previous buffer issue when closing a tree win
So :bprev was failing to jump back to the right buffer. I dont fully
understand this yet, but I'm fairly sure this is because there is a
magic <directory> buffer that we delete when creating a wintree :-/

Anyway, we are explicitly storing the prev buffer again - and updating
it when reusing treewins. It's worky, but there may be a superior way...
2016-10-21 14:48:05 +01:00
Martin Grenfell
48df6bfd6e Revert "remove NERDTree.previousBuf() and related code"
This reverts commit 2027ae03db.
2016-10-21 14:40:18 +01:00
Martin Grenfell
513bf64555 update changelog 2016-10-19 14:11:40 +01:00
Martin Grenfell
2027ae03db remove NERDTree.previousBuf() and related code
We were using this when closing a wintree - to go to the previous
buffer. Not sure why we weren't just using `:bprev` ...
2016-10-19 13:28:44 +01:00
Phil Runninger
4477078170 Unlet! the nt variable before letting it.
Some will have a "NERDTree" buffer variable and others will not. In the
ones that do, getbufvar will return a dictionary. getbufvar will return
an empty string from the other buffers. When looping through the buffers,
let will throw an error if nt already exists and is a different type than
what is trying to be put into it. This easily can be illustrated by these
two statements:

:let x = ""
:let x = {}
E706: Variable type mismatch for: x

This commit gets rid of the variable before setting it so that the
mismatch cannot occur.
2016-10-17 10:30:33 -04:00
Martin Grenfell
84e7a77a7e reuse win trees when editing the same dir again
If you do

```
:edit some/dir/
```

then do the same thing at a later point, then the same nerdtree buffer
will be loaded/shown the second time.
2016-10-14 16:34:08 +01:00
Phil Runninger
334fb0e687 Update CHANGELOG 2016-10-13 16:10:27 -04:00
Phil Runninger
25ec8b47c6 Merge pull request #630 from Leeiio/patch-1
Update NERDTreeOpenable and NERDTreeClosable color
2016-10-13 15:33:05 -04:00
瓜牛
32186f1660 Update NERDTreeOpenable and NERDTreeClosable color
It is more comfortable
2016-10-13 13:38:36 +08:00
Phil Runninger
b9b53d814b Update CHANGELOG 2016-10-10 15:18:14 -04:00
Phil Runninger
10ac799808 Update README.markdown
Adjusted the wording of one of the tips, and added a sentence about the type of NERDTree window that is displayed. See pull reqest #628.
2016-10-10 15:16:00 -04:00
Phil Runninger
148e8570df Merge pull request #628 from ggicci/master
Add note in README: trick to open NERDTree as a window on startup.
2016-10-10 15:06:53 -04:00
Ggicci
a229d8bb61 Remove a similar tip in README file. 2016-10-11 00:02:29 +08:00
Ggicci
b78fa83373 Fix opening current directory in NERDTree tab. 2016-10-09 20:28:33 +08:00