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.
* 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.