Commit Graph

523 Commits

Author SHA1 Message Date
Jason Franklin
5442d5e04a Put cursor in first column 2018-09-10 08:52:43 -04:00
Jason Franklin
7e00a9971e Check for error; remove code duplication 2018-09-10 08:46:42 -04:00
Phil Runninger (mac)
c726ec7318 Implement PR review comments. 2018-09-10 06:57:39 -04:00
Phil Runninger (mac)
18071f5999 NERDTreeCWD: reset CWD if changed by NERDTreeFocus
When the user has `'autochdir'` turned on, opening a new NERDTree will
cause the current working directory to change. To prevent this
happening, remember the CWD and reset it if NERDTreeFocus caused it to
change.
2018-08-22 17:01:08 -04:00
Phil Runninger (mac)
e99a7a0313 Restore the cached _sortKey for faster processing.
Also add a new global variable to track when the g:NERDTreeSortOrder
changes. If it has been changed, or when the cached _sortKey value is
uninitialized, then calculate the sort key. This improves processing
speed over the previous commit, and allows on-the-fly changes to the
sort order, (without required vim to be restarted.)
2018-07-27 08:46:50 -04:00
Phil Runninger (mac)
1e2b7ef98d Remove AddDefaultGroupToSortOrder check from startup.
The call to AddDefaultGroupToSortOrder in NERD_tree.vim is redundant
because it's also done every time sortChildren is called. And since the
check is done only once, there's no need for a function either.
sortChildren now just contains the needed if statement.
2018-07-02 09:06:09 -04:00
Phil Runninger (mac)
a053925279 Recalculate the node's sortkey every time.
The cached _sortkey wasn't being recalculated after changing the
NERDTreeSortOrder, resulting in incorrect sort orders.
2018-07-01 19:57:02 -04:00
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
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
Phil Runninger
408f7a572c Revert "changed arrows for NERDTreeDirArrowExpandable and NERDTreeDirArrowCol…" 2016-10-04 17:52:12 -04:00
Phil Runninger
f173f62c9a Merge pull request #546 from gwilk/master
changed arrows for NERDTreeDirArrowExpandable and NERDTreeDirArrowCol…
2016-09-22 15:43:19 -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
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
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
Juan Ibiapina
b2bbed41fa Add option to disable collapsing of diretory names 2016-03-05 14:20:04 -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
Grzegorz Wilk
28560e2e1b changed arrows for NERDTreeDirArrowExpandable and NERDTreeDirArrowCollapsible 2016-02-04 11:24:45 +01:00
Maxim Bublis
6251ab1e63 Add support for natural sorting order. 2016-01-19 00:21:13 -08: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
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
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
be8f18914c remove some unneeded header comments 2015-11-13 16:54:47 +00: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
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
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
8b189cb263 move some rendering and cursor moving functions out of autoload 2015-05-02 15:24:59 +01:00
Martin Grenfell
0d88ce946f move isTreeOpen() out of autoload 2015-05-02 14:44:32 +01:00
Martin Grenfell
aa831e242b Merge pull request #356 from alvan/patch-2
Use event BufLeave instead of BufWinLeave to record screen state
2014-07-14 10:03:01 +01:00
Martin Grenfell
0c045d85ea fix a bug from recent refactoring RE some NERDTreeCWD 2014-07-14 09:43:45 +01:00
alvan
98a5d1fca7 Use event BufLeave instead of BufWinLeave to record screen state to avoid undefined b:NERDTree error
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.
2014-07-09 15:20:24 +08: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
b33d6daf0b remove the NERDChristmasTree option
If users want to customise the tree colours, this can be done trivially
in their vimrc. e.g.

    hi link NERDTreeFile error
2014-06-29 19:53:57 +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
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
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
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
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
Chris Perl
bb1390c0c7 Fix s:Path.Resolve to it handles '/' properly 2012-12-10 14:44:01 -05:00
Martin Grenfell
1dc3891f96 Merge pull request #204 from techlivezheng/feature/chrootcwd
Add a NERDTreeCWD command to change tree root to CWD
2012-11-12 02:10:45 -08:00
Martin Grenfell
dff80ff7d0 Merge pull request #203 from techlivezheng/feature/find-in-existing-window
Reveal the current editing file in current NERDTree window instaead initiating a new one
2012-11-12 02:06:22 -08:00