Commit Graph

1047 Commits

Author SHA1 Message Date
Hieu Nguyen
435861ee69 Support revealing file and executing file with xdg-open for Linux 2018-04-09 19:08:09 +02:00
Phil Runninger
a0e49c9b11
Merge pull request #822 from scrooloose/821-better_delete_confirmation
If node isn't open, count children on disk before deleting.
2018-04-02 14:01:00 -04:00
Phil Runninger (mac)
b37495fa98 If node isn't open, count children on disk before deleting.
Fixes #821. If a node isn't opened in NERDTree, it's children aren't
known yet, so when deleting the node (with `m`, `d`), the user isn't
properly asked to confirm the delete. It was going to the less strict
`Y`/`n` confirmation, instead of the `yes` confirmation for non-empty
directories.

This change checks to see if the node is opened already. If it is, the
existing getChildCount() function is used; otherwise, the disk is read
to get the number of children there.
2018-04-02 09:26:34 -04:00
Phil Runninger (mac)
a172d7cfcb Add documentation for the NERDTreeRemoveDirCmd option. 2018-03-13 08:51:33 -04:00
Phil Runninger
b702500f77
Merge pull request #816 from kutsan/master
Add new variable g:NERDTreeRemoveFileCmd
2018-03-13 08:41:08 -04:00
Kutsan Kaplan
9afa6b3828
Add new variable g:NERDTreeRemoveFileCmd 2018-03-13 15:17:10 +03:00
Phil Runninger
ed446e5cbe
Update issue template again. "Optional" isn't needed. 2018-03-06 11:31:19 -05:00
Phil Runninger
f6987b7ea6
Merge pull request #814 from scrooloose/813-bwipeout_NERDTree_buffer
Use a better check for existence of the NERDTree buffer.
2018-03-06 11:28:46 -05:00
Phil Runninger (mac)
d6fe203dec Update issue template, making it a little cleaner. 2018-03-06 09:23:11 -05:00
Phil Runninger (mac)
dc349a072a Use a better check for existence of the NERDTree buffer.
If the user wipes out or deletes (:bw or :bd) the NERDTree buffer, there
is still a tab variable that hangs onto the name of that now-missing
buffer. Checking only that variable is not enough to decide whether to
create a new NERDTree or use the existing one. Fortunately, there
already is a function with a more complete check: ExistsForTab()
2018-03-06 08:41:06 -05:00
Phil Runninger
e47e588705
Merge pull request #801 from mrubli/focus-on-close
Fix focussing previous buffer when closing NERDTree
2018-02-02 09:19:53 -05:00
Martin Rubli
a0f3bf3ed6 Focus previous window when closing NERDTree
Previously closing NERDTree while two windows were showing the same
buffer would focus the first window, which was not necessarily the
previously active one.

Instead of obtaining the buffer ID of the previous buffer and
mapping that to the window ID (which is a 1:n mapping) we obtain the
unique window ID and focus the right window after closing NERDTree.

win_getid() and win_gotoid() are available from VIM 7.4.1557 but the
old behavior is used as a fallback if the two functions are not
available.
2018-02-02 21:26:17 +08:00
Jason Franklin
68572ef461
Merge pull request #796 from lifecrisis/doc-update
Update the documentation for the "NERDTreeStatusline" setting.
2018-01-07 08:34:08 -05:00
Jason Franklin
183bb53485
Merge pull request #795 from lifecrisis/empty-line
Fix unstable behaviour in the "NERDTreeUI.getPath()" method.
2018-01-07 08:33:01 -05:00
Jason Franklin
6e26222a30 Update the docs for "NERDTreeStatusline" 2018-01-06 10:55:18 -05:00
Jason Franklin
a019486dc8 Fix unstable behavior in "NERDTreeUI.getPath()"
This commit prevents "NERDTreeUI.getPath()" from returning a "Path"
object even when no tree node was selected.  Previously, positioning
your cursor on one of the blank lines above the tree and running...

  :echo g:NERDTreeFileNode.GetSelected()

... could potentially return the path for the current working
directory (your working directory needs to be under the tree root).
This is because the constructor for "Path" objects returns a "Path"
for the current working directory when passed an empty string.  So,
we need to short circuit the "getPath()" function for lines that
cannot possibly be tree nodes.

