Commit Graph

1314 Commits

Author SHA1 Message Date
Jason Franklin
5301dd24fb Improve variable naming in "findAndRevealPath" 2017-12-21 08:43:15 -05:00
Jason Franklin
496d9a17d8 Remove code duplication in "findAndRevealPath" 2017-12-21 08:28:28 -05:00
Phil Runninger
fc14b4f5df
Add :Helptags to the pathogen instructions 2017-12-19 09:45:47 -05:00
Jason Franklin
509122df20
Merge pull request #782 from lifecrisis/modelines
Add a modeline to each script that needs but does not have one.
2017-12-17 08:53:01 -05:00
Jason Franklin
9f985514f0 Add modelines 2017-12-17 08:43:43 -05:00
Jason Franklin
193fed598b
Merge pull request #781 from lifecrisis/find-complete
Change the type of completion used by :NERDTreeFind.
2017-12-12 09:03:53 -05:00
Jason Franklin
b4b99c39fa Change the type of completion used by NERDTreeFind
This command should complete file names, not directories.

Fixes #780.
2017-12-12 08:24:18 -05:00
Phil Runninger
461ea6d2d8
Merge pull request #778 from zhenyangze/master
change NERDTreeFind with args
2017-12-11 13:27:14 -05:00
Jason Franklin
c20ac9c27f
Merge pull request #772 from skyblueee/stripMarkup_leadingSpaces
Remove useless argument in user interface function.
2017-12-09 11:33:54 -05:00
Jason Franklin
fc55d012ee
Merge pull request #773 from skyblueee/wasdir_sub
Remove two useless substitutions.
2017-12-09 11:28:40 -05:00
Jason Franklin
2129740419 Add style improvements
Function-local variables, instead of script-local variables, should
be used here.  In addition, "empty()" is a better choice for testing
for the absence of an argument.  Finally, the use of "else" is
removed.

The docstring is also updated to include the new argument.
2017-12-09 11:09:10 -05:00
zhenyangze
12960b966f change NERDTreeFind with args 2017-12-09 16:58:18 +08:00
Jason Franklin
8cbea5109e
Merge pull request #777 from lifecrisis/bm-confirm
Use the confirm() builtin when deleting a bookmark.
2017-12-06 11:10:51 -05:00
Jason Franklin
e48ae299f9 Update the delete bookmark map to use confirm()
I contend that we should use confirm() whenever possible.  It makes
the code cleaner and uses a builtin feature rather than a custom
one.  Doing it the "Vim way" is always preferable in my mind.
2017-12-01 08:45:18 -05:00
SkyBlueEE
ea01a691a2 remove useless removeLeadingSpaces in _stripMarkup 2017-11-28 00:04:03 +08:00
SkyBlueEE
3485b2a939 remove useless substitute when 'file =~# "/$"' 2017-11-27 23:56:41 +08:00
Jason Franklin
b89de09810
Merge pull request #769 from lifecrisis/o-map
Make the "o" mapping consistent with the "x" mapping.
2017-11-20 07:47:33 -05:00
Jason Franklin
ac94cd28c2 Make the "o" mapping consistent with "x"
The "o" mapping, which toggles directory nodes open/closed, allowed
the user to close the tree root.  This was not consistent with the
"x" mapping which stops the user from doing this.  This applies to
a double-click on the root node as well.

