Use event BufLeave instead of BufWinLeave to record screen state. The BufWinLeave event also triggered when exiting(:qa), will cause an undefined b:NERDTree error.
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.
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.
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`.
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
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.
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.
* fix the fold markers (they were unnecessarily deep)
* always have one line under each method
* update some of the fold comments -> always use FUNCTION in all caps
* add a modeline to each class 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
Add 2 autocmds - NERDTreeInit and NERDTreeNewRoot. These are called when
a tree is created and when the root is changed. The goal is to give the
fugitive plugin something to listen for so it can add the G* commands to
nerdtree buffers in git repo dirs.
When 'virtualedit' is set, the column where the cursor resides can no longer be
relied on for determining the number of elements in the 'line' list for
iterating. Replacing virtcol() with len() seems to work correctly and not
result in E684 errors. Fixes Issue #144
Previously if we used the gi/gs mappings on a dir node/bookmark the
cursor would end up in the new window. Now it stays in the current
window as expected
KeyMap.bind() does not gracefully handle use of '<>' notation. For
example, trying to call NERDTreeAddKeyMap() with a 'key' argument of
'<Leader>e'. There were some workarounds KeyMap.bind() to help with
this by specifically allowing you to leave off the '<>' parts for
'<C-...>', '<M-...>' and mouse mappings and it would add them back for
you before creating the mapping. This commit reverts some of that logic
and simply says that if the key starts with '<', replace it with <lt>.
These calls to NERDTreeAddKeyMap use the same callback as when these
keys are mapped with a 'scope' of "Node." This should not pose a
problem though as s:previewNodeCurrent, s:previewNodeHSplit and
s:previewNodeVSplit all just call the passed in node's open() method,
which gets passed on to an Opener object.
The core issue is that in some versions of vim resolve() will remove trailing
slashes, while in others it will not. This lead to commit
bc745b6e99 attempting to address a double slash
problem. However, that broke symlink detection on systems where resolve()
removes trailing slashes. This new function just calls vim's resolve()
function, but removes trailing slashes if they exist.
Previously we are doing this every time a nerdtree window was created -
which is wrong and was removing custom mappings from users that overrode
default key mappings.
Now we only generate the defaults once.
Older versions of vim require you to unlet a dictionary function if you
are replacing it (i.e. overriding it in a prototype OO scenario). The
unlet call got lost in the recent refactoring.
Move the code to split windows and open nodes and bookmarks out into a
dedicated class. This will remove duplication and remove and centralise
a concern from the other classes.
Make these all go through .open() and pass in args to control the
behaviour. Deprecate the old `openSplit`, `openVSplit` and
`openInNewTab` methods and make them private.
This makes the API a lot cleaner - it was getting pretty messy in this
regard.
First, set the tree parts regex appropriately depending on
g:NERDTreeDirArrows.
Second, fix an edge case when trying to edit a file like +foo where the
+ meant 'foo' was being interpreted as an arg to the :edit cmd
dont display quickhelp for a mapping if there is no text to display -
this prevents all the default mappings from being displayed under the
"custom mappings" section.
Add "scope" to it. This allows the user to specify that keymaps should
apply to files/directories/bookmarks or everything. This will reduce
the amount of 'if empty(node)' checks that are done