mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 11:23:48 -05:00
Compare commits
76 Commits
6.7.15
...
broken-sym
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62884a4005 | ||
|
|
9eeacfd04b | ||
|
|
6ad85ec29b | ||
|
|
f3a4d8eaa8 | ||
|
|
bdf81a086d | ||
|
|
60b5e602e9 | ||
|
|
bc606c43e2 | ||
|
|
6acfc48d80 | ||
|
|
aa29fbe481 | ||
|
|
e5599272a9 | ||
|
|
ff9469a14a | ||
|
|
fefea5d382 | ||
|
|
a954661824 | ||
|
|
9ec27d45a8 | ||
|
|
50a394b2bf | ||
|
|
0cb04e9245 | ||
|
|
4c588f1820 | ||
|
|
ff002d2132 | ||
|
|
79f6f912f4 | ||
|
|
edc9460859 | ||
|
|
334542c361 | ||
|
|
9184ec05bd | ||
|
|
ea4833da8a | ||
|
|
c99395a323 | ||
|
|
d69b68bf31 | ||
|
|
3a66272486 | ||
|
|
b1f5bb60df | ||
|
|
32168889bd | ||
|
|
aedd0653ad | ||
|
|
1f2e28d476 | ||
|
|
6895e5259e | ||
|
|
c46e12a886 | ||
|
|
fc85a6f07c | ||
|
|
eed488b1cd | ||
|
|
9310f91476 | ||
|
|
e731b84559 | ||
|
|
7eee457efa | ||
|
|
aa7e97b7ff | ||
|
|
e5f24e2b8b | ||
|
|
0e71462f90 | ||
|
|
2c14ed0e15 | ||
|
|
de0e2edeac | ||
|
|
81f3eaba29 | ||
|
|
f63fb6984f | ||
|
|
a1fa4a33bf | ||
|
|
3a9d533f3d | ||
|
|
d3f9fc44ca | ||
|
|
1d46d6df3e | ||
|
|
593c16add3 | ||
|
|
d3becd1149 | ||
|
|
1b19089917 | ||
|
|
c8be9458dd | ||
|
|
628098fff1 | ||
|
|
b134f6518b | ||
|
|
7099f638ed | ||
|
|
a7eb011e47 | ||
|
|
7e1713853a | ||
|
|
aaa946fb6b | ||
|
|
2406c456ee | ||
|
|
474d735b7d | ||
|
|
14af89743a | ||
|
|
577ddc73f0 | ||
|
|
23000acd7f | ||
|
|
6b5d70e5bf | ||
|
|
373a4b28e4 | ||
|
|
4a32dd0be3 | ||
|
|
e571d3e95b | ||
|
|
96e247ba74 | ||
|
|
2af10e3589 | ||
|
|
42a5a2c106 | ||
|
|
f8aa749985 | ||
|
|
aa37cb40da | ||
|
|
6571452857 | ||
|
|
d48ab70721 | ||
|
|
9de5b3e785 | ||
|
|
635071dcc8 |
55
.github/ISSUE_TEMPLATE/bug.md
vendored
55
.github/ISSUE_TEMPLATE/bug.md
vendored
@@ -5,41 +5,42 @@ labels: bug
|
|||||||
---
|
---
|
||||||
<!-- Attention! Please Read!
|
<!-- Attention! Please Read!
|
||||||
|
|
||||||
Please fill out ALL the information below so that the issue can be fully
|
Please fill out ALL the information below so that the issue can be fully understood. Omitting
|
||||||
understood. Omitting information will delay the resolution of your issue. It
|
information will delay the resolution of your issue. It will be labeled "Needs More Info", and
|
||||||
will be labeled "Needs More Info", and may be closed until there is enough
|
may be closed until there is enough information.
|
||||||
information.
|
|
||||||
|
|
||||||
Keep in mind that others may have the same question in the future. The better
|
Keep in mind that others may have the same question in the future. The better your information,
|
||||||
your information, the more likely they'll be able to help themselves. -->
|
the more likely they'll be able to help themselves.
|
||||||
|
-->
|
||||||
|
|
||||||
#### Self-Diagnosis
|
#### Self-Diagnosis
|
||||||
<!-- Check the boxes after creating the issue, or use [x]. -->
|
Before creating an issue, take some time to search these resources for an answer. It's possible that someone else has already seen and solved your issue.
|
||||||
- [ ] I have searched the [issues](https://github.com/scrooloose/nerdtree/issues) for an answer to my question.
|
- [old NERDTree issues](https://github.com/preservim/nerdtree/issues?q=is%3Aissue)
|
||||||
- [ ] I have reviewed the NERDTree documentation. `:h NERDTree`
|
- NERDTree documentation - `:h NERDTree`
|
||||||
- [ ] I have reviewed the [Wiki](https://github.com/scrooloose/nerdtree/wiki).
|
- [NERDTree Wiki](https://github.com/preservim/nerdtree/wiki)
|
||||||
- [ ] I have searched the web for an answer to my question.
|
- Other resources: <https://stackoverflow.com>, <https://vi.stackexchange.com>, etc.
|
||||||
|
|
||||||
#### Environment (for bug reports)
|
#### Environment
|
||||||
- [ ] Operating System:
|
- Operating System:
|
||||||
- [ ] Vim/Neovim version `:echo v:version`:
|
- Vim/Neovim version `:version`:
|
||||||
- [ ] NERDTree version, found on 1st line in NERDTree quickhelp `?`:
|
- NERDTree version, found on first line of quickhelp `?`:
|
||||||
- [ ] vimrc settings
|
- Are you using any of these NERDTree-dependent plugins? <!-- Check the boxes after creating the issue. -->
|
||||||
- [ ] NERDTree variables
|
- [ ] [Xuyuanp/nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin)
|
||||||
```vim
|
- [ ] [ryanoasis/vim-devicons](https://github.com/ryanoasis/vim-devicons)
|
||||||
```
|
- [ ] [tiagofumo/vim-nerdtree-syntax-highlight](https://github.com/tiagofumo/vim-nerdtree-syntax-highlight)
|
||||||
- Other NERDTree-dependent Plugins
|
- [ ] [scrooloose/nerdtree-project-plugin](https://github.com/scrooloose/nerdtree-project-plugin)
|
||||||
- [ ] jistr/vim-nerdtree-tabs
|
- [ ] [PhilRunninger/nerdtree-buffer-ops](https://github.com/PhilRunninger/nerdtree-buffer-ops)
|
||||||
- [ ] ryanoasis/vim-devicons
|
- [ ] [PhilRunninger/nerdtree-visual-selection](https://github.com/PhilRunninger/nerdtree-visual-selection)
|
||||||
- [ ] tiagofumo/vim-nerdtree-syntax-highlight
|
- [ ] [jistr/vim-nerdtree-tabs](https://github.com/jistr/vim-nerdtree-tabs)
|
||||||
- [ ] Xuyuanp/nerdtree-git-plugin
|
- [ ] Others (specify):
|
||||||
- [ ] Others (specify):
|
- Provide a minimal **.vimrc** file that will reproduce the issue.
|
||||||
- [ ] I've verified the issue occurs with only NERDTree installed.
|
```vim
|
||||||
|
```
|
||||||
|
|
||||||
#### Steps to Reproduce the Issue
|
#### Steps to Reproduce the Issue
|
||||||
1.
|
1.
|
||||||
|
|
||||||
#### Current Result (Include screenshots where appropriate.)
|
#### Current Behavior (Include screenshots where appropriate.)
|
||||||
|
|
||||||
#### Expected Result
|
#### Expected Result
|
||||||
|
|
||||||
|
|||||||
21
.github/ISSUE_TEMPLATE/question.md
vendored
21
.github/ISSUE_TEMPLATE/question.md
vendored
@@ -3,22 +3,11 @@ name: "General Question"
|
|||||||
about: "Having trouble setting up NERDTree? Need clarification on a setting? Ask your question here."
|
about: "Having trouble setting up NERDTree? Need clarification on a setting? Ask your question here."
|
||||||
labels: "general question"
|
labels: "general question"
|
||||||
---
|
---
|
||||||
<!-- Attention! Please Read!
|
Before creating an issue, take some time to search these resources. It's possible that someone else has already asked your question and gotten an answer.
|
||||||
|
- [old NERDTree issues](https://github.com/preservim/nerdtree/issues?q=is%3Aissue)
|
||||||
Please fill out ALL the information below so that the issue can be fully
|
- NERDTree documentation - `:h NERDTree`
|
||||||
understood. Omitting information will delay the resolution of your issue. It
|
- [NERDTree Wiki](https://github.com/preservim/nerdtree/wiki)
|
||||||
will be labeled "Needs More Info", and may be closed until there is enough
|
- Other resource: <https://stackoverflow.com>, <https://vi.stackexchange.com>, etc.
|
||||||
information.
|
|
||||||
|
|
||||||
Keep in mind that others may have the same question in the future. The better
|
|
||||||
your information, the more likely they'll be able to help themselves. -->
|
|
||||||
|
|
||||||
#### Self-Diagnosis
|
|
||||||
<!-- Check the boxes after creating the issue, or use [x]. -->
|
|
||||||
- [ ] I have searched the [issues](https://github.com/scrooloose/nerdtree/issues) for an answer to my question.
|
|
||||||
- [ ] I have reviewed the NERDTree documentation. `:h NERDTree`
|
|
||||||
- [ ] I have reviewed the [Wiki](https://github.com/scrooloose/nerdtree/wiki).
|
|
||||||
- [ ] I have searched the web for an answer to my question.
|
|
||||||
|
|
||||||
#### State Your Question
|
#### State Your Question
|
||||||
|
|
||||||
|
|||||||
11
.github/PULL_REQUEST_TEMPLATE.md
vendored
11
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,16 +1,7 @@
|
|||||||
### Description of Changes
|
### Description of Changes
|
||||||
Closes # <!-- Issue number this PR addresses. If none, remove this line. -->
|
Closes # <!-- Enter the issue number this PR addresses. If none, remove this line. -->
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
### New Version Info
|
### New Version Info
|
||||||
|
|
||||||
#### Author's Instructions
|
|
||||||
- [ ] Derive a new `MAJOR.MINOR.PATCH` version number. Increment the:
|
|
||||||
- `MAJOR` version when you make incompatible API changes
|
|
||||||
- `MINOR` version when you add functionality in a backwards-compatible manner
|
|
||||||
- `PATCH` version when you make backwards-compatible bug fixes
|
|
||||||
- [ ] Update [CHANGELOG.md](https://github.com/scrooloose/nerdtree/blob/master/CHANGELOG.md), following the established pattern.
|
|
||||||
#### Collaborator's Instructions
|
|
||||||
- [ ] Review [CHANGELOG.md](https://github.com/scrooloose/nerdtree/blob/master/CHANGELOG.md), suggesting a different version number if necessary.
|
|
||||||
- [ ] After merge, tag the merge commit, e.g. `git tag -a 3.1.4 -m "v3.1.4" && git push origin --tags`
|
|
||||||
|
|||||||
4
.github/workflows/vint.yml
vendored
4
.github/workflows/vint.yml
vendored
@@ -7,9 +7,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v3
|
||||||
- name: Run vint with reviewdog
|
- name: Run vint with reviewdog
|
||||||
uses: reviewdog/action-vint@v1.0.1
|
uses: reviewdog/action-vint@v1
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.github_token }}
|
github_token: ${{ secrets.github_token }}
|
||||||
reporter: github-pr-review
|
reporter: github-pr-review
|
||||||
|
|||||||
70
CHANGELOG.md
70
CHANGELOG.md
@@ -3,7 +3,77 @@
|
|||||||
PATCH versions are listed from newest to oldest under their respective MAJOR.MINOR
|
PATCH versions are listed from newest to oldest under their respective MAJOR.MINOR
|
||||||
version in an unordered list. The format is:
|
version in an unordered list. The format is:
|
||||||
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
|
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
|
||||||
|
or
|
||||||
|
- **.PATCH**:
|
||||||
|
- Pull Request Title 1 (PR Author) [PR Number](Link to PR)
|
||||||
|
- Pull Request Title 2 (PR Author) [PR Number](Link to PR)
|
||||||
|
.
|
||||||
|
.
|
||||||
|
.
|
||||||
|
- Pull Request Title n (PR Author) [PR Number](Link to PR)
|
||||||
-->
|
-->
|
||||||
|
#### 7.1
|
||||||
|
- **.2**:
|
||||||
|
- fix: GetWinNum regex pattern. (rzvxa) [#1409](https://github.com/preservim/nerdtree/pull/1409)
|
||||||
|
- fix: session restore for nerdtree buffers. (rzvxa) [#1405](https://github.com/preservim/nerdtree/pull/1405)
|
||||||
|
- **.1**:
|
||||||
|
- fix: change default binding of filelines to `FL`. (rzvxa) [#1400](https://github.com/preservim/nerdtree/pull/1400)
|
||||||
|
- fix: toggle zoom resizing. (ds2606) [#1395](https://github.com/preservim/nerdtree/pull/1395)
|
||||||
|
- **.0**:
|
||||||
|
- fix: typo in the docs. (bl4kraven) [#1390](https://github.com/preservim/nerdtree/pull/1390)
|
||||||
|
- feat: add NERDTreeExplore command. (msibal6) [#1389](https://github.com/preservim/nerdtree/pull/1389)
|
||||||
|
- fix: mapping description in NERDTree.txt. (roccomao) [#1393](https://github.com/preservim/nerdtree/pull/1393)
|
||||||
|
#### 7.0
|
||||||
|
- **.1**:
|
||||||
|
- Fix NERDTreeFind to handle directory case sensitivity. (dangibson) [#1387](https://github.com/preservim/nerdtree/pull/1387)
|
||||||
|
- New Show file lines toggle. (hsnks100) [#1384](https://github.com/preservim/nerdtree/pull/1384)
|
||||||
|
- Add case sensitivity for refreshing nodes. (rzvxa) [#1382](https://github.com/preservim/nerdtree/pull/1382)
|
||||||
|
- Clarified the NERDTreeChangePermissions prompt. (rzvxa) [#1381](https://github.com/preservim/nerdtree/pull/1381)
|
||||||
|
- New reveal functionality for Windows. (rzvxa) [#1366](https://github.com/preservim/nerdtree/pull/1366)
|
||||||
|
- Fix bracket escaping in path names. (kai-patel) [#1359](https://github.com/preservim/nerdtree/pull/1359)
|
||||||
|
- Fix Case Sensitive Move Operation. (rzvxa) [#1375](https://github.com/preservim/nerdtree/pull/1375)
|
||||||
|
- New menu command for changing selected node permissions. (mjkloeckner) [#1348](https://github.com/preservim/nerdtree/pull/1348)
|
||||||
|
- Fix documentation errors. (BubuDavid) [#1372](https://github.com/preservim/nerdtree/pull/1372)
|
||||||
|
- Fix typo in nerdtree.vim file. (SandeshPyakurel) [#1380](https://github.com/preservim/nerdtree/pull/1380)
|
||||||
|
- **.0**:
|
||||||
|
- Now we warn about invalid files instead of ignoring them silently. (rmonico) [#1365](https://github.com/preservim/nerdtree/pull/1365)
|
||||||
|
- New g:NERDTreeWinPos options for top and bottom. (rzvxa) [#1363](https://github.com/preservim/nerdtree/pull/1363)
|
||||||
|
- Fix error in README. (nickspoons) [#1330](https://github.com/preservim/nerdtree/pull/1330)
|
||||||
|
- Fix typo in the documentation. (chapeupreto) [#1306](https://github.com/preservim/nerdtree/pull/1306)
|
||||||
|
#### 6.10
|
||||||
|
- **.16**: Fix documentation errors. (lifecrisis) [#1269](https://github.com/preservim/nerdtree/pull/1269)
|
||||||
|
- **.15**: Ensure backward compatible testing of types. (lifecrisis) [#1266](https://github.com/preservim/nerdtree/pull/1266)
|
||||||
|
- **.14**: Replace trim() with a version-compatible alternative. (PhilRunninger) [#1265](https://github.com/preservim/nerdtree/pull/1265)
|
||||||
|
- **.13**: Change highlighting of bookmarks in the tree. (PhilRunninger) [#1261](https://github.com/preservim/nerdtree/pull/1261)
|
||||||
|
- **.12**: Answer the question about accessing files over scp or ftp. (PhilRunninger) [#1259](https://github.com/preservim/nerdtree/pull/1259)
|
||||||
|
- **.11**: Trim filenames created via the fs_menu (elanorigby) [#1243](https://github.com/preservim/nerdtree/pull/1243)
|
||||||
|
- **.10**: Improve F.A.Q. Answers and Issue Templates (PhilRunninger) [#1249](https://github.com/preservim/nerdtree/pull/1249)
|
||||||
|
- **.9**: `go` on a bookmark directory will NERDTreeFind it. (PhilRunninger) [#1236](https://github.com/preservim/nerdtree/pull/1236)
|
||||||
|
- **.8**: Put `Callback` function variables in local scope. (PhilRunninger) [#1230](https://github.com/preservim/nerdtree/pull/1230)
|
||||||
|
- **.7**: Fix mouse-clicking a file to open it. (PhilRunninger) [#1225](https://github.com/preservim/nerdtree/pull/1225)
|
||||||
|
- **.6**: Restore the default behavior of the `<CR>` key. (PhilRunninger) [#1221](https://github.com/preservim/nerdtree/pull/1221)
|
||||||
|
- **.5**: Fix `{'keepopen':0}` in NERDTreeCustomOpenArgs (PhilRunninger) [#1217](https://github.com/preservim/nerdtree/pull/1217)
|
||||||
|
- **.4**: Removed directory separator from sort key (Daniel E) [#1219](https://github.com/preservim/nerdtree/pull/1219)
|
||||||
|
- **.3**: Add new FAQ and answer: How to prevent buffers replacing NERDTree. (PhilRunninger) [#1215](https://github.com/preservim/nerdtree/pull/1215)
|
||||||
|
- **.2**: New menu command: Run a system command in this directory. (PhilRunninger) [#1214](https://github.com/preservim/nerdtree/pull/1214)
|
||||||
|
- **.1**: Escape quotation marks so they can be used in key mappings. (PhilRunninger) [#1213](https://github.com/preservim/nerdtree/pull/1213)
|
||||||
|
- **.0**: Enable full path specifications for NERDTreeIgnore (PhilRunninger) [#1207](https://github.com/preservim/nerdtree/pull/1207)
|
||||||
|
#### 6.9
|
||||||
|
- **.12**: Respect NERDTreeCustomOpenArgs when opening bookmark (przepompownia) [#1200](https://github.com/preservim/nerdtree/pull/1200)
|
||||||
|
- **.11**: Revamp the README. (buncis, PhilRunninger) [#1192](https://github.com/preservim/nerdtree/pull/1192), [#1193](https://github.com/preservim/nerdtree/pull/1193)
|
||||||
|
- **.10**: Open a mirrored NERDTree with correct width (PhilRunninger) [#1177](https://github.com/preservim/nerdtree/pull/1177)
|
||||||
|
- **.9**: Updated Readme, removed typo (H3RSKO) [#1167](https://github.com/preservim/nerdtree/pull/1167)
|
||||||
|
- **.8**: Refactor sort comparison functions, removing redundancy (PhilRunninger) [#1166](https://github.com/preservim/nerdtree/pull/1166)
|
||||||
|
- **.7**: Fix argument of `exists()` function calls checking for autocommands. (PhilRunninger) [#1165](https://github.com/preservim/nerdtree/pull/1165)
|
||||||
|
- **.6**: Don't use silent when raising User events (PhilRunninger) [#1164](https://github.com/preservim/nerdtree/pull/1164)
|
||||||
|
- **.5**: Fix highlight for file node. (pirey) [#1157](https://github.com/preservim/nerdtree/pull/1157)
|
||||||
|
- **.4**: Make sure symbolic links' flags are highlighted correctly. (PhilRunninger) [#1156](https://github.com/preservim/nerdtree/pull/1156)
|
||||||
|
- **.3**: Fix new NERDTrees' width when previous one was in the only window. (PhilRunninger) [#1153](https://github.com/preservim/nerdtree/pull/1153)
|
||||||
|
- **.2**: Fix the scope of several key mappings (lifecrisis, PhilRunninger) [#1151](https://github.com/preservim/nerdtree/pull/1151)
|
||||||
|
- **.1**: Respect user's `&shellslash` setting in CopyNode and RemoveNode functions (PhilRunninger) [#1150](https://github.com/preservim/nerdtree/pull/1150)
|
||||||
|
- **.0**: Enable opening bookmarks in split windows. (PhilRunninger) [#1144](https://github.com/preservim/nerdtree/pull/1144)
|
||||||
|
#### 6.8
|
||||||
|
- **.0**: Allow concealed characters to show another character. (PhilRunninger) [#1138](https://github.com/preservim/nerdtree/pull/1138)
|
||||||
#### 6.7
|
#### 6.7
|
||||||
- **.15**: Add curly braces to the list of characters to be escaped. (PhilRunninger) [#1128](https://github.com/preservim/nerdtree/pull/1128)
|
- **.15**: Add curly braces to the list of characters to be escaped. (PhilRunninger) [#1128](https://github.com/preservim/nerdtree/pull/1128)
|
||||||
- **.14**: Use backward-compatible `nerdtree#and()` in one place that was missed. (PhilRunninger) [#1134](https://github.com/preservim/nerdtree/pull/1134)
|
- **.14**: Use backward-compatible `nerdtree#and()` in one place that was missed. (PhilRunninger) [#1134](https://github.com/preservim/nerdtree/pull/1134)
|
||||||
|
|||||||
306
README.markdown
306
README.markdown
@@ -1,157 +1,243 @@
|
|||||||
The NERDTree [](https://github.com/preservim/nerdtree/actions?workflow=Vint)
|
# The NERDTree [](https://github.com/preservim/nerdtree/actions?workflow=Vint)
|
||||||
=============
|
|
||||||
|
|
||||||
Introduction
|
## Introduction
|
||||||
------------
|
|
||||||
|
|
||||||
The NERDTree is a file system explorer for the Vim editor. Using this plugin,
|
The NERDTree is a file system explorer for the Vim editor. Using this plugin, users can visually browse complex directory hierarchies, quickly open files for reading or editing, and perform basic file system operations.
|
||||||
users can visually browse complex directory hierarchies, quickly open files for
|
|
||||||
reading or editing, and perform basic file system operations.
|
|
||||||
|
|
||||||
This plugin can also be extended with custom mappings using a special API. The
|
|
||||||
details of this API and of other NERDTree features are described in the
|
|
||||||
included documentation.
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Installation
|
## Installation
|
||||||
------------
|
|
||||||
|
|
||||||
Below are just some of the methods for installing NERDTree. Do not follow all of these instructions; just pick your favorite one. Other plugin managers exist, and NERDTree should install just fine with any of them.
|
Use your favorite plugin manager to install this plugin. [tpope/vim-pathogen](https://github.com/tpope/vim-pathogen), [VundleVim/Vundle.vim](https://github.com/VundleVim/Vundle.vim), [junegunn/vim-plug](https://github.com/junegunn/vim-plug), and [Shougo/dein.vim](https://github.com/Shougo/dein.vim) are some of the more popular ones. A lengthy discussion of these and other managers can be found on [vi.stackexchange.com](https://vi.stackexchange.com/questions/388/what-is-the-difference-between-the-vim-plugin-managers). Basic instructions are provided below, but please **be sure to read, understand, and follow all the safety rules that come with your ~~power tools~~ plugin manager.**
|
||||||
|
|
||||||
#### Vim 8+ packages
|
If you have no favorite, or want to manage your plugins without 3rd-party dependencies, consider using Vim 8+ packages, as described in Greg Hurrell's excellent Youtube video: [Vim screencast #75: Plugin managers](https://www.youtube.com/watch?v=X2_R3uxDN6g).
|
||||||
|
|
||||||
If you are using VIM version 8 or higher you can use its built-in package management; see `:help packages` for more information. Just run these commands in your terminal:
|
<details>
|
||||||
|
<summary>Pathogen</summary>
|
||||||
|
Pathogen is more of a runtime path manager than a plugin manager. You must clone the plugins' repositories yourself to a specific location, and Pathogen makes sure they are available in Vim.
|
||||||
|
|
||||||
|
|
||||||
|
1. In the terminal,
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/preservim/nerdtree.git ~/.vim/bundle/nerdtree
|
||||||
|
```
|
||||||
|
1. In your `vimrc`,
|
||||||
|
```vim
|
||||||
|
call pathogen#infect()
|
||||||
|
syntax on
|
||||||
|
filetype plugin indent on
|
||||||
|
```
|
||||||
|
1. Restart Vim, and run `:helptags ~/.vim/bundle/nerdtree/doc/` or `:Helptags`.
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Vundle</summary>
|
||||||
|
|
||||||
|
1. Install Vundle, according to its instructions.
|
||||||
|
1. Add the following text to your `vimrc`.
|
||||||
|
```vim
|
||||||
|
call vundle#begin()
|
||||||
|
Plugin 'preservim/nerdtree'
|
||||||
|
call vundle#end()
|
||||||
|
```
|
||||||
|
1. Restart Vim, and run the `:PluginInstall` statement to install your plugins.
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Vim-Plug</summary>
|
||||||
|
|
||||||
|
1. Install Vim-Plug, according to its instructions.
|
||||||
|
1. Add the following text to your `vimrc`.
|
||||||
|
```vim
|
||||||
|
call plug#begin()
|
||||||
|
Plug 'preservim/nerdtree'
|
||||||
|
call plug#end()
|
||||||
|
```
|
||||||
|
1. Restart Vim, and run the `:PlugInstall` statement to install your plugins.
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Dein</summary>
|
||||||
|
|
||||||
|
1. Install Dein, according to its instructions.
|
||||||
|
1. Add the following text to your `vimrc`.
|
||||||
|
```vim
|
||||||
|
call dein#begin()
|
||||||
|
call dein#add('preservim/nerdtree')
|
||||||
|
call dein#end()
|
||||||
|
```
|
||||||
|
1. Restart Vim, and run the `:call dein#install()` statement to install your plugins.
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Vim 8+ packages</summary>
|
||||||
|
|
||||||
|
If you are using Vim version 8 or higher you can use its built-in package management; see `:help packages` for more information. Just run these commands in your terminal:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/preservim/nerdtree.git ~/.vim/pack/vendor/start/nerdtree
|
git clone https://github.com/preservim/nerdtree.git ~/.vim/pack/vendor/start/nerdtree
|
||||||
vim -u NONE -c "helptags ~/.vim/pack/vendor/start/nerdtree/doc" -c q
|
vim -u NONE -c "helptags ~/.vim/pack/vendor/start/nerdtree/doc" -c q
|
||||||
```
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
Otherwise, these are some of the several 3rd-party plugin managers you can choose from. Be sure you read the instructions for your chosen plugin, as there typically are additional steps you nee d to take.
|
## Getting Started
|
||||||
|
After installing NERDTree, the best way to learn it is to turn on the Quick Help. Open NERDTree with the `:NERDTree` command, and press `?` to turn on the Quick Help, which will show you all the mappings and commands available in the NERDTree. Of course, your most complete source of information is the documentation: `:help NERDTree`.
|
||||||
|
|
||||||
#### [pathogen.vim](https://github.com/tpope/vim-pathogen)
|
## NERDTree Plugins
|
||||||
|
NERDTree can be extended with custom mappings and functions using its built-in API. The details of this API are described in the included documentation. Several plugins have been written, and are available on Github for installation like any other plugin. The plugins in this list are maintained (or not) by their respective owners, and certain combinations may be incompatible.
|
||||||
|
|
||||||
In the terminal,
|
* [Xuyuanp/nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin): Shows Git status flags for files and folders in NERDTree.
|
||||||
```bash
|
* [ryanoasis/vim-devicons](https://github.com/ryanoasis/vim-devicons): Adds filetype-specific icons to NERDTree files and folders,
|
||||||
git clone https://github.com/preservim/nerdtree.git ~/.vim/bundle/nerdtree
|
* [tiagofumo/vim-nerdtree-syntax-highlight](https://github.com/tiagofumo/vim-nerdtree-syntax-highlight): Adds syntax highlighting to NERDTree based on filetype.
|
||||||
```
|
* [scrooloose/nerdtree-project-plugin](https://github.com/scrooloose/nerdtree-project-plugin): Saves and restores the state of the NERDTree between sessions.
|
||||||
In your vimrc,
|
* [PhilRunninger/nerdtree-buffer-ops](https://github.com/PhilRunninger/nerdtree-buffer-ops): 1) Highlights open files in a different color. 2) Closes a buffer directly from NERDTree.
|
||||||
|
* [PhilRunninger/nerdtree-visual-selection](https://github.com/PhilRunninger/nerdtree-visual-selection): Enables NERDTree to open, delete, move, or copy multiple Visually-selected files at once.
|
||||||
|
|
||||||
|
If any others should be listed, mention them in an issue or pull request.
|
||||||
|
|
||||||
|
|
||||||
|
## Frequently Asked Questions
|
||||||
|
|
||||||
|
In the answers to these questions, you will see code blocks that you can put in your `vimrc` file.
|
||||||
|
|
||||||
|
### How can I map a specific key or shortcut to open NERDTree?
|
||||||
|
|
||||||
|
NERDTree doesn't create any shortcuts outside of the NERDTree window, so as not to overwrite any of your other shortcuts. Use the `nnoremap` command in your `vimrc`. You, of course, have many keys and NERDTree commands to choose from. Here are but a few examples.
|
||||||
```vim
|
```vim
|
||||||
call pathogen#infect()
|
nnoremap <leader>n :NERDTreeFocus<CR>
|
||||||
syntax on
|
nnoremap <C-n> :NERDTree<CR>
|
||||||
filetype plugin indent on
|
nnoremap <C-t> :NERDTreeToggle<CR>
|
||||||
|
nnoremap <C-f> :NERDTreeFind<CR>
|
||||||
```
|
```
|
||||||
|
|
||||||
Then reload vim, run `:helptags ~/.vim/bundle/nerdtree/doc/` or `:Helptags`.
|
### How do I open NERDTree automatically when Vim starts?
|
||||||
|
Each code block below is slightly different, as described in the `" Comment lines`.
|
||||||
|
|
||||||
#### [Vundle.vim](https://github.com/VundleVim/Vundle.vim)
|
|
||||||
```vim
|
```vim
|
||||||
call vundle#begin()
|
" Start NERDTree and leave the cursor in it.
|
||||||
Plugin 'preservim/nerdtree'
|
autocmd VimEnter * NERDTree
|
||||||
call vundle#end()
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### [vim-plug](https://github.com/junegunn/vim-plug)
|
|
||||||
```vim
|
|
||||||
call plug#begin()
|
|
||||||
Plug 'preservim/nerdtree'
|
|
||||||
call plug#end()
|
|
||||||
```
|
|
||||||
|
|
||||||
#### [dein.vim](https://github.com/Shougo/dein.vim)
|
|
||||||
```vim
|
|
||||||
call dein#begin()
|
|
||||||
call dein#add('preservim/nerdtree')
|
|
||||||
call dein#end()
|
|
||||||
```
|
|
||||||
|
|
||||||
#### [apt-vim](https://github.com/egalpin/apt-vim)
|
|
||||||
```bash
|
|
||||||
apt-vim install -y https://github.com/preservim/nerdtree.git
|
|
||||||
```
|
|
||||||
|
|
||||||
F.A.Q. (here, and in the [Wiki](https://github.com/preservim/nerdtree/wiki))
|
|
||||||
------
|
|
||||||
|
|
||||||
#### Is there any support for `git` flags?
|
|
||||||
|
|
||||||
Yes, install [nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin).
|
|
||||||
|
|
||||||
---
|
---
|
||||||
#### Can I have the nerdtree on every tab automatically?
|
|
||||||
|
|
||||||
Nope. If this is something you want then chances are you aren't using tabs and
|
|
||||||
buffers as they were intended to be used. Read this
|
|
||||||
http://stackoverflow.com/questions/102384/using-vims-tabs-like-buffers
|
|
||||||
|
|
||||||
If you are interested in this behaviour then consider [vim-nerdtree-tabs](https://github.com/jistr/vim-nerdtree-tabs)
|
|
||||||
|
|
||||||
---
|
|
||||||
#### How can I open a NERDTree automatically when vim starts up?
|
|
||||||
|
|
||||||
Stick this in your vimrc: `autocmd vimenter * NERDTree`
|
|
||||||
|
|
||||||
---
|
|
||||||
#### How can I open a NERDTree automatically when vim starts up if no files were specified?
|
|
||||||
|
|
||||||
Stick this in your vimrc:
|
|
||||||
```vim
|
```vim
|
||||||
|
" Start NERDTree and put the cursor back in the other window.
|
||||||
|
autocmd VimEnter * NERDTree | wincmd p
|
||||||
|
```
|
||||||
|
---
|
||||||
|
```vim
|
||||||
|
" Start NERDTree when Vim is started without file arguments.
|
||||||
autocmd StdinReadPre * let s:std_in=1
|
autocmd StdinReadPre * let s:std_in=1
|
||||||
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
|
autocmd VimEnter * if argc() == 0 && !exists('s:std_in') | NERDTree | endif
|
||||||
```
|
```
|
||||||
|
|
||||||
Note: Now start vim with plain `vim`, not `vim .`
|
|
||||||
|
|
||||||
---
|
---
|
||||||
#### What if I'm also opening a saved session, for example `vim -S session_file.vim`? I don't want NERDTree to open in that scenario.
|
|
||||||
```vim
|
```vim
|
||||||
|
" Start NERDTree. If a file is specified, move the cursor to its window.
|
||||||
autocmd StdinReadPre * let s:std_in=1
|
autocmd StdinReadPre * let s:std_in=1
|
||||||
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") && v:this_session == "" | NERDTree | endif
|
autocmd VimEnter * NERDTree | if argc() > 0 || exists("s:std_in") | wincmd p | endif
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
#### How can I open NERDTree automatically when vim starts up on opening a directory?
|
|
||||||
```vim
|
```vim
|
||||||
|
" Start NERDTree, unless a file or session is specified, eg. vim -S session_file.vim.
|
||||||
autocmd StdinReadPre * let s:std_in=1
|
autocmd StdinReadPre * let s:std_in=1
|
||||||
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif
|
autocmd VimEnter * if argc() == 0 && !exists('s:std_in') && v:this_session == '' | NERDTree | endif
|
||||||
```
|
```
|
||||||
|
|
||||||
This window is tab-specific, meaning it's used by all windows in the tab. This trick also prevents NERDTree from hiding when first selecting a file.
|
|
||||||
|
|
||||||
Note: Executing `vim ~/some-directory` will open NERDTree and a new edit window. `exe 'cd '.argv()[0]` sets the `pwd` of the new edit window to `~/some-directory`
|
|
||||||
|
|
||||||
---
|
---
|
||||||
#### How can I map a specific key or shortcut to open NERDTree?
|
|
||||||
|
|
||||||
Stick this in your vimrc to open NERDTree with `Ctrl+n` (you can set whatever key you want):
|
|
||||||
```vim
|
```vim
|
||||||
map <C-n> :NERDTreeToggle<CR>
|
" Start NERDTree when Vim starts with a directory argument.
|
||||||
|
autocmd StdinReadPre * let s:std_in=1
|
||||||
|
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') |
|
||||||
|
\ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] | endif
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### How can I close Vim or a tab automatically when NERDTree is the last window?
|
||||||
|
|
||||||
|
```vim
|
||||||
|
" Exit Vim if NERDTree is the only window remaining in the only tab.
|
||||||
|
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
|
||||||
|
```
|
||||||
---
|
---
|
||||||
#### How can I close vim if the only window left open is a NERDTree?
|
|
||||||
|
|
||||||
Stick this in your vimrc:
|
|
||||||
```vim
|
```vim
|
||||||
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
|
" Close the tab if NERDTree is the only window remaining in it.
|
||||||
|
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
### How can I prevent other buffers replacing NERDTree in its window?
|
||||||
#### Can I have different highlighting for different file extensions?
|
|
||||||
|
|
||||||
See here: https://github.com/preservim/nerdtree/issues/433#issuecomment-92590696
|
|
||||||
|
|
||||||
---
|
|
||||||
#### How can I change default arrows?
|
|
||||||
|
|
||||||
Use these variables in your vimrc. Note that below are default arrow symbols
|
|
||||||
```vim
|
```vim
|
||||||
let g:NERDTreeDirArrowExpandable = '▸'
|
" If another buffer tries to replace NERDTree, put it in the other window, and bring back NERDTree.
|
||||||
let g:NERDTreeDirArrowCollapsible = '▾'
|
autocmd BufEnter * if winnr() == winnr('h') && bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 |
|
||||||
|
\ let buf=bufnr() | buffer# | execute "normal! \<C-W>w" | execute 'buffer'.buf | endif
|
||||||
```
|
```
|
||||||
You can remove the arrows altogether by setting these variables to empty strings, as shown below. This will remove not only the arrows, but a single space following them, shifting the whole tree two character positions to the left.
|
|
||||||
|
### Can I have the same NERDTree on every tab automatically?
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
let g:NERDTreeDirArrowExpandable = ''
|
" Open the existing NERDTree on each new tab.
|
||||||
let g:NERDTreeDirArrowCollapsible = ''
|
autocmd BufWinEnter * if &buftype != 'quickfix' && getcmdwintype() == '' | silent NERDTreeMirror | endif
|
||||||
|
```
|
||||||
|
or change your NERDTree-launching shortcut key like so:
|
||||||
|
```vim
|
||||||
|
" Mirror the NERDTree before showing it. This makes it the same on all tabs.
|
||||||
|
nnoremap <C-n> :NERDTreeMirror<CR>:NERDTreeFocus<CR>
|
||||||
|
```
|
||||||
|
|
||||||
|
### How can I change the default arrows?
|
||||||
|
|
||||||
|
```vim
|
||||||
|
let g:NERDTreeDirArrowExpandable = '?'
|
||||||
|
let g:NERDTreeDirArrowCollapsible = '?'
|
||||||
|
```
|
||||||
|
The preceding values are the non-Windows default arrow symbols. Setting these variables to empty strings will remove the arrows completely and shift the entire tree two character positions to the left. See `:h NERDTreeDirArrowExpandable` for more details.
|
||||||
|
|
||||||
|
### How can I show lines of files?
|
||||||
|
|
||||||
|
```vim
|
||||||
|
let g:NERDTreeFileLines = 1
|
||||||
|
```
|
||||||
|
|
||||||
|
Lines in the file are displayed as shown below.
|
||||||
|
```
|
||||||
|
</pack/packer/start/nerdtree/
|
||||||
|
▸ autoload/
|
||||||
|
▸ doc/
|
||||||
|
▸ lib/
|
||||||
|
▸ nerdtree_plugin/
|
||||||
|
▸ plugin/
|
||||||
|
▸ syntax/
|
||||||
|
_config.yml (1)
|
||||||
|
CHANGELOG.md (307)
|
||||||
|
LICENCE (13)
|
||||||
|
README.markdown (234)
|
||||||
|
screenshot.png (219)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Can NERDTree access remote files via scp or ftp?
|
||||||
|
|
||||||
|
Short answer: No, and there are no plans to add that functionality. However, Vim ships with a plugin that does just that. It's called netrw, and by adding the following lines to your `.vimrc`, you can use it to open files over the `scp:`, `ftp:`, or other protocols, while still using NERDTree for all local files. The function seamlessly makes the decision to open NERDTree or netrw, and other supported protocols can be added to the regular expression.
|
||||||
|
|
||||||
|
```vim
|
||||||
|
" Function to open the file or NERDTree or netrw.
|
||||||
|
" Returns: 1 if either file explorer was opened; otherwise, 0.
|
||||||
|
function! s:OpenFileOrExplorer(...)
|
||||||
|
if a:0 == 0 || a:1 == ''
|
||||||
|
NERDTree
|
||||||
|
elseif filereadable(a:1)
|
||||||
|
execute 'edit '.a:1
|
||||||
|
return 0
|
||||||
|
elseif a:1 =~? '^\(scp\|ftp\)://' " Add other protocols as needed.
|
||||||
|
execute 'Vexplore '.a:1
|
||||||
|
elseif isdirectory(a:1)
|
||||||
|
execute 'NERDTree '.a:1
|
||||||
|
endif
|
||||||
|
return 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Auto commands to handle OS commandline arguments
|
||||||
|
autocmd StdinReadPre * let s:std_in=1
|
||||||
|
autocmd VimEnter * if argc()==1 && !exists('s:std_in') | if <SID>OpenFileOrExplorer(argv()[0]) | wincmd p | enew | wincmd p | endif | endif
|
||||||
|
|
||||||
|
" Command to call the OpenFileOrExplorer function.
|
||||||
|
command! -n=? -complete=file -bar Edit :call <SID>OpenFileOrExplorer('<args>')
|
||||||
|
|
||||||
|
" Command-mode abbreviation to replace the :edit Vim command.
|
||||||
|
cnoreabbrev e Edit
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -30,9 +30,21 @@ endfunction
|
|||||||
" SECTION: General Functions {{{1
|
" SECTION: General Functions {{{1
|
||||||
"============================================================
|
"============================================================
|
||||||
|
|
||||||
"FUNCTION: nerdtree#slash() {{{2
|
" FUNCTION: nerdtree#closeTreeOnOpen() {{{2
|
||||||
function! nerdtree#slash() abort
|
function! nerdtree#closeTreeOnOpen() abort
|
||||||
|
return g:NERDTreeQuitOnOpen == 1 || g:NERDTreeQuitOnOpen == 3
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: nerdtree#closeBookmarksOnOpen() {{{2
|
||||||
|
function! nerdtree#closeBookmarksOnOpen() abort
|
||||||
|
return g:NERDTreeQuitOnOpen == 2 || g:NERDTreeQuitOnOpen == 3
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: nerdtree#slash() {{{2
|
||||||
|
" Return the path separator used by the underlying file system. Special
|
||||||
|
" consideration is taken for the use of the 'shellslash' option on Windows
|
||||||
|
" systems.
|
||||||
|
function! nerdtree#slash() abort
|
||||||
if nerdtree#runningWindows()
|
if nerdtree#runningWindows()
|
||||||
if exists('+shellslash') && &shellslash
|
if exists('+shellslash') && &shellslash
|
||||||
return '/'
|
return '/'
|
||||||
@@ -44,28 +56,6 @@ function! nerdtree#slash() abort
|
|||||||
return '/'
|
return '/'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: nerdtree#and(x,y) {{{2
|
|
||||||
" Implements and() function for Vim <= 7.4
|
|
||||||
function! nerdtree#and(x,y) abort
|
|
||||||
if exists('*and')
|
|
||||||
return and(a:x, a:y)
|
|
||||||
else
|
|
||||||
let l:x = a:x
|
|
||||||
let l:y = a:y
|
|
||||||
let l:n = 0
|
|
||||||
let l:result = 0
|
|
||||||
while l:x > 0 && l:y > 0
|
|
||||||
if (l:x % 2) && (l:y % 2)
|
|
||||||
let l:result += float2nr(pow(2, l:n))
|
|
||||||
endif
|
|
||||||
let l:x = float2nr(l:x / 2)
|
|
||||||
let l:y = float2nr(l:y / 2)
|
|
||||||
let l:n += 1
|
|
||||||
endwhile
|
|
||||||
return l:result
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"FUNCTION: nerdtree#checkForBrowse(dir) {{{2
|
"FUNCTION: nerdtree#checkForBrowse(dir) {{{2
|
||||||
"inits a window tree in the current buffer if appropriate
|
"inits a window tree in the current buffer if appropriate
|
||||||
function! nerdtree#checkForBrowse(dir) abort
|
function! nerdtree#checkForBrowse(dir) abort
|
||||||
@@ -108,32 +98,32 @@ function! nerdtree#completeBookmarks(A,L,P) abort
|
|||||||
return filter(g:NERDTreeBookmark.BookmarkNames(), 'v:val =~# "^' . a:A . '"')
|
return filter(g:NERDTreeBookmark.BookmarkNames(), 'v:val =~# "^' . a:A . '"')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: nerdtree#compareNodes(dir) {{{2
|
"FUNCTION: nerdtree#compareNodes(n1, n2) {{{2
|
||||||
function! nerdtree#compareNodes(n1, n2) abort
|
function! nerdtree#compareNodes(n1, n2) abort
|
||||||
return a:n1.path.compareTo(a:n2.path)
|
return nerdtree#compareNodePaths(a:n1.path, a:n2.path)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: nerdtree#compareNodesBySortKey(n1, n2) {{{2
|
"FUNCTION: nerdtree#compareNodePaths(p1, p2) {{{2
|
||||||
function! nerdtree#compareNodesBySortKey(n1, n2) abort
|
function! nerdtree#compareNodePaths(p1, p2) abort
|
||||||
let sortKey1 = a:n1.path.getSortKey()
|
let sortKey1 = a:p1.getSortKey()
|
||||||
let sortKey2 = a:n2.path.getSortKey()
|
let sortKey2 = a:p2.getSortKey()
|
||||||
let i = 0
|
let i = 0
|
||||||
while i < min([len(sortKey1), len(sortKey2)])
|
while i < min([len(sortKey1), len(sortKey2)])
|
||||||
" Compare chunks upto common length.
|
" Compare chunks upto common length.
|
||||||
" If chunks have different type, the one which has
|
" If chunks have different type, the one which has
|
||||||
" integer type is the lesser.
|
" integer type is the lesser.
|
||||||
if type(sortKey1[i]) ==# type(sortKey2[i])
|
if type(sortKey1[i]) == type(sortKey2[i])
|
||||||
if sortKey1[i] <# sortKey2[i]
|
if sortKey1[i] <# sortKey2[i]
|
||||||
return - 1
|
return - 1
|
||||||
elseif sortKey1[i] ># sortKey2[i]
|
elseif sortKey1[i] ># sortKey2[i]
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
elseif type(sortKey1[i]) ==# v:t_number
|
elseif type(sortKey1[i]) == type(0)
|
||||||
return -1
|
return -1
|
||||||
elseif type(sortKey2[i]) ==# v:t_number
|
elseif type(sortKey2[i]) == type(0)
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
let i = i + 1
|
let i += 1
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
" Keys are identical upto common length.
|
" Keys are identical upto common length.
|
||||||
@@ -208,16 +198,74 @@ function! nerdtree#postSourceActions() abort
|
|||||||
runtime! nerdtree_plugin/**/*.vim
|
runtime! nerdtree_plugin/**/*.vim
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: nerdtree#runningWindows(dir) {{{2
|
"FUNCTION: nerdtree#runningWindows() {{{2
|
||||||
function! nerdtree#runningWindows() abort
|
function! nerdtree#runningWindows() abort
|
||||||
return has('win16') || has('win32') || has('win64')
|
return has('win16') || has('win32') || has('win64')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: nerdtree#runningCygwin(dir) {{{2
|
"FUNCTION: nerdtree#runningCygwin() {{{2
|
||||||
function! nerdtree#runningCygwin() abort
|
function! nerdtree#runningCygwin() abort
|
||||||
return has('win32unix')
|
return has('win32unix')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
"FUNCTION: nerdtree#runningMac() {{{2
|
||||||
|
function! nerdtree#runningMac() abort
|
||||||
|
return has('gui_mac') || has('gui_macvim') || has('mac') || has('osx')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: nerdtree#osDefaultCaseSensitiveFS() {{{2
|
||||||
|
function! nerdtree#osDefaultCaseSensitiveFS() abort
|
||||||
|
return s:osDefaultCaseSensitiveFS
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: nerdtree#caseSensitiveFS() {{{2
|
||||||
|
function! nerdtree#caseSensitiveFS() abort
|
||||||
|
return g:NERDTreeCaseSensitiveFS == 1 ||
|
||||||
|
\((g:NERDTreeCaseSensitiveFS == 2 || g:NERDTreeCaseSensitiveFS == 3) &&
|
||||||
|
\nerdtree#osDefaultCaseSensitiveFS())
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
"FUNCTION: nerdtree#pathEquals(lhs, rhs) {{{2
|
||||||
|
function! nerdtree#pathEquals(lhs, rhs) abort
|
||||||
|
if nerdtree#caseSensitiveFS()
|
||||||
|
return a:lhs ==# a:rhs
|
||||||
|
else
|
||||||
|
return a:lhs ==? a:rhs
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
"FUNCTION: nerdtree#onBufLeave() {{{2
|
||||||
|
" used for handling the nerdtree BufLeave/WinLeave events.
|
||||||
|
function! nerdtree#onBufLeave() abort
|
||||||
|
" detect whether we are in the middle of sourcing a session.
|
||||||
|
" if it is a buffer from the sourced session we need to restore it.
|
||||||
|
if exists('g:SessionLoad') && !exists('b:NERDTree')
|
||||||
|
let bname = bufname('%')
|
||||||
|
" is the buffer for a tab tree?
|
||||||
|
if bname =~# '^' . g:NERDTreeCreator.BufNamePrefix() . 'tab_\d\+$'
|
||||||
|
" rename loaded buffer and mark it as trash to prevent this event
|
||||||
|
" getting fired again
|
||||||
|
exec 'file TRASH_' . bname
|
||||||
|
" delete the trash buffer
|
||||||
|
exec 'bwipeout!'
|
||||||
|
" rescue the tab tree at the current working directory
|
||||||
|
call g:NERDTreeCreator.CreateTabTree(getcwd())
|
||||||
|
" is the buffer for a window tree?
|
||||||
|
elseif bname =~# '^' . g:NERDTreeCreator.BufNamePrefix(). 'win_\d\+$'
|
||||||
|
" rescue the window tree at the current working directory
|
||||||
|
call g:NERDTreeCreator.CreateWindowTree(getcwd())
|
||||||
|
else " unknown buffer type
|
||||||
|
" rename buffer to mark it as broken.
|
||||||
|
exec 'file BROKEN_' . bname
|
||||||
|
call nerdtree#echoError('Failed to restore "' . bname . '" from session. Is this session created with an older version of NERDTree?')
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if g:NERDTree.IsOpen()
|
||||||
|
call b:NERDTree.ui.saveScreenState()
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
" SECTION: View Functions {{{1
|
" SECTION: View Functions {{{1
|
||||||
"============================================================
|
"============================================================
|
||||||
|
|
||||||
@@ -256,4 +304,12 @@ function! nerdtree#renderView() abort
|
|||||||
call b:NERDTree.render()
|
call b:NERDTree.render()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
if nerdtree#runningWindows()
|
||||||
|
let s:osDefaultCaseSensitiveFS = 0
|
||||||
|
elseif nerdtree#runningMac()
|
||||||
|
let s:osDefaultCaseSensitiveFS = 0
|
||||||
|
else
|
||||||
|
let s:osDefaultCaseSensitiveFS = 1
|
||||||
|
endif
|
||||||
|
|
||||||
" vim: set sw=4 sts=4 et fdm=marker:
|
" vim: set sw=4 sts=4 et fdm=marker:
|
||||||
|
|||||||
@@ -25,12 +25,16 @@ function! nerdtree#ui_glue#createDefaultBindings() abort
|
|||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'Bookmark', 'callback': s.'previewBookmark' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'Bookmark', 'callback': s.'previewBookmark' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': 'all', 'callback': s.'activateAll' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': 'all', 'callback': s.'activateAll' })
|
||||||
|
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'Node', 'callback': s.'openHSplit' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'FileNode', 'callback': s.'openHSplit' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'Node', 'callback': s.'openVSplit' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'Bookmark', 'callback': s.'openHSplitBookmark' })
|
||||||
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'FileNode', 'callback': s.'openVSplit' })
|
||||||
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'Bookmark', 'callback': s.'openVSplitBookmark' })
|
||||||
|
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'Node', 'callback': s.'previewNodeCurrent' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'FileNode', 'callback': s.'previewNodeCurrent' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'Node', 'callback': s.'previewNodeVSplit' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'FileNode', 'callback': s.'previewNodeHSplit' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'Node', 'callback': s.'previewNodeHSplit' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'Bookmark', 'callback': s.'previewNodeHSplitBookmark' })
|
||||||
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'FileNode', 'callback': s.'previewNodeVSplit' })
|
||||||
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'Bookmark', 'callback': s.'previewNodeVSplitBookmark' })
|
||||||
|
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenRecursively, 'scope': 'DirNode', 'callback': s.'openNodeRecursively' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenRecursively, 'scope': 'DirNode', 'callback': s.'openNodeRecursively' })
|
||||||
|
|
||||||
@@ -53,6 +57,7 @@ function! nerdtree#ui_glue#createDefaultBindings() abort
|
|||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFilters, 'scope': 'all', 'callback': s.'toggleIgnoreFilter' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFilters, 'scope': 'all', 'callback': s.'toggleIgnoreFilter' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFiles, 'scope': 'all', 'callback': s.'toggleShowFiles' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFiles, 'scope': 'all', 'callback': s.'toggleShowFiles' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleBookmarks, 'scope': 'all', 'callback': s.'toggleShowBookmarks' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleBookmarks, 'scope': 'all', 'callback': s.'toggleShowBookmarks' })
|
||||||
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFileLines, 'scope': 'all', 'callback': s.'toggleShowFileLines' })
|
||||||
|
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseDir, 'scope': 'Node', 'callback': s.'closeCurrentDir' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseDir, 'scope': 'Node', 'callback': s.'closeCurrentDir' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseChildren, 'scope': 'DirNode', 'callback': s.'closeChildren' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseChildren, 'scope': 'DirNode', 'callback': s.'closeChildren' })
|
||||||
@@ -65,6 +70,7 @@ function! nerdtree#ui_glue#createDefaultBindings() abort
|
|||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpRoot, 'scope': 'all', 'callback': s.'jumpToRoot' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpRoot, 'scope': 'all', 'callback': s.'jumpToRoot' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpNextSibling, 'scope': 'Node', 'callback': s.'jumpToNextSibling' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpNextSibling, 'scope': 'Node', 'callback': s.'jumpToNextSibling' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpPrevSibling, 'scope': 'Node', 'callback': s.'jumpToPrevSibling' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpPrevSibling, 'scope': 'Node', 'callback': s.'jumpToPrevSibling' })
|
||||||
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpBookmarks, 'scope': 'all', 'callback': s.'jumpToBookmarks' })
|
||||||
|
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': 'Node', 'callback': s . 'openInNewTab' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': 'Node', 'callback': s . 'openInNewTab' })
|
||||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': 'Node', 'callback': s . 'openInNewTabSilent' })
|
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': 'Node', 'callback': s . 'openInNewTabSilent' })
|
||||||
@@ -104,10 +110,17 @@ function! s:customOpenBookmark(node) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:initCustomOpenArgs() {{{1
|
"FUNCTION: s:initCustomOpenArgs() {{{1
|
||||||
" Make sure NERDTreeCustomOpenArgs has needed keys
|
|
||||||
function! s:initCustomOpenArgs() abort
|
function! s:initCustomOpenArgs() abort
|
||||||
let g:NERDTreeCustomOpenArgs = get(g:, 'NERDTreeCustomOpenArgs', {})
|
let l:defaultOpenArgs = {'file': {'reuse': 'all', 'where': 'p', 'keepopen':!nerdtree#closeTreeOnOpen()}, 'dir': {}}
|
||||||
return extend(g:NERDTreeCustomOpenArgs, {'file':{'reuse': 'all', 'where': 'p'}, 'dir':{}}, 'keep')
|
try
|
||||||
|
let g:NERDTreeCustomOpenArgs = get(g:, 'NERDTreeCustomOpenArgs', {})
|
||||||
|
call extend(g:NERDTreeCustomOpenArgs, l:defaultOpenArgs, 'keep')
|
||||||
|
catch /^Vim(\a\+):E712:/
|
||||||
|
call nerdtree#echoWarning('g:NERDTreeCustomOpenArgs is not set properly. Using default value.')
|
||||||
|
let g:NERDTreeCustomOpenArgs = l:defaultOpenArgs
|
||||||
|
finally
|
||||||
|
return g:NERDTreeCustomOpenArgs
|
||||||
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:activateAll() {{{1
|
"FUNCTION: s:activateAll() {{{1
|
||||||
@@ -133,13 +146,13 @@ endfunction
|
|||||||
"FUNCTION: s:activateFileNode() {{{1
|
"FUNCTION: s:activateFileNode() {{{1
|
||||||
"handle the user activating a tree node
|
"handle the user activating a tree node
|
||||||
function! s:activateFileNode(node) abort
|
function! s:activateFileNode(node) abort
|
||||||
call a:node.activate({'reuse': 'all', 'where': 'p'})
|
call a:node.activate({'reuse': 'all', 'where': 'p', 'keepopen': !nerdtree#closeTreeOnOpen()})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:activateBookmark(bookmark) {{{1
|
"FUNCTION: s:activateBookmark(bookmark) {{{1
|
||||||
"handle the user activating a bookmark
|
"handle the user activating a bookmark
|
||||||
function! s:activateBookmark(bm) abort
|
function! s:activateBookmark(bm) abort
|
||||||
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'p'} : {})
|
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'p', 'keepopen': !nerdtree#closeTreeOnOpen()} : {})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: nerdtree#ui_glue#bookmarkNode(name) {{{1
|
" FUNCTION: nerdtree#ui_glue#bookmarkNode(name) {{{1
|
||||||
@@ -362,7 +375,7 @@ function! s:handleLeftClick() abort
|
|||||||
if currentNode.path.isDirectory
|
if currentNode.path.isDirectory
|
||||||
call currentNode.activate()
|
call currentNode.activate()
|
||||||
else
|
else
|
||||||
call currentNode.activate({'reuse': 'all', 'where': 'p'})
|
call currentNode.activate({'reuse': 'all', 'where': 'p', 'keepopen':!nerdtree#closeTreeOnOpen()})
|
||||||
endif
|
endif
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@@ -484,6 +497,21 @@ function! s:jumpToSibling(node, forward) abort
|
|||||||
call b:NERDTree.ui.centerView()
|
call b:NERDTree.ui.centerView()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: s:jumpToBookmarks() {{{1
|
||||||
|
" moves the cursor to the bookmark table
|
||||||
|
function! s:jumpToBookmarks() abort
|
||||||
|
try
|
||||||
|
if b:NERDTree.ui.getShowBookmarks()
|
||||||
|
call g:NERDTree.CursorToBookmarkTable()
|
||||||
|
else
|
||||||
|
call b:NERDTree.ui.setShowBookmarks(1)
|
||||||
|
endif
|
||||||
|
catch /^NERDTree/
|
||||||
|
call nerdtree#echoError('Failed to jump to the bookmark table')
|
||||||
|
return
|
||||||
|
endtry
|
||||||
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: nerdtree#ui_glue#openBookmark(name) {{{1
|
" FUNCTION: nerdtree#ui_glue#openBookmark(name) {{{1
|
||||||
" Open the Bookmark that has the specified name. This function provides the
|
" Open the Bookmark that has the specified name. This function provides the
|
||||||
" implementation for the :OpenBookmark command.
|
" implementation for the :OpenBookmark command.
|
||||||
@@ -496,19 +524,42 @@ function! nerdtree#ui_glue#openBookmark(name) abort
|
|||||||
endtry
|
endtry
|
||||||
if l:bookmark.path.isDirectory
|
if l:bookmark.path.isDirectory
|
||||||
call l:bookmark.open(b:NERDTree)
|
call l:bookmark.open(b:NERDTree)
|
||||||
else
|
return
|
||||||
call l:bookmark.open(b:NERDTree, {'where': 'p'})
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
call l:bookmark.open(b:NERDTree, s:initCustomOpenArgs().file)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:openHSplit(target) {{{1
|
" FUNCTION: s:openHSplit(target) {{{1
|
||||||
function! s:openHSplit(target) abort
|
function! s:openHSplit(target) abort
|
||||||
call a:target.activate({'where': 'h'})
|
call a:target.activate({'where': 'h', 'keepopen': !nerdtree#closeTreeOnOpen()})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:openVSplit(target) {{{1
|
" FUNCTION: s:openVSplit(target) {{{1
|
||||||
function! s:openVSplit(target) abort
|
function! s:openVSplit(target) abort
|
||||||
call a:target.activate({'where': 'v'})
|
call a:target.activate({'where': 'v', 'keepopen': !nerdtree#closeTreeOnOpen()})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
"FUNCTION: s:openHSplitBookmark(bookmark) {{{1
|
||||||
|
"handle the user activating a bookmark
|
||||||
|
function! s:openHSplitBookmark(bm) abort
|
||||||
|
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'h', 'keepopen': !nerdtree#closeTreeOnOpen()} : {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
"FUNCTION: s:openVSplitBookmark(bookmark) {{{1
|
||||||
|
"handle the user activating a bookmark
|
||||||
|
function! s:openVSplitBookmark(bm) abort
|
||||||
|
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'v', 'keepopen': !nerdtree#closeTreeOnOpen()} : {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: s:previewHSplitBookmark(bookmark) {{{1
|
||||||
|
function! s:previewNodeHSplitBookmark(bookmark) abort
|
||||||
|
call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'h', 'keepopen': 1} : {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: s:previewVSplitBookmark(bookmark) {{{1
|
||||||
|
function! s:previewNodeVSplitBookmark(bookmark) abort
|
||||||
|
call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'v', 'keepopen': 1} : {})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:openExplorer(node) {{{1
|
" FUNCTION: s:openExplorer(node) {{{1
|
||||||
@@ -518,13 +569,13 @@ endfunction
|
|||||||
|
|
||||||
" FUNCTION: s:openInNewTab(target) {{{1
|
" FUNCTION: s:openInNewTab(target) {{{1
|
||||||
function! s:openInNewTab(target) abort
|
function! s:openInNewTab(target) abort
|
||||||
let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't'})
|
let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't', 'keepopen': !nerdtree#closeTreeOnOpen()})
|
||||||
call l:opener.open(a:target)
|
call l:opener.open(a:target)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:openInNewTabSilent(target) {{{1
|
" FUNCTION: s:openInNewTabSilent(target) {{{1
|
||||||
function! s:openInNewTabSilent(target) abort
|
function! s:openInNewTabSilent(target) abort
|
||||||
let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't', 'stay': 1})
|
let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't', 'keepopen': !nerdtree#closeTreeOnOpen(), 'stay': 1})
|
||||||
call l:opener.open(a:target)
|
call l:opener.open(a:target)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -567,7 +618,7 @@ function! nerdtree#ui_glue#revealBookmark(name) abort
|
|||||||
let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0, b:NERDTree)
|
let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0, b:NERDTree)
|
||||||
call targetNode.putCursorHere(0, 1)
|
call targetNode.putCursorHere(0, 1)
|
||||||
catch /^NERDTree.BookmarkNotFoundError/
|
catch /^NERDTree.BookmarkNotFoundError/
|
||||||
call nerdtree#echo('Bookmark isnt cached under the current root')
|
call nerdtree#echo('Bookmark isn''t cached under the current root')
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -607,6 +658,7 @@ endfunction
|
|||||||
function! nerdtree#ui_glue#setupCommands() abort
|
function! nerdtree#ui_glue#setupCommands() abort
|
||||||
command! -n=? -complete=dir -bar NERDTree :call g:NERDTreeCreator.CreateTabTree('<args>')
|
command! -n=? -complete=dir -bar NERDTree :call g:NERDTreeCreator.CreateTabTree('<args>')
|
||||||
command! -n=? -complete=dir -bar NERDTreeToggle :call g:NERDTreeCreator.ToggleTabTree('<args>')
|
command! -n=? -complete=dir -bar NERDTreeToggle :call g:NERDTreeCreator.ToggleTabTree('<args>')
|
||||||
|
command! -n=? -complete=dir -bar NERDTreeExplore :call g:NERDTreeCreator.CreateExploreTree('<args>')
|
||||||
command! -n=0 -bar NERDTreeClose :call g:NERDTree.Close()
|
command! -n=0 -bar NERDTreeClose :call g:NERDTree.Close()
|
||||||
command! -n=1 -complete=customlist,nerdtree#completeBookmarks -bar NERDTreeFromBookmark call g:NERDTreeCreator.CreateTabTree('<args>')
|
command! -n=1 -complete=customlist,nerdtree#completeBookmarks -bar NERDTreeFromBookmark call g:NERDTreeCreator.CreateTabTree('<args>')
|
||||||
command! -n=0 -bar NERDTreeMirror call g:NERDTreeCreator.CreateMirror()
|
command! -n=0 -bar NERDTreeMirror call g:NERDTreeCreator.CreateMirror()
|
||||||
@@ -651,6 +703,12 @@ function! s:toggleShowHidden() abort
|
|||||||
call b:NERDTree.ui.toggleShowHidden()
|
call b:NERDTree.ui.toggleShowHidden()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: s:toggleShowFileLines() {{{1
|
||||||
|
" toggles the display of hidden files
|
||||||
|
function! s:toggleShowFileLines() abort
|
||||||
|
call b:NERDTree.ui.toggleShowFileLines()
|
||||||
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:toggleZoom() {{{1
|
" FUNCTION: s:toggleZoom() {{{1
|
||||||
function! s:toggleZoom() abort
|
function! s:toggleZoom() abort
|
||||||
call b:NERDTree.ui.toggleZoom()
|
call b:NERDTree.ui.toggleZoom()
|
||||||
|
|||||||
147
doc/NERDTree.txt
147
doc/NERDTree.txt
@@ -116,7 +116,7 @@ The following features and functionality are provided by the NERDTree:
|
|||||||
:NERDTreeVCS (opens root of repository containing CWD)
|
:NERDTreeVCS (opens root of repository containing CWD)
|
||||||
<
|
<
|
||||||
:NERDTreeFromBookmark <bookmark> *:NERDTreeFromBookmark*
|
:NERDTreeFromBookmark <bookmark> *:NERDTreeFromBookmark*
|
||||||
Opens a fresh NERDTree with the root initialized to the dir for
|
Opens a fresh NERDTree with the root initialized to the directory for
|
||||||
<bookmark>. The only reason to use this command over :NERDTree is for
|
<bookmark>. The only reason to use this command over :NERDTree is for
|
||||||
the completion (which is for bookmarks rather than directories).
|
the completion (which is for bookmarks rather than directories).
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ The following features and functionality are provided by the NERDTree:
|
|||||||
is set to that path. If no NERDTree exists for this tab then this command
|
is set to that path. If no NERDTree exists for this tab then this command
|
||||||
acts the same as the |:NERDTree| command.
|
acts the same as the |:NERDTree| command.
|
||||||
|
|
||||||
:NERDTreeToggleVCS [<start-directory> | <bookmark>] *:NERDTreeToggleVCS*
|
:NERDTreeToggleVCS [<start-directory> | <bookmark>] *:NERDTreeToggleVCS*
|
||||||
Like |:NERDTreeToggle|, but searches up the directory tree to find the top of
|
Like |:NERDTreeToggle|, but searches up the directory tree to find the top of
|
||||||
the version control system repository, and roots the NERDTree there. It
|
the version control system repository, and roots the NERDTree there. It
|
||||||
works with Git, Subversion, Mercurial, Bazaar, and Darcs repositories. A
|
works with Git, Subversion, Mercurial, Bazaar, and Darcs repositories. A
|
||||||
@@ -249,7 +249,7 @@ Key Description help-tag~
|
|||||||
|
|
||||||
o........Open files, directories and bookmarks......................|NERDTree-o|
|
o........Open files, directories and bookmarks......................|NERDTree-o|
|
||||||
go.......Open selected file, but leave cursor in the NERDTree......|NERDTree-go|
|
go.......Open selected file, but leave cursor in the NERDTree......|NERDTree-go|
|
||||||
Open selected bookmark dir in current NERDTree
|
Find selected bookmark directory in current NERDTree
|
||||||
t........Open selected node/bookmark in a new tab...................|NERDTree-t|
|
t........Open selected node/bookmark in a new tab...................|NERDTree-t|
|
||||||
T........Same as 't' but keep the focus on the current tab..........|NERDTree-T|
|
T........Same as 't' but keep the focus on the current tab..........|NERDTree-T|
|
||||||
i........Open selected file in a split window.......................|NERDTree-i|
|
i........Open selected file in a split window.......................|NERDTree-i|
|
||||||
@@ -260,10 +260,10 @@ gs.......Same as s, but leave the cursor on the NERDTree...........|NERDTree-gs|
|
|||||||
O........Recursively open the selected directory....................|NERDTree-O|
|
O........Recursively open the selected directory....................|NERDTree-O|
|
||||||
x........Close the current nodes parent.............................|NERDTree-x|
|
x........Close the current nodes parent.............................|NERDTree-x|
|
||||||
X........Recursively close all children of the current node.........|NERDTree-X|
|
X........Recursively close all children of the current node.........|NERDTree-X|
|
||||||
e........Edit the current dir.......................................|NERDTree-e|
|
e........Edit the current directory.................................|NERDTree-e|
|
||||||
|
|
||||||
double-click....same as |NERDTree-o|.
|
double-click....same as |NERDTree-o|.
|
||||||
middle-click....same as |NERDTree-i| for files, and |NERDTree-e| for dirs.
|
middle-click....same as |NERDTree-i| for files, and |NERDTree-e| for directories.
|
||||||
|
|
||||||
D........Delete the current bookmark ...............................|NERDTree-D|
|
D........Delete the current bookmark ...............................|NERDTree-D|
|
||||||
|
|
||||||
@@ -274,19 +274,20 @@ J........Jump down inside directories at the current tree depth.....|NERDTree-J|
|
|||||||
<C-J>....Jump down to next sibling of the current directory.......|NERDTree-C-J|
|
<C-J>....Jump down to next sibling of the current directory.......|NERDTree-C-J|
|
||||||
<C-K>....Jump up to previous sibling of the current directory.....|NERDTree-C-K|
|
<C-K>....Jump up to previous sibling of the current directory.....|NERDTree-C-K|
|
||||||
|
|
||||||
C........Change the tree root to the selected dir...................|NERDTree-C|
|
C........Change the tree root to the selected directory.............|NERDTree-C|
|
||||||
u........Move the tree root up one directory........................|NERDTree-u|
|
u........Move the tree root up one directory........................|NERDTree-u|
|
||||||
U........Same as 'u' except the old root node is left open..........|NERDTree-U|
|
U........Same as 'u' except the old root node is left open..........|NERDTree-U|
|
||||||
r........Recursively refresh the current directory..................|NERDTree-r|
|
r........Recursively refresh the current directory..................|NERDTree-r|
|
||||||
R........Recursively refresh the current root.......................|NERDTree-R|
|
R........Recursively refresh the current root.......................|NERDTree-R|
|
||||||
m........Display the NERDTree menu..................................|NERDTree-m|
|
m........Display the NERDTree menu..................................|NERDTree-m|
|
||||||
cd.......Change the CWD to the dir of the selected node............|NERDTree-cd|
|
cd.......Change the CWD to the directory of the selected node......|NERDTree-cd|
|
||||||
CD.......Change tree root to the CWD...............................|NERDTree-CD|
|
CD.......Change tree root to the CWD...............................|NERDTree-CD|
|
||||||
|
|
||||||
I........Toggle whether hidden files displayed......................|NERDTree-I|
|
I........Toggle whether hidden files displayed......................|NERDTree-I|
|
||||||
f........Toggle whether the file filters are used...................|NERDTree-f|
|
f........Toggle whether the file filters are used...................|NERDTree-f|
|
||||||
F........Toggle whether files are displayed.........................|NERDTree-F|
|
F........Toggle whether files are displayed.........................|NERDTree-F|
|
||||||
B........Toggle whether the bookmark table is displayed.............|NERDTree-B|
|
B........Toggle whether the bookmark table is displayed.............|NERDTree-B|
|
||||||
|
L........Toggle whether the number of lines in files is displayed..|NERDTree-FL|
|
||||||
|
|
||||||
q........Close the NERDTree window..................................|NERDTree-q|
|
q........Close the NERDTree window..................................|NERDTree-q|
|
||||||
A........Zoom (maximize/minimize) the NERDTree window...............|NERDTree-A|
|
A........Zoom (maximize/minimize) the NERDTree window...............|NERDTree-A|
|
||||||
@@ -318,9 +319,8 @@ Applies to: files.
|
|||||||
If a file node or a bookmark that links to a file is selected, it is opened in
|
If a file node or a bookmark that links to a file is selected, it is opened in
|
||||||
the previous window, but the cursor does not move.
|
the previous window, but the cursor does not move.
|
||||||
|
|
||||||
If a bookmark that links to a directory is selected, that directory is found
|
If a bookmark that links to a directory is selected then that directory
|
||||||
in the current NERDTree. If the directory couldn't be found, a new NERDTree is
|
becomes the new root.
|
||||||
created.
|
|
||||||
|
|
||||||
The default key combo for this mapping is "g" + NERDTreeMapActivateNode (see
|
The default key combo for this mapping is "g" + NERDTreeMapActivateNode (see
|
||||||
|NERDTree-o|).
|
|NERDTree-o|).
|
||||||
@@ -350,7 +350,7 @@ The same as |NERDTree-t| except that the focus is kept in the current tab.
|
|||||||
*NERDTree-i*
|
*NERDTree-i*
|
||||||
Default key: i
|
Default key: i
|
||||||
Map setting: *NERDTreeMapOpenSplit*
|
Map setting: *NERDTreeMapOpenSplit*
|
||||||
Applies to: files.
|
Applies to: files, and bookmarks pointing to files.
|
||||||
|
|
||||||
Opens the selected file in a new split window and puts the cursor in the new
|
Opens the selected file in a new split window and puts the cursor in the new
|
||||||
window.
|
window.
|
||||||
@@ -359,7 +359,7 @@ window.
|
|||||||
*NERDTree-gi*
|
*NERDTree-gi*
|
||||||
Default key: gi
|
Default key: gi
|
||||||
Map setting: *NERDTreeMapPreviewSplit*
|
Map setting: *NERDTreeMapPreviewSplit*
|
||||||
Applies to: files.
|
Applies to: files, and bookmarks pointing to files.
|
||||||
|
|
||||||
The same as |NERDTree-i| except that the cursor is not moved.
|
The same as |NERDTree-i| except that the cursor is not moved.
|
||||||
|
|
||||||
@@ -370,7 +370,7 @@ The default key combo for this mapping is "g" + NERDTreeMapOpenSplit (see
|
|||||||
*NERDTree-s*
|
*NERDTree-s*
|
||||||
Default key: s
|
Default key: s
|
||||||
Map setting: *NERDTreeMapOpenVSplit*
|
Map setting: *NERDTreeMapOpenVSplit*
|
||||||
Applies to: files.
|
Applies to: files, and bookmarks pointing to files.
|
||||||
|
|
||||||
Opens the selected file in a new vertically split window and puts the cursor
|
Opens the selected file in a new vertically split window and puts the cursor
|
||||||
in the new window.
|
in the new window.
|
||||||
@@ -379,7 +379,7 @@ in the new window.
|
|||||||
*NERDTree-gs*
|
*NERDTree-gs*
|
||||||
Default key: gs
|
Default key: gs
|
||||||
Map setting: *NERDTreeMapPreviewVSplit*
|
Map setting: *NERDTreeMapPreviewVSplit*
|
||||||
Applies to: files.
|
Applies to: files, and bookmarks pointing to files.
|
||||||
|
|
||||||
The same as |NERDTree-s| except that the cursor is not moved.
|
The same as |NERDTree-s| except that the cursor is not moved.
|
||||||
|
|
||||||
@@ -470,7 +470,7 @@ Jump to the first child of the current nodes parent.
|
|||||||
|
|
||||||
If the cursor is already on the first node then do the following:
|
If the cursor is already on the first node then do the following:
|
||||||
* loop back thru the siblings of the current nodes parent until we find an
|
* loop back thru the siblings of the current nodes parent until we find an
|
||||||
open dir with children
|
open directory with children
|
||||||
* go to the first child of that node
|
* go to the first child of that node
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
@@ -483,7 +483,7 @@ Jump to the last child of the current nodes parent.
|
|||||||
|
|
||||||
If the cursor is already on the last node then do the following:
|
If the cursor is already on the last node then do the following:
|
||||||
* loop forward thru the siblings of the current nodes parent until we find
|
* loop forward thru the siblings of the current nodes parent until we find
|
||||||
an open dir with children
|
an open directory with children
|
||||||
* go to the last child of that node
|
* go to the last child of that node
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
@@ -517,7 +517,7 @@ Default key: u
|
|||||||
Map setting: *NERDTreeMapUpdir*
|
Map setting: *NERDTreeMapUpdir*
|
||||||
Applies to: no restrictions.
|
Applies to: no restrictions.
|
||||||
|
|
||||||
Move the tree root up a dir (like doing a "cd ..").
|
Move the tree root up a directory (like doing a "cd ..").
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTree-U*
|
*NERDTree-U*
|
||||||
@@ -533,8 +533,8 @@ Default key: r
|
|||||||
Map setting: *NERDTreeMapRefresh*
|
Map setting: *NERDTreeMapRefresh*
|
||||||
Applies to: files and directories.
|
Applies to: files and directories.
|
||||||
|
|
||||||
If a dir is selected, recursively refresh that dir, i.e. scan the filesystem
|
If a directory is selected, recursively refresh that directory, i.e. scan the
|
||||||
for changes and represent them in the tree.
|
filesystem for changes and represent them in the tree.
|
||||||
|
|
||||||
If a file node is selected then the above is done on it's parent.
|
If a file node is selected then the above is done on it's parent.
|
||||||
|
|
||||||
@@ -602,6 +602,14 @@ Applies to: no restrictions.
|
|||||||
|
|
||||||
Toggles whether the bookmarks table is displayed.
|
Toggles whether the bookmarks table is displayed.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*NERDTree-FL*
|
||||||
|
Default key: FL
|
||||||
|
Map setting: *NERDTreeMapToggleFileLines*
|
||||||
|
Applies to: no restrictions.
|
||||||
|
|
||||||
|
Toggles whether the number of lines in files is displayed.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTree-q*
|
*NERDTree-q*
|
||||||
Default key: q
|
Default key: q
|
||||||
@@ -635,8 +643,8 @@ file explorers have.
|
|||||||
|
|
||||||
The script comes with two default menu plugins: exec_menuitem.vim and
|
The script comes with two default menu plugins: exec_menuitem.vim and
|
||||||
fs_menu.vim. fs_menu.vim adds some basic filesystem operations to the menu for
|
fs_menu.vim. fs_menu.vim adds some basic filesystem operations to the menu for
|
||||||
creating/deleting/moving/copying files and dirs. exec_menuitem.vim provides a
|
creating/deleting/moving/copying files and directories. exec_menuitem.vim
|
||||||
menu item to execute executable files.
|
provides a menu item to execute executable files.
|
||||||
|
|
||||||
Related tags: |NERDTree-m| |NERDTreeApi|
|
Related tags: |NERDTree-m| |NERDTreeApi|
|
||||||
|
|
||||||
@@ -674,6 +682,9 @@ the NERDTree. These settings should be set in your vimrc, using `:let`.
|
|||||||
|
|
||||||
|NERDTreeAutoCenterThreshold| Controls the sensitivity of autocentering.
|
|NERDTreeAutoCenterThreshold| Controls the sensitivity of autocentering.
|
||||||
|
|
||||||
|
|NERDTreeCaseSensitiveFS| Tells the NERDTree whether or not it is
|
||||||
|
running in on a case sensitive file system.
|
||||||
|
|
||||||
|NERDTreeCaseSensitiveSort| Tells the NERDTree whether to be case
|
|NERDTreeCaseSensitiveSort| Tells the NERDTree whether to be case
|
||||||
sensitive or not when sorting nodes.
|
sensitive or not when sorting nodes.
|
||||||
|
|
||||||
@@ -809,6 +820,26 @@ Default: 3
|
|||||||
This setting controls the "sensitivity" of the NERDTree auto centering. See
|
This setting controls the "sensitivity" of the NERDTree auto centering. See
|
||||||
|NERDTreeAutoCenter| for details.
|
|NERDTreeAutoCenter| for details.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*NERDTreeCaseSensitiveFS*
|
||||||
|
Values: 0, 1, 2 or 3.
|
||||||
|
Default: 2.
|
||||||
|
|
||||||
|
If set to 0, the NERDTree will interact with the file system without case
|
||||||
|
sensitivity.
|
||||||
|
|
||||||
|
If set to 1, the NERDTree will interact with the file system in a case-sensitive
|
||||||
|
manner.
|
||||||
|
|
||||||
|
If set to 2, the NERDTree assumes its case sensitivity from the OS it is
|
||||||
|
running on. It Will default to case-insensitive on Windows and macOS
|
||||||
|
machines and case-sensitive on everything else. Since it's not a foolproof
|
||||||
|
way of detection, NERDTree won't proceed with any write actions when
|
||||||
|
the destination is ambiguous.
|
||||||
|
|
||||||
|
Setting it to 3 will perform just like 2, but without suppressing write
|
||||||
|
actions.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTreeCaseSensitiveSort*
|
*NERDTreeCaseSensitiveSort*
|
||||||
Values: 0 or 1.
|
Values: 0 or 1.
|
||||||
@@ -922,7 +953,7 @@ Default: ['\~$'].
|
|||||||
|
|
||||||
This setting is used to specify which files the NERDTree should ignore. It
|
This setting is used to specify which files the NERDTree should ignore. It
|
||||||
must be a list of regular expressions. When the NERDTree is rendered, any
|
must be a list of regular expressions. When the NERDTree is rendered, any
|
||||||
files/dirs that match any of the regex's in NERDTreeIgnore won't be
|
files/directories that match any of the regex's in NERDTreeIgnore won't be
|
||||||
displayed.
|
displayed.
|
||||||
|
|
||||||
For example if you put the following line in your vimrc: >
|
For example if you put the following line in your vimrc: >
|
||||||
@@ -930,13 +961,18 @@ For example if you put the following line in your vimrc: >
|
|||||||
<
|
<
|
||||||
then all files ending in .vim or ~ will be ignored.
|
then all files ending in .vim or ~ will be ignored.
|
||||||
|
|
||||||
There are 2 magic flags that can be appended to the end of each regular
|
There are 3 magic flags that can be appended to the end of each regular
|
||||||
expression to specify that the regex should match only files or only dirs.
|
expression to specify that the regex should match only filenames, only lowest
|
||||||
These flags are "[[dir]]" and "[[file]]". Example: >
|
level directories, or a full path. These flags are "[[dir]]", "[[file]]", and
|
||||||
let NERDTreeIgnore=['\.d$[[dir]]', '\.o$[[file]]']
|
"[[path]]". Example: >
|
||||||
|
let NERDTreeIgnore=['\.d$[[dir]]', '\.o$[[file]]', 'tmp/cache$[[path]]']
|
||||||
<
|
<
|
||||||
This will cause all dirs ending in ".d" to be ignored and all files ending in
|
This will cause all directories ending in ".d" to be ignored, all files ending
|
||||||
".o" to be ignored.
|
in ".o" to be ignored, and the "cache" subdirectory of any "tmp" directory to
|
||||||
|
be ignored. All other "cache" directories will be displayed.
|
||||||
|
|
||||||
|
When using the "[[path]]" tag on Windows, make sure you use escaped
|
||||||
|
backslashes for the separators in the regex, eg. 'Temp\\cache$[[path]]'
|
||||||
|
|
||||||
Note: to tell the NERDTree not to ignore any files you must use the following
|
Note: to tell the NERDTree not to ignore any files you must use the following
|
||||||
line: >
|
line: >
|
||||||
@@ -1036,6 +1072,20 @@ This setting can be toggled dynamically, per tree, with the |NERDTree-F|
|
|||||||
mapping and is useful for drastically shrinking the tree when you are
|
mapping and is useful for drastically shrinking the tree when you are
|
||||||
navigating to a different part of the tree.
|
navigating to a different part of the tree.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*NERDTreeShowFilesLines*
|
||||||
|
Values: 0 or 1.
|
||||||
|
Default: 0.
|
||||||
|
|
||||||
|
If this setting is set to 1 then the NERDTree shows number of lines for each
|
||||||
|
file.
|
||||||
|
|
||||||
|
This setting can be toggled dynamically, per tree, with the |NERDTree-FL|
|
||||||
|
mapping.
|
||||||
|
Use one of the follow lines for this setting: >
|
||||||
|
let NERDTreeShowFilesLines=0
|
||||||
|
let NERDTreeShowFilesLines=1
|
||||||
|
<
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTreeShowHidden*
|
*NERDTreeShowHidden*
|
||||||
Values: 0 or 1.
|
Values: 0 or 1.
|
||||||
@@ -1100,8 +1150,8 @@ Examples: >
|
|||||||
<
|
<
|
||||||
1. Directories will appear last, everything else will appear above.
|
1. Directories will appear last, everything else will appear above.
|
||||||
2. Everything will simply appear in alphabetical order.
|
2. Everything will simply appear in alphabetical order.
|
||||||
3. Dirs will appear first, then ruby and php. Swap files, bak files and vim
|
3. Directories will appear first, then ruby and php. Swap files, bak files
|
||||||
backup files will appear last with everything else preceding them.
|
and vim backup files will appear last with everything else preceding them.
|
||||||
4. Everything is sorted by size, largest to smallest, with directories
|
4. Everything is sorted by size, largest to smallest, with directories
|
||||||
considered to have size 0 bytes.
|
considered to have size 0 bytes.
|
||||||
5. Directories will appear first alphabetically, followed by files, sorted by
|
5. Directories will appear first alphabetically, followed by files, sorted by
|
||||||
@@ -1124,7 +1174,7 @@ setting is used.
|
|||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTreeWinPos*
|
*NERDTreeWinPos*
|
||||||
Values: "left" or "right"
|
Values: "left", "right", "top" or "bottom"
|
||||||
Default: "left".
|
Default: "left".
|
||||||
|
|
||||||
This setting is used to determine where NERDTree window is placed on the
|
This setting is used to determine where NERDTree window is placed on the
|
||||||
@@ -1134,6 +1184,13 @@ This setting makes it possible to use two different explorer plugins
|
|||||||
simultaneously. For example, you could have the taglist plugin on the left of
|
simultaneously. For example, you could have the taglist plugin on the left of
|
||||||
the window and the NERDTree on the right.
|
the window and the NERDTree on the right.
|
||||||
|
|
||||||
|
When setting this variable to "top" or "bottom" make sure to also change the
|
||||||
|
|NERDTreeWinSize| to a more reasonable size.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
>
|
||||||
|
let g:NERDTreeWinSize = 15
|
||||||
|
<
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTreeWinSize*
|
*NERDTreeWinSize*
|
||||||
Values: a positive integer.
|
Values: a positive integer.
|
||||||
@@ -1175,8 +1232,9 @@ Use one of the following lines for this setting: >
|
|||||||
Values: 0 or 1
|
Values: 0 or 1
|
||||||
Default: 1.
|
Default: 1.
|
||||||
|
|
||||||
When displaying dir nodes, this setting tells NERDTree to collapse dirs that
|
When displaying directory nodes, this setting tells NERDTree to collapse
|
||||||
have only one child. Use one of the following lines for this setting: >
|
directories that have only one child. Use one of the following lines for this
|
||||||
|
setting: >
|
||||||
let NERDTreeCascadeSingleChildDir=0
|
let NERDTreeCascadeSingleChildDir=0
|
||||||
let NERDTreeCascadeSingleChildDir=1
|
let NERDTreeCascadeSingleChildDir=1
|
||||||
<
|
<
|
||||||
@@ -1185,11 +1243,12 @@ have only one child. Use one of the following lines for this setting: >
|
|||||||
Values: 0 or 1
|
Values: 0 or 1
|
||||||
Default: 1.
|
Default: 1.
|
||||||
|
|
||||||
When opening dir nodes, this setting tells NERDTree to recursively open dirs
|
When opening directory nodes, this setting tells NERDTree to recursively open
|
||||||
that have only one child which is also a dir. NERDTree will stop when it finds
|
directories that have only one child which is also a directory. NERDTree will
|
||||||
a dir that contains anything but another single dir. This setting also causes
|
stop when it finds a directory that contains anything but another single
|
||||||
the |NERDTree-x| mapping to close dirs in the same manner. This setting may be
|
directory. This setting also causes the |NERDTree-x| mapping to close
|
||||||
useful for Java projects. Use one of the following lines for this setting: >
|
directories in the same manner. This setting may be useful for Java projects.
|
||||||
|
Use one of the following lines for this setting: >
|
||||||
let NERDTreeCascadeOpenSingleChildDir=0
|
let NERDTreeCascadeOpenSingleChildDir=0
|
||||||
let NERDTreeCascadeOpenSingleChildDir=1
|
let NERDTreeCascadeOpenSingleChildDir=1
|
||||||
<
|
<
|
||||||
@@ -1250,10 +1309,10 @@ responsible pull request: https://github.com/preservim/nerdtree/pull/868.
|
|||||||
The default value of this variable depends on the features compiled into your
|
The default value of this variable depends on the features compiled into your
|
||||||
vim and the values of |NERDTreeDirArrowCollapsible| and
|
vim and the values of |NERDTreeDirArrowCollapsible| and
|
||||||
|NERDTreeDirArrowExpandable|.
|
|NERDTreeDirArrowExpandable|.
|
||||||
* If your vim is compiled with the +conceal feature, it is the "\x07" (BELL)
|
* If your vim is compiled with the +conceal feature, it is the "\x07"
|
||||||
character, and it is hidden by setting 'conceallevel' to 3. If you use
|
(BEL) character, and it is hidden by setting 'conceallevel' to 2. If you
|
||||||
autocommands, make sure none of them change that setting in the NERDTree_*
|
use autocommands, make sure none of them change that setting in the
|
||||||
buffers.
|
NERD_Tree_* buffers.
|
||||||
* If your vim does NOT have the +conceal feature and you're using "\u00a0"
|
* If your vim does NOT have the +conceal feature and you're using "\u00a0"
|
||||||
(non-breaking space) to hide the directory arrows, "\u00b7" (middle dot)
|
(non-breaking space) to hide the directory arrows, "\u00b7" (middle dot)
|
||||||
is used as the default delimiter.
|
is used as the default delimiter.
|
||||||
@@ -1363,8 +1422,8 @@ NERDTreeAddKeyMap({options}) *NERDTreeAddKeyMap()*
|
|||||||
<
|
<
|
||||||
This code should sit in a file like ~/.vim/nerdtree_plugin/mymapping.vim.
|
This code should sit in a file like ~/.vim/nerdtree_plugin/mymapping.vim.
|
||||||
It adds a (redundant) mapping on 'foo' which changes vim's CWD to that of
|
It adds a (redundant) mapping on 'foo' which changes vim's CWD to that of
|
||||||
the current dir node. Note this mapping will only fire when the cursor is
|
the current directory node. Note this mapping will only fire when the
|
||||||
on a directory node.
|
cursor is on a directory node.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
4.2. Menu API *NERDTreeMenuAPI*
|
4.2. Menu API *NERDTreeMenuAPI*
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ endfunction
|
|||||||
function! s:Bookmark.open(nerdtree, ...)
|
function! s:Bookmark.open(nerdtree, ...)
|
||||||
let opts = a:0 ? a:1 : {}
|
let opts = a:0 ? a:1 : {}
|
||||||
|
|
||||||
if nerdtree#and(g:NERDTreeQuitOnOpen,2)
|
if nerdtree#closeBookmarksOnOpen()
|
||||||
call a:nerdtree.ui.toggleShowBookmarks()
|
call a:nerdtree.ui.toggleShowBookmarks()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,9 @@ endfunction
|
|||||||
|
|
||||||
" FUNCTION: s:Creator._broadcastInitEvent() {{{1
|
" FUNCTION: s:Creator._broadcastInitEvent() {{{1
|
||||||
function! s:Creator._broadcastInitEvent()
|
function! s:Creator._broadcastInitEvent()
|
||||||
silent doautocmd User NERDTreeInit
|
if exists('#User#NERDTreeInit')
|
||||||
|
doautocmd User NERDTreeInit
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:Creator.BufNamePrefix() {{{1
|
" FUNCTION: s:Creator.BufNamePrefix() {{{1
|
||||||
@@ -36,6 +38,29 @@ function! s:Creator.BufNamePrefix()
|
|||||||
return 'NERD_tree_'
|
return 'NERD_tree_'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: s:Creator.CreateExploreTree(dir) {{{1
|
||||||
|
function! s:Creator.CreateExploreTree(dir)
|
||||||
|
try
|
||||||
|
let path = g:NERDTreePath.New(a:dir)
|
||||||
|
catch /^NERDTree.InvalidArgumentsError/
|
||||||
|
call nerdtree#echo('Invalid directory name:' . a:dir)
|
||||||
|
return
|
||||||
|
endtry
|
||||||
|
|
||||||
|
let creator = s:Creator.New()
|
||||||
|
if getbufinfo('%')[0].changed && !&hidden && !&autowriteall
|
||||||
|
let l:splitLocation = g:NERDTreeWinPos ==# 'left' || g:NERDTreeWinPos ==# 'top' ? 'topleft ' : 'botright '
|
||||||
|
let l:splitDirection = g:NERDTreeWinPos ==# 'left' || g:NERDTreeWinPos ==# 'right' ? 'vertical' : ''
|
||||||
|
silent! execute l:splitLocation . l:splitDirection . ' new'
|
||||||
|
else
|
||||||
|
silent! execute 'enew'
|
||||||
|
endif
|
||||||
|
|
||||||
|
call creator.createWindowTree(a:dir)
|
||||||
|
"we want windowTree buffer to disappear after moving to any other buffer
|
||||||
|
setlocal bufhidden=wipe
|
||||||
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:Creator.CreateTabTree(a:name) {{{1
|
" FUNCTION: s:Creator.CreateTabTree(a:name) {{{1
|
||||||
function! s:Creator.CreateTabTree(name)
|
function! s:Creator.CreateTabTree(name)
|
||||||
let creator = s:Creator.New()
|
let creator = s:Creator.New()
|
||||||
@@ -93,7 +118,7 @@ function! s:Creator.createWindowTree(dir)
|
|||||||
|
|
||||||
"we need a unique name for each window tree buffer to ensure they are
|
"we need a unique name for each window tree buffer to ensure they are
|
||||||
"all independent
|
"all independent
|
||||||
exec g:NERDTreeCreatePrefix . ' edit ' . self._nextBufferName()
|
exec g:NERDTreeCreatePrefix . ' edit ' . self._nextBufferName('win')
|
||||||
|
|
||||||
call self._createNERDTree(path, 'window')
|
call self._createNERDTree(path, 'window')
|
||||||
let b:NERDTree._previousBuf = bufnr(previousBuf)
|
let b:NERDTree._previousBuf = bufnr(previousBuf)
|
||||||
@@ -170,6 +195,7 @@ function! s:Creator.createMirror()
|
|||||||
let t:NERDTreeBufName = bufferName
|
let t:NERDTreeBufName = bufferName
|
||||||
call self._createTreeWin()
|
call self._createTreeWin()
|
||||||
exec 'buffer ' . bufferName
|
exec 'buffer ' . bufferName
|
||||||
|
call b:NERDTree.ui.restoreScreenState()
|
||||||
if !&hidden
|
if !&hidden
|
||||||
call b:NERDTree.render()
|
call b:NERDTree.render()
|
||||||
endif
|
endif
|
||||||
@@ -179,16 +205,17 @@ endfunction
|
|||||||
" Initialize the NERDTree window. Open the window, size it properly, set all
|
" Initialize the NERDTree window. Open the window, size it properly, set all
|
||||||
" local options, etc.
|
" local options, etc.
|
||||||
function! s:Creator._createTreeWin()
|
function! s:Creator._createTreeWin()
|
||||||
let l:splitLocation = g:NERDTreeWinPos ==# 'left' ? 'topleft ' : 'botright '
|
let l:splitLocation = g:NERDTreeWinPos ==# 'left' || g:NERDTreeWinPos ==# 'top' ? 'topleft ' : 'botright '
|
||||||
|
let l:splitDirection = g:NERDTreeWinPos ==# 'left' || g:NERDTreeWinPos ==# 'right' ? 'vertical' : ''
|
||||||
let l:splitSize = g:NERDTreeWinSize
|
let l:splitSize = g:NERDTreeWinSize
|
||||||
|
|
||||||
if !g:NERDTree.ExistsForTab()
|
if !g:NERDTree.ExistsForTab()
|
||||||
let t:NERDTreeBufName = self._nextBufferName()
|
let t:NERDTreeBufName = self._nextBufferName('tab')
|
||||||
silent! execute l:splitLocation . 'vertical ' . l:splitSize . ' new'
|
silent! execute l:splitLocation . l:splitDirection . ' ' . l:splitSize . ' new'
|
||||||
silent! execute 'edit ' . t:NERDTreeBufName
|
silent! execute 'edit ' . t:NERDTreeBufName
|
||||||
silent! execute 'vertical resize '. l:splitSize
|
silent! execute l:splitDirection . ' resize '. l:splitSize
|
||||||
else
|
else
|
||||||
silent! execute l:splitLocation . 'vertical ' . l:splitSize . ' split'
|
silent! execute l:splitLocation . l:splitDirection . ' ' . l:splitSize . ' split'
|
||||||
silent! execute 'buffer ' . t:NERDTreeBufName
|
silent! execute 'buffer ' . t:NERDTreeBufName
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -217,10 +244,22 @@ function! s:Creator.New()
|
|||||||
return newCreator
|
return newCreator
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:Creator._nextBufferName() {{{1
|
" FUNCTION: s:Creator._nextBufferName(type='') {{{1
|
||||||
" returns the buffer name for the next nerd tree
|
" gets an optional buffer type of either 'tab' or 'win'.
|
||||||
function! s:Creator._nextBufferName()
|
" returns the buffer name for the next nerd tree of such type.
|
||||||
let name = s:Creator.BufNamePrefix() . self._nextBufferNumber()
|
function! s:Creator._nextBufferName(...)
|
||||||
|
if a:0 > 0
|
||||||
|
let type = a:1
|
||||||
|
else
|
||||||
|
let type = ''
|
||||||
|
end
|
||||||
|
let name = s:Creator.BufNamePrefix()
|
||||||
|
if type ==# 'tab'
|
||||||
|
let name = name . 'tab_'
|
||||||
|
elseif type ==# 'win'
|
||||||
|
let name = name . 'win_'
|
||||||
|
endif
|
||||||
|
let name = name . self._nextBufferNumber()
|
||||||
return name
|
return name
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -247,7 +286,7 @@ function! s:Creator._pathForString(str)
|
|||||||
|
|
||||||
"hack to get an absolute path if a relative path is given
|
"hack to get an absolute path if a relative path is given
|
||||||
if dir =~# '^\.'
|
if dir =~# '^\.'
|
||||||
let dir = getcwd() . g:NERDTreePath.Slash() . dir
|
let dir = getcwd() . nerdtree#slash() . dir
|
||||||
endif
|
endif
|
||||||
|
|
||||||
"hack to prevent removing slash if dir is the root of the file system.
|
"hack to prevent removing slash if dir is the root of the file system.
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ function! s:KeyMap.bind()
|
|||||||
else
|
else
|
||||||
let keymapInvokeString = self.key
|
let keymapInvokeString = self.key
|
||||||
endif
|
endif
|
||||||
let keymapInvokeString = escape(keymapInvokeString, '\')
|
let keymapInvokeString = escape(keymapInvokeString, '\"')
|
||||||
|
|
||||||
let premap = self.key ==# '<LeftRelease>' ? ' <LeftRelease>' : ' '
|
let premap = self.key ==# '<LeftRelease>' ? ' <LeftRelease>' : ' '
|
||||||
|
|
||||||
@@ -66,11 +66,11 @@ endfunction
|
|||||||
"FUNCTION: KeyMap.invoke() {{{1
|
"FUNCTION: KeyMap.invoke() {{{1
|
||||||
"Call the KeyMaps callback function
|
"Call the KeyMaps callback function
|
||||||
function! s:KeyMap.invoke(...)
|
function! s:KeyMap.invoke(...)
|
||||||
let Callback = type(self.callback) ==# type(function('tr')) ? self.callback : function(self.callback)
|
let l:Callback = type(self.callback) ==# type(function('tr')) ? self.callback : function(self.callback)
|
||||||
if a:0
|
if a:0
|
||||||
call Callback(a:1)
|
call l:Callback(a:1)
|
||||||
else
|
else
|
||||||
call Callback()
|
call l:Callback()
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ function! s:NERDTree.changeRoot(node)
|
|||||||
call self.render()
|
call self.render()
|
||||||
call self.root.putCursorHere(0, 0)
|
call self.root.putCursorHere(0, 0)
|
||||||
|
|
||||||
silent doautocmd User NERDTreeNewRoot
|
if exists('#User#NERDTreeNewRoot')
|
||||||
|
doautocmd User NERDTreeNewRoot
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:NERDTree.Close() {{{1
|
"FUNCTION: s:NERDTree.Close() {{{1
|
||||||
@@ -63,14 +65,6 @@ function! s:NERDTree.Close()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:NERDTree.CloseIfQuitOnOpen() {{{1
|
|
||||||
"Closes the NERD tree window if the close on open option is set
|
|
||||||
function! s:NERDTree.CloseIfQuitOnOpen()
|
|
||||||
if nerdtree#and(g:NERDTreeQuitOnOpen,1) && s:NERDTree.IsOpen()
|
|
||||||
call s:NERDTree.Close()
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"FUNCTION: s:NERDTree.CursorToBookmarkTable(){{{1
|
"FUNCTION: s:NERDTree.CursorToBookmarkTable(){{{1
|
||||||
"Places the cursor at the top of the bookmarks table
|
"Places the cursor at the top of the bookmarks table
|
||||||
function! s:NERDTree.CursorToBookmarkTable()
|
function! s:NERDTree.CursorToBookmarkTable()
|
||||||
@@ -150,7 +144,7 @@ function! s:NERDTree.GetWinNum()
|
|||||||
|
|
||||||
" If WindowTree, there is no t:NERDTreeBufName variable. Search all windows.
|
" If WindowTree, there is no t:NERDTreeBufName variable. Search all windows.
|
||||||
for w in range(1,winnr('$'))
|
for w in range(1,winnr('$'))
|
||||||
if bufname(winbufnr(w)) =~# '^' . g:NERDTreeCreator.BufNamePrefix() . '\d\+$'
|
if bufname(winbufnr(w)) =~# '^' . g:NERDTreeCreator.BufNamePrefix() . 'win_\d\+$'
|
||||||
return w
|
return w
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ function! s:Notifier.NotifyListeners(event, path, nerdtree, params)
|
|||||||
let event = g:NERDTreeEvent.New(a:nerdtree, a:path, a:event, a:params)
|
let event = g:NERDTreeEvent.New(a:nerdtree, a:path, a:event, a:params)
|
||||||
|
|
||||||
for Listener in s:Notifier.GetListenersForEvent(a:event)
|
for Listener in s:Notifier.GetListenersForEvent(a:event)
|
||||||
let Callback = type(Listener) == type(function('tr')) ? Listener : function(Listener)
|
let l:Callback = type(Listener) == type(function('tr')) ? Listener : function(Listener)
|
||||||
call Callback(event)
|
call l:Callback(event)
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,7 @@ function! s:Opener._bufInWindows(bnum)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: Opener._checkToCloseTree(newtab) {{{1
|
" FUNCTION: Opener._checkToCloseTree(newtab) {{{1
|
||||||
" Check the class options and global options (i.e. NERDTreeQuitOnOpen) to see
|
" Check the class options to see if the tree should be closed now.
|
||||||
" if the tree should be closed now.
|
|
||||||
"
|
"
|
||||||
" Args:
|
" Args:
|
||||||
" a:newtab - boolean. If set, only close the tree now if we are opening the
|
" a:newtab - boolean. If set, only close the tree now if we are opening the
|
||||||
@@ -46,7 +45,7 @@ function! s:Opener._checkToCloseTree(newtab)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if (a:newtab && self._where ==# 't') || !a:newtab
|
if (a:newtab && self._where ==# 't') || !a:newtab
|
||||||
call g:NERDTree.CloseIfQuitOnOpen()
|
call g:NERDTree.Close()
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -174,9 +173,8 @@ function! s:Opener._newSplit()
|
|||||||
|
|
||||||
"resize the tree window if no other window was open before
|
"resize the tree window if no other window was open before
|
||||||
if onlyOneWin
|
if onlyOneWin
|
||||||
let size = exists('b:NERDTreeOldWindowSize') ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize
|
|
||||||
call nerdtree#exec('wincmd p', 1)
|
call nerdtree#exec('wincmd p', 1)
|
||||||
call nerdtree#exec('silent '. splitMode .' resize '. size, 1)
|
call nerdtree#exec('silent '. splitMode .' resize '. g:NERDTreeWinSize, 1)
|
||||||
call nerdtree#exec('wincmd p', 0)
|
call nerdtree#exec('wincmd p', 0)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -219,7 +217,7 @@ endfunction
|
|||||||
|
|
||||||
" FUNCTION: Opener._openFile() {{{1
|
" FUNCTION: Opener._openFile() {{{1
|
||||||
function! s:Opener._openFile()
|
function! s:Opener._openFile()
|
||||||
if !self._stay && !nerdtree#and(g:NERDTreeQuitOnOpen,1) && exists('b:NERDTreeZoomed') && b:NERDTreeZoomed
|
if !self._stay && self._keepopen && get(b:, 'NERDTreeZoomed', 0)
|
||||||
call b:NERDTree.ui.toggleZoom()
|
call b:NERDTree.ui.toggleZoom()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ function! s:Path.AbsolutePathFor(pathStr)
|
|||||||
if l:prependWorkingDir
|
if l:prependWorkingDir
|
||||||
let l:result = getcwd()
|
let l:result = getcwd()
|
||||||
|
|
||||||
if l:result[-1:] ==# s:Path.Slash()
|
if l:result[-1:] == nerdtree#slash()
|
||||||
let l:result = l:result . a:pathStr
|
let l:result = l:result . a:pathStr
|
||||||
else
|
else
|
||||||
let l:result = l:result . s:Path.Slash() . a:pathStr
|
let l:result = l:result . nerdtree#slash() . a:pathStr
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -62,9 +62,32 @@ function! s:Path.cacheDisplayString() abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if self.isSymLink
|
if self.isSymLink
|
||||||
let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' -> ' . self.symLinkDest
|
let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' -> '
|
||||||
|
let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . self.symLinkDest
|
||||||
|
if self.isBroken
|
||||||
|
let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . g:NERDTreeGlyphBroken
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if !self.isDirectory && b:NERDTree.ui.getShowFileLines() != 0
|
||||||
|
let l:bufname = self.str({'format': 'Edit'})
|
||||||
|
let l:lines = 0
|
||||||
|
if executable('wc')
|
||||||
|
let l:lines = split(system('wc -l "'.l:bufname.'"'))[0]
|
||||||
|
elseif nerdtree#runningWindows()
|
||||||
|
let l:lines = substitute(system('type "'.l:bufname.'" | find /c /v ""'), '\n', '', 'g')
|
||||||
|
else
|
||||||
|
let s:lines = readfile(l:bufname)
|
||||||
|
let l:lines = 0
|
||||||
|
for s:line in s:lines
|
||||||
|
let l:lines += 1
|
||||||
|
if l:lines >= 20000
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' ('.l:lines.')'
|
||||||
|
endif
|
||||||
if self.isReadOnly
|
if self.isReadOnly
|
||||||
let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' ['.g:NERDTreeGlyphReadOnly.']'
|
let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' ['.g:NERDTreeGlyphReadOnly.']'
|
||||||
endif
|
endif
|
||||||
@@ -99,50 +122,6 @@ function! s:Path.changeToDir()
|
|||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: Path.compareTo() {{{1
|
|
||||||
"
|
|
||||||
" Compares this Path to the given path and returns 0 if they are equal, -1 if
|
|
||||||
" this Path is 'less than' the given path, or 1 if it is 'greater'.
|
|
||||||
"
|
|
||||||
" Args:
|
|
||||||
" path: the path object to compare this to
|
|
||||||
"
|
|
||||||
" Return:
|
|
||||||
" 1, -1 or 0
|
|
||||||
function! s:Path.compareTo(path)
|
|
||||||
let thisPath = self.getLastPathComponent(1)
|
|
||||||
let thatPath = a:path.getLastPathComponent(1)
|
|
||||||
|
|
||||||
"if the paths are the same then clearly we return 0
|
|
||||||
if thisPath ==# thatPath
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
let thisSS = self.getSortOrderIndex()
|
|
||||||
let thatSS = a:path.getSortOrderIndex()
|
|
||||||
|
|
||||||
"compare the sort sequences, if they are different then the return
|
|
||||||
"value is easy
|
|
||||||
if thisSS < thatSS
|
|
||||||
return -1
|
|
||||||
elseif thisSS > thatSS
|
|
||||||
return 1
|
|
||||||
else
|
|
||||||
if !g:NERDTreeSortHiddenFirst
|
|
||||||
let thisPath = substitute(thisPath, '^[._]', '', '')
|
|
||||||
let thatPath = substitute(thatPath, '^[._]', '', '')
|
|
||||||
endif
|
|
||||||
"if the sort sequences are the same then compare the paths
|
|
||||||
"alphabetically
|
|
||||||
let pathCompare = g:NERDTreeCaseSensitiveSort ? thisPath <# thatPath : thisPath <? thatPath
|
|
||||||
if pathCompare
|
|
||||||
return -1
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" FUNCTION: Path.Create(fullpath) {{{1
|
" FUNCTION: Path.Create(fullpath) {{{1
|
||||||
"
|
"
|
||||||
" Factory method.
|
" Factory method.
|
||||||
@@ -438,7 +417,7 @@ function! s:Path.getSortKey()
|
|||||||
let self._sortKey = [self.getSortOrderIndex()] + metadata
|
let self._sortKey = [self.getSortOrderIndex()] + metadata
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let path = self.getLastPathComponent(1)
|
let path = self.getLastPathComponent(0)
|
||||||
if !g:NERDTreeSortHiddenFirst
|
if !g:NERDTreeSortHiddenFirst
|
||||||
let path = substitute(path, '^[._]', '', '')
|
let path = substitute(path, '^[._]', '', '')
|
||||||
endif
|
endif
|
||||||
@@ -503,10 +482,10 @@ function! s:Path.ignore(nerdtree)
|
|||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
for Callback in g:NERDTree.PathFilters()
|
for l:Callback in g:NERDTree.PathFilters()
|
||||||
let Callback = type(Callback) ==# type(function('tr')) ? Callback : function(Callback)
|
let l:Callback = type(l:Callback) ==# type(function('tr')) ? l:Callback : function(l:Callback)
|
||||||
if Callback({'path': self, 'nerdtree': a:nerdtree})
|
if l:Callback({'path': self, 'nerdtree': a:nerdtree})
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
@@ -527,7 +506,10 @@ endfunction
|
|||||||
" returns true if this path matches the given ignore pattern
|
" returns true if this path matches the given ignore pattern
|
||||||
function! s:Path._ignorePatternMatches(pattern)
|
function! s:Path._ignorePatternMatches(pattern)
|
||||||
let pat = a:pattern
|
let pat = a:pattern
|
||||||
if strpart(pat,len(pat)-7) ==# '[[dir]]'
|
if strpart(pat,len(pat)-8) ==# '[[path]]'
|
||||||
|
let pat = strpart(pat,0, len(pat)-8)
|
||||||
|
return self.str() =~# pat
|
||||||
|
elseif strpart(pat,len(pat)-7) ==# '[[dir]]'
|
||||||
if !self.isDirectory
|
if !self.isDirectory
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
@@ -571,7 +553,7 @@ function! s:Path.isUnder(parent)
|
|||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
for i in range(0, l:that_count-1)
|
for i in range(0, l:that_count-1)
|
||||||
if self.pathSegments[i] !=# a:parent.pathSegments[i]
|
if !nerdtree#pathEquals(self.pathSegments[i], a:parent.pathSegments[i])
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
@@ -595,11 +577,7 @@ endfunction
|
|||||||
" Args:
|
" Args:
|
||||||
" path: the other path obj to compare this with
|
" path: the other path obj to compare this with
|
||||||
function! s:Path.equals(path)
|
function! s:Path.equals(path)
|
||||||
if nerdtree#runningWindows()
|
return nerdtree#pathEquals(self.str(), a:path.str())
|
||||||
return self.str() ==? a:path.str()
|
|
||||||
else
|
|
||||||
return self.str() ==# a:path.str()
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: Path.New(pathStr) {{{1
|
" FUNCTION: Path.New(pathStr) {{{1
|
||||||
@@ -614,23 +592,6 @@ function! s:Path.New(pathStr)
|
|||||||
return l:newPath
|
return l:newPath
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: Path.Slash() {{{1
|
|
||||||
" Return the path separator used by the underlying file system. Special
|
|
||||||
" consideration is taken for the use of the 'shellslash' option on Windows
|
|
||||||
" systems.
|
|
||||||
function! s:Path.Slash()
|
|
||||||
|
|
||||||
if nerdtree#runningWindows()
|
|
||||||
if exists('+shellslash') && &shellslash
|
|
||||||
return '/'
|
|
||||||
endif
|
|
||||||
|
|
||||||
return '\'
|
|
||||||
endif
|
|
||||||
|
|
||||||
return '/'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" FUNCTION: Path.Resolve() {{{1
|
" FUNCTION: Path.Resolve() {{{1
|
||||||
" Invoke the vim resolve() function and return the result
|
" Invoke the vim resolve() function and return the result
|
||||||
" This is necessary because in some versions of vim resolve() removes trailing
|
" This is necessary because in some versions of vim resolve() removes trailing
|
||||||
@@ -650,24 +611,33 @@ function! s:Path.readInfoFromDisk(fullpath)
|
|||||||
|
|
||||||
let fullpath = s:Path.WinToUnixPath(a:fullpath)
|
let fullpath = s:Path.WinToUnixPath(a:fullpath)
|
||||||
|
|
||||||
if getftype(fullpath) ==# 'fifo'
|
let ftype = getftype(fullpath)
|
||||||
|
|
||||||
|
if ftype ==# 'fifo'
|
||||||
throw 'NERDTree.InvalidFiletypeError: Cant handle FIFO files: ' . a:fullpath
|
throw 'NERDTree.InvalidFiletypeError: Cant handle FIFO files: ' . a:fullpath
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let self.pathSegments = filter(split(fullpath, '/'), '!empty(v:val)')
|
let self.pathSegments = filter(split(fullpath, '/'), '!empty(v:val)')
|
||||||
|
|
||||||
let self.isReadOnly = 0
|
|
||||||
if isdirectory(a:fullpath)
|
if isdirectory(a:fullpath)
|
||||||
let self.isDirectory = 1
|
let self.isDirectory = 1
|
||||||
|
let self.isReadOnly = 0
|
||||||
|
let self.isBroken = 0
|
||||||
elseif filereadable(a:fullpath)
|
elseif filereadable(a:fullpath)
|
||||||
let self.isDirectory = 0
|
let self.isDirectory = 0
|
||||||
let self.isReadOnly = filewritable(a:fullpath) ==# 0
|
let self.isReadOnly = filewritable(a:fullpath) ==# 0
|
||||||
|
let self.isBroken = 0
|
||||||
|
elseif ftype ==# 'link'
|
||||||
|
let self.isDirectory = 0
|
||||||
|
let self.isReadOnly = 0
|
||||||
|
let self.isBroken = 1
|
||||||
else
|
else
|
||||||
|
call nerdtree#echoWarning('invalid ' . a:fullpath . 'file type: ' . ftype)
|
||||||
throw 'NERDTree.InvalidArgumentsError: Invalid path = ' . a:fullpath
|
throw 'NERDTree.InvalidArgumentsError: Invalid path = ' . a:fullpath
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let self.isExecutable = 0
|
let self.isExecutable = 0
|
||||||
if !self.isDirectory
|
if !self.isDirectory && !self.isBroken
|
||||||
let self.isExecutable = getfperm(a:fullpath) =~# 'x'
|
let self.isExecutable = getfperm(a:fullpath) =~# 'x'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -815,7 +785,7 @@ function! s:Path._strForEdit()
|
|||||||
|
|
||||||
" On Windows, the drive letter may be removed by "fnamemodify()". Add it
|
" On Windows, the drive letter may be removed by "fnamemodify()". Add it
|
||||||
" back, if necessary.
|
" back, if necessary.
|
||||||
if nerdtree#runningWindows() && l:result[0] ==# s:Path.Slash()
|
if nerdtree#runningWindows() && l:result[0] == nerdtree#slash()
|
||||||
let l:result = self.drive . l:result
|
let l:result = self.drive . l:result
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -830,14 +800,14 @@ endfunction
|
|||||||
|
|
||||||
" FUNCTION: Path._strForGlob() {{{1
|
" FUNCTION: Path._strForGlob() {{{1
|
||||||
function! s:Path._strForGlob()
|
function! s:Path._strForGlob()
|
||||||
let lead = s:Path.Slash()
|
let lead = nerdtree#slash()
|
||||||
|
|
||||||
"if we are running windows then slap a drive letter on the front
|
"if we are running windows then slap a drive letter on the front
|
||||||
if nerdtree#runningWindows()
|
if nerdtree#runningWindows()
|
||||||
let lead = self.drive . '\'
|
let lead = self.drive . '\'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let toReturn = lead . join(self.pathSegments, s:Path.Slash())
|
let toReturn = lead . join(self.pathSegments, nerdtree#slash())
|
||||||
|
|
||||||
if !nerdtree#runningWindows()
|
if !nerdtree#runningWindows()
|
||||||
let toReturn = escape(toReturn, self._escChars())
|
let toReturn = escape(toReturn, self._escChars())
|
||||||
@@ -849,7 +819,7 @@ endfunction
|
|||||||
" Return the absolute pathname associated with this Path object. The pathname
|
" Return the absolute pathname associated with this Path object. The pathname
|
||||||
" returned is appropriate for the underlying file system.
|
" returned is appropriate for the underlying file system.
|
||||||
function! s:Path._str()
|
function! s:Path._str()
|
||||||
let l:separator = s:Path.Slash()
|
let l:separator = nerdtree#slash()
|
||||||
let l:leader = l:separator
|
let l:leader = l:separator
|
||||||
|
|
||||||
if nerdtree#runningWindows()
|
if nerdtree#runningWindows()
|
||||||
|
|||||||
@@ -121,8 +121,14 @@ function! s:TreeDirNode.findNode(path)
|
|||||||
if a:path.equals(self.path)
|
if a:path.equals(self.path)
|
||||||
return self
|
return self
|
||||||
endif
|
endif
|
||||||
if stridx(a:path.str(), self.path.str(), 0) ==# -1
|
if nerdtree#caseSensitiveFS()
|
||||||
return {}
|
if stridx(a:path.str(), self.path.str(), 0) ==# -1
|
||||||
|
return {}
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if stridx(tolower(a:path.str()), tolower(self.path.str()), 0) ==# -1
|
||||||
|
return {}
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if self.path.isDirectory
|
if self.path.isDirectory
|
||||||
@@ -236,7 +242,7 @@ function! s:TreeDirNode.getChildIndex(path)
|
|||||||
let z = self.getChildCount()
|
let z = self.getChildCount()
|
||||||
while a < z
|
while a < z
|
||||||
let mid = (a+z)/2
|
let mid = (a+z)/2
|
||||||
let diff = a:path.compareTo(self.children[mid].path)
|
let diff = nerdtree#compareNodePaths(a:path, self.children[mid].path)
|
||||||
|
|
||||||
if diff ==# -1
|
if diff ==# -1
|
||||||
let z = mid
|
let z = mid
|
||||||
@@ -278,8 +284,12 @@ function! s:TreeDirNode._glob(pattern, all)
|
|||||||
else
|
else
|
||||||
let l:pathSpec = escape(fnamemodify(self.path.str({'format': 'Glob'}), ':.'), ',')
|
let l:pathSpec = escape(fnamemodify(self.path.str({'format': 'Glob'}), ':.'), ',')
|
||||||
|
|
||||||
" On Windows, the drive letter may be removed by fnamemodify().
|
if nerdtree#runningWindows()
|
||||||
if nerdtree#runningWindows() && l:pathSpec[0] ==# g:NERDTreePath.Slash()
|
let l:pathSpec = substitute(l:pathSpec, "\\[\\(.*\\]\\)", "[[]\\1", "g")
|
||||||
|
endif
|
||||||
|
|
||||||
|
" On Windows, the drive letter may be removed by "fnamemodify()".
|
||||||
|
if nerdtree#runningWindows() && l:pathSpec[0] == nerdtree#slash()
|
||||||
let l:pathSpec = self.path.drive . l:pathSpec
|
let l:pathSpec = self.path.drive . l:pathSpec
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -289,7 +299,7 @@ function! s:TreeDirNode._glob(pattern, all)
|
|||||||
" See ':h version7.txt' and ':h version8.txt' for details on the
|
" See ':h version7.txt' and ':h version8.txt' for details on the
|
||||||
" development of the glob() and globpath() functions.
|
" development of the glob() and globpath() functions.
|
||||||
if v:version > 704 || (v:version ==# 704 && has('patch654'))
|
if v:version > 704 || (v:version ==# 704 && has('patch654'))
|
||||||
let l:globList = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore, 1, 0)
|
let l:globList = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore, 1, 1)
|
||||||
elseif v:version ==# 704 && has('patch279')
|
elseif v:version ==# 704 && has('patch279')
|
||||||
let l:globList = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore, 1)
|
let l:globList = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore, 1)
|
||||||
elseif v:version > 702 || (v:version ==# 702 && has('patch051'))
|
elseif v:version > 702 || (v:version ==# 702 && has('patch051'))
|
||||||
@@ -421,6 +431,7 @@ function! s:TreeDirNode._initChildren(silent)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let invalidFilesFound = 0
|
let invalidFilesFound = 0
|
||||||
|
let invalidFiles = []
|
||||||
for i in files
|
for i in files
|
||||||
try
|
try
|
||||||
let path = g:NERDTreePath.New(i)
|
let path = g:NERDTreePath.New(i)
|
||||||
@@ -428,6 +439,7 @@ function! s:TreeDirNode._initChildren(silent)
|
|||||||
call g:NERDTreePathNotifier.NotifyListeners('init', path, self.getNerdtree(), {})
|
call g:NERDTreePathNotifier.NotifyListeners('init', path, self.getNerdtree(), {})
|
||||||
catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
|
catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
|
||||||
let invalidFilesFound += 1
|
let invalidFilesFound += 1
|
||||||
|
let invalidFiles += [i]
|
||||||
endtry
|
endtry
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
@@ -437,7 +449,7 @@ function! s:TreeDirNode._initChildren(silent)
|
|||||||
call nerdtree#echo('')
|
call nerdtree#echo('')
|
||||||
|
|
||||||
if invalidFilesFound
|
if invalidFilesFound
|
||||||
call nerdtree#echoWarning(invalidFilesFound . ' file(s) could not be loaded into the NERD tree')
|
call nerdtree#echoWarning(invalidFilesFound . ' Invalid file(s): ' . join(invalidFiles, ', '))
|
||||||
endif
|
endif
|
||||||
return self.getChildCount()
|
return self.getChildCount()
|
||||||
endfunction
|
endfunction
|
||||||
@@ -564,12 +576,13 @@ function! s:TreeDirNode.refresh()
|
|||||||
let files = self._glob('*', 1) + self._glob('.*', 0)
|
let files = self._glob('*', 1) + self._glob('.*', 0)
|
||||||
let newChildNodes = []
|
let newChildNodes = []
|
||||||
let invalidFilesFound = 0
|
let invalidFilesFound = 0
|
||||||
|
let invalidFiles = []
|
||||||
for i in files
|
for i in files
|
||||||
try
|
try
|
||||||
"create a new path and see if it exists in this nodes children
|
"create a new path and see if it exists in this nodes children
|
||||||
let path = g:NERDTreePath.New(i)
|
let path = g:NERDTreePath.New(i)
|
||||||
let newNode = self.getChild(path)
|
let newNode = self.getChild(path)
|
||||||
if newNode !=# {}
|
if newNode !=# {} && path.str() ==# newNode.path.str()
|
||||||
call newNode.refresh()
|
call newNode.refresh()
|
||||||
call add(newChildNodes, newNode)
|
call add(newChildNodes, newNode)
|
||||||
|
|
||||||
@@ -580,7 +593,8 @@ function! s:TreeDirNode.refresh()
|
|||||||
call add(newChildNodes, newNode)
|
call add(newChildNodes, newNode)
|
||||||
endif
|
endif
|
||||||
catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
|
catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
|
||||||
let invalidFilesFound = 1
|
let invalidFilesFound += 1
|
||||||
|
let invalidFiles += [i]
|
||||||
endtry
|
endtry
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
@@ -589,7 +603,7 @@ function! s:TreeDirNode.refresh()
|
|||||||
call self.sortChildren()
|
call self.sortChildren()
|
||||||
|
|
||||||
if invalidFilesFound
|
if invalidFilesFound
|
||||||
call nerdtree#echoWarning('some files could not be loaded into the NERD tree')
|
call nerdtree#echoWarning(invalidFilesFound . ' Invalid file(s): ' . join(invalidFiles, ', '))
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@@ -666,7 +680,7 @@ function! s:TreeDirNode.sortChildren()
|
|||||||
if count(g:NERDTreeSortOrder, '*') < 1
|
if count(g:NERDTreeSortOrder, '*') < 1
|
||||||
call add(g:NERDTreeSortOrder, '*')
|
call add(g:NERDTreeSortOrder, '*')
|
||||||
endif
|
endif
|
||||||
let CompareFunc = function('nerdtree#compareNodesBySortKey')
|
let CompareFunc = function('nerdtree#compareNodes')
|
||||||
call sort(self.children, CompareFunc)
|
call sort(self.children, CompareFunc)
|
||||||
let g:NERDTreeOldSortOrder = g:NERDTreeSortOrder
|
let g:NERDTreeOldSortOrder = g:NERDTreeSortOrder
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -62,11 +62,16 @@ function! s:UI._dumpHelp()
|
|||||||
let help .= "\"\n\" ----------------------------\n"
|
let help .= "\"\n\" ----------------------------\n"
|
||||||
let help .= "\" Bookmark table mappings~\n"
|
let help .= "\" Bookmark table mappings~\n"
|
||||||
let help .= "\" double-click,\n"
|
let help .= "\" double-click,\n"
|
||||||
|
let help .= '" '. g:NERDTreeMapJumpBookmarks .": jump to bookmark table\n"
|
||||||
let help .= '" '. g:NERDTreeMapActivateNode .": open bookmark\n"
|
let help .= '" '. g:NERDTreeMapActivateNode .": open bookmark\n"
|
||||||
let help .= '" '. g:NERDTreeMapPreview .": preview file\n"
|
let help .= '" '. g:NERDTreeMapPreview .": preview file\n"
|
||||||
let help .= '" '. g:NERDTreeMapPreview .": find dir in tree\n"
|
let help .= '" '. g:NERDTreeMapPreview .": find dir in tree\n"
|
||||||
let help .= '" '. g:NERDTreeMapOpenInTab.": open in new tab\n"
|
let help .= '" '. g:NERDTreeMapOpenInTab.": open in new tab\n"
|
||||||
let help .= '" '. g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
|
let help .= '" '. g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
|
||||||
|
let help .= '" '. g:NERDTreeMapOpenSplit .": open split\n"
|
||||||
|
let help .= '" '. g:NERDTreeMapPreviewSplit .": preview split\n"
|
||||||
|
let help .= '" '. g:NERDTreeMapOpenVSplit .": open vsplit\n"
|
||||||
|
let help .= '" '. g:NERDTreeMapPreviewVSplit .": preview vsplit\n"
|
||||||
let help .= '" '. g:NERDTreeMapCustomOpen .": custom open\n"
|
let help .= '" '. g:NERDTreeMapCustomOpen .": custom open\n"
|
||||||
let help .= '" '. g:NERDTreeMapDeleteBookmark .": delete bookmark\n"
|
let help .= '" '. g:NERDTreeMapDeleteBookmark .": delete bookmark\n"
|
||||||
|
|
||||||
@@ -99,6 +104,7 @@ function! s:UI._dumpHelp()
|
|||||||
let help .= '" '. g:NERDTreeMapToggleFilters .': file filters (' . (self.isIgnoreFilterEnabled() ? 'on' : 'off') . ")\n"
|
let help .= '" '. g:NERDTreeMapToggleFilters .': file filters (' . (self.isIgnoreFilterEnabled() ? 'on' : 'off') . ")\n"
|
||||||
let help .= '" '. g:NERDTreeMapToggleFiles .': files (' . (self.getShowFiles() ? 'on' : 'off') . ")\n"
|
let help .= '" '. g:NERDTreeMapToggleFiles .': files (' . (self.getShowFiles() ? 'on' : 'off') . ")\n"
|
||||||
let help .= '" '. g:NERDTreeMapToggleBookmarks .': bookmarks (' . (self.getShowBookmarks() ? 'on' : 'off') . ")\n"
|
let help .= '" '. g:NERDTreeMapToggleBookmarks .': bookmarks (' . (self.getShowBookmarks() ? 'on' : 'off') . ")\n"
|
||||||
|
let help .= '" '. g:NERDTreeMapToggleFileLines .': files lines (' . (self.getShowFileLines() ? 'on' : 'off') . ")\n"
|
||||||
|
|
||||||
" add quickhelp entries for each custom key map
|
" add quickhelp entries for each custom key map
|
||||||
let help .= "\"\n\" ----------------------------\n"
|
let help .= "\"\n\" ----------------------------\n"
|
||||||
@@ -143,6 +149,7 @@ function! s:UI.New(nerdtree)
|
|||||||
let newObj._showFiles = g:NERDTreeShowFiles
|
let newObj._showFiles = g:NERDTreeShowFiles
|
||||||
let newObj._showHidden = g:NERDTreeShowHidden
|
let newObj._showHidden = g:NERDTreeShowHidden
|
||||||
let newObj._showBookmarks = g:NERDTreeShowBookmarks
|
let newObj._showBookmarks = g:NERDTreeShowBookmarks
|
||||||
|
let newObj._showFileLines = g:NERDTreeFileLines
|
||||||
|
|
||||||
return newObj
|
return newObj
|
||||||
endfunction
|
endfunction
|
||||||
@@ -280,6 +287,11 @@ function! s:UI.getShowHidden()
|
|||||||
return self._showHidden
|
return self._showHidden
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: s:UI.getShowFileLines() {{{1
|
||||||
|
function! s:UI.getShowFileLines()
|
||||||
|
return self._showFileLines
|
||||||
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:UI._indentLevelFor(line) {{{1
|
" FUNCTION: s:UI._indentLevelFor(line) {{{1
|
||||||
function! s:UI._indentLevelFor(line)
|
function! s:UI._indentLevelFor(line)
|
||||||
" Replace multi-character DirArrows with a single space so the
|
" Replace multi-character DirArrows with a single space so the
|
||||||
@@ -364,7 +376,7 @@ function! s:UI.saveScreenState()
|
|||||||
call g:NERDTree.CursorToTreeWin()
|
call g:NERDTree.CursorToTreeWin()
|
||||||
let self._screenState['oldPos'] = getpos('.')
|
let self._screenState['oldPos'] = getpos('.')
|
||||||
let self._screenState['oldTopLine'] = line('w0')
|
let self._screenState['oldTopLine'] = line('w0')
|
||||||
let self._screenState['oldWindowSize']= winwidth('')
|
let self._screenState['oldWindowSize'] = winnr('$')==1 ? g:NERDTreeWinSize : winwidth('')
|
||||||
call nerdtree#exec(win . 'wincmd w', 1)
|
call nerdtree#exec(win . 'wincmd w', 1)
|
||||||
catch
|
catch
|
||||||
endtry
|
endtry
|
||||||
@@ -471,10 +483,10 @@ function! s:UI.toggleIgnoreFilter()
|
|||||||
call self.centerView()
|
call self.centerView()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:UI.toggleShowBookmarks() {{{1
|
" FUNCTION: s:UI.setShowBookmarks() {{{1
|
||||||
" Toggle the visibility of the Bookmark table.
|
" Sets the visibility of the Bookmark table.
|
||||||
function! s:UI.toggleShowBookmarks()
|
function! s:UI.setShowBookmarks(value)
|
||||||
let self._showBookmarks = !self._showBookmarks
|
let self._showBookmarks = a:value
|
||||||
|
|
||||||
if self.getShowBookmarks()
|
if self.getShowBookmarks()
|
||||||
call self.nerdtree.render()
|
call self.nerdtree.render()
|
||||||
@@ -492,6 +504,12 @@ function! s:UI.toggleShowBookmarks()
|
|||||||
call self.centerView()
|
call self.centerView()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: s:UI.toggleShowBookmarks() {{{1
|
||||||
|
" Toggle the visibility of the Bookmark table.
|
||||||
|
function! s:UI.toggleShowBookmarks()
|
||||||
|
call self.setShowBookmarks(!self._showBookmarks)
|
||||||
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:UI.toggleShowFiles() {{{1
|
" FUNCTION: s:UI.toggleShowFiles() {{{1
|
||||||
" toggles the display of hidden files
|
" toggles the display of hidden files
|
||||||
function! s:UI.toggleShowFiles()
|
function! s:UI.toggleShowFiles()
|
||||||
@@ -508,12 +526,23 @@ function! s:UI.toggleShowHidden()
|
|||||||
call self.centerView()
|
call self.centerView()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: s:UI.toggleShowFileLines() {{{1
|
||||||
|
" toggles the display of file lines
|
||||||
|
function! s:UI.toggleShowFileLines()
|
||||||
|
let self._showFileLines = !self._showFileLines
|
||||||
|
call self.nerdtree.root.refresh()
|
||||||
|
call self.renderViewSavingPosition()
|
||||||
|
call self.centerView()
|
||||||
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:UI.toggleZoom() {{{1
|
" FUNCTION: s:UI.toggleZoom() {{{1
|
||||||
" zoom (maximize/minimize) the NERDTree window
|
" zoom (maximize/minimize) the NERDTree window
|
||||||
function! s:UI.toggleZoom()
|
function! s:UI.toggleZoom()
|
||||||
if exists('b:NERDTreeZoomed') && b:NERDTreeZoomed
|
if exists('b:NERDTreeZoomed') && b:NERDTreeZoomed
|
||||||
let size = exists('b:NERDTreeOldWindowSize') ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize
|
setlocal nowinfixwidth
|
||||||
call nerdtree#exec('silent vertical resize '. size, 1)
|
wincmd =
|
||||||
|
setlocal winfixwidth
|
||||||
|
call nerdtree#exec('silent vertical resize '. g:NERDTreeWinSize, 1)
|
||||||
let b:NERDTreeZoomed = 0
|
let b:NERDTreeZoomed = 0
|
||||||
else
|
else
|
||||||
call nerdtree#exec('vertical resize '. get(g:, 'NERDTreeWinSizeMax', ''), 1)
|
call nerdtree#exec('vertical resize '. get(g:, 'NERDTreeWinSizeMax', ''), 1)
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ call NERDTreeAddMenuItem({'text': '(a)dd a childnode', 'shortcut': 'a', 'callbac
|
|||||||
call NERDTreeAddMenuItem({'text': '(m)ove the current node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'})
|
call NERDTreeAddMenuItem({'text': '(m)ove the current node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'})
|
||||||
call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'})
|
call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'})
|
||||||
|
|
||||||
if has('gui_mac') || has('gui_macvim') || has('mac')
|
if nerdtree#runningMac()
|
||||||
call NERDTreeAddMenuItem({'text': '(r)eveal in Finder the current node', 'shortcut': 'r', 'callback': 'NERDTreeRevealInFinder'})
|
call NERDTreeAddMenuItem({'text': '(r)eveal the current node in the Finder', 'shortcut': 'r', 'callback': 'NERDTreeRevealInFinder'})
|
||||||
call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFile'})
|
call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFile'})
|
||||||
call NERDTreeAddMenuItem({'text': '(q)uicklook the current node', 'shortcut': 'q', 'callback': 'NERDTreeQuickLook'})
|
call NERDTreeAddMenuItem({'text': '(q)uicklook the current node', 'shortcut': 'q', 'callback': 'NERDTreeQuickLook'})
|
||||||
endif
|
endif
|
||||||
@@ -35,6 +35,7 @@ if executable('xdg-open')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if nerdtree#runningWindows()
|
if nerdtree#runningWindows()
|
||||||
|
call NERDTreeAddMenuItem({'text': '(r)eveal the current node in the Explorer', 'shortcut': 'r', 'callback': 'NERDTreeRevealInExplorer'})
|
||||||
call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFileWindows'})
|
call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFileWindows'})
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -45,10 +46,15 @@ call NERDTreeAddMenuItem({'text': (has('clipboard')?'copy (p)ath to clipboard':'
|
|||||||
|
|
||||||
if has('unix') || has('osx')
|
if has('unix') || has('osx')
|
||||||
call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNode'})
|
call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNode'})
|
||||||
|
call NERDTreeAddMenuItem({'text': '(C)hange node permissions', 'shortcut':'C', 'callback': 'NERDTreeChangePermissions'})
|
||||||
else
|
else
|
||||||
call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNodeWin32'})
|
call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNodeWin32'})
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if exists('*system')
|
||||||
|
call NERDTreeAddMenuItem({'text': 'Run (s)ystem command in this directory', 'shortcut':'s', 'callback': 'NERDTreeSystemCommand'})
|
||||||
|
endif
|
||||||
|
|
||||||
"FUNCTION: s:inputPrompt(action){{{1
|
"FUNCTION: s:inputPrompt(action){{{1
|
||||||
"returns the string that should be prompted to the user for the given action
|
"returns the string that should be prompted to the user for the given action
|
||||||
"
|
"
|
||||||
@@ -144,28 +150,48 @@ function! s:renameBuffer(bufNum, newNodeName, isDirectory)
|
|||||||
let quotedFileName = fnameescape(a:newNodeName)
|
let quotedFileName = fnameescape(a:newNodeName)
|
||||||
let editStr = g:NERDTreePath.New(a:newNodeName).str({'format': 'Edit'})
|
let editStr = g:NERDTreePath.New(a:newNodeName).str({'format': 'Edit'})
|
||||||
endif
|
endif
|
||||||
" 1. ensure that a new buffer is loaded
|
|
||||||
call nerdtree#exec('badd ' . quotedFileName, 0)
|
|
||||||
" 2. ensure that all windows which display the just deleted filename
|
|
||||||
" display a buffer for a new filename.
|
|
||||||
let s:originalTabNumber = tabpagenr()
|
let s:originalTabNumber = tabpagenr()
|
||||||
let s:originalWindowNumber = winnr()
|
let s:originalWindowNumber = winnr()
|
||||||
call nerdtree#exec('tabdo windo if winbufnr(0) ==# ' . a:bufNum . " | exec ':e! " . editStr . "' | endif", 0)
|
let l:tempBufferName = 'NERDTreeRenameTempBuffer'
|
||||||
call nerdtree#exec('tabnext ' . s:originalTabNumber, 1)
|
|
||||||
call nerdtree#exec(s:originalWindowNumber . 'wincmd w', 1)
|
" 1. swap deleted file buffer with a temporary one
|
||||||
" 3. We don't need a previous buffer anymore
|
" this step is needed to compensate for case insensitive filesystems
|
||||||
|
|
||||||
|
" 1.1. create an intermediate(temporary) buffer
|
||||||
|
call nerdtree#exec('badd ' . l:tempBufferName, 0)
|
||||||
|
let l:tempBufNum = bufnr(l:tempBufferName)
|
||||||
|
" 1.2. ensure that all windows which display the just deleted filename
|
||||||
|
" display the new temp buffer.
|
||||||
|
call nerdtree#exec('tabdo windo if winbufnr(0) ==# ' . a:bufNum . " | exec ':e! " . l:tempBufferName . "' | endif", 0)
|
||||||
|
" 1.3. We don't need the deleted file buffer anymore
|
||||||
try
|
try
|
||||||
call nerdtree#exec('confirm bwipeout ' . a:bufNum, 0)
|
call nerdtree#exec('confirm bwipeout ' . a:bufNum, 0)
|
||||||
catch
|
catch
|
||||||
" This happens when answering Cancel if confirmation is needed. Do nothing.
|
" This happens when answering Cancel if confirmation is needed. Do nothing.
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
|
" 2. swap temporary buffer with the new filename buffer
|
||||||
|
" 2.1. create the actual new file buffer
|
||||||
|
call nerdtree#exec('badd ' . quotedFileName, 0)
|
||||||
|
|
||||||
|
" 2.2. ensure that all windows which display the temporary buffer
|
||||||
|
" display a buffer for the new filename.
|
||||||
|
call nerdtree#exec('tabdo windo if winbufnr(0) ==# ' . l:tempBufNum . " | exec ':e! " . editStr . "' | endif", 0)
|
||||||
|
call nerdtree#exec('tabnext ' . s:originalTabNumber, 1)
|
||||||
|
call nerdtree#exec(s:originalWindowNumber . 'wincmd w', 1)
|
||||||
|
" 2.3. We don't need the temporary buffer anymore
|
||||||
|
try
|
||||||
|
call nerdtree#exec('confirm bwipeout ' . l:tempBufNum, 0)
|
||||||
|
catch
|
||||||
|
" This happens when answering Cancel if confirmation is needed. Do nothing.
|
||||||
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: NERDTreeAddNode(){{{1
|
"FUNCTION: NERDTreeAddNode(){{{1
|
||||||
function! NERDTreeAddNode()
|
function! NERDTreeAddNode()
|
||||||
let curDirNode = g:NERDTreeDirNode.GetSelected()
|
let curDirNode = g:NERDTreeDirNode.GetSelected()
|
||||||
let prompt = s:inputPrompt('add')
|
let prompt = s:inputPrompt('add')
|
||||||
let newNodeName = input(prompt, curDirNode.path.str() . g:NERDTreePath.Slash(), 'file')
|
let newNodeName = substitute(input(prompt, curDirNode.path.str() . nerdtree#slash(), 'file'), '\(^\s*\|\s*$\)', '', 'g')
|
||||||
|
|
||||||
if newNodeName ==# ''
|
if newNodeName ==# ''
|
||||||
call nerdtree#echo('Node Creation Aborted.')
|
call nerdtree#echo('Node Creation Aborted.')
|
||||||
@@ -201,8 +227,25 @@ function! NERDTreeMoveNode()
|
|||||||
let prompt = s:inputPrompt('move')
|
let prompt = s:inputPrompt('move')
|
||||||
let newNodePath = input(prompt, curNode.path.str(), 'file')
|
let newNodePath = input(prompt, curNode.path.str(), 'file')
|
||||||
while filereadable(newNodePath)
|
while filereadable(newNodePath)
|
||||||
call nerdtree#echoWarning('This destination already exists. Try again.')
|
" allow renames with different casing when g:NERDTreeCaseSensitiveFS
|
||||||
let newNodePath = input(prompt, curNode.path.str(), 'file')
|
" is set to either 0 or 3 and the 2 paths are equal
|
||||||
|
if (g:NERDTreeCaseSensitiveFS == 0 || g:NERDTreeCaseSensitiveFS == 3) &&
|
||||||
|
\nerdtree#pathEquals(curNode.path.str(), newNodePath)
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
|
||||||
|
call nerdtree#echoWarning('This destination already exists, Try again.')
|
||||||
|
|
||||||
|
" inform the user about the flag if we think it is a false positive
|
||||||
|
" when g:NERDTreeCaseSensitiveFS is set to 2
|
||||||
|
if g:NERDTreeCaseSensitiveFS == 2 &&
|
||||||
|
\!nerdtree#osDefaultCaseSensitiveFS() &&
|
||||||
|
\nerdtree#pathEquals(curNode.path.str(), newNodePath)
|
||||||
|
echon "\n(If it is a false positive please consider assigning NERDTreeCaseSensitiveFS's value)"
|
||||||
|
endif
|
||||||
|
|
||||||
|
" prompt the user again
|
||||||
|
let newNodePath = substitute(input(prompt, curNode.path.str(), 'file'), '\(^\s*\|\s*$\)', '', 'g')
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
|
|
||||||
@@ -252,8 +295,6 @@ endfunction
|
|||||||
|
|
||||||
" FUNCTION: NERDTreeDeleteNode() {{{1
|
" FUNCTION: NERDTreeDeleteNode() {{{1
|
||||||
function! NERDTreeDeleteNode()
|
function! NERDTreeDeleteNode()
|
||||||
let l:shellslash = &shellslash
|
|
||||||
let &shellslash = 0
|
|
||||||
let currentNode = g:NERDTreeFileNode.GetSelected()
|
let currentNode = g:NERDTreeFileNode.GetSelected()
|
||||||
let confirmed = 0
|
let confirmed = 0
|
||||||
|
|
||||||
@@ -289,7 +330,6 @@ function! NERDTreeDeleteNode()
|
|||||||
else
|
else
|
||||||
call nerdtree#echo('delete aborted')
|
call nerdtree#echo('delete aborted')
|
||||||
endif
|
endif
|
||||||
let &shellslash = l:shellslash
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: NERDTreeListNode() {{{1
|
" FUNCTION: NERDTreeListNode() {{{1
|
||||||
@@ -332,13 +372,34 @@ function! NERDTreeListNodeWin32()
|
|||||||
call nerdtree#echo('node not recognized')
|
call nerdtree#echo('node not recognized')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: NERDTreeChangePermissions() {{{1
|
||||||
|
function! NERDTreeChangePermissions()
|
||||||
|
let l:node = g:NERDTreeFileNode.GetSelected()
|
||||||
|
let l:prompt = "change node permissions (chmod args): "
|
||||||
|
let l:newNodePerm = input(l:prompt)
|
||||||
|
|
||||||
|
if !empty(l:node)
|
||||||
|
let l:path = l:node.path.str()
|
||||||
|
let l:cmd = 'chmod ' .. newNodePerm .. ' ' .. path
|
||||||
|
let l:error = split(system(l:cmd), '\n')
|
||||||
|
|
||||||
|
if !empty(l:error)
|
||||||
|
call nerdtree#echo(l:error[0])
|
||||||
|
endif
|
||||||
|
|
||||||
|
call b:NERDTree.root.refresh()
|
||||||
|
call b:NERDTree.render()
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
call nerdtree#echo('node not recognized')
|
||||||
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: NERDTreeCopyNode() {{{1
|
" FUNCTION: NERDTreeCopyNode() {{{1
|
||||||
function! NERDTreeCopyNode()
|
function! NERDTreeCopyNode()
|
||||||
let l:shellslash = &shellslash
|
|
||||||
let &shellslash = 0
|
|
||||||
let currentNode = g:NERDTreeFileNode.GetSelected()
|
let currentNode = g:NERDTreeFileNode.GetSelected()
|
||||||
let prompt = s:inputPrompt('copy')
|
let prompt = s:inputPrompt('copy')
|
||||||
let newNodePath = input(prompt, currentNode.path.str(), 'file')
|
let newNodePath = substitute(input(prompt, currentNode.path.str(), 'file'), '\(^\s*\|\s*$\)', '', 'g')
|
||||||
|
|
||||||
if newNodePath !=# ''
|
if newNodePath !=# ''
|
||||||
"strip trailing slash
|
"strip trailing slash
|
||||||
@@ -371,7 +432,6 @@ function! NERDTreeCopyNode()
|
|||||||
else
|
else
|
||||||
call nerdtree#echo('Copy aborted.')
|
call nerdtree#echo('Copy aborted.')
|
||||||
endif
|
endif
|
||||||
let &shellslash = l:shellslash
|
|
||||||
redraw!
|
redraw!
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -455,6 +515,17 @@ function! NERDTreeExecuteFileLinux()
|
|||||||
call system('xdg-open ' . shellescape(l:node.path.str()))
|
call system('xdg-open ' . shellescape(l:node.path.str()))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: NERDTreeRevealInExplorer() {{{1
|
||||||
|
function! NERDTreeRevealInExplorer()
|
||||||
|
let l:node = g:NERDTreeFileNode.GetSelected()
|
||||||
|
|
||||||
|
if empty(l:node)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
call system('cmd.exe /c explorer /select, ' . shellescape(l:node.path.str()))
|
||||||
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: NERDTreeExecuteFileWindows() {{{1
|
" FUNCTION: NERDTreeExecuteFileWindows() {{{1
|
||||||
function! NERDTreeExecuteFileWindows()
|
function! NERDTreeExecuteFileWindows()
|
||||||
let l:node = g:NERDTreeFileNode.GetSelected()
|
let l:node = g:NERDTreeFileNode.GetSelected()
|
||||||
@@ -466,4 +537,21 @@ function! NERDTreeExecuteFileWindows()
|
|||||||
call system('cmd.exe /c start "" ' . shellescape(l:node.path.str()))
|
call system('cmd.exe /c start "" ' . shellescape(l:node.path.str()))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: NERDTreeSystemCommand() {{{1
|
||||||
|
function! NERDTreeSystemCommand()
|
||||||
|
let l:node = g:NERDTreeFileNode.GetSelected()
|
||||||
|
|
||||||
|
if empty(l:node)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:cwd = getcwd()
|
||||||
|
let l:directory = l:node.path.isDirectory ? l:node.path.str() : l:node.parent.path.str()
|
||||||
|
execute 'cd '.l:directory
|
||||||
|
|
||||||
|
let l:nl = nr2char(10)
|
||||||
|
echo l:nl . system(input(l:directory . (nerdtree#runningWindows() ? '> ' : ' $ ')))
|
||||||
|
execute 'cd '.l:cwd
|
||||||
|
endfunction
|
||||||
|
|
||||||
" vim: set sw=4 sts=4 et fdm=marker:
|
" vim: set sw=4 sts=4 et fdm=marker:
|
||||||
|
|||||||
@@ -26,141 +26,120 @@ let loaded_nerd_tree = 1
|
|||||||
let s:old_cpo = &cpoptions
|
let s:old_cpo = &cpoptions
|
||||||
set cpoptions&vim
|
set cpoptions&vim
|
||||||
|
|
||||||
"Function: s:initVariable() function {{{2
|
"SECTION: Initialize variable calls and other random constants {{{2
|
||||||
"This function is used to initialise a given variable to a given value. The
|
let g:NERDTreeAutoCenter = get(g:, 'NERDTreeAutoCenter', 1)
|
||||||
"variable is only initialised if it does not exist prior
|
let g:NERDTreeAutoCenterThreshold = get(g:, 'NERDTreeAutoCenterThreshold', 3)
|
||||||
"
|
let g:NERDTreeCaseSensitiveFS = get(g:, 'NERDTreeCaseSensitiveFS', 2)
|
||||||
"Args:
|
let g:NERDTreeCaseSensitiveSort = get(g:, 'NERDTreeCaseSensitiveSort', 0)
|
||||||
"var: the name of the var to be initialised
|
let g:NERDTreeNaturalSort = get(g:, 'NERDTreeNaturalSort', 0)
|
||||||
"value: the value to initialise var to
|
let g:NERDTreeSortHiddenFirst = get(g:, 'NERDTreeSortHiddenFirst', 1)
|
||||||
"
|
let g:NERDTreeUseTCD = get(g:, 'NERDTreeUseTCD', 0)
|
||||||
"Returns:
|
let g:NERDTreeChDirMode = get(g:, 'NERDTreeChDirMode', 0)
|
||||||
"1 if the var is set, 0 otherwise
|
let g:NERDTreeCreatePrefix = get(g:, 'NERDTreeCreatePrefix', 'silent')
|
||||||
function! s:initVariable(var, value)
|
let g:NERDTreeMinimalUI = get(g:, 'NERDTreeMinimalUI', 0)
|
||||||
if !exists(a:var)
|
let g:NERDTreeMinimalMenu = get(g:, 'NERDTreeMinimalMenu', 0)
|
||||||
exec 'let ' . a:var . ' = ' . "'" . substitute(a:value, "'", "''", 'g') . "'"
|
let g:NERDTreeIgnore = get(g:, 'NERDTreeIgnore', ['\~$'])
|
||||||
return 1
|
let g:NERDTreeBookmarksFile = get(g:, 'NERDTreeBookmarksFile', expand('$HOME') . '/.NERDTreeBookmarks')
|
||||||
endif
|
let g:NERDTreeBookmarksSort = get(g:, 'NERDTreeBookmarksSort', 1)
|
||||||
return 0
|
let g:NERDTreeHighlightCursorline = get(g:, 'NERDTreeHighlightCursorline', 1)
|
||||||
endfunction
|
let g:NERDTreeHijackNetrw = get(g:, 'NERDTreeHijackNetrw', 1)
|
||||||
|
let g:NERDTreeMarkBookmarks = get(g:, 'NERDTreeMarkBookmarks', 1)
|
||||||
|
let g:NERDTreeMouseMode = get(g:, 'NERDTreeMouseMode', 1)
|
||||||
|
let g:NERDTreeNotificationThreshold = get(g:, 'NERDTreeNotificationThreshold', 100)
|
||||||
|
let g:NERDTreeQuitOnOpen = get(g:, 'NERDTreeQuitOnOpen', 0)
|
||||||
|
let g:NERDTreeRespectWildIgnore = get(g:, 'NERDTreeRespectWildIgnore', 0)
|
||||||
|
let g:NERDTreeShowBookmarks = get(g:, 'NERDTreeShowBookmarks', 0)
|
||||||
|
let g:NERDTreeShowFiles = get(g:, 'NERDTreeShowFiles', 1)
|
||||||
|
let g:NERDTreeShowHidden = get(g:, 'NERDTreeShowHidden', 0)
|
||||||
|
let g:NERDTreeShowLineNumbers = get(g:, 'NERDTreeShowLineNumbers', 0)
|
||||||
|
let g:NERDTreeSortDirs = get(g:, 'NERDTreeSortDirs', 1)
|
||||||
|
let g:NERDTreeFileLines = get(g:, 'NERDTreeFileLines', 0)
|
||||||
|
|
||||||
"SECTION: Init variable calls and other random constants {{{2
|
|
||||||
call s:initVariable('g:NERDTreeAutoCenter', 1)
|
|
||||||
call s:initVariable('g:NERDTreeAutoCenterThreshold', 3)
|
|
||||||
call s:initVariable('g:NERDTreeCaseSensitiveSort', 0)
|
|
||||||
call s:initVariable('g:NERDTreeNaturalSort', 0)
|
|
||||||
call s:initVariable('g:NERDTreeSortHiddenFirst', 1)
|
|
||||||
call s:initVariable('g:NERDTreeUseTCD', 0)
|
|
||||||
call s:initVariable('g:NERDTreeChDirMode', 0)
|
|
||||||
call s:initVariable('g:NERDTreeCreatePrefix', 'silent')
|
|
||||||
call s:initVariable('g:NERDTreeMinimalUI', 0)
|
|
||||||
call s:initVariable('g:NERDTreeMinimalMenu', 0)
|
|
||||||
if !exists('g:NERDTreeIgnore')
|
|
||||||
let g:NERDTreeIgnore = ['\~$']
|
|
||||||
endif
|
|
||||||
call s:initVariable('g:NERDTreeBookmarksFile', expand('$HOME') . '/.NERDTreeBookmarks')
|
|
||||||
call s:initVariable('g:NERDTreeBookmarksSort', 1)
|
|
||||||
call s:initVariable('g:NERDTreeHighlightCursorline', 1)
|
|
||||||
call s:initVariable('g:NERDTreeHijackNetrw', 1)
|
|
||||||
call s:initVariable('g:NERDTreeMarkBookmarks', 1)
|
|
||||||
call s:initVariable('g:NERDTreeMouseMode', 1)
|
|
||||||
call s:initVariable('g:NERDTreeNotificationThreshold', 100)
|
|
||||||
call s:initVariable('g:NERDTreeQuitOnOpen', 0)
|
|
||||||
call s:initVariable('g:NERDTreeRespectWildIgnore', 0)
|
|
||||||
call s:initVariable('g:NERDTreeShowBookmarks', 0)
|
|
||||||
call s:initVariable('g:NERDTreeShowFiles', 1)
|
|
||||||
call s:initVariable('g:NERDTreeShowHidden', 0)
|
|
||||||
call s:initVariable('g:NERDTreeShowLineNumbers', 0)
|
|
||||||
call s:initVariable('g:NERDTreeSortDirs', 1)
|
|
||||||
|
|
||||||
if !nerdtree#runningWindows() && !nerdtree#runningCygwin()
|
if !nerdtree#runningWindows() && !nerdtree#runningCygwin()
|
||||||
call s:initVariable('g:NERDTreeDirArrowExpandable', '▸')
|
let g:NERDTreeDirArrowExpandable = get(g:, 'NERDTreeDirArrowExpandable', '▸')
|
||||||
call s:initVariable('g:NERDTreeDirArrowCollapsible', '▾')
|
let g:NERDTreeDirArrowCollapsible = get(g:, 'NERDTreeDirArrowCollapsible', '▾')
|
||||||
else
|
else
|
||||||
call s:initVariable('g:NERDTreeDirArrowExpandable', '+')
|
let g:NERDTreeDirArrowExpandable = get(g:, 'NERDTreeDirArrowExpandable', '+')
|
||||||
call s:initVariable('g:NERDTreeDirArrowCollapsible', '~')
|
let g:NERDTreeDirArrowCollapsible = get(g:, 'NERDTreeDirArrowCollapsible', '~')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call s:initVariable('g:NERDTreeCascadeOpenSingleChildDir', 1)
|
let g:NERDTreeCascadeOpenSingleChildDir = get(g:, 'NERDTreeCascadeOpenSingleChildDir', 1)
|
||||||
call s:initVariable('g:NERDTreeCascadeSingleChildDir', 1)
|
let g:NERDTreeCascadeSingleChildDir = get(g:, 'NERDTreeCascadeSingleChildDir', 1)
|
||||||
|
|
||||||
if !exists('g:NERDTreeSortOrder')
|
let g:NERDTreeSortOrder = get(g:, 'NERDTreeSortOrder', ['\/$', '*', '\.swp$', '\.bak$', '\~$'])
|
||||||
let g:NERDTreeSortOrder = ['\/$', '*', '\.swp$', '\.bak$', '\~$']
|
|
||||||
endif
|
|
||||||
let g:NERDTreeOldSortOrder = []
|
let g:NERDTreeOldSortOrder = []
|
||||||
|
|
||||||
call s:initVariable('g:NERDTreeGlyphReadOnly', 'RO')
|
let g:NERDTreeGlyphReadOnly = get(g:, 'NERDTreeGlyphReadOnly', 'RO')
|
||||||
|
let g:NERDTreeGlyphBroken = get(g:, 'NERDTreeGlyphBroken', ' [*broken]')
|
||||||
|
|
||||||
if has('conceal')
|
if has('conceal')
|
||||||
call s:initVariable('g:NERDTreeNodeDelimiter', "\x07")
|
let g:NERDTreeNodeDelimiter = get(g:, 'NERDTreeNodeDelimiter', "\x07")
|
||||||
elseif (g:NERDTreeDirArrowExpandable ==# "\u00a0" || g:NERDTreeDirArrowCollapsible ==# "\u00a0")
|
elseif (g:NERDTreeDirArrowExpandable ==# "\u00a0" || g:NERDTreeDirArrowCollapsible ==# "\u00a0")
|
||||||
call s:initVariable('g:NERDTreeNodeDelimiter', "\u00b7")
|
let g:NERDTreeNodeDelimiter = get(g:, 'NERDTreeNodeDelimiter', "\u00b7")
|
||||||
else
|
else
|
||||||
call s:initVariable('g:NERDTreeNodeDelimiter', "\u00a0")
|
let g:NERDTreeNodeDelimiter = get(g:, 'NERDTreeNodeDelimiter', "\u00a0")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !exists('g:NERDTreeStatusline')
|
"the exists() crap here is a hack to stop vim spazzing out when
|
||||||
|
"loading a session that was created with an open nerd tree. It spazzes
|
||||||
|
"because it doesnt store b:NERDTree(its a b: var, and its a hash)
|
||||||
|
let g:NERDTreeStatusline = get(g:, 'NERDTreeStatusline', "%{exists('b:NERDTree')?b:NERDTree.root.path.str():''}")
|
||||||
|
|
||||||
"the exists() crap here is a hack to stop vim spazzing out when
|
let g:NERDTreeWinPos = get(g:, 'NERDTreeWinPos', 'left')
|
||||||
"loading a session that was created with an open nerd tree. It spazzes
|
let g:NERDTreeWinSize = get(g:, 'NERDTreeWinSize', 31)
|
||||||
"because it doesnt store b:NERDTree(its a b: var, and its a hash)
|
|
||||||
let g:NERDTreeStatusline = "%{exists('b:NERDTree')?b:NERDTree.root.path.str():''}"
|
|
||||||
|
|
||||||
endif
|
|
||||||
call s:initVariable('g:NERDTreeWinPos', 'left')
|
|
||||||
call s:initVariable('g:NERDTreeWinSize', 31)
|
|
||||||
|
|
||||||
"init the shell commands that will be used to copy nodes, and remove dir trees
|
"init the shell commands that will be used to copy nodes, and remove dir trees
|
||||||
"
|
|
||||||
"Note: the space after the command is important
|
"Note: the space after the command is important
|
||||||
if nerdtree#runningWindows()
|
if nerdtree#runningWindows()
|
||||||
call s:initVariable('g:NERDTreeRemoveDirCmd', 'rmdir /s /q ')
|
let g:NERDTreeRemoveDirCmd = get(g:, 'NERDTreeRemoveDirCmd', 'rmdir /s /q ')
|
||||||
call s:initVariable('g:NERDTreeCopyDirCmd', 'xcopy /s /e /i /y /q ')
|
let g:NERDTreeCopyDirCmd = get(g:, 'NERDTreeCopyDirCmd', 'xcopy /s /e /i /y /q ')
|
||||||
call s:initVariable('g:NERDTreeCopyFileCmd', 'copy /y ')
|
let g:NERDTreeCopyFileCmd = get(g:, 'NERDTreeCopyFileCmd', 'copy /y ')
|
||||||
else
|
else
|
||||||
call s:initVariable('g:NERDTreeRemoveDirCmd', 'rm -rf ')
|
let g:NERDTreeRemoveDirCmd = get(g:, 'NERDTreeRemoveDirCmd', 'rm -rf ')
|
||||||
call s:initVariable('g:NERDTreeCopyCmd', 'cp -r ')
|
let g:NERDTreeCopyCmd = get(g:, 'NERDTreeCopyCmd', 'cp -r ')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
"SECTION: Init variable calls for key mappings {{{2
|
"SECTION: Init variable calls for key mappings {{{2
|
||||||
call s:initVariable('g:NERDTreeMapCustomOpen', '<CR>')
|
let g:NERDTreeMapCustomOpen = get(g:, 'NERDTreeMapCustomOpen', '<CR>')
|
||||||
call s:initVariable('g:NERDTreeMapActivateNode', 'o')
|
let g:NERDTreeMapJumpBookmarks = get(g:, 'NERDTreeMapJumpBookmarks', 'gb')
|
||||||
call s:initVariable('g:NERDTreeMapChangeRoot', 'C')
|
let g:NERDTreeMapActivateNode = get(g:, 'NERDTreeMapActivateNode', 'o')
|
||||||
call s:initVariable('g:NERDTreeMapChdir', 'cd')
|
let g:NERDTreeMapChangeRoot = get(g:, 'NERDTreeMapChangeRoot', 'C')
|
||||||
call s:initVariable('g:NERDTreeMapCloseChildren', 'X')
|
let g:NERDTreeMapChdir = get(g:, 'NERDTreeMapChdir', 'cd')
|
||||||
call s:initVariable('g:NERDTreeMapCloseDir', 'x')
|
let g:NERDTreeMapCloseChildren = get(g:, 'NERDTreeMapCloseChildren', 'X')
|
||||||
call s:initVariable('g:NERDTreeMapDeleteBookmark', 'D')
|
let g:NERDTreeMapCloseDir = get(g:, 'NERDTreeMapCloseDir', 'x')
|
||||||
call s:initVariable('g:NERDTreeMapMenu', 'm')
|
let g:NERDTreeMapDeleteBookmark = get(g:, 'NERDTreeMapDeleteBookmark', 'D')
|
||||||
call s:initVariable('g:NERDTreeMapHelp', '?')
|
let g:NERDTreeMapMenu = get(g:, 'NERDTreeMapMenu', 'm')
|
||||||
call s:initVariable('g:NERDTreeMapJumpFirstChild', 'K')
|
let g:NERDTreeMapHelp = get(g:, 'NERDTreeMapHelp', '?')
|
||||||
call s:initVariable('g:NERDTreeMapJumpLastChild', 'J')
|
let g:NERDTreeMapJumpFirstChild = get(g:, 'NERDTreeMapJumpFirstChild', 'K')
|
||||||
call s:initVariable('g:NERDTreeMapJumpNextSibling', '<C-j>')
|
let g:NERDTreeMapJumpLastChild = get(g:, 'NERDTreeMapJumpLastChild', 'J')
|
||||||
call s:initVariable('g:NERDTreeMapJumpParent', 'p')
|
let g:NERDTreeMapJumpNextSibling = get(g:, 'NERDTreeMapJumpNextSibling', '<C-j>')
|
||||||
call s:initVariable('g:NERDTreeMapJumpPrevSibling', '<C-k>')
|
let g:NERDTreeMapJumpParent = get(g:, 'NERDTreeMapJumpParent', 'p')
|
||||||
call s:initVariable('g:NERDTreeMapJumpRoot', 'P')
|
let g:NERDTreeMapJumpPrevSibling = get(g:, 'NERDTreeMapJumpPrevSibling', '<C-k>')
|
||||||
call s:initVariable('g:NERDTreeMapOpenExpl', 'e')
|
let g:NERDTreeMapJumpRoot = get(g:, 'NERDTreeMapJumpRoot', 'P')
|
||||||
call s:initVariable('g:NERDTreeMapOpenInTab', 't')
|
let g:NERDTreeMapOpenExpl = get(g:, 'NERDTreeMapOpenExpl', 'e')
|
||||||
call s:initVariable('g:NERDTreeMapOpenInTabSilent', 'T')
|
let g:NERDTreeMapOpenInTab = get(g:, 'NERDTreeMapOpenInTab', 't')
|
||||||
call s:initVariable('g:NERDTreeMapOpenRecursively', 'O')
|
let g:NERDTreeMapOpenInTabSilent = get(g:, 'NERDTreeMapOpenInTabSilent', 'T')
|
||||||
call s:initVariable('g:NERDTreeMapOpenSplit', 'i')
|
let g:NERDTreeMapOpenRecursively = get(g:, 'NERDTreeMapOpenRecursively', 'O')
|
||||||
call s:initVariable('g:NERDTreeMapOpenVSplit', 's')
|
let g:NERDTreeMapOpenSplit = get(g:, 'NERDTreeMapOpenSplit', 'i')
|
||||||
call s:initVariable('g:NERDTreeMapPreview', 'g' . NERDTreeMapActivateNode)
|
let g:NERDTreeMapOpenVSplit = get(g:, 'NERDTreeMapOpenVSplit', 's')
|
||||||
call s:initVariable('g:NERDTreeMapPreviewSplit', 'g' . NERDTreeMapOpenSplit)
|
let g:NERDTreeMapPreview = get(g:, 'NERDTreeMapPreview', 'g'.NERDTreeMapActivateNode)
|
||||||
call s:initVariable('g:NERDTreeMapPreviewVSplit', 'g' . NERDTreeMapOpenVSplit)
|
let g:NERDTreeMapPreviewSplit = get(g:, 'NERDTreeMapPreviewSplit', 'g'.NERDTreeMapOpenSplit)
|
||||||
call s:initVariable('g:NERDTreeMapQuit', 'q')
|
let g:NERDTreeMapPreviewVSplit = get(g:, 'NERDTreeMapPreviewVSplit', 'g'.NERDTreeMapOpenVSplit)
|
||||||
call s:initVariable('g:NERDTreeMapRefresh', 'r')
|
let g:NERDTreeMapQuit = get(g:, 'NERDTreeMapQuit', 'q')
|
||||||
call s:initVariable('g:NERDTreeMapRefreshRoot', 'R')
|
let g:NERDTreeMapRefresh = get(g:, 'NERDTreeMapRefresh', 'r')
|
||||||
call s:initVariable('g:NERDTreeMapToggleBookmarks', 'B')
|
let g:NERDTreeMapRefreshRoot = get(g:, 'NERDTreeMapRefreshRoot', 'R')
|
||||||
call s:initVariable('g:NERDTreeMapToggleFiles', 'F')
|
let g:NERDTreeMapToggleBookmarks = get(g:, 'NERDTreeMapToggleBookmarks', 'B')
|
||||||
call s:initVariable('g:NERDTreeMapToggleFilters', 'f')
|
let g:NERDTreeMapToggleFiles = get(g:, 'NERDTreeMapToggleFiles', 'F')
|
||||||
call s:initVariable('g:NERDTreeMapToggleHidden', 'I')
|
let g:NERDTreeMapToggleFilters = get(g:, 'NERDTreeMapToggleFilters', 'f')
|
||||||
call s:initVariable('g:NERDTreeMapToggleZoom', 'A')
|
let g:NERDTreeMapToggleHidden = get(g:, 'NERDTreeMapToggleHidden', 'I')
|
||||||
call s:initVariable('g:NERDTreeMapUpdir', 'u')
|
let g:NERDTreeMapToggleFileLines = get(g:, 'NERDTreeMapToggleFileLines', 'FL')
|
||||||
call s:initVariable('g:NERDTreeMapUpdirKeepOpen', 'U')
|
let g:NERDTreeMapToggleZoom = get(g:, 'NERDTreeMapToggleZoom', 'A')
|
||||||
call s:initVariable('g:NERDTreeMapCWD', 'CD')
|
let g:NERDTreeMapUpdir = get(g:, 'NERDTreeMapUpdir', 'u')
|
||||||
call s:initVariable('g:NERDTreeMenuDown', 'j')
|
let g:NERDTreeMapUpdirKeepOpen = get(g:, 'NERDTreeMapUpdirKeepOpen', 'U')
|
||||||
call s:initVariable('g:NERDTreeMenuUp', 'k')
|
let g:NERDTreeMapCWD = get(g:, 'NERDTreeMapCWD', 'CD')
|
||||||
|
let g:NERDTreeMenuDown = get(g:, 'NERDTreeMenuDown', 'j')
|
||||||
|
let g:NERDTreeMenuUp = get(g:, 'NERDTreeMenuUp', 'k')
|
||||||
|
|
||||||
"SECTION: Load class files{{{2
|
"SECTION: Load class files{{{2
|
||||||
call nerdtree#loadClassFiles()
|
call nerdtree#loadClassFiles()
|
||||||
@@ -169,11 +148,12 @@ call nerdtree#loadClassFiles()
|
|||||||
"============================================================
|
"============================================================
|
||||||
call nerdtree#ui_glue#setupCommands()
|
call nerdtree#ui_glue#setupCommands()
|
||||||
|
|
||||||
|
|
||||||
" SECTION: Auto commands {{{1
|
" SECTION: Auto commands {{{1
|
||||||
"============================================================
|
"============================================================
|
||||||
augroup NERDTree
|
augroup NERDTree
|
||||||
"Save the cursor position whenever we close the nerd tree
|
"Save the cursor position whenever we close the nerd tree
|
||||||
exec 'autocmd BufLeave,WinLeave '. g:NERDTreeCreator.BufNamePrefix() .'* if g:NERDTree.IsOpen() | call b:NERDTree.ui.saveScreenState() | endif'
|
exec 'autocmd BufLeave,WinLeave '. g:NERDTreeCreator.BufNamePrefix() .'* call nerdtree#onBufLeave()'
|
||||||
|
|
||||||
"disallow insert mode in the NERDTree
|
"disallow insert mode in the NERDTree
|
||||||
exec 'autocmd BufEnter,WinEnter '. g:NERDTreeCreator.BufNamePrefix() .'* stopinsert'
|
exec 'autocmd BufEnter,WinEnter '. g:NERDTreeCreator.BufNamePrefix() .'* stopinsert'
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ syn match NERDTreeLinkDir #.*/ ->#me=e-3 containedin=NERDTreeDir
|
|||||||
"highlighting to conceal the delimiter around the file/dir name
|
"highlighting to conceal the delimiter around the file/dir name
|
||||||
if has('conceal')
|
if has('conceal')
|
||||||
exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# conceal containedin=ALL'
|
exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# conceal containedin=ALL'
|
||||||
setlocal conceallevel=3 concealcursor=nvic
|
setlocal conceallevel=2 concealcursor=nvic
|
||||||
else
|
else
|
||||||
exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# containedin=ALL'
|
exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# containedin=ALL'
|
||||||
hi! link NERDTreeNodeDelimiters Ignore
|
hi! link NERDTreeNodeDelimiters Ignore
|
||||||
endif
|
endif
|
||||||
|
|
||||||
"highlighing for directory nodes and file nodes
|
"highlighting for directory nodes and file nodes
|
||||||
syn match NERDTreeDirSlash #/# containedin=NERDTreeDir
|
syn match NERDTreeDirSlash #/# containedin=NERDTreeDir
|
||||||
|
|
||||||
if g:NERDTreeDirArrowExpandable !=# ''
|
if g:NERDTreeDirArrowExpandable !=# ''
|
||||||
@@ -36,23 +36,23 @@ if g:NERDTreeDirArrowExpandable !=# ''
|
|||||||
exec 'syn match NERDTreeOpenable #' . escape(g:NERDTreeDirArrowExpandable, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
|
exec 'syn match NERDTreeOpenable #' . escape(g:NERDTreeDirArrowExpandable, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
|
||||||
let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-')
|
let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-')
|
||||||
exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#'
|
exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#'
|
||||||
exec 'syn match NERDTreeExecFile #^.*'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark'
|
exec 'syn match NERDTreeExecFile #^.*'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmarkName'
|
||||||
exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
|
exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmarkName,NERDTreeExecFile'
|
||||||
else
|
else
|
||||||
exec 'syn match NERDTreeDir #[^'.g:NERDTreeNodeDelimiter.']\{-}/\ze\($\|'.g:NERDTreeNodeDelimiter.'\)#'
|
exec 'syn match NERDTreeDir #[^'.g:NERDTreeNodeDelimiter.']\{-}/\ze\($\|'.g:NERDTreeNodeDelimiter.'\)#'
|
||||||
exec 'syn match NERDTreeExecFile #[^'.g:NERDTreeNodeDelimiter.']\{-}'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark'
|
exec 'syn match NERDTreeExecFile #[^'.g:NERDTreeNodeDelimiter.']\{-}'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmarkName'
|
||||||
exec 'syn match NERDTreeFile #^.*'.g:NERDTreeNodeDelimiter.'.*[^\/]\($\|'.g:NERDTreeNodeDelimiter.'.*\)# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
|
exec 'syn match NERDTreeFile #^.*'.g:NERDTreeNodeDelimiter.'.*[^\/]\($\|'.g:NERDTreeNodeDelimiter.'.*\)# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmarkName,NERDTreeExecFile'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
"highlighting for readonly files
|
"highlighting for readonly files
|
||||||
exec 'syn match NERDTreeRO #.*'.g:NERDTreeNodeDelimiter.'\zs.*\ze'.g:NERDTreeNodeDelimiter.'.*\['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile'
|
exec 'syn match NERDTreeRO #.*'.g:NERDTreeNodeDelimiter.'\zs.*\ze'.g:NERDTreeNodeDelimiter.'.*\['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmarkName,NERDTreeFile'
|
||||||
|
|
||||||
exec 'syn match NERDTreeFlags #\[[^\]]*\]\ze'.g:NERDTreeNodeDelimiter.'# containedin=NERDTreeFile,NERDTreeExecFile,NERDTreeDir'
|
exec 'syn match NERDTreeFlags #\[[^\]]*\]\ze'.g:NERDTreeNodeDelimiter.'# containedin=NERDTreeFile,NERDTreeExecFile,NERDTreeLinkFile,NERDTreeRO,NERDTreeDir'
|
||||||
|
|
||||||
syn match NERDTreeCWD #^[</].*$#
|
syn match NERDTreeCWD #^[</].*$#
|
||||||
|
|
||||||
"highlighting for bookmarks
|
"highlighting for bookmarks
|
||||||
syn match NERDTreeBookmark # {.*}#hs=s+1
|
syn match NERDTreeBookmarkName # {.*}#hs=s+2,he=e-1
|
||||||
|
|
||||||
"highlighting for the bookmarks table
|
"highlighting for the bookmarks table
|
||||||
syn match NERDTreeBookmarksLeader #^>#
|
syn match NERDTreeBookmarksLeader #^>#
|
||||||
@@ -93,3 +93,5 @@ hi def link NERDTreeBookmark Statement
|
|||||||
hi def link NERDTreeFlags Number
|
hi def link NERDTreeFlags Number
|
||||||
|
|
||||||
hi def link NERDTreeCurrentNode Search
|
hi def link NERDTreeCurrentNode Search
|
||||||
|
|
||||||
|
hi NERDTreeFile ctermbg=NONE guibg=NONE
|
||||||
|
|||||||
Reference in New Issue
Block a user