It should be noted that, if the root node is somehow closed, "o" and
double click can still re-open the tree, even with this change.  In
other words, I was careful.
2017-11-19 16:37:54 -05:00
Jason Franklin
e0e36c5385
Fix a problem with the "x" handler (#768)
Pressing "x" on a cascade could close the root of the tree.  This
commit prevents that from happening.
2017-11-18 10:55:43 -05:00
Jason Franklin
f526c4e652
Clean up the handler for the "x" mapping (#767)
Previously, pressing "x" on the tree root would result in
unpredictable behavior.  The user would either an receive an error
message or the parent of the tree root (which is not visible) would
be closed.  This commit repairs this problem.

In addition, some code duplication was removed.
2017-11-18 09:51:34 -05:00
Jason Franklin
70c8cb9bfa
Revert change to tab opening method (#766)
Previously the "t" and "T" mappings were altered to open new tabs at
the end of the tab line.  This commit reverts that change.
2017-11-18 09:50:40 -05:00
Jason Franklin
93356cd92b
Add back support for "b:NERDTreeRoot" (#765) 2017-11-14 18:36:09 -05:00
Jason Franklin
b6e3c0db30
Merge pull request #759 from lifecrisis/iss549
This pull request repairs the broken "t" and "T" mappings.
2017-11-14 08:37:09 -05:00
Jason Franklin
e59d02575e Update the CHANGELOG 2017-11-14 08:33:31 -05:00
Jason Franklin
21c470c316 Have new tabs open as the last tab (with '$') 2017-11-14 08:29:40 -05:00
Jason Franklin
4c409a1640 Add a note/warning to "TreeDirNode.activate()"
This warning makes developers aware of the possibility of
overwriting the NERDTree text in a new window when activate is used.
2017-11-11 13:23:51 -05:00
Jason Franklin
e27cd86a9b Document "t" and "T" mappings in the quick help 2017-11-11 13:09:42 -05:00
Jason Franklin
31dbf1c139 Silence messages when opening a file with "T" 2017-11-11 12:37:04 -05:00
Jason Franklin
c9f7014034 Fix handlers for "t" and "T" on bookmarks
The "t" and "T" mappings didn't work on bookmarks.  This commit
fixes this problem by making the callbacks more general.

Fixes #565.
2017-11-11 12:10:08 -05:00
Jason Franklin
ae1c95bcbc Explicitly call open() in "ui_glue.vim" callbacks
This bug is subtle!  Opening a directory node in a new tab (with the
"t" or "T" mappings) would previously fail and require a refresh
because it called the directory node's "activate()" method.

In reviewing that method (i.e., "activate()"), I discovered that the
directory node's NERDTree is rendered before the method returns,
which overwrites the content of the tree in the new tab or window.

To clarify, when "t" or "T" is used on a directory node, a new
directory node and tree must be created to be rendered in a new tab.
So, calling "self.getNerdtree().render()" at the bottom of
"activate()" will render the NERDTree instance from which "t" or "T"
was invoked, not the new NERDTree that is being displayed.  This
overwrites the new NERDTree text, and, thus, a refresh is required.

Since a call to "render()" is almost always necessary at the bottom
of "activate()" to keep everything in sync for other mappings, we
avoid this problem entirely by using the "open()" method directly
(works for files and directories) in the callbacks.

Fixes #549.
2017-11-11 11:19:16 -05:00
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
Phil Runninger
97433edd43 Merge pull request #754 from branch comma-separated-file-size
This change will display the file size (printed with the "ml"
command) in an easy-to-read format, while still displaying its
precise value.  It uses the "stat" command (with the correct
switches for Unix and OSX) to get the file size, "sed" to add the
commas, and "sed" again to replace the original size with the
modified number.
2017-11-02 08:36:07 -04:00
Mohamed Boughaba
a8c6245057 Merge pull request #756 from mboughaba/master
Previously, deleting a file in the NERDTree with "md" would cause
a new buffer to be created to fill the window(s) occupied by
a buffer on the file.  This pull request makes it so that a new
buffer is not created.  Instead, the next buffer in the buffer list
fills the window.

Fixes #755.
2017-11-02 08:26:48 -04:00
Jason Franklin
f554c20cb2
Merge pull request #751 from ashumkin/dir-arrows-on-cygwin
Introduce the "nerdtree#runningCygwin()" function.
2017-10-27 11:37:12 -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
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
5782b228e4 Merge pull request #734 from lifecrisis/issue733
BUGFIX: Make the NERDTree aware of the 'shellslash' setting.
2017-08-19 09:48:27 -04:00
Jason Franklin
876283b07c Improve display of shell output from menu command
This small change reverts to the previous method of breaking shell
output into lines.  The reason for this is to avoid the printing of
trailing carriage return characters on Windows.
2017-08-19 09:39:25 -04:00
Jason Franklin
f4ff6dcf84 Fix a menu command that breaks under 'shellslash'
The (l) menu command breaks on Windows systems when 'shellslash' is
set.  This is due to the fact that the menu item uses a hard coded
shell command, thus relying on the use of the default Windows shell
without the 'shellslash' setting.

The pattern used for the fix is localized to the problem function.
However, this technique could easily be abstracted into its own
function to execute Windows shell commands with the default shell
throughout the NERDTree codebase.
2017-08-19 08:58:57 -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