Commit Graph

1311 Commits

Author SHA1 Message Date
Sharla Kew
0e71462f90
Trim filenames created via the fs_menu (#1243)
The default when naming a file in the command line is that extra white
space will be stripped away. It seems logical for file naming via the
fs_menu in nerdtree to follow that convention.

I have left the defaults of `trim` because they seem sensible.

Co-authored-by: Phil Runninger <PhilRunninger@users.noreply.github.com>
2021-08-12 19:18:53 -04:00
Phil Runninger
2c14ed0e15
Update Wiki link in General Question issue template 2021-07-15 08:31:01 -04:00
Phil Runninger
de0e2edeac
Improve F.A.Q. Answers and Issue Templates (#1249)
* Update the issue templates, making them simpler to use.

* Update FAQ answers.

Closes #1246.
- Add an if statement to the autocommand to prevent its running in the
  Command Window.

Closes #1248.
- Add a new answer to show closing a tab when only NERDTree remains.

* Update the Bug issue template.

* Update version number in change log.
2021-07-13 14:28:29 -04:00
Phil Runninger
81f3eaba29
go on a bookmark directory will NERDTreeFind it. (#1236)
* `go` on a bookmark directory will NERDTreeFind it.

This leaves the root unchanged if possible.

* Update version number in change log.
2021-03-24 23:41:15 -04:00
Phil Runninger
f63fb6984f
Put Callback function variables in local scope. (#1230)
* Put `Callback` function variables in local scope.

This change prevents conflict with other `Callback` functions that are
defined elsewhere in global scope.

* Update version number in change log.
2021-03-01 09:34:54 -05:00
Phil Runninger
a1fa4a33bf
Fix mouse-clicking a file to open it, which was broken in 6.10.5. (#1225)
* Fix mouse-clicking a file to open it, which was broken in 6.10.5.

* Update version number in change log.
2021-02-12 23:14:26 -05:00
Phil Runninger
3a9d533f3d
Restore the default behavior of the <CR> key. (#1221)
* Restore <CR>'s default behavior to be the same as o's.

* Remove the dictionary validation, and simplify initCustomOpenArgs().

There was a bug in the validation logic that caused a valid integer
value of 'keepopen' to always be overwritten with the defaultOpenArgs'
value. It was always comparing its type to the type of a string.

I fixed this by removing all the type validation, and wrapping the code
with a try-catch block. If NERDTreeCustomOpenArgs is not a dictionary,
an error message will print and the defaults will be used instead.

* Add fold markers to new functions.

* Update version number in change log.
2021-02-10 22:20:04 -05:00
Phil Runninger
d3f9fc44ca
Update README.markdown
Add the missing slashes in the names of two of the mentioned plugin managers.
2021-02-10 16:38:41 -05:00
Phil Runninger
1d46d6df3e
Update README.markdown 2021-02-09 21:50:35 -05:00
Phil Runninger
593c16add3
Fix {'keepopen':0} in NERDTreeCustomOpenArgs (#1217)
* Replace #and() with two more-specific functions.

* Push NERDTreeQuitOnOpen checking earlier in the call stack.

* Fix bug in `go` key for file bookmarks. It was behaving like `gs`.

* Fix the `o` mapping for bookmark nodes and the g:NERDTree reference.

* Use get() function to shorten if statement logic.

* Update version number in change log.

* Remove obsolete reference to MERDTreeQuitOnOpen in comment.
2021-02-09 21:34:24 -05:00
Daniel E
d3becd1149
Removed directory separator from sort key (#1219)
* Removed directory separator from sort key

Directories had an additional separator appended to them which caused improper comparisons for other directories that shared similar prefixes.

* Updated changelog
2021-02-09 20:48:36 -05:00
Phil Runninger
1b19089917
Add new FAQ and answer: How to prevent buffers replacing NERDTree. (#1215)
* Add new FAQ and answer: How to prevent buffers replacing NERDTree.

* Update version number in change log.
2021-01-31 00:19:58 -05:00
Phil Runninger
c8be9458dd
New menu command: Run a system command in this directory. (#1214)
* New menu command: Run system command in this directory.

* Echo the output from the system command.

* Update version number in change log.

* Address Vim linter message: change "\n" to nr2char(10)

* Use single quoted strings.

* Use system() instead of systemlist() for greater version compatibility.

systemlist() was introduced sometime in Vim 8+, so I switched to
system() for 7.4 compatibility.
2021-01-30 23:45:56 -05:00
Phil Runninger
628098fff1
Escape quotation marks so they can be used in key mappings. (#1213)
* Escape quotation marks so they can be used in key mappings.

* Update version number in change log.
2021-01-30 23:43:29 -05:00
Phil Runninger
b134f6518b
Enable full path specifications for NERDTreeIgnore (#1207)
* Add ability to specify a path to be ignored.

This ignore expression compares itself against the whole path of the
node, instead of just the tail component of the node.

* Remove debug statements and make it work on Windows.

* Restore the original self.str() to get OS-specific paths for comparing.

Using the UI-formatted path had two problems.
1. It always appended a forward slash at the end of the path, which was
   unnecessary and made patterns like '/tmp/cache$[[path]]' not work as
   expected.
2. It always used forward slashes to join the path components. I thought
   this would be a good thing, but there's no reason to force Windows
   users to use that syntax. They'll just need to remember to escape the
   backslashes, like so: '\\Temp\\cache$[[path]]'

* Add documentation for the new [[path]] tag for NERDTreeIgnore.

* Replace the abbreviation 'dir' with the full word 'directory'.

* Update version number in change log.
2021-01-19 20:07:26 -05:00
Tomasz N
7099f638ed
Fix missing key case, add BC type checking (#1206)
* Fix missing key case, add BC type checking

Resolves #1205

* Assign g:NERDTreeCustomOpenArgs also before quick return

* Fix syntax to be compatibile with Vim 7.3
2021-01-18 21:23:52 -05:00
Phil Runninger
a7eb011e47 Revert #1200, due to bug (#1205) it introduced. 2021-01-17 22:16:38 -05:00
Tomasz N
7e1713853a
Respect NERDTreeCustomOpenArgs when opening bookmark (#1200)
* Respect NERDTreeCustomOpenArgs when opening bookmark

* Update CHANGELOG

* Do not duplicate s:initCustomOpenArgs()

* Restore missing assignment

* fixup! Restore missing assignment

* fixup! Do not duplicate s:initCustomOpenArgs()

* Simplify loop iteration
2021-01-17 20:00:17 -05:00
Phil Runninger
aaa946fb6b
Provide alternate way to mirror the NERDTree on all tabs. 2020-12-19 20:28:15 -05:00
Phil Runninger
2406c456ee
Revamp the README file (#1193)
* Revamp the README to improve clarity and provide more information.

* Verify correct behavior of suggested auto commands.

* Add my tribute to Norm Abrams. Be careful with those plugin managers.

* Other minor formatting and cleanup.

* Fix typos, reorder some sections, and tidy up the README.

* Give a better answer to the single NERDTree for all tabs question.

* More reformatting of text.

* Add basic installation instructions. Switch to single quotes.

* Update version number in CHANGELOG.
2020-12-18 15:03:38 -05:00
buncis
474d735b7d
readme update add script for automatically open NERDTree and focus on file (#1192)
* update readme for auto startup NERDTree and focus on file

* readme update

add how to open NERDTree automatically and focus on file
2020-12-18 00:36:10 -05:00
Phil Runninger
14af89743a
Open a mirrored NERDTree with correct width (#1177)
* Make sure a mirrored NERDTree is displayed at correct width.

* Remove references to unused variables.

b:NERDTreeOldWindowSize was referenced, but never set anywhere. No need
to keep it around.

* Refactor: Initialize variables a different way.

Using the get() function allows us to "let" variables more directly,
without using the execute command or requiring strings to be escaped.
This also eliminates the s:initVariable function. The new format is
shown below, and defines a default value if the user didn't provide a
value in the vimrc file.

  let g:var = get(g: 'var', 'default value')

* Update version number in change log.

* Fix alignment of `let g:var = get(g:, 'var', <default>)` statements.
2020-10-14 18:08:18 -04:00
Yosef Herskovitz
577ddc73f0
Updated Readme (#1167)
* Updated Readme

Fixed typo in readme

* Updated Changelog
2020-08-18 11:14:05 -04:00
Phil Runninger
23000acd7f
Refactor sort comparison functions, removing redundancy (#1166)
* Add a function to compare path objects.

* Remove redundant node comparison function, and rename the ones left.

* Remove the compareTo function in the Path object.

Use nerdtree#compareNodePaths(p1,p2) instead. There was no need for two
comparison functions that do the same thing. They were a little
different in their details, but that shouldn't be the case. Having only
one such function makes better sense and is easier to maintain.

* Update version number in change log.
2020-08-14 18:06:03 -04:00
Phil Runninger
6b5d70e5bf
Fix argument of exists() function calls checking for autocommands. (#1165)
* Fix syntax of exists function calls checking for autocommands.

* Update version number in change log.
2020-08-09 07:07:55 -04:00
Phil Runninger
373a4b28e4
Don't use silent when raising User events (#1164)
* Remove silent from doautocmd. Prevent errors with exists('#...').

* Update version number in change log.
2020-08-07 00:37:56 -04:00
Yeri Pratama
4a32dd0be3
fix highlight for file node (#1157)
* fix #960 953 highlight for file node

* update changelog
2020-07-24 11:14:54 -04:00
Phil Runninger
e571d3e95b
Make sure symbolic links' flags are highlighted correctly. (#1156)
* Make sure symbolic links' flags are higlighted correctly.

* Update version number in change log.
2020-07-17 14:11:08 -04:00
Phil Runninger
96e247ba74
Respect user's &shellslash setting in CopyNode and RemoveNode functions (#1150)
* Replace s:Path.Slash() with nerdtree#slash().

* Check the value of &shell when determining the slash under Windows.

* Leave &shellslash unchanged when forming copy/delete commands.

* Fix fold marker.

* Update version number in change log.

* Add abort attribute to nerdtree#slash() to satisfy Vim style guide.

Co-authored-by: Phil Runninger <prunninger@vhtcx.com>
2020-07-14 08:53:00 -04:00
Phil Runninger
2af10e3589
Update PULL_REQUEST_TEMPLATE.md
Use a shorter command to display the recent patches: replace `| head -2` with `-m2` grep switch; replace a `sed` with `cut` to get the line numbers.
2020-07-14 08:49:44 -04:00
Phil Runninger
42a5a2c106
Update PULL_REQUEST_TEMPLATE.md
Make the tag creation process semi-automatic by making bash do more of the legwork. The included bash commands will:

1. Make sure your master branch is up to date
2. Display all the patch releases in the current MAJOR.MINOR version
3. Ask for a version number to use as the tag (one of the ones previously displayed, presumably)
4. Get the latest commit's subject line, and use it in the tag's message field.
5. Create the tag, and push all tags to the origin.
2020-07-14 08:32:29 -04:00
Phil Runninger
f8aa749985
Fix new NERDTrees' width when previous one was in the only window. (#1153)
* Fix new NERDTrees' width when previous one was in the only window.

When leaving a NERDTree buffer, its window's width is remembered so that
that width can be used when showing the buffer again in a new window. If
NERDTree is the only window when leaving the buffer, it remembers the
whole width of the editor. When a new NERDTree window is created, it is
sized such that there is only a very small window for files to be opened
into.

To fix this, if NERDTree is the ONLY window, remember its width as the
value of g:NERDTreeWinSize, not the width of the editor.

* Update version number in change log.
2020-07-14 07:20:48 -04:00
Phil Runninger
aa37cb40da
Fix the scope of several key mappings (#1151)
* Limit opening or previewing into a split window to only file nodes.

* Prevent previwing directory nodes, which would create another NERDTree.

* Refactor the previewBookmark code to open directories a better way.

* Update version number in change log.

* Update documentation.
2020-07-12 10:03:24 -04:00
Phil Runninger
6571452857
Enable opening bookmarks in split windows. (#1144)
* Add open/preview in split/vsplit to bookmarks.

* Make preview split/vsplit bookmark work only on file nodes.

* Add quickhelp text for split/vsplit commands on bookmarks.

* Handle previewing directory bookmarks properly.

* Update documentation: bookmarks can be opened in a split/vsplit.

* Update version number in change log.
2020-06-23 10:40:30 -04:00
Phil Runninger
d48ab70721 Merge branch 'master' of github.com:preservim/nerdtree 2020-06-01 02:09:39 -04:00
Phil Runninger
9de5b3e785
Allow concealed characters to show another character. (#1138)
* Closes #1136. Allow concealed characters to show another character.

conceallevel=3 always hides the character, but conceallevel=2 allows an
alternate character to be displayed instead.

* Update version number in changelog.
2020-06-01 02:08:13 -04:00
Phil Runninger
635071dcc8 Closes #1136. Allow concealed characters to show another character.
conceallevel=3 always hides the character, but conceallevel=2 allows an
alternate character to be displayed instead.
2020-06-01 01:51:27 -04:00
Phil Runninger
052b1f00a0
Add curly braces to the list of characters to be escaped. (#1128)
* Add curly braces to the list of characters to be escaped.

* Update version number in change log.
2020-05-26 00:15:17 -04:00
Phil Runninger
f63132cade
Use backward-compatible nerdtree#and() in one place that was missed. (#1134)
* Use backward-compatible nerdtree#and() in one place that was missed.

* Update version number in change log.
2020-05-25 11:33:20 -04:00
Phil Runninger
484dc84b47 Update title of pull request. Add PR authors where missing. 2020-05-22 09:02:39 -04:00
Jordi Altayó
2e9d43b6f8
cmd.exe /c start "" <filename> for windows default viewer support (#1130)
* support for default viewer in Windows

* updated changelog

* Update nerdtree_plugin/fs_menu.vim

Co-authored-by: Phil Runninger <PhilRunninger@users.noreply.github.com>

* Update nerdtree_plugin/fs_menu.vim

Co-authored-by: Phil Runninger <PhilRunninger@users.noreply.github.com>

Co-authored-by: Phil Runninger <PhilRunninger@users.noreply.github.com>
2020-05-22 08:57:19 -04:00
Eugenij
10eaa3a2f4
Fixed a bug that caused the file-tree construction to slow down significantly. (#1126)
Co-authored-by: evgenij.vidershpan <evgenij.vidershpan@yandex.ru>
2020-05-21 02:23:35 -04:00
Eugenij
e2670f0d19
* fix duplicated slash in s:Path.isUnder() (on windows OS) (#1122)
* * fix duplicated slash in s:Path.isUnder() (on windows OS, for root directory on drive Path.str() return path with [back]slash)

* * Rewrite NERDTreePath.isUnder() and NERDTreePath.isAncestor() for direct comparison of paths without transformations

* Remove trailing slash, so we don't end up with two on root folder.

The str() function returns "C:\" on the root folder and "C:\temp" on
non-root folders, one with and one without a trailing backslash. This
inconsistency needs to be handled so the stridx() function will work
correctly.

* Make sure the change also works in a non-windows file system.

This commit handles an edge case that can be triggered with these
commands:
    :cd /home/me
    :e /foobar.txt  (an existing file)
    :NERDTreeFind
What happened was the root directory name '/' was being Resolved(), and
the trailing (and only) slash was being removed. The NERDTree was then
created in the current working directory, instead of the root directory.
:NERDTreeFind then wasn't able to find foobar.txt, and printed an error.

* Remove degugging statements.

* * ambiguity issue fix

Co-authored-by: Phil Runninger <philrunninger@gmail.com>
2020-05-14 14:24:36 -04:00
lifecrisis
4cc6097ecb
Do not consider the tree root to be "cascadable" (#1120)
* Do not consider the tree root to be "cascadable"

* Update "CHANGELOG.md"
2020-05-06 23:24:01 -04:00
Phil Runninger
30ad6da984
Force NERDTreeFocus to allow events to be fired when switching windows. (#1118) 2020-05-04 08:14:22 -04:00
Phil Runninger
3005a0e9c0 Update version number in change log. 2020-05-04 08:11:49 -04:00
Phil Runninger
a7d585f7af Force NERDTreeFocus to allow events to be fired when switching windows. 2020-05-04 07:59:25 -04:00
Phil Runninger
5e77fb2fef
Fix example code for the NERDTreeAddKeyMap function. (#1116)
* Fix example code for the NERDTreeAddKeyMap function.

The quickhelpText didn't match what the statement in the callback
function actually did.

* Update version number in change log.
2020-05-03 01:21:34 -04:00
Phil Runninger
29a321d061
Put '%' argument in bufname() for backwards compatibility. (#1105)
* Put '%' argument in bufname() for backwards compatibility.

* Update version number in change log.
2020-04-15 08:58:07 -04:00
Phil Runninger
0257d64248
If a file's already open in the window, don't edit it again. (#1103)
* If a file's already open in the window, don't edit it again.

* Update version number in change log.

* Make only one call to self.str().
2020-04-15 00:55:13 -04:00