Commit Graph

50 Commits

Author SHA1 Message Date
Alexey Shumkin
cb9f4db6ff fixed: directory navigation does not work on Cygwin
Directory tree navigation is broken because of directory signs which is
shown in UTF-8.

Cygwin is a Windows application, so it uses ASCII codepages and so
directory signs must be in ASCII, but if to modify
"nerdtree#runningWindows" function there are many other functions break
that convert paths, e.g.

So, the quick and reliable solution is to add a
separate function "nerdtree#runningCygwin" and use it in a specific
place.
2017-10-27 10:06:51 +03: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 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
Phil Runninger
d99967cadd Revert "Determine if we're running in Cygwin on Windows." 2017-05-23 07:15:35 -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
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
Phil Runninger
45f4d61f04 Merge pull request #578 from wincent/eventignore
Suppress autocmds less aggressively
2017-04-12 09:50:28 -04: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
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
a9a5aec9c0 Determine if we're running in Cygwin on Windows. 2016-10-06 17:51:22 -04:00
Greg Hurrell
35b04fa3df Suppress autocmds less aggressively
This is the counterpart to a PR I just submitted to undotree
(https://github.com/mbbill/undotree/pull/61).

I noticed that my statusline doesn't update properly when using NERDTree to move
between revisions of a file with `go` or `gi`
(https://github.com/wincent/wincent/issues/16). I established that this was
because it was using `'eventignore'` to suppress all autocmds, which in turn
prevents the statusline from updating.

Commenting out the `set eventignore=all` line makes the failure to update go
away, at the cost of firing more autocmds.

I considered adding an option for opting out of this behavior (eg. `let
g:NERDTreeEventignore=0` or something), or rearchitecting my statusline to use
an approach like vim-airline does based on CursorMoved autocmds (see
https://github.com/vim-airline/vim-airline/issues/82; see also
30f078daf5/plugin/airline.vim (L36-L50)
for current implementation), but then realized that a simpler fix is to have
NERDTree just disable only the autocmds that it uses instead of disabling all of
them.

This is probably not enough to unbreak every bit of code in the world that
depends on those autocmds, but it does at least unbreak my use case, because it
allows my `WinLeave` autocmd to run and update the statusline.
2016-05-05 09:35:16 -07:00
Maxim Bublis
6251ab1e63 Add support for natural sorting order. 2016-01-19 00:21:13 -08:00
Martin Grenfell
4ebbb533c3 silence bookmark errors on startup
Just disable the warning for now. The bookmark system will be replaced
with the project system soon - so no sense putting much effort into
this.

Closes #168
2015-12-02 21:17:22 +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
4dada8c04f update version number to 5.0.0 2015-11-13 16:57:21 +00:00
toiffel
93c9726c6d Fixed case-sensitive sorting of tree nodes when 'ignorecase' option is on 2015-07-13 03:03:14 +06: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
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
Curtiss Howard
f6cad7e957 Use different arrow characters for compatibility. 2015-04-17 17:36:23 -04: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
0c045d85ea fix a bug from recent refactoring RE some NERDTreeCWD 2014-07-14 09:43:45 +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
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
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
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
55a8954c48 update the doc/quickhelp for :Bookmark
Make it clearer that the argument is optional.

Closes #229
2014-06-29 12:37:29 +01:00
pendulm
6ef67a2d8e Add correspoding close action to cascade open single child dir 2013-04-22 23:39:26 +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
Martin Grenfell
f93d2c79e5 fix NERDTreeCWD
Closes #233
2013-04-03 13:39:10 +01:00
Martin Grenfell
64cb6204cc move a couple of functions into NERDTreeCreator
The "next buffer name" functions are only used in NERDTreeCreator so put
them there.
2013-01-09 09:51:28 +00:00
Martin Grenfell
c3b63d2fd9 add some class methods to wrap the NERDTreeCreator public methods
This is needed because some versions of vim dont let you chain method
calls together. So do the work in NERDTreeCreator instead of forcing all
callers to break the New().createXXX() calls out onto 2 lines with an
intermediate variable.

Fixes #226.
2013-01-09 00:43:37 +00:00
Martin Grenfell
25b80b8a16 extract the tree creation functions out into their own class
Add the NERDTreeCreator class.

Stick all functions related to creating a primary/secondary/mirror
nerdtree in there. We may break this down further in the future, but
this is a good starting point.

Make some of the interface binding functions in autoload/nerdtree
public. This is needed since we are accessing some of them from
NERDTreeCreator. Should be temporary until we get some kind of proper
interface binding system set up.
2013-01-08 00:04:30 +00:00
Martin Grenfell
a7d5b3dbc1 fix the <enter> mapping
It now acts the same as the ActivateNode mapping ('o' by default) again.
This was broken in the big refactor.

Fixes #222
2013-01-05 11:58:36 +00:00
Martin Grenfell
cc0777b792 move KeyMap_Invoke into the autoload file
This will keep the class file cleaner, and may also fix #223
2013-01-05 11:44:48 +00:00
Martin Grenfell
8a984260e7 manually apply #220 to fix NERDTreeFind for hidden dirs 2013-01-05 01:48:13 +00:00
Martin Grenfell
370f180ca0 replace a script level var with a query 2013-01-05 01:47:20 +00:00
Martin Grenfell
fb4a5a116a decompose the giant NERD_tree.vim file
* Move the classes out into `plugin/nerdtree/<classname>`.
* Move the other functions out into `autoload/nerdtree.vim`.

Stuff still to do:

* extract out at least one view class from `autoload/nerdtree` -
  something like NERDTreeWindow
* figure out which functions in autoload/nerdtree should be scoped to
  the script instead of public
2013-01-05 01:08:06 +00:00