https://github.com/philrunninger/nerdtree-visual-selection
Defines commands that will work on files inside a Visual selection
https://github.com/philrunninger/nerdtree-visual-selection
nerdtree nerdtree-plugin vim-plugin visual-selections
Last synced: 5 months ago
JSON representation
Defines commands that will work on files inside a Visual selection
- Host: GitHub
- URL: https://github.com/philrunninger/nerdtree-visual-selection
- Owner: PhilRunninger
- License: mit
- Created: 2019-05-08T10:53:01.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-09-03T04:29:17.000Z (almost 2 years ago)
- Last Synced: 2025-01-23T20:31:48.222Z (over 1 year ago)
- Topics: nerdtree, nerdtree-plugin, vim-plugin, visual-selections
- Language: Vim Script
- Size: 23.4 KB
- Stars: 81
- Watchers: 3
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nerdtree-visual-selection
This plugin requires [NERDTree](https://github.com/preservim/nerdtree) also to be installed. **nerdtree-visual-selection** defines key mappings that will work on nodes contained in a Visual selection in **NERDTree**.
## Installation
Use your favorite plugin manager to install this plugin. [vim-pathogen](https://github.com/tpope/vim-pathogen), [Vundle.vim](https://github.com/VundleVim/Vundle.vim), [vim-plug](https://github.com/junegunn/vim-plug), [neobundle.vim](https://github.com/Shougo/neobundle.vim), and [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).
If you have no favorite, or want to manage your plugins without 3rd-party dependencies, I recommend 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)
## Known Issue
There are two kinds of NERDTree:
* **TabTree** - Opened with `:NERDTree`, `:NERDTreeFocus`, `:NERDTreeFind`, or `:NERDTreeToggle`
* **WindowTree** - Opened with `vim .` or `:e .`, among others.
This plugin does not work with **WindowTree** type trees, because the first file opened by it causes the NERDTree to close, and the other files in the selection to fail to open. These commands are disabled, and an error message is printed, when trying to use them in the wrong type NERDTree.
## Configuration
By default, all operations ask to be confirmed with a `Yes/No/All/Cancel` prompt. `All` is a `Yes` answer, while `Cancel` is a `No`, for the remainder of the selection. Confirmation for the different operations can be turned off by setting the following aptly-named variables to `0` in your `.vimrc`.
* `g:nerdtree_vis_confirm_open`
* `g:nerdtree_vis_confirm_delete`
* `g:nerdtree_vis_confirm_copy`
* `g:nerdtree_vis_confirm_move`
* `g:nerdtree_vis_confirm_append_arglist`
* `g:nerdtree_vis_confirm_set_arglist`
A [mark](http://vimdoc.sourceforge.net/htmldoc/motion.html#mark-motions) is used to make your NERDTree's `Jump` mappings work while keeping your selection. By default the mark is on the `n` key, if you already use this key for a mark inside NERDTree you can change it via `g:nerdtree_vis_jumpmark`
## Mappings
Where applicable, those key mappings match up with NERDTree settings. If not defined in your `.vimrc`, their default values are used. The mappings are as follows:
NERDTree variable | default | Purpose
---|---|---
NERDTreeMapActivateNode | o | Open selected files.
NERDTreeMapOpenSplit | i | Open selected files in horizontal splits.
NERDTreeMapOpenVSplit | s | Open selected files in vertical splits.
NERDTreeMapOpenInTab | t | Open selected files in tabs.
*n/a* | d | Delete selected files from disk. If open in Vim, they remain open.
*n/a* | m | Move the selected files to another directory. If open in Vim, the buffer still points to its old location.
*n/a* | c | Copy selected files to another directory.
*n/a* | a | Append selected files to the arglist. If a directory is selected, it is ignored. Only files will be added.
*n/a* | A | Set the arglist to only selected file. This overwrites the previeous arglist. If a directory is selected, it is ignored. Only files will be added.
NERDTreeMapJumpRoot | P | Jump to the tree root.
NERDTreeMapJumpParent | p | Jump to the parent node of the cursor node.
NERDTreeMapJumpFirstChild | K | Jump to the first child of the cursor node's parent.
NERDTreeMapJumpLastChild | J | Jump to the last child of the cursor node's parent.
NERDTreeMapJumpPrevSibling | c-k | Jump to the previous sibling of the cursor node.
NERDTreeMapJumpNextSibling | c-j | Jump to the next sibling of the cursor node.