Commit Graph

1077 Commits

Author SHA1 Message Date
Bubba
c0d87db309 Better OSX detection 2018-06-15 10:43:20 -04:00
Phil Runninger
26abd33ad9
Merge pull request #852 from mnussbaum/fix_maybe_missing_map
Bugfix - ensure keymaps dictionary exists before using it
2018-06-12 18:34:52 -04:00
mnussbaum
eb048a3070 Bugfix - ensure keymaps dictionary exists before using it
The s:KeyMap._all function isn't necessary if we initialize the
s:keyMaps dictionary at file load time.
2018-06-12 13:46:14 -07:00
Phil Runninger
bf4591c5d8
Merge pull request #851 from mnussbaum/decrease_startup_time
Decrease startup-time by avoiding linear-time iteration over key mappings
2018-06-12 11:31:03 -04:00
mnussbaum
657be6b24d Mark private function with leading underscore 2018-06-12 08:28:04 -07:00
mnussbaum
c6d757f198 Decrease startup-time by avoiding iteration over maps
This commit makes adding, removing and finding key maps an O(1)
operation instead of O(n), where n is the number of pre-existing maps.

In my testing, averaged over 100 iterations, this reduces the time spent
initializing NERDTree at Vim startup from ~73ms to ~9.7ms. That's with
only the default included key maps.
2018-06-10 23:55:04 -07:00
Jason Franklin
9af083a6d1
Merge pull request #849 from lifecrisis/sort-maps 2018-06-06 13:15:53 -04:00
Jason Franklin
57c825a169 Add code to sort mappings in quickhelp 2018-06-06 09:02:25 -04:00
Jason Franklin
0788027b55
Merge pull request #844 from lifecrisis/clearjumps
Use ":clearjumps" in new NERDTree windows.
2018-05-29 16:13:48 -04:00
Jason Franklin
80ee0897ff Add a call to ":clearjumps" to "_createTreeWin()"
Using the ":clearjumps" command wipes out the jump list for the
current window.  This means that the user can't inadvertently jump
out of the NERDTree buffer while using the NERDTree window (i.e., by
using "<C-O>").
2018-05-26 08:43:27 -04:00
Jason Franklin
35953042fb
Merge pull request #840 from scrooloose/create_parent_directories_on_m-m
Like m-c did before, create parent directories if needed on m-m.
2018-05-22 09:48:37 -04:00
Phil Runninger (mac)
c4f8a0f370 Like m-c did before, create parent directories if needed on m-m. 2018-05-16 13:09:20 -04:00
Jason Franklin
6188c5ea5f
Merge pull request #838 from lifecrisis/updir-fix 2018-05-07 08:22:55 -04:00
Phil Runninger
0bf429bac3
Merge pull request #837 from scrooloose/readonly-error-#831
Make the NERDTree buffer writable when rendering it.
2018-05-06 21:13:44 -04:00
Jason Franklin
f9e83ad8bd Fix a bug with the 'u' mapping
This commit refactors the "nerdtree#ui_glue#UpDir()" function to fix
a bug in the behavior of the 'u' mapping.  To reproduce the bug:

  1. Open a bookmarked directory with 'o'
  2. Press 'u' twice, observing normal behavior
  3. Open the same bookmark again with 'o'
  4. Press 'u' again, observe the new root is closed

The reason for this bug is that the parent node already existed and
was closed by the second 'u' press in step two above.

This commit fixes this bug by being careful to always open the new
root and transplant the child node properly.  Also, the internals of
the function in question were refactored to make use of valuable
NERDTree functions that ultimately help to reduce the amount of code
needed for this operation.
2018-05-06 12:19:19 -04:00
Phil Runninger (mac)
2c38519733 Make the NERDTree buffer writable when rendering it. 2018-05-06 11:34:24 -04:00
Jason Franklin
68313ef0f5
Merge pull request #835 from lifecrisis/cleanmaps
Remove unsupported bookmark table mappings.
2018-04-30 15:24:58 -04:00
Jason Franklin
2437b75479 Remove unsupported bookmark table mappings
The definitions for certain bookmark mappings reference callbacks
that don't actually support operation on bookmarks.  Furthermore,
the mappings that are defined are not documented anywhere.  Removing
them seems reasonable since they serve no real purpose.
2018-04-28 09:17:29 -04:00
Phil Runninger
925a96f58d
Merge pull request #834 from bravestarr/fix-multibyte-path
Replace strcharpart() with substitute() for backward compatibility
2018-04-26 09:36:24 -04:00
bravestarr
abf200397f
Merge branch 'master' into fix-multibyte-path 2018-04-26 21:20:33 +08:00
bravestarr
b45f2c27ea Replace strcharpart() with substitute() for backward compatibility 2018-04-26 17:13:06 +08:00
Phil Runninger
cc60495fe0
Merge pull request #833 from hav4ik/master
Fixed error 'unknown function strcharpart' for older versions of Vim
2018-04-25 01:25:43 -04:00
hav4ik
0972cda243 Fixed bug 'unknown function strcharpart' for older versions of Vim 2018-04-25 03:04:18 +03:00
Phil Runninger
d3a7cd20ae
Merge pull request #830 from bravestarr/fix-multibyte-path
Display a path with multi-byte characters correctly when it is truncated
2018-04-24 14:19:36 -04:00
Jason Franklin
ec3c3b0fa1
Merge pull request #832 from lifecrisis/menufix
Clear output when the NERDTree menu is aborted.
2018-04-23 17:12:14 -04:00
bravestarr
6aff1b6cd3 Display a path with multi-byte characters correctly when it is truncated
When a path is rendered in the Bookmarks area or as the header line of the
tree, it is truncated if there is no enough space for it.  But if a path
contains multi-byte characters, it should be truncated by characters, not
bytes, otherwise the path may be truncated between the bytes of a
multi-byte character.  To deal with multi-byte characters, use
strdisplaywidth() instead of len() to get the number of display cells, and
use strcharpart() instead of strpart() to truncate a path.
2018-04-23 03:09:49 +08:00
Jason Franklin
164131762f Refine the internals of the "showMenu()" function 2018-04-22 10:23:16 -04:00
Jason Franklin
38d4d2288a Clean up a function comment 2018-04-22 10:21:16 -04:00
Jason Franklin
1792b6a75b Clear output when the NERDTree menu is aborted
Previously, exiting the NERDTree menu with "Ctrl-C" or "Esc" would
leave the last line of the menu visible.  We can avoid this by
redrawing the screen when the menu is aborted in this manner.
2018-04-22 10:19:13 -04:00
Phil Runninger
727770147a
Merge pull request #824 from ngnmhieu/master
Support revealing file and executing file with xdg-open for Linux
2018-04-10 08:23:02 -04:00
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