Commit Graph

322 Commits

Author SHA1 Message Date
Jason Franklin
0a0374b826 Remove an unnecessary assignment 2017-11-11 09:09:19 -05:00
Jason Franklin
870bedef21 Clean up the Creator.createTabTree() function 2017-11-11 09:08:24 -05:00
Jason Franklin
d9074c2753 Clean up the commentary in "creator.vim" 2017-11-11 08:53:47 -05:00
Jason Franklin
3cb90cb18d Extract a common line to the top of a function 2017-11-11 08:45:34 -05:00
Jason Franklin
26168324fc Remove an unnecessary "else" clause 2017-11-11 08:34:29 -05:00
Jason Franklin
f0a97209f1 Clean up the NERDTreeOpener constructor
This method needed some love.  The internals were simplified and
reformatted, and the comment was edited for additional readability.
2017-11-11 08:29:09 -05:00
riyu ken
8a6ae7c633 Use a better function to change directories
When g:NERDTreeChDirMode is 2, changing the tree root will change the working
directory as well.  This change was silent because the wrong function was used to
make the switch.  This commit uses a better function that echoes a message.
2017-09-28 09:04:01 -04:00
Jason Franklin
d7cf9a2a98 Fix the drive check in "TreeDirNode._glob()"
This check did not use the proper abstract method to check for a
path separator. It now does.

This fixes a problem with the 'u' macro that I noticed while working
on the fix for using the NERDTree with 'shellslash'.
2017-08-11 10:14:05 -04:00
Jason Franklin
a32a55e8d9 Rewrite the "Path._strForEdit()" method
This method used the brittle "Path._escChars()" method to do its
work.  This created problems when 'shellslash' was in use on Windows
because excessive escape characters (i.e., backslashes!) are
interpreted by Vim as additional path separators.

The above problem made it impossible to edit files with weird names
using the NERDTree on Windows with 'shellslash' set.  For example,
'+' should be escaped with ":edit", but '(' should not.  So, when
escaping '(', Vim on Windows correctly sees the start of a new
directory in the path.

This was reported in five issues which may be read for further
details and commentary.