This solves the problem for "GetSelected()" because that method uses
the "getPath()" method from the "UI" class to do its work.

Note that this bug only presented for me on *nix systems.
2018-01-06 10:31:15 -05:00
Jason Franklin
1d14961285 Remove a noise comment 2018-01-06 09:28:15 -05:00
Jason Franklin
8f052c5b47 Simplify the commentary for the "getPath()" method 2018-01-06 09:23:27 -05:00
Jason Franklin
1e93f6840a Format the commentary in "ui.vim" 2018-01-06 09:10:10 -05:00
Jason Franklin
c6a68d4b96 Improve the style in a "TreeFileNode" method
No functional changes here.
2018-01-06 09:02:10 -05:00
Jason Franklin
d745e11b42 Format the commentary in "tree_file_node.vim" 2018-01-06 08:54:28 -05:00
Jason Franklin
e6a116a9cd Improve the code style in a "Path" method
No functional changes here.  Only style improvements were made.
2018-01-06 08:41:55 -05:00
Jason Franklin
f4df038366 Refactor the "Path" constructor 2018-01-06 08:35:34 -05:00
Jason Franklin
5fc48b0b13
Merge pull request #794 from lifecrisis/reopen779
Revert the bugfix from pull request #785 and reopen issue #779.
We keep the good style changes from PR #785 intact.
2018-01-05 08:35:52 -05:00
Jason Franklin
af3ba1ef4e Revert the bugfix from pull request #785
The small change here reverts an attempted bugfix from #785.  That
change resulted in the unintended side-effect of closing other
children of the root whenever ":NERDTreeFind" was invoked.  This was
disruptive (as reported in #793), so a new method must be found to
solve the problem of ":NERDTreeFind" not opening newly created
files.

Fixes #793.
2018-01-05 08:32:03 -05:00
Jason Franklin
fa65ec60ea Merge pull request #786 from lifecrisis/find-hidden
Here, a more accurate method of determining whether or not to show
hidden files is used.  A new method, "isHiddenUnder()" is defined
for "Path" objects.  This method is then used to set the flag for
hidden files in the ":NERDTreeFind" command.  Note that this
function is likely to be useful elsewhere.

Fixes #189.
2018-01-05 08:12:59 -05:00
Jason Franklin
d90b2af474 Add a space to help the parser 2017-12-22 10:46:49 -05:00
Jason Franklin
0ff697eb40 Implement the "isHiddenUnder()" method for Path 2017-12-22 10:28:31 -05:00
Jason Franklin
57788abd6f
Merge pull request #785 from lifecrisis/find-new-file
In certain cases, ":NERDTreeFind" would fail to reveal files that
were created/written after the current tab's NERDTree had been
initialized.  This pull request repairs that problem.
2017-12-22 09:44:04 -05:00
Jason Franklin
f6dad4796e Update the documentation
The docs for ":NERDTreeFind" are updated.  Some additional
formatting changes are made to other sections.
2017-12-22 09:16:16 -05:00
Jason Franklin
01b011d38e Have "finAndRevealPath()" fail on no file
If a file does not exist for the current buffer, this function
should fail with a clear warning message.

Here, I improved the messages that this function prints so that it
fails gracefully when no path can be determined in the calling
context.
2017-12-22 08:45:57 -05:00
Jason Franklin
344119439e Refresh children of directory nodes on "reveal()"
The ":NERDTreeFind" command calls the "reveal()" method on the
NERDTree root node.  The "reveal()" method would, in turn, call the
node's "open()" method.  Since the "open()" method would only
initialize the child nodes of the root (i.e., read them from disk)
when the list of child nodes was empty, new paths would not be
included in the list.

This commit will result in the refreshing of the child node list
whenever "reveal()" is called on a directory node (unless it is the
first time the node is being opened... the most efficient option).

The result is that ":NERDTreeFind" will discover newly created paths
that exist on disk but are not cached in the NERDTree.

A stray debugging message is also removed.

Fixes issue #779.
2017-12-21 10:36:16 -05:00
Jason Franklin
90d08dc626 Add a debugging message 2017-12-21 09:26:26 -05:00
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