Commit Graph

1158 Commits

Author SHA1 Message Date
Phil Runninger
b3804dcd71
Merge pull request #871 from scrooloose/trap_bad_bookmark_path
Make sure the path to the bookmarks file exists before writing it.
2018-09-10 17:34:06 -04:00
Phil Runninger
15d06b676d
Merge pull request #878 from scrooloose/autochdir_interference
NERDTreeCWD: reset CWD if changed by NERDTreeFocus
2018-09-10 09:27:52 -04:00
Jason Franklin
2cd4331b78 Check for unknown current working directory 2018-09-10 09:00:05 -04:00
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
Jason Franklin
7c8c811f00 Edit the help file 2018-09-10 08:33:10 -04:00
Phil Runninger (mac)
c726ec7318 Implement PR review comments. 2018-09-10 06:57:39 -04:00
Phil Runninger
129a241b22
Merge pull request #870 from scrooloose/undo_zoom_on_open
Unzoom NERDTree when opening a file
2018-09-10 06:34:05 -04:00
Phil Runninger (mac)
f78cf63627 Instead of creating the bookmark file path, show error message.
This change puts the burden on the user to make sure
g:NERDTreeBookmarksFile is correctly set and the path it contains is
present and has the proper permissions. If this is not the case, an
error message is displayed. This is a better solution than to blindly
create the path, when it may actually be impossible to do so.
2018-09-09 21:29:20 -04:00
Phil Runninger (home)
808f5b225b Escape commas in the globpath() function's path argument.
If not escaped, commas will cause globpath() to search in multiple
directories, none of which really exist.
2018-08-25 09:52:55 -04:00
Jason Franklin
b8cc044760
Merge pull request #875 from scrooloose/open_differently_cased_files
Force a case-sensitive comparison of new and existing buffers.
2018-08-25 09:36:57 -04:00
Jason Franklin
b10c61b063
Merge pull request #877 from scrooloose/replace_gt_with_tabnext
Use {count}tabnext to allow users to remap gt.
2018-08-25 09:18:08 -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)
39a89f5e50 Use <count>tabnext instead of <count>gt to allow users to remap gt. 2018-08-22 09:16:33 -04:00
Phil Runninger (mac)
026bfaf35e Do a case sensitive comparison of new/existing buffers.
When NERTDtree opens a file, it compares this new file to all open
buffers to see if it's already open. If the user has 'ignorecase' turned
on then the comparison of "file" and "File" says they're the same, and
NERDTree won't reopen the file. This commit forces a case sensitive
comparison by using the ==# operator.
2018-08-15 13:22:06 +00:00
Phil Runninger (mac)
7d9a3f0e8b Make sure the path to the bookmarks file exists before writing it. 2018-08-07 18:13:40 -04:00
Phil Runninger (mac)
b6978ecd70 Unzoom only when user want NERDTree to stay open. 2018-08-07 10:01:09 -04:00
Phil Runninger (mac)
192b07ce1f If the NERDTree is zoomed when 'o'pening a file, unzoom it.
'go' does not trigger this new behavior, because focus remains in the
NERDTree.
2018-08-07 09:00:39 -04:00
Phil Runninger
e653a68270
Merge pull request #867 from aflock/aflock/reword-renamed-buffer
Reword renamed-buffer prompt to be more clear
2018-08-04 15:13:46 -04:00
Andrew Flockhart
9e9d16a38a Reword renamed-buffer prompt to be more clear 2018-08-04 01:16:46 -04:00
Jason Franklin
43d569195c
Merge pull request #866 from lifecrisis/bm_toggle 2018-08-03 14:04:57 -04:00
Jason Franklin
456367ab07 Put cursor on root when closing bookmark table
If the cursor is not already positioned on a node when the bookmark
table is closed, then the resulting position of the cursor is not
determined.  Here, we default to positioning the cursor on the
root when the bookmark table is closed.
2018-08-02 09:17:18 -04:00
Phil Runninger
eee179f0bf
Merge pull request #856 from scrooloose/broken_sort_#277
Fix issues with sorting of nodes
2018-07-31 14:53:40 -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)
6ef3213cd0 Fix indentation. 2018-07-02 08:55:32 -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
Phil Runninger (mac)
703e1ef4fe Correctly check the type of the sort key's value. Fixes #842. 2018-07-01 19:55:26 -04:00
Phil Runninger
d6032c876c
Merge pull request #853 from bubba-h57/master
Better OSX detection
2018-06-15 12:04:30 -04:00
Bubba
08db3a0eea Do not need to check for unix os here. 2018-06-15 12:02:58 -04:00
Bubba
a053179d6a Use the case-insensitive regex 2018-06-15 11:29:09 -04:00
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