Fixes #398, fixes #474, fixes #653, fixes #674, and fixes #733.
2017-08-11 10:09:18 -04:00
Jason Franklin
7a2fc6b6b9 Refactor the "Path._str()" method
This method was using hardcoded values rather than provided
abstractions to do its work. These improvements were necessary.
2017-08-11 09:43:57 -04:00
Jason Franklin
19b8dd7b60 Add a check for 'shellslash' in "Path.Slash()'
Several issues (namely issue #733) report problems with using the NERDTree
on Windows when 'shellslash' is set.  This commit doesn't solve all of these
problems, but it improves the NERDTree's recognition of this setting.
2017-08-11 09:32:01 -04:00
Jason Franklin
72f9135d19 Clean up the commentary for two Path methods
Especially note the improvements to the commentary on "Path.str()".
This method does too much. However, it is used heavily, and changing
its interface would be a major undertaking at this point.
2017-08-11 09:19:36 -04:00
Jason Franklin
b5e54d255e Rewrite the "Path._strForCd()" method
This commit is the first in a series of commits that will rework
some of the methods responsible for escaping pathnames. Some of
these methods simply don't use the features that Vim has properly.

The custom "Path._escChars()" method is far too rigid for our
purposes, and better options have been available for some time.

See ":h fnameescape()" for an especially helpful function in this
effort.
2017-08-11 08:46:41 -04:00
Jason Franklin
1a121337dd Clean up the script header in "path.vim"
Some code was reorganized and comments were written/rewritten.
2017-08-11 08:33:51 -04:00
Jason Franklin
a7d667b81b Add spaces after comment leaders in "path.vim"
Here, I applied the usual fix for the cramped comments I've found in
our scripts. Use this command...

 :%s/^"\ze\S/" /

to fix this problem elsewhere.
2017-08-11 08:07:23 -04:00
Jason Franklin
d68c9abca8 Improve three highlighting rules
The highlighting rules "NERDTreeClosable" and "NERDTreeOpenable" did
not recognize files beginning with a "~" character. This caused bad
highlighting on systems that use "~" and "+" for the dir arrow
symbols by default. Making these rules more specific solves this
problem.

The "~" characters in quickhelp section titles also would get
confused with a custom mapping for "~". Adjusting the
"NERDTreeHelpTitle" solved this problem.

I also changed the quickhelp title in a minor way to reflect the
proper spelling of "NERDTree".
2017-07-29 09:40:11 -04:00
Jason Franklin
35724ee206 Refactor the internals of "_newVSplit()"
The previous change to this function was simple. I figured that it
would be a good time to improve the style of this function with some
minor edits. The function is now cleaner and more readable.
2017-07-29 08:55:28 -04:00
Jason Franklin
719d6785d4 Edit the commentary in "opener.vim"
This commit doesn't change the content of any comments. It just
changes their appearance (leading quotes are now followed by
a space).
2017-07-29 08:37:25 -04:00
Parker Kemp
eae5d02fa9 Use window number when opening in new vsplit 2017-07-24 15:32:59 -04:00
Jason Franklin
5daec4c7b7 Edit stale commentary and add proper sigils 2017-07-14 18:02:02 -04:00
Jason Franklin
3a7694aa55 Add a call to close the children of bookmarks
When bookmarks are opened normally (i.e., when a bookmark is made
the root of the current NERDTree), any open children of that
bookmark will remain open.

This is often inconvenient, especially for users who want bookmarks
to appear "fresh" when opened.
2017-07-14 17:52:00 -04:00
Jason Franklin
1f089a362b Rework the "TreeDirNode.closeChildren()" method
This function needed polishing; in the choice of variable names and
in the leading comment.
2017-07-14 17:36:09 -04:00
Jason Franklin
3245007f0e Remove a method from the TreeDirNode class
The "TreeDirNode.getDirChildren()" method is never called and can be
safely removed.

Further, note that this method has a bug. It calls the "filter()"
builtin function, which modifies "self.children" in-place. This is
obviously not a desirable side effect of calling this function.

If the functionality is genuinely required later, "filter()" should
be called on a copy of "self.children" to achieve the desired
result.
2017-07-14 17:17:25 -04:00
Jason Franklin
ef35ee8918 Remove the helper function for "openRecursively()"
The support function for this method was unnecessary, so I took the
time to remove it. Since "TreeDirNode.openRecursively()" now calls
the "open()" method, it can take advantage of the improvements made
to that function in recent commits. Specifically, this method will
reflect the bugfix provided in pull request #720.
2017-07-04 09:45:06 -04:00
Jason Franklin
7f4a7205dc Replace an equality test with an instance method
A proper instance method was substituted for the more brittle
equality test in the "TreeDirNode.open()" method.

Note that the order of the tests was reversed to account for the
fact that the "isRoot()" method can only be called after the first
test has passed.
2017-07-02 15:16:49 -04:00
Jason Franklin
ebc206e58d Refactor "TreeDirNode.close()" method
This method required adjustment to take cascades into consideration.

Since the arrow in the NERDTree window reflects the status of the
tail directory of the associated cascade, an arrow indicating open
status can be present when a higher directory in the cascade was
closed.

This commit will automatically close child nodes within the same
cascade of a closed directory node so that the arrow accurately
reflects what is rendered.
2017-07-02 12:25:15 -04:00
Jason Franklin
8660541333 Fix the "TreeDirNode.open()" method
Issues #547 and #526 reported a problem with the "open()" method in
the "TreeDirNode" class.

Specifically, opening a cascade in the NERDTree will perform the
opening operation on the tail of the cascade. This is a problem when
other operations (such as the "u" mapping) close intermediate
cascaded directories, which causes opening the tail to have no
effect (other than toggling the arrow).

Here, the "open()" method was modified to open all directories in a
cascade whenever the tail is opened. This is the only reasonable fix
for this type of problem.

Fixes #547 and fixes #526.
2017-07-02 12:25:15 -04:00
Jason Franklin
18f04e0824 Refactor the "TreeDirNode.displayString()" method
I found this method to be unreadable and cumbersome. Cleaning it up
helped me to understand the design ideas behind it.
2017-07-02 12:25:15 -04:00
Jason Franklin
2b2b35ceda Fix an inaccurate version check
Calling the function "globpath()" is complex when one is trying to
support multiple versions of Vim because this particular function
developed rapidly (as did "glob()") during the life of Vim 7.0.

This commit makes the version check for calling "globpath()" much
clearer. It also allows for rendering dead links in the NERDTree by
changing the "globpath()" call for versions of Vim that include
patch 7.4.654. This can be done later when the effects are known and
the feature is officially requested.

Fixes #718.
2017-06-30 10:11:06 -04:00
Jason Franklin
779e13374a Edit the filter in the TreeDirNode glob method
A better style for executing the removal of each filtered name was
chosen. This is a minor change, but I viewed it as necessary.
2017-06-28 16:56:03 -04:00
Jason Franklin
2a97fb0fda Reformat the commentary in the TreeDirNode script
The commentary in "tree_dir_node.vim" needed to be cleaned up a
little. Spaces after leading quotes are a good idea, to avoid the
"clustered" appearance that comments can sometimes have.

Use the following substitution command...

  :s/^"\ze\S/" /

to make this change to longer scripts.
2017-06-28 16:55:54 -04:00
Jason Franklin
b877fc65d8 Rename and expand the TreeDirNode glob method
Pull request #710 also brought to my attention some glaring code
duplication in the TreeDirNode class. This commit renames and
expands the glob method defined in PR #710 into a more general
purpose helper method.

The new method also ensures that 'wildignore' rules are applied
consistently. Issue #569 noted that the application of the
'wildignore' setting in populating a node's children was
unpredictable. When a node was rendered, "_initChildren()" would
load the children with its own call to "globpath()". Refreshing the
same node would then invoke "globpath()" again, but with different
arguments.

The result was that a node's children were initialized using the
'g:NERDTreeRespectWildIgnore' setting, but refreshing ignored this
setting. So, if it the setting was 0, "test.class" might render when
the parent was initialized, and then be removed on refresh (if
'wildignore' contained '*.class').

This commit solves this problem by ensuring that the NERDTree
setting mentioned above is only checked and applied to a node's
children in one place by cleaning up the duplication.

Fixes #569.
2017-06-28 16:55:43 -04:00
Jason Franklin
b0c44c7be1 Refactor the TreeDirNode glob method
Pull request #710 correctly noted that TreeDirNode directories must
be passed to "globpath()" as relative paths (i.e., to the working
directory) if 'wildignore' rules for relative paths are to be
obeyed.

The solution was to use "fnamemodify()" to get a relative path to
the TreeDirNode object's directory, if possible. However, this
method does not modify our TreeDirNode path if it IS the current
working directory. Thus, immediate children of the node are seen as
absolute paths in glob results when our PWD is pointing to their
parent. This is not consistent behavior.

This commit defines the result of this function as ',' when this
special case arises to fix this problem.

See ":h 'path'" for an explanation of how this works.
2017-06-28 16:55:24 -04:00
Jason Franklin
4a487474c4 Modify call to sort() for older versions of Vim (#714)
Older Vim versions seem to require that calls to sort() specify a
dictionary when the compare function argument is a dictionary
function. This seems to be required even when the dictionary is not
used. Since this change does not seem to affect behavior in later
Vim editions, I see no harm in including it.
2017-06-22 17:15:51 -04:00
Phil Runninger
626e80f6e4 Merge pull request #536 from satori/master
Add support for natural sorting order.
2017-06-21 11:33:47 -04:00
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
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
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
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
925627536e Merge pull request #574 from sooth-sayer/master
Remove empty segments
2017-05-20 03:07:36 -04: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
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
Alex Geana
9c73a19f56 fix bug with files and directories that have dollar sign in name 2016-12-29 23:22:48 +01: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
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
5d7bc3b0b8 Merge pull request #533 from devm33/fix_e_on_dir
update api call to open directory tree in window
2016-09-22 15:54:39 -04:00
Phil Runninger
ac2d3b077a Merge branch 'disable-cascade' of git://github.com/juanibiapina/nerdtree into juanibiapina-disable-cascade 2016-09-08 01:02:17 -04:00
Phil Runninger
4428aba2a2 Replace strchars() with a backward compatible workaround. 2016-08-26 08:59:25 -04:00
Phil Runninger
0b73db9368 Simplify some statements. Don't convert path WinToUnix. 2016-08-26 01:32:04 -04:00
Skyler
7730c8731a Quick syntax issue fix 2016-08-25 18:20:32 -07:00
Skyler Lipthay
b5519197e9 Added support for the copy command for both file and directory nodes on Windows systems 2016-08-25 18:19:38 -07:00
Martin Grenfell
15445be5fb remove unneeded exec
As @mkoskar pointed out at:
https://github.com/scrooloose/nerdtree/pull/576#issuecomment-218470556
2016-05-11 16:28:34 +01:00
Mike Zueff
5458680265 Fixed read-only files opening. 2016-04-30 04:08:18 +03:00
Martin Grenfell
35c859179d update initialization of default value for g:NERDTreeCreatePrefix
Init it with the rest of the option defaults - rather than specify the
default at point of use. For consistency.

See #550.
2016-04-26 09:17:03 +01:00
Martin Grenfell
0cb999c070 Merge pull request #550 from wincent/keepalt
Make window creation command configurable
2016-04-26 09:05:57 +01:00
d.chernyatiev
1a55a93788 Remove empty segments 2016-04-25 19:05:17 +04:00
Juan Ibiapina
b2bbed41fa Add option to disable collapsing of diretory names 2016-03-05 14:20:04 -03:00
Juan Ibiapina
88946e9832 Rewrite getCascade recursively 2016-03-05 13:59:27 -03:00
Juan Ibiapina
7f6c608a35 Remove extra whitespace at the end of the line 2016-03-05 13:35:41 -03:00
Alex Carlson
dfb9111786 Allow user-defined RO indicator.
(inspired by overwriting g:NERDTreeDirArrowCollapsible/Expandable)

Replace instances of the RO string with a variable that the user can
override. Useful for custom unicode glyphs, i.e. Font Awesome.

* Initialize variable g:NERDTreeGlyphReadOnly = "RO".
   -> plugin/NERD_tree.vim
* Replace instances of 'RO' with g:NERDTreeGlyphReadOnly
2016-02-26 17:57:40 -08:00
Greg Hurrell
9843fd3686 Make window creation command configurable
This commit adds a `NERDTreeCreatePrefix` setting that can be used to
prefix the `:edit` command that is used to create the NERDTree tree
window. Defaults to "silent", meaning that out of the box the window
will be created with "silent edit".

Users may wish to configure this to produce other effects. For example,
`NERDTreeCreatePrefix` can be set to "silent keepalt keepjumps" in order
to make NERDTree create its window with "silent keepalt keepjumps edit".

This can be used to create an effect analogous to the `g:netrw_altfile`
setting in netrw. An example of why you might want to do this is
described here:

    https://github.com/tpope/vim-vinegar/issues/25

I'm not using vim-vinegar myself, but I am using something like it here:

    https://github.com/wincent/wincent/blob/3efaa8fa50895/roles/dotfiles/files/.vim/plugin/mappings.vim#L60

And having `NERDTreeCreatePrefix` enables me to map "-" to show the
current file in context, and `^-6` to jump back to it.
2016-02-09 00:17:46 -08:00
Maxim Bublis
6251ab1e63 Add support for natural sorting order. 2016-01-19 00:21:13 -08:00
Devraj Mehta
afe99a46d8 update api call to open directory tree in window 2016-01-17 18:51:36 -05:00
Martin Grenfell
2f8a72144f silence an ls! call 2015-11-27 10:14:45 +00:00
Martin Grenfell
bbb819d696 bugfix for win trees when using "stay in current win" command variants
Previously maps like T would not restore the cursor position. Not sure
why the code was like this in the first place... hopefully I haven't
just broken a bunch of shit.

Closes #146.
2015-11-26 19:52:40 +00:00
Martin Grenfell
0544ff524c handle tab tree buffers being :bdeleted
Closes #375
2015-11-26 19:14:51 +00:00
Martin Grenfell
fddac60afb fix a bug that occurs when opening window trees
Closes #507
2015-11-26 09:31:55 +00:00
Martin Grenfell
c800aa27e2 fix a bug with C mapping
Closes #512
2015-11-26 09:27:44 +00:00
Martin Grenfell
a2b06bbac3 remove references to NERDTreeDirArrows
Closes #515
2015-11-26 00:25:06 +00:00
Martin Grenfell
677a83b2b6 remove NERDTreeDirArrows option
Use +/~ for windows - which seems to not have the arrow chars in its
default font. TBH I don't really understand this.

Inprove the UI indent matching so that it should handle any combo of
open/close symbol lengths e.g. the fancy arrows are 3 bytes each,
whereas +/~ are 1 byte each.
2015-11-25 23:29:00 +00:00
Martin Grenfell
fb15cfbf45 fix flag rendering for cascading dirs
Use the innermost dirs flags only. Previously each dirs flags were
rendered inline i.e.

    [x]dir1/[y]dir2/[z]dir3/

This looked bad and broke the UI. Now we only render the flags for dir3
- and render them on the left side of the cascade.

Not sure if this is ultimately the right decision - but will do for now.
2015-11-25 22:12:52 +00:00
Martin Grenfell
af39458989 rework the cascading slightly to correctly show open/closed dir arrows 2015-11-24 22:06:04 +00:00
Martin Grenfell
2cef8bb602 make cascading dirs more compact
Render cascading dirs on one line i.e.

    > foo/bar/baz
      file1

instead of

    > foo
      > bar
        > baz
          > file1

This should be useful things like java projects that have deep dir
structures.

Remove the old UI view (pre the dir arrows) as this simply isnt worth
supporting for a proof of concept. This may get added back - or not.
2015-11-24 20:59:35 +00:00
Martin Grenfell
ee4d42cfed encapsulate dep on g:NERDTreeMinimalUI in a function 2015-11-22 14:02:56 +00:00
Martin Grenfell
dd754c7bc6 add path.isAncestor 2015-11-20 19:16:07 +00:00
Martin Grenfell
9eb0004278 fix a syntax issue for older versions of vim
closes #508
2015-11-20 19:15:51 +00:00
Martin Grenfell
7c6795c5a2 fix a typo 2015-11-20 16:45:05 +00:00
Martin Grenfell
a60bd34a33 add NERDTree.getroot()
Eventually 'root' will become a "private" instance var '_root'
2015-11-20 16:16:12 +00:00
Martin Grenfell
c4f8681b77 add NERDTree.getRoot() and NERDTree.ForCurrentTab() 2015-11-20 01:52:38 +00:00
Martin Grenfell
665f326577 remove dependency on b:NERDTree from classes that dont need it
Inject it where needed.
2015-11-20 01:44:12 +00:00
Martin Grenfell
a0de028688 wipeout "stale" nerdtree bufs
When :NERDTree is called several times and &hidden is set, stale
nerdtree bufs will exist. Wipe them out.
2015-11-19 23:44:39 +00:00
Martin Grenfell
cedb40b4f5 move TreeFileNode.makeRoot() to NERDTree.changeRoot(node) 2015-11-16 13:17:59 +00:00
Martin Grenfell
71ee64fed7 add TreeDirNode.getDirChildren() - using this in a plugin 2015-11-16 11:30:16 +00:00
Martin Grenfell
bf217c75f9 fix a couple of var references in UI 2015-11-16 11:29:54 +00:00
Martin Grenfell
d36b793656 dont use b:NERDTreeRoot internally, but leave the var there for compat
Use b:NERDTree.root instead. I will eventually remove  b:NERDTreeRoot
altogether - but this will break some other plugins so leave it for now.
2015-11-16 11:28:24 +00:00
Martin Grenfell
0b966aa23a refactor TreeDirNode.reveal slightly 2015-11-16 09:35:31 +00:00
Martin Grenfell
b4fa33c39c remove some confusing redundancy from a few function calls 2015-11-15 01:04:03 +00:00
Martin Grenfell
83d108894e move a bunch of b:NERDTree.* vars into the b:NERDTree.ui obj 2015-11-15 00:45:57 +00:00
Martin Grenfell
4d8a0c90cb move b:NERDTreePreviousBuf into NERDTree class 2015-11-14 13:10:08 +00:00
Martin Grenfell
5c20274761 move b:NERDTreeType into the NERDTree class and add some query methods 2015-11-14 12:01:55 +00:00
Martin Grenfell
848857d18b rename "primary" and "secondary" trees to "tab" and "window" trees
This is much more accurate and descriptive.
2015-11-14 11:50:01 +00:00
Martin Grenfell
0c13ebc126 remove some old commented code 2015-11-13 15:08:01 +00:00
Martin Grenfell
47c20c4b64 Merge pull request #378 from Xuyuanp/up/master
fix #363
2015-11-12 14:29:12 +00:00
hiberabyss
34630f3926 issue #147: add support to ~ expand in bookmarks 2015-09-20 00:53:39 +08:00
Igor Tatarintsev
dc29ec2db3 Added global variables for changing default arrows
g:NERDTreeDirArrowExpandable
g:NERDTreeDirArrowCollapsable
2015-09-11 23:52:37 +06:00
Igor Tatarintsev
188bd92658 Added global variables for changing default arrows 2015-09-11 23:44:06 +06:00
Rick van Hattem
013c607ba4 Fixed incompatibility with older Vim versions
Fixed incompatibility with older Vim versions that are compiled without float function support such as `log10` and `ceil`

This fixes #452
2015-05-22 13:14:01 +02:00
Martin Grenfell
af85499eda 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
2015-05-13 20:29:03 +01:00
Martin Grenfell
99fa465b5d fix syntax error 2015-05-13 20:27:22 +01:00
Vincent Tsang
10261d60a0 Updated the comment 2015-05-11 11:59:10 +08:00
Vincent Tsang
80e184df56 Refactor code to use getSortKey() and replace regular expression with
simple string comparison in tree_dir_node.vim
2015-05-11 11:56:08 +08:00
Vincent Tsang
57d5bd7731 Speed up sortChildren() by using sorting token
This improves the sorting functions from 12 seconds to 0.66 seconds for
~4000 objects
2015-05-09 22:47:33 +08:00
Martin Grenfell
a87b1bf3c5 Merge branch 'update_reuse_option' 2015-05-06 21:42:03 +01:00
Martin Grenfell
76dbc0c8ee Merge branch 'add_path_filter_api' 2015-05-06 20:58:55 +01:00
Martin Grenfell
da3874cf93 fix a bug when opening files in a new tab
On bufleave we save the nerdtree window state. However, sometimes when
bufleave is triggered the tree is no longer open in this tab - e.g. for
secondary trees or mappings that open in another tab. Dont bother saving
screen state in these cases as the code doing the saving assumes the
tree is available in this tab.
2015-05-04 20:25:43 +01:00
Martin Grenfell
7270212214 bugfix for secondary trees occurring when the screen state is saved 2015-05-03 11:14:34 +01:00
Martin Grenfell
64a9579c11 add a path filter API
Add an API to allow custom "path filter callbacks" to be added.

Previously we allowed one path filtering function to exist called
`NERDTreeCustomIgnoreFilter`. This has been removed and replaced with an
API to allow any number of such functions to exist -  via the new
`NERDTreeAddPathFilter()`
2015-05-02 22:21:41 +01:00
Martin Grenfell
fc4bcb4806 remove UI.lolcats()... not sure what the story is there 2015-05-02 15:26:59 +01:00
Martin Grenfell
8b189cb263 move some rendering and cursor moving functions out of autoload 2015-05-02 15:24:59 +01:00
Martin Grenfell
b0114d202b move dumpHelp out of autoload 2015-05-02 15:05:28 +01:00
Martin Grenfell
53d2de86eb move the closeTree functions out of autoload
Remove `closeTreeIfOpen` and just make `closeTree` fail silently.
2015-05-02 15:03:54 +01:00
Martin Grenfell
0d88ce946f move isTreeOpen() out of autoload 2015-05-02 14:44:32 +01:00
Martin Grenfell
8270b6d717 move nerdtree#getTreeWinNum out of autoload 2015-05-02 14:32:21 +01:00
Martin Grenfell
973c9906f8 refactor 3 more functions out of the monolithic autoload file 2015-05-02 14:17:52 +01:00
Martin Grenfell
f8499462c5 Revert "Use different arrow characters for compatibility."
This reverts commit f6cad7e957.
2015-05-02 11:29:43 +01:00
Martin Grenfell
5cec19365a Merge pull request #411 from xdl/master
Fix for nonexistent dir/bookmarks given to NERDTree commands
2015-05-01 16:05:35 +01:00
Martin Grenfell
87b27802b5 allow control over whether to reuse windows in different tabs
When opening a file we will "reuse" a window if the buffer is already
open somewhere.

Add an option to NERDTreeOpener to configure it to not reuse windows
across tabs.
2015-05-01 15:33:06 +01:00
Curtiss Howard
f6cad7e957 Use different arrow characters for compatibility. 2015-04-17 17:36:23 -04:00
xiaodili
6dfbcd660a Return early if exception was thrown in pathForString 2014-12-21 17:44:41 +00:00
Giacomo Comitti
ba26044746 Truncate paths at slashes. 2014-11-20 07:50:47 +01:00
Martin Grenfell
3d421b8ec5 use the built in fnamemodify() to make a path relative
Closes #383
2014-10-29 19:18:28 +00:00
Martin Grenfell
1c08146224 apply @mixvin's windows path fix at the top of the method instead 2014-10-29 11:20:58 +00:00
mixvin
cd8d87fa57 Fix opening file path, in Windows 2014-10-29 11:17:53 +00:00
Xuyuan Pang
8e06723c04 fix #363 2014-09-01 17:32:59 +08:00
Xuyuan Pang
8cd045d0e2 add refreshDirFlags method to avoid refreshing too many files 2014-07-19 17:57:41 +08:00
Martin Grenfell
c2dd750860 move nerdtree#treeExists.* methods into the NERDTree class 2014-07-17 20:31:17 +01:00
Martin Grenfell
fd14757c04 add proper events and make the notifier class generic
Expand the event system to have explicit Event objects and potentially
many Notifiers. Previously they was only one notifier and one (implied)
event.

A lot of this is stolen from #358.
2014-07-17 20:18:09 +01:00
Martin Grenfell
f9a933991d allow plugins to override the default mappings 2014-07-15 19:00:17 +01:00
Martin Grenfell
9f351de594 Merge branch 'master' into expt_add_path_flags_and_git 2014-07-09 09:26:17 +01:00
Martin Grenfell
1e0d1cbc8f move some more view code into the UI class 2014-07-09 09:25:25 +01:00
Martin Grenfell
2f59cc2080 Merge branch 'master' into expt_add_path_flags_and_git 2014-07-08 09:47:38 +01:00
Martin Grenfell
8644622000 Merge branch 'master' into expt_add_path_flags_and_git
Conflicts:
	autoload/nerdtree.vim
	lib/nerdtree/creator.vim
2014-07-08 09:38:43 +01:00
Lucas Caton
1784de15dd Updating creator.vim file (this fixes #352) 2014-07-08 10:57:39 +10:00
Martin Grenfell
23dfc6d818 continue breaking down the epic autoload module
Add 2 new classes and move code into them from autoload:

* NERDTree. Each nerdtree buffer now has a NERDTree object that holds
  the root node and will old other util functions
* UI. Each NERDTree object holds a UI object which is responsible for
  rendering, getting the current node, etc

Still a fair few methods to sort through in autoload (many of which will
end up in the above classes) - need sleep though.
2014-07-07 22:59:28 +01:00
Martin Grenfell
f982f61e8a continue breaking up the autoload/nerdtree god module 2014-07-07 21:34:57 +01:00
Martin Grenfell
86488b1aa0 move ui functions out into their own autoload
All of the autoload shit needs to be cleaned up... break it out first
2014-07-07 19:36:34 +01:00
Martin Grenfell
04d9b27541 add .refreshFlags() to path/dir/file objects
This will trigger the path refresh callbacks without refreshing the
path's from disk (which takes ages)
2014-07-07 18:24:37 +01:00
Martin Grenfell
3941389f13 fix a retarded bug with FlagSet.clearFlags 2014-07-06 23:36:45 +01:00
Martin Grenfell
32cf3ee62d allow flags to be scoped to a plugin
Add new FlagSet class and init each Path with one.

Call Path.flagSet.addFlag(scope, flag) instead of Path.addFlag(flag)
2014-07-05 20:51:21 +01:00
Martin Grenfell
a7428eba38 add proof of concept for path flags API and add git modified flags 2014-07-05 00:29:45 +01:00
Martin Grenfell
d162c08fd7 comment and tweak the <LeftRelease> fix in 24561ad 2014-07-02 20:54:14 +01:00
Martin Grenfell
2a769a7263 Merge pull request #298 from buggo/master
Fix error 121 when clicking on command line below another window
2014-07-02 20:49:59 +01:00
Martin Grenfell
0ee888ee17 simplify the <cr> mapping definition 2014-07-02 20:25:17 +01:00
Shane Smith
82cd4f5a9f Fix <CR> not working if active node map is special char such as <Right> 2014-07-01 20:29:52 -04:00
Martin Grenfell
4b89264dfc Merge branch 'better-set-filetype' of https://github.com/inkarkat/nerdtree into inkarkat-better-set-filetype 2014-06-27 19:37:17 +01:00
Martin Grenfell
0928b5b026 Merge pull request #251 from pendulm/master
fix typo and smart close single child directory
2014-06-27 19:25:48 +01:00
Martin Grenfell
8b48413155 rename NERDTreeWildIgnore option and refactor the usage of it
Rename it to the more intention revealing NERDTreeRespectWildIgnore.

Use it directly in the `globpath()` call rather than surrounding if
statement. Its subjective, but I find this clearer.

Add an initializer for the option.
2014-06-26 10:02:42 +01:00
Martin Grenfell
186abb84c1 Merge pull request #303 from amarshall/wildignore
Add option to respect wildignore
2014-06-26 09:48:39 +01:00
Martin Grenfell
10ba84b1fc Merge pull request #308 from igrep/patch-1
correct invalid reference to MenuController
2014-06-26 09:40:01 +01:00
Martin Grenfell
a45304832b Merge pull request #295 from DanielleSucher/create_parent_directories_as_needed
Create parent directories as needed when creating or copying nested nodes
2014-06-26 09:35:02 +01:00
Martin Grenfell
23d2d19846 Merge pull request #331 from jinnko/add-bookmarks-sort-flag
Add flag to disable/enable bookmark sorting
2014-06-26 09:27:58 +01:00
Jaeho Shin
43842e0de5 Option for mixing dot files when sorting
NERDTree can now optionally ignore the dot at the beginning of hidden
filenames for sorting to show them next to normal files if
`g:NERDTreeSortHiddenFirst` is set to 0.  (By default it's set to 1 to
preserve the current behavior.)  This is just like what GNU ls does when
`LC_COLLATE` environment variable is set to `en_US`.
2014-06-09 23:11:44 -07:00
Jinn Koriech
e38d8a8340 Add flag to disable/enable bookmark sorting
The bookmarks are normally sorted, however with a newly introduced
flag this can be disabled.
2014-04-24 15:51:55 +01:00
Yamamoto Yuji
ad4ebaac93 correct invalid reference to MenuController
I found an error when I tried to use [git_menu.vim](g:NERDTreeMenuController):

```
Error detected while processing function nerdtree#invokeKeyMap..91..90..<SNR>52_showMenu..65..82:
line    2:
E121: Undefined variable: s:MenuController
E15: Invalid expression: s:MenuController.New(self.children)
line    3:
E121: Undefined variable: mc
```

I searched the line at which it happened
then, I found that `s:MenuController` is not defined in  `menu_item.vim` but in menu_controller.vim .
So I corrected the name to refer to MenuController.
2014-02-01 20:56:40 +09:00
Andrew Marshall
a50c571929 Add option to respect wildignore 2013-12-07 00:10:46 -05:00
Rickard Karlsson
24561ad59c Ugly hack to fix Error 121 when NERDTree is the active window and clicking on the command line below another window. 2013-11-05 12:17:28 +01:00
Danielle Sucher
eacd5d72ec Create nested parent directories as needed
Allows the user to create or copy a nested node
in a single step with ma or mc, recursively
creating nested parent directories if needed, and
without throwing any errors if they already exist.

[Finishes #163, #34]
2013-10-12 20:18:43 -04:00
Volodymyr Medvid
21af5e0abd fix spelling in documentation 2013-05-14 16:39:46 +03:00
Martin Grenfell
6697bb7bed Revert "don't redefine user-defined mappings"
This reverts commit 2fa35fb494.
2013-05-13 10:00:40 +01:00
Josh Hoff
2fa35fb494 don't redefine user-defined mappings
As a user it's a little jarring when a plugin maps over something I've
already defined.  This patch fixes that problem, by using `<unique>` to
ensure unique mappings.

For more info see `:help <unique>`

Note: This has no effect if the mapping isn't already defined (that is,
NERDTree is defining a unique mapping), so this won't break for normal
users of the plugin.

Note: `:silent!` is needed to ignore the error that occurs when a
mapping is already defined.

Fixes #252
2013-04-25 21:34:36 -05:00
pendulm
60683f1cce Fix typo Casade to Cascade 2013-04-22 23:35:15 +08:00
Martin Grenfell
eaf19734e7 move the class files out of the plugin dir
On some new versions of vim these files were being loaded before the
main NERD_tree.vim which was causing errors as dependencies werent
loaded in time. Move the classes into lib - so vim wont try to load them
until we tell it
2013-04-13 20:32:25 +01:00