mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-11-08 09:53:47 -05:00
Compare commits
86 Commits
houl-autol
...
doc-overha
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b099e55d3e | ||
|
|
c526e3957f | ||
|
|
47ab32444d | ||
|
|
8e8d74faaf | ||
|
|
dbc631adf9 | ||
|
|
ea11ba5a79 | ||
|
|
3768b28aa4 | ||
|
|
f12042b675 | ||
|
|
dec06b1fb9 | ||
|
|
a5d1663185 | ||
|
|
ab475e1325 | ||
|
|
d9366fc27c | ||
|
|
1b53686d5f | ||
|
|
b2642c8ed9 | ||
|
|
d4855b233e | ||
|
|
6d0ab7dec9 | ||
|
|
16ecc429ec | ||
|
|
1c7b57608e | ||
|
|
b83e9cdf83 | ||
|
|
898de2de1b | ||
|
|
2955d669dc | ||
|
|
7be3292b8d | ||
|
|
7d2fb974a3 | ||
|
|
119b99d166 | ||
|
|
f02686f2f6 | ||
|
|
3441a98b2d | ||
|
|
253eafd3a7 | ||
|
|
85750560a6 | ||
|
|
19f677513c | ||
|
|
7caf7b58a1 | ||
|
|
1f4a238e73 | ||
|
|
2e50bcbb8d | ||
|
|
a5772187fa | ||
|
|
592d5767e0 | ||
|
|
5a5bad0ece | ||
|
|
656f6b5beb | ||
|
|
cb5fb95a81 | ||
|
|
f9a87bf68f | ||
|
|
f62c4ca1d4 | ||
|
|
fade3d4b26 | ||
|
|
bedc6dc384 | ||
|
|
6b49172f9b | ||
|
|
c3e308c2ca | ||
|
|
95af34d581 | ||
|
|
be1a24d6d8 | ||
|
|
5e2aeffb03 | ||
|
|
700b7d2916 | ||
|
|
90f7606234 | ||
|
|
480799db6d | ||
|
|
8f375b0bbb | ||
|
|
f72adff404 | ||
|
|
97c79a541f | ||
|
|
c62e618a1a | ||
|
|
cbadb3d93e | ||
|
|
fa00e9820c | ||
|
|
6f1f2894cb | ||
|
|
96a6c3e452 | ||
|
|
53f5710627 | ||
|
|
eb6243c0c8 | ||
|
|
70b5b933cd | ||
|
|
ec16c09a0b | ||
|
|
e6510c1a71 | ||
|
|
24df32304e | ||
|
|
0384b5bf34 | ||
|
|
6295aeba66 | ||
|
|
277986725d | ||
|
|
ac3db1e70a | ||
|
|
6d51d1b334 | ||
|
|
8a68872933 | ||
|
|
8786861a3c | ||
|
|
f5525720ec | ||
|
|
ce590719f6 | ||
|
|
023f2d10d5 | ||
|
|
023cc20324 | ||
|
|
9208286236 | ||
|
|
a4b7c046b3 | ||
|
|
50f307bbf6 | ||
|
|
8228c7b0a7 | ||
|
|
2504a3d84e | ||
|
|
a05185584d | ||
|
|
df2f6825f4 | ||
|
|
7f5c217f79 | ||
|
|
14cd7719ac | ||
|
|
17cec9747e | ||
|
|
e6fd663def | ||
|
|
25c2920fe8 |
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
github: [alerque, scrooloose]
|
||||||
16
.github/workflows/reviewdog.yml
vendored
Normal file
16
.github/workflows/reviewdog.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
name: Reviewdog
|
||||||
|
on: [pull_request]
|
||||||
|
jobs:
|
||||||
|
vint:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Lint Vimscript in PR changes
|
||||||
|
uses: reviewdog/action-vint@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.github_token }}
|
||||||
|
reporter: github-pr-review
|
||||||
|
level: info
|
||||||
16
.github/workflows/vint.yml
vendored
Normal file
16
.github/workflows/vint.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
name: Vint
|
||||||
|
on: [push]
|
||||||
|
jobs:
|
||||||
|
vint:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
- name: Setup dependencies
|
||||||
|
run: pip install vim-vint
|
||||||
|
- name: Lint Vimscript
|
||||||
|
run: vint .
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
*~
|
*~
|
||||||
*.swp
|
*.swp
|
||||||
tags
|
tags
|
||||||
|
DEBUG
|
||||||
|
|||||||
5
.vintrc.yaml
Normal file
5
.vintrc.yaml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
cmdargs:
|
||||||
|
severity: style_problem
|
||||||
|
color: true
|
||||||
|
env:
|
||||||
|
neovim: false
|
||||||
79
CHANGELOG.md
Normal file
79
CHANGELOG.md
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
### 2.5.2
|
||||||
|
|
||||||
|
* Minor update to include new file types contributed by the community over the last few months.
|
||||||
|
* Also adds a customization option to the sexy comment style.
|
||||||
|
|
||||||
|
### 2.5.1
|
||||||
|
|
||||||
|
* Minor update release that adds a few new contributed filetypes and normalizes the code format a little bit.
|
||||||
|
|
||||||
|
### 2.5.0
|
||||||
|
|
||||||
|
* Add lots of new contributed file types, cleanup some odds and ends.
|
||||||
|
* Bump "release" for the sake of plugin managers still not tracking master.
|
||||||
|
|
||||||
|
### 2.4.0
|
||||||
|
|
||||||
|
* Bump release number for the benefit of plugin managers that update to tags
|
||||||
|
|
||||||
|
### 2.3.0
|
||||||
|
|
||||||
|
* remove all filetypes which have a &commentstring in the standard vim runtime
|
||||||
|
for vim > 7.0 unless the script stores an alternate set of delimiters
|
||||||
|
* make the script complain if the user doesn't have filetype plugins enabled
|
||||||
|
* use |<Leader>| instead of comma to start the default mappings
|
||||||
|
* fix a couple of bugs with sexy comments - thanks to Tim Smart
|
||||||
|
* lots of refactoring
|
||||||
|
|
||||||
|
### 2.2.2
|
||||||
|
|
||||||
|
* remove the NERDShutup option and the message is suppresses, this makes the plugin silently rely on &commentstring for unknown filetypes.
|
||||||
|
* add support for dhcpd, limits, ntp, resolv, rgb, sysctl, udevconf and udevrules. Thanks to Thilo Six.
|
||||||
|
* match filetypes case insensitively
|
||||||
|
* add support for mp (metapost), thanks to Andrey Skvortsov.
|
||||||
|
* add support for htmlcheetah, thanks to Simon Hengel.
|
||||||
|
* add support for javacc, thanks to Matt Tolton.
|
||||||
|
* make <%# %> the default delims for eruby, thanks to tpope.
|
||||||
|
* add support for javascript.jquery, thanks to Ivan Devat.
|
||||||
|
* add support for cucumber and pdf. Fix sass and railslog delims, thanks to tpope
|
||||||
|
|
||||||
|
### 2.2.1
|
||||||
|
|
||||||
|
* add support for newlisp and clojure, thanks to Matthew Lee Hinman.
|
||||||
|
* fix automake comments, thanks to Elias Pipping
|
||||||
|
* make haml comments default to -# with / as the alternative delimiter, thanks to tpope
|
||||||
|
* add support for actionscript and processing thanks to Edwin Benavides
|
||||||
|
* add support for ps1 (powershell), thanks to Jason Mills
|
||||||
|
* add support for hostsaccess, thanks to Thomas Rowe
|
||||||
|
* add support for CVScommit
|
||||||
|
* add support for asciidoc, git and gitrebase. Thanks to Simon Ruderich.
|
||||||
|
* use # for gitcommit comments, thanks to Simon Ruderich.
|
||||||
|
* add support for mako and genshi, thanks to Keitheis.
|
||||||
|
* add support for conkyrc, thanks to David
|
||||||
|
* add support for SVNannotate, thanks to Miguel Jaque Barbero.
|
||||||
|
* add support for sieve, thanks to Stefan Walk
|
||||||
|
* add support for objj, thanks to Adam Thorsen.
|
||||||
|
|
||||||
|
### 2.2.0
|
||||||
|
|
||||||
|
* rewrote the mappings system to be more "standard".
|
||||||
|
* removed all the mapping options. Now, mappings to <plug> mappings are used
|
||||||
|
* see :help NERDComMappings, and :help NERDCreateDefaultMappings for more info
|
||||||
|
* remove "prepend comments" and "right aligned comments".
|
||||||
|
* add support for applescript, calbire, man, SVNcommit, potwiki, txt2tags and SVNinfo. Thanks to nicothakis, timberke, sgronblo, mntnoe, Bernhard Grotz, John O'Shea, François and Giacomo Mariani respectively.
|
||||||
|
* bugfix for haskell delimiters. Thanks to mntnoe.
|
||||||
|
|
||||||
|
### 2.1.18
|
||||||
|
|
||||||
|
* add support for llvm. Thanks to nicothakis.
|
||||||
|
* add support for xquery. Thanks to Phillip Kovalev.
|
||||||
|
|
||||||
|
### 2.1.17
|
||||||
|
|
||||||
|
* fixed haskell delimiters (hackily). Thanks to Elias Pipping.
|
||||||
|
* add support for mailcap. Thanks to Pascal Brueckner.
|
||||||
|
* add support for stata. Thanks to Jerónimo Carballo.
|
||||||
|
* applied a patch from ewfalor to fix an error in the help file with the NERDMapleader doc
|
||||||
|
* disable the insert mode ctrl-c mapping by default, see :help NERDCommenterInsert if you wish to restore it
|
||||||
121
LICENSE
Normal file
121
LICENSE
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
Creative Commons Legal Code
|
||||||
|
|
||||||
|
CC0 1.0 Universal
|
||||||
|
|
||||||
|
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||||
|
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||||
|
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||||
|
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||||
|
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||||
|
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||||
|
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||||
|
HEREUNDER.
|
||||||
|
|
||||||
|
Statement of Purpose
|
||||||
|
|
||||||
|
The laws of most jurisdictions throughout the world automatically confer
|
||||||
|
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||||
|
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||||
|
authorship and/or a database (each, a "Work").
|
||||||
|
|
||||||
|
Certain owners wish to permanently relinquish those rights to a Work for
|
||||||
|
the purpose of contributing to a commons of creative, cultural and
|
||||||
|
scientific works ("Commons") that the public can reliably and without fear
|
||||||
|
of later claims of infringement build upon, modify, incorporate in other
|
||||||
|
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||||
|
and for any purposes, including without limitation commercial purposes.
|
||||||
|
These owners may contribute to the Commons to promote the ideal of a free
|
||||||
|
culture and the further production of creative, cultural and scientific
|
||||||
|
works, or to gain reputation or greater distribution for their Work in
|
||||||
|
part through the use and efforts of others.
|
||||||
|
|
||||||
|
For these and/or other purposes and motivations, and without any
|
||||||
|
expectation of additional consideration or compensation, the person
|
||||||
|
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||||
|
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||||
|
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||||
|
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||||
|
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||||
|
|
||||||
|
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||||
|
protected by copyright and related or neighboring rights ("Copyright and
|
||||||
|
Related Rights"). Copyright and Related Rights include, but are not
|
||||||
|
limited to, the following:
|
||||||
|
|
||||||
|
i. the right to reproduce, adapt, distribute, perform, display,
|
||||||
|
communicate, and translate a Work;
|
||||||
|
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||||
|
iii. publicity and privacy rights pertaining to a person's image or
|
||||||
|
likeness depicted in a Work;
|
||||||
|
iv. rights protecting against unfair competition in regards to a Work,
|
||||||
|
subject to the limitations in paragraph 4(a), below;
|
||||||
|
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||||
|
in a Work;
|
||||||
|
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||||
|
European Parliament and of the Council of 11 March 1996 on the legal
|
||||||
|
protection of databases, and under any national implementation
|
||||||
|
thereof, including any amended or successor version of such
|
||||||
|
directive); and
|
||||||
|
vii. other similar, equivalent or corresponding rights throughout the
|
||||||
|
world based on applicable law or treaty, and any national
|
||||||
|
implementations thereof.
|
||||||
|
|
||||||
|
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||||
|
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||||
|
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||||
|
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||||
|
of action, whether now known or unknown (including existing as well as
|
||||||
|
future claims and causes of action), in the Work (i) in all territories
|
||||||
|
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||||
|
treaty (including future time extensions), (iii) in any current or future
|
||||||
|
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||||
|
including without limitation commercial, advertising or promotional
|
||||||
|
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||||
|
member of the public at large and to the detriment of Affirmer's heirs and
|
||||||
|
successors, fully intending that such Waiver shall not be subject to
|
||||||
|
revocation, rescission, cancellation, termination, or any other legal or
|
||||||
|
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||||
|
as contemplated by Affirmer's express Statement of Purpose.
|
||||||
|
|
||||||
|
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||||
|
be judged legally invalid or ineffective under applicable law, then the
|
||||||
|
Waiver shall be preserved to the maximum extent permitted taking into
|
||||||
|
account Affirmer's express Statement of Purpose. In addition, to the
|
||||||
|
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||||
|
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||||
|
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||||
|
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||||
|
maximum duration provided by applicable law or treaty (including future
|
||||||
|
time extensions), (iii) in any current or future medium and for any number
|
||||||
|
of copies, and (iv) for any purpose whatsoever, including without
|
||||||
|
limitation commercial, advertising or promotional purposes (the
|
||||||
|
"License"). The License shall be deemed effective as of the date CC0 was
|
||||||
|
applied by Affirmer to the Work. Should any part of the License for any
|
||||||
|
reason be judged legally invalid or ineffective under applicable law, such
|
||||||
|
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||||
|
of the License, and in such case Affirmer hereby affirms that he or she
|
||||||
|
will not (i) exercise any of his or her remaining Copyright and Related
|
||||||
|
Rights in the Work or (ii) assert any associated claims and causes of
|
||||||
|
action with respect to the Work, in either case contrary to Affirmer's
|
||||||
|
express Statement of Purpose.
|
||||||
|
|
||||||
|
4. Limitations and Disclaimers.
|
||||||
|
|
||||||
|
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||||
|
surrendered, licensed or otherwise affected by this document.
|
||||||
|
b. Affirmer offers the Work as-is and makes no representations or
|
||||||
|
warranties of any kind concerning the Work, express, implied,
|
||||||
|
statutory or otherwise, including without limitation warranties of
|
||||||
|
title, merchantability, fitness for a particular purpose, non
|
||||||
|
infringement, or the absence of latent or other defects, accuracy, or
|
||||||
|
the present or absence of errors, whether or not discoverable, all to
|
||||||
|
the greatest extent permissible under applicable law.
|
||||||
|
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||||
|
that may apply to the Work or any use thereof, including without
|
||||||
|
limitation any person's Copyright and Related Rights in the Work.
|
||||||
|
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||||
|
consents, permissions or other rights required for any use of the
|
||||||
|
Work.
|
||||||
|
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||||
|
party to this document and has no duty or obligation with respect to
|
||||||
|
this CC0 or use of the Work.
|
||||||
103
README.md
103
README.md
@@ -1,59 +1,93 @@
|
|||||||
# NERD Commenter
|
# NERD Commenter
|
||||||
|
|
||||||
|
[](https://github.com/preservim/nerdcommenter/actions?workflow=Vint)
|
||||||
|
|
||||||
Comment functions so powerful—no comment necessary.
|
Comment functions so powerful—no comment necessary.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
### Via Plugin Manager (Recommended)
|
### Via Plugin Manager (Recommended)
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Vim Plug</summary>
|
||||||
|
|
||||||
#### [Vim-Plug](https://github.com/junegunn/vim-plug)
|
#### [Vim-Plug](https://github.com/junegunn/vim-plug)
|
||||||
|
|
||||||
1. Add `Plug 'scrooloose/nerdcommenter'` to your vimrc file.
|
1. Add `Plug 'preservim/nerdcommenter'` to your vimrc file.
|
||||||
2. Reload your vimrc or restart
|
2. Reload your vimrc or restart
|
||||||
3. Run `:PlugInstall`
|
3. Run `:PlugInstall`
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Vundle</summary>
|
||||||
|
|
||||||
#### [Vundle](https://github.com/VundleVim/Vundle.vim) or similar
|
#### [Vundle](https://github.com/VundleVim/Vundle.vim) or similar
|
||||||
|
|
||||||
1. Add `Plugin 'scrooloose/nerdcommenter'` to your vimrc file.
|
1. Add `Plugin 'preservim/nerdcommenter'` to your vimrc file.
|
||||||
2. Reload your vimrc or restart
|
2. Reload your vimrc or restart
|
||||||
3. Run `:BundleInstall`
|
3. Run `:BundleInstall`
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>NeoBundle</summary>
|
||||||
|
|
||||||
#### [NeoBundle](https://github.com/Shougo/neobundle.vim)
|
#### [NeoBundle](https://github.com/Shougo/neobundle.vim)
|
||||||
|
|
||||||
1. Add `NeoBundle 'scrooloose/nerdcommenter'` to your vimrc file.
|
1. Add `NeoBundle 'preservim/nerdcommenter'` to your vimrc file.
|
||||||
2. Reload your vimrc or restart
|
2. Reload your vimrc or restart
|
||||||
3. Run `:NeoUpdate`
|
3. Run `:NeoUpdate`
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Pathogen</summary>
|
||||||
|
|
||||||
#### [Pathogen](https://github.com/tpope/vim-pathogen)
|
#### [Pathogen](https://github.com/tpope/vim-pathogen)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd ~/.vim/bundle
|
cd ~/.vim/bundle
|
||||||
git clone https://github.com/scrooloose/nerdcommenter.git
|
git clone https://github.com/preservim/nerdcommenter.git
|
||||||
```
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Vim 8+ Packages</summary>
|
||||||
|
|
||||||
|
git clone https://github.com/preservim/nerdcommenter.git ~/.vim/pack/vendor/start/nerdcommenter
|
||||||
|
</details>
|
||||||
|
|
||||||
### Manual Installation
|
### Manual Installation
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Unix</summary>
|
||||||
|
|
||||||
#### Unix
|
#### Unix
|
||||||
|
|
||||||
(For Neovim, change `~/.vim/` to `~/.config/nvim/`.)
|
(For Neovim, change `~/.vim/` to `~/.config/nvim/`.)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl -fLo ~/.vim/plugin/NERD_Commenter.vim --create-dirs \
|
curl -fLo ~/.vim/plugin/NERD_Commenter.vim --create-dirs \
|
||||||
https://raw.githubusercontent.com/scrooloose/nerdcommenter/master/plugin/NERD_commenter.vim
|
https://raw.githubusercontent.com/preservim/nerdcommenter/master/plugin/nerdcommenter.vim
|
||||||
curl -fLo ~/.vim/doc/NERD_Commenter.txt --create-dirs \
|
curl -fLo ~/.vim/doc/NERD_Commenter.txt --create-dirs \
|
||||||
https://raw.githubusercontent.com/scrooloose/nerdcommenter/master/doc/NERD_commenter.txt
|
https://raw.githubusercontent.com/preservim/nerdcommenter/master/doc/nerdcommenter.txt
|
||||||
```
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Windows</summary>
|
||||||
#### Windows (PowerShell)
|
#### Windows (PowerShell)
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
md ~\vimfiles\plugin
|
md ~\vimfiles\plugin
|
||||||
md ~\vimfiles\doc
|
md ~\vimfiles\doc
|
||||||
$pluguri = 'https://raw.githubusercontent.com/scrooloose/nerdcommenter/master/plugin/NERD_commenter.vim'
|
$pluguri = 'https://raw.githubusercontent.com/preservim/nerdcommenter/master/plugin/nerdcommenter.vim'
|
||||||
$docsuri = 'https://raw.githubusercontent.com/scrooloose/nerdcommenter/master/doc/NERD_commenter.txt'
|
$docsuri = 'https://raw.githubusercontent.com/preservim/nerdcommenter/master/doc/nerdcommenter.txt'
|
||||||
(New-Object Net.WebClient).DownloadFile($pluguri, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("~\vimfiles\plugin\NERD_commenter.vim"))
|
(New-Object Net.WebClient).DownloadFile($pluguri, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("~\vimfiles\plugin\nerdcommenter.vim"))
|
||||||
(New-Object Net.WebClient).DownloadFile($docsuri, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("~\vimfiles\doc\NERD_commenter.txt"))
|
(New-Object Net.WebClient).DownloadFile($docsuri, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("~\vimfiles\doc\nerdcommenter.txt"))
|
||||||
```
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
### Post Installation
|
### Post Installation
|
||||||
|
|
||||||
@@ -74,6 +108,9 @@ Please see the vim help system for full documentation of all options: `:help ner
|
|||||||
Several settings can be added to your vimrc to change the default behavior. Some examples:
|
Several settings can be added to your vimrc to change the default behavior. Some examples:
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
|
" Create default mappings
|
||||||
|
let g:NERDCreateDefaultMappings = 1
|
||||||
|
|
||||||
" Add spaces after comment delimiters by default
|
" Add spaces after comment delimiters by default
|
||||||
let g:NERDSpaceDelims = 1
|
let g:NERDSpaceDelims = 1
|
||||||
|
|
||||||
@@ -101,59 +138,73 @@ let g:NERDToggleCheckAllLines = 1
|
|||||||
|
|
||||||
### Default mappings
|
### Default mappings
|
||||||
|
|
||||||
|
> **Note:** You can turn off settings default mappings to provide your own from scratch (look at the [Settings list](#settings) above)
|
||||||
|
|
||||||
The following key mappings are provided by default (there is also a menu provided that contains menu items corresponding to all the below mappings):
|
The following key mappings are provided by default (there is also a menu provided that contains menu items corresponding to all the below mappings):
|
||||||
|
|
||||||
Most of the following mappings are for normal/visual mode only. The **|NERDComInsertComment|** mapping is for insert mode only.
|
Most of the following mappings are for normal/visual mode only. The **|NERDCommenterInsert|** mapping is for insert mode only.
|
||||||
|
|
||||||
* `[count]<leader>cc` **|NERDComComment|**
|
* `[count]<leader>cc` **|NERDCommenterComment|**
|
||||||
|
|
||||||
Comment out the current line or text selected in visual mode.
|
Comment out the current line or text selected in visual mode.
|
||||||
|
|
||||||
* `[count]<leader>cn` **|NERDComNestedComment|**
|
* `[count]<leader>cn` **|NERDCommenterNested|**
|
||||||
|
|
||||||
Same as <leader>cc but forces nesting.
|
Same as <leader>cc but forces nesting.
|
||||||
|
|
||||||
* `[count]<leader>c<space>` **|NERDComToggleComment|**
|
* `[count]<leader>c<space>` **|NERDCommenterToggle|**
|
||||||
|
|
||||||
Toggles the comment state of the selected line(s). If the topmost selected line is commented, all selected lines are uncommented and vice versa.
|
Toggles the comment state of the selected line(s). If the topmost selected line is commented, all selected lines are uncommented and vice versa.
|
||||||
|
|
||||||
* `[count]<leader>cm` **|NERDComMinimalComment|**
|
* `[count]<leader>cm` **|NERDCommenterMinimal|**
|
||||||
|
|
||||||
Comments the given lines using only one set of multipart delimiters.
|
Comments the given lines using only one set of multipart delimiters.
|
||||||
|
|
||||||
* `[count]<leader>ci` **|NERDComInvertComment|**
|
* `[count]<leader>ci` **|NERDCommenterInvert|**
|
||||||
|
|
||||||
Toggles the comment state of the selected line(s) individually.
|
Toggles the comment state of the selected line(s) individually.
|
||||||
|
|
||||||
* `[count]<leader>cs` **|NERDComSexyComment|**
|
* `[count]<leader>cs` **|NERDCommenterSexy|**
|
||||||
|
|
||||||
Comments out the selected lines with a pretty block formatted layout.
|
Comments out the selected lines with a pretty block formatted layout.
|
||||||
|
|
||||||
* `[count]<leader>cy` **|NERDComYankComment|**
|
* `[count]<leader>cy` **|NERDCommenterYank|**
|
||||||
|
|
||||||
Same as <leader>cc except that the commented line(s) are yanked first.
|
Same as <leader>cc except that the commented line(s) are yanked first.
|
||||||
|
|
||||||
* `<leader>c$` **|NERDComEOLComment|**
|
* `<leader>c$` **|NERDCommenterToEOL|**
|
||||||
|
|
||||||
Comments the current line from the cursor to the end of line.
|
Comments the current line from the cursor to the end of line.
|
||||||
|
|
||||||
* `<leader>cA` **|NERDComAppendComment|**
|
* `<leader>cA` **|NERDCommenterAppend|**
|
||||||
|
|
||||||
Adds comment delimiters to the end of line and goes into insert mode between them.
|
Adds comment delimiters to the end of line and goes into insert mode between them.
|
||||||
|
|
||||||
* **|NERDComInsertComment|**
|
* **|NERDCommenterInsert|**
|
||||||
|
|
||||||
Adds comment delimiters at the current cursor position and inserts between. Disabled by default.
|
Adds comment delimiters at the current cursor position and inserts between. Disabled by default.
|
||||||
|
|
||||||
* `<leader>ca` **|NERDComAltDelim|**
|
* `<leader>ca` **|NERDCommenterAltDelims|**
|
||||||
|
|
||||||
Switches to the alternative set of delimiters.
|
Switches to the alternative set of delimiters.
|
||||||
|
|
||||||
* `[count]<leader>cl`
|
* `[count]<leader>cl` **|NERDCommenterAlignLeft**
|
||||||
`[count]<leader>cb` **|NERDComAlignedComment|**
|
`[count]<leader>cb` **|NERDCommenterAlignBoth**
|
||||||
|
|
||||||
Same as **|NERDComComment|** except that the delimiters are aligned down the left side (`<leader>cl`) or both sides (`<leader>cb`).
|
Same as **|NERDCommenterComment|** except that the delimiters are aligned down the left side (`<leader>cl`) or both sides (`<leader>cb`).
|
||||||
|
|
||||||
* `[count]<leader>cu` **|NERDComUncommentLine|**
|
* `[count]<leader>cu` **|NERDCommenterUncomment|**
|
||||||
|
|
||||||
Uncomments the selected line(s).
|
Uncomments the selected line(s).
|
||||||
|
|
||||||
|
## Motions
|
||||||
|
|
||||||
|
While the plugin does not directly support motions, you can leverage its support for selections to do something very similar. For example, to add motions to toggle comments on the paragraph text object you could use:
|
||||||
|
```vim
|
||||||
|
nnoremap <silent> <leader>c} V}:call NERDComment('x', 'toggle')<CR>
|
||||||
|
nnoremap <silent> <leader>c{ V{:call NERDComment('x', 'toggle')<CR>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributions
|
||||||
|
|
||||||
|
This plugin was originally written in 2007 by [Martin Grenfell (@scrooloose)](https://github.com/scrooloose/). Lots of features and many of the supported filetypes have come from [community contributors](https://github.com/preservim/nerdcommenter/graphs/contributors). Since 2016 it has been maintained primarily by [Caleb Maclennan (@alerque)](https://github.com/alerque). Additional file type support, bug fixes, and new feature contributons are all welcome, please send them as Pull Requests on Github. If you can't contribute yourself please also feel free to open issues to report problems or request features.
|
||||||
|
|||||||
76
Rakefile
76
Rakefile
@@ -1,76 +0,0 @@
|
|||||||
# written by travis jeffery <travisjeffery@gmail.com>
|
|
||||||
# contributions by scrooloose <github:scrooloose>
|
|
||||||
|
|
||||||
require 'rake'
|
|
||||||
require 'find'
|
|
||||||
require 'pathname'
|
|
||||||
|
|
||||||
IGNORE = [/\.gitignore$/, /Rakefile$/]
|
|
||||||
|
|
||||||
files = `git ls-files`.split("\n")
|
|
||||||
files.reject! { |f| IGNORE.any? { |re| f.match(re) } }
|
|
||||||
|
|
||||||
desc 'Zip up the project files'
|
|
||||||
task :zip do
|
|
||||||
zip_name = File.basename(File.dirname(__FILE__))
|
|
||||||
zip_name.gsub!(/ /, '_')
|
|
||||||
zip_name = "#{zip_name}.zip"
|
|
||||||
|
|
||||||
if File.exist?(zip_name)
|
|
||||||
abort("Zip file #{zip_name} already exists. Remove it first.")
|
|
||||||
end
|
|
||||||
|
|
||||||
puts "Creating zip file: #{zip_name}"
|
|
||||||
system("zip #{zip_name} #{files.join(" ")}")
|
|
||||||
end
|
|
||||||
|
|
||||||
desc 'Install plugin and documentation'
|
|
||||||
task :install do
|
|
||||||
vimfiles = if ENV['VIMFILES']
|
|
||||||
ENV['VIMFILES']
|
|
||||||
elsif RUBY_PLATFORM =~ /(win|w)32$/
|
|
||||||
File.expand_path("~/vimfiles")
|
|
||||||
else
|
|
||||||
File.expand_path("~/.vim")
|
|
||||||
end
|
|
||||||
files.each do |file|
|
|
||||||
target_file = File.join(vimfiles, file)
|
|
||||||
FileUtils.mkdir_p File.dirname(target_file)
|
|
||||||
FileUtils.cp file, target_file
|
|
||||||
|
|
||||||
puts "Installed #{file} to #{target_file}"
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
desc 'Pulls from origin'
|
|
||||||
task :pull do
|
|
||||||
puts "Updating local repo..."
|
|
||||||
system("cd " << Dir.new(File.dirname(__FILE__)).path << " && git pull")
|
|
||||||
end
|
|
||||||
|
|
||||||
desc 'Calls pull task and then install task'
|
|
||||||
task :update => ['pull', 'install'] do
|
|
||||||
puts "Update of vim script complete."
|
|
||||||
end
|
|
||||||
|
|
||||||
desc 'Uninstall plugin and documentation'
|
|
||||||
task :uninstall do
|
|
||||||
vimfiles = if ENV['VIMFILES']
|
|
||||||
ENV['VIMFILES']
|
|
||||||
elsif RUBY_PLATFORM =~ /(win|w)32$/
|
|
||||||
File.expand_path("~/vimfiles")
|
|
||||||
else
|
|
||||||
File.expand_path("~/.vim")
|
|
||||||
end
|
|
||||||
files.each do |file|
|
|
||||||
target_file = File.join(vimfiles, file)
|
|
||||||
FileUtils.rm target_file
|
|
||||||
|
|
||||||
puts "Uninstalled #{target_file}"
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
task :default => ['update']
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
*NERD_commenter.txt* Plugin for commenting code
|
*nerdcommenter.txt* Plugin for commenting code
|
||||||
|
|
||||||
|
|
||||||
NERD COMMENTER REFERENCE MANUAL~
|
NERD COMMENTER REFERENCE MANUAL
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -11,41 +11,44 @@
|
|||||||
CONTENTS *NERDCommenterContents*
|
CONTENTS *NERDCommenterContents*
|
||||||
|
|
||||||
1.Intro...................................|NERDCommenter|
|
1.Intro...................................|NERDCommenter|
|
||||||
2.Installation............................|NERDComInstallation|
|
1.1 Leader............................|NERDCommenterLeader|
|
||||||
3.Functionality provided..................|NERDComFunctionality|
|
2.Installation............................|NERDCommenterInstallation|
|
||||||
3.1 Functionality Summary.............|NERDComFunctionalitySummary|
|
3.Functionality provided..................|NERDCommenterFunctionality|
|
||||||
3.2 Functionality Details.............|NERDComFunctionalityDetails|
|
3.1 Functionality Summary.............|NERDCommenterFunctionalitySummary|
|
||||||
3.2.1 Comment map.................|NERDComComment|
|
3.2 Functionality Details.............|NERDCommenterFunctionalityDetails|
|
||||||
3.2.2 Nested comment map..........|NERDComNestedComment|
|
3.2.1 Comment map.................|NERDCommenterComment|
|
||||||
3.2.3 Toggle comment map..........|NERDComToggleComment|
|
3.2.2 Nested comment map..........|NERDCommenterNested|
|
||||||
3.2.4 Minimal comment map.........|NERDComMinimalComment|
|
3.2.3 Toggle comment map..........|NERDCommenterToggle|
|
||||||
3.2.5 Invert comment map..........|NERDComInvertComment|
|
3.2.4 Minimal comment map.........|NERDCommenterMinimal|
|
||||||
3.2.6 Sexy comment map............|NERDComSexyComment|
|
3.2.5 Invert comment map..........|NERDCommenterInvert|
|
||||||
3.2.7 Yank comment map............|NERDComYankComment|
|
3.2.6 Sexy comment map............|NERDCommenterSexy|
|
||||||
3.2.8 Comment to EOL map..........|NERDComEOLComment|
|
3.2.7 Yank comment map............|NERDCommenterYank|
|
||||||
3.2.9 Append com to line map......|NERDComAppendComment|
|
3.2.8 Comment to EOL map..........|NERDCommenterToEOL|
|
||||||
3.2.10 Insert comment map.........|NERDComInsertComment|
|
3.2.9 Append com to line map......|NERDCommenterAppend|
|
||||||
3.2.11 Use alternate delims map...|NERDComAltDelim|
|
3.2.10 Insert comment map.........|NERDCommenterInsert|
|
||||||
3.2.12 Comment aligned maps.......|NERDComAlignedComment|
|
3.2.11 Use alternate delims map...|NERDCommenterAltDelims|
|
||||||
3.2.13 Uncomment line map.........|NERDComUncommentLine|
|
3.2.12 Comment aligned maps.......|NERDCommenterAlignLeft|
|
||||||
3.3 Sexy Comments.....................|NERDComSexyComments|
|
|NERDCommenterAlignBoth|
|
||||||
3.4 The NERDComment function..........|NERDComNERDComment|
|
3.2.13 Uncomment line map.........|NERDCommenterUncomment|
|
||||||
3.5 The Hooks.........................|NERDComHooks|
|
3.3 Sexy Comments.....................|NERDCommenterSexyComments|
|
||||||
4.Options.................................|NERDComOptions|
|
3.4 The NERDComment function..........|NERDCommenterNERDComment|
|
||||||
4.1 Options summary...................|NERDComOptionsSummary|
|
3.5 The Hooks.........................|NERDCommenterHooks|
|
||||||
4.2 Options details...................|NERDComOptionsDetails|
|
4.Options.................................|NERDCommenterOptions|
|
||||||
4.3 Default delimiter Options.........|NERDComDefaultDelims|
|
4.1 Options summary...................|NERDCommenterOptionsSummary|
|
||||||
5. Customising key mappings...............|NERDComMappings|
|
4.2 Options details...................|NERDCommenterOptionsDetails|
|
||||||
6. Issues with the script.................|NERDComIssues|
|
4.3 Default delimiter Options.........|NERDCommenterDefaultDelims|
|
||||||
6.1 Delimiter detection heuristics....|NERDComHeuristics|
|
5. Customising key mappings...............|NERDCommenterMappings|
|
||||||
6.2 Nesting issues....................|NERDComNesting|
|
6. Interfaces.............................|NERDCommenterInterfaces|
|
||||||
7.About.. ............................|NERDComAbout|
|
7. Issues with the script.................|NERDCommenterIssues|
|
||||||
8.Changelog...............................|NERDComChangelog|
|
7.1 Delimiter detection heuristics....|NERDCommenterHeuristics|
|
||||||
9.Credits.................................|NERDComCredits|
|
7.2 Nesting issues....................|NERDCommenterNesting|
|
||||||
10.License................................|NERDComLicense|
|
8.About.. ............................|NERDCommenterAbout|
|
||||||
|
9.Changelog...............................|NERDCommenterChangelog|
|
||||||
|
10.Credits................................|NERDCommenterCredits|
|
||||||
|
11.License................................|NERDCommenterLicense|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
1. Intro *NERDCommenter*
|
1. Intro *NERDCommenter*
|
||||||
|
|
||||||
The NERD commenter provides many different commenting operations and styles
|
The NERD commenter provides many different commenting operations and styles
|
||||||
which are invoked via key mappings and a menu. These operations are available
|
which are invoked via key mappings and a menu. These operations are available
|
||||||
@@ -54,15 +57,29 @@ for most filetypes.
|
|||||||
There are also options that allow to tweak the commenting engine to your
|
There are also options that allow to tweak the commenting engine to your
|
||||||
taste.
|
taste.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
1.1 Leader key *NERDCommenterLeader*
|
||||||
|
|
||||||
|
Most NERD commenter commands are executed using the |<Leader>| key. In Vim
|
||||||
|
this is a key dedicated for user-specific customizations. It effectively
|
||||||
|
creates a namespace so that custom commands don't interfere with Vim's
|
||||||
|
built-in shortcuts.
|
||||||
|
|
||||||
|
The leader key can be mapped to whatever the user likes (see :help mapleader).
|
||||||
|
In the definition of custom commands |<Leader>| is the placeholder for the
|
||||||
|
leader key. To see the current mapping for |<Leader>| type :echo mapleader.
|
||||||
|
If it reports an undefined variable it means the leader key is set to the
|
||||||
|
default of '\'.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
2. Installation *NERDComInstallation*
|
2. Installation *NERDCommenterInstallation*
|
||||||
|
|
||||||
The NERD Commenter requires Vim 7 or higher.
|
The NERD Commenter requires Vim 7 or higher.
|
||||||
|
|
||||||
Extract the plugin files in your ~/.vim (*nix) or ~/vimfiles (Windows). You
|
Extract the plugin files in your ~/.vim (*nix) or ~/vimfiles (Windows). You
|
||||||
should have 2 files: >
|
should have 2 files: >
|
||||||
plugin/NERD_commenter.vim
|
plugin/nerdcommenter.vim
|
||||||
doc/NERD_commenter.txt
|
doc/nerdcommenter.txt
|
||||||
<
|
<
|
||||||
Next, to finish installing the help file run: >
|
Next, to finish installing the help file run: >
|
||||||
:helptags ~/.vim/doc
|
:helptags ~/.vim/doc
|
||||||
@@ -76,68 +93,68 @@ See |filetype-plugin-on| for details, but basically, stick this in your vimrc >
|
|||||||
<
|
<
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
3. Functionality provided *NERDComFunctionality*
|
3. Functionality provided *NERDCommenterFunctionality*
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.1 Functionality summary *NERDComFunctionalitySummary*
|
3.1 Functionality summary *NERDCommenterFunctionalitySummary*
|
||||||
|
|
||||||
The following key mappings are provided by default (there is also a menu
|
The following key mappings are provided by default (there is also a menu
|
||||||
with items corresponding to all the mappings below):
|
with items corresponding to all the mappings below):
|
||||||
|
|
||||||
[count]|<Leader>|cc |NERDComComment|
|
[count]|<Leader>|cc |NERDCommenterComment|
|
||||||
Comment out the current line or text selected in visual mode.
|
Comment out the current line or text selected in visual mode.
|
||||||
|
|
||||||
|
|
||||||
[count]|<Leader>|cn |NERDComNestedComment|
|
[count]|<Leader>|cn |NERDCommenterNested|
|
||||||
Same as |<Leader>|cc but forces nesting.
|
Same as |<Leader>|cc but forces nesting.
|
||||||
|
|
||||||
|
|
||||||
[count]|<Leader>|c<space> |NERDComToggleComment|
|
[count]|<Leader>|c<space> |NERDCommenterToggle|
|
||||||
Toggles the comment state of the selected line(s). If the topmost selected
|
Toggles the comment state of the selected line(s). If the topmost selected
|
||||||
line is commented, all selected lines are uncommented and vice versa.
|
line is commented, all selected lines are uncommented and vice versa.
|
||||||
|
|
||||||
|
|
||||||
[count]|<Leader>|cm |NERDComMinimalComment|
|
[count]|<Leader>|cm |NERDCommenterMinimal|
|
||||||
Comments the given lines using only one set of multipart delimiters.
|
Comments the given lines using only one set of multipart delimiters.
|
||||||
|
|
||||||
|
|
||||||
[count]|<Leader>|ci |NERDComInvertComment|
|
[count]|<Leader>|ci |NERDCommenterInvert|
|
||||||
Toggles the comment state of the selected line(s) individually.
|
Toggles the comment state of the selected line(s) individually.
|
||||||
|
|
||||||
|
|
||||||
[count]|<Leader>|cs |NERDComSexyComment|
|
[count]|<Leader>|cs |NERDCommenterSexy|
|
||||||
Comments out the selected lines ``sexily''
|
Comments out the selected lines ``sexily''
|
||||||
|
|
||||||
|
|
||||||
[count]|<Leader>|cy |NERDComYankComment|
|
[count]|<Leader>|cy |NERDCommenterYank|
|
||||||
Same as |<Leader>|cc except that the commented line(s) are yanked first.
|
Same as |<Leader>|cc except that the commented line(s) are yanked first.
|
||||||
|
|
||||||
|
|
||||||
|<Leader>|c$ |NERDComEOLComment|
|
|<Leader>|c$ |NERDCommenterToEOL|
|
||||||
Comments the current line from the cursor to the end of line.
|
Comments the current line from the cursor to the end of line.
|
||||||
|
|
||||||
|
|
||||||
|<Leader>|cA |NERDComAppendComment|
|
|<Leader>|cA |NERDCommenterAppend|
|
||||||
Adds comment delimiters to the end of line and goes into insert mode between
|
Adds comment delimiters to the end of line and goes into insert mode between
|
||||||
them.
|
them.
|
||||||
|
|
||||||
|
|
||||||
|NERDComInsertComment|
|
|NERDCommenterInsert|
|
||||||
Adds comment delimiters at the current cursor position and inserts between.
|
Adds comment delimiters at the current cursor position and inserts between.
|
||||||
Disabled by default.
|
Disabled by default.
|
||||||
|
|
||||||
|
|
||||||
|<Leader>|ca |NERDComAltDelim|
|
|<Leader>|ca |NERDCommenterAltDelims|
|
||||||
Switches to the alternative set of delimiters.
|
Switches to the alternative set of delimiters.
|
||||||
|
|
||||||
|
|
||||||
[count]|<Leader>|cl
|
[count]|<Leader>|cl |NERDCommenterAlignLeft|
|
||||||
[count]|<Leader>|cb |NERDComAlignedComment|
|
[count]|<Leader>|cb |NERDCommenterAlignBoth|
|
||||||
Same as |NERDComComment| except that the delimiters are aligned down the
|
Same as |NERDCommenterComment| except that the delimiters are aligned down the
|
||||||
left side (|<Leader>|cl) or both sides (|<Leader>|cb).
|
left side (|<Leader>|cl) or both sides (|<Leader>|cb).
|
||||||
|
|
||||||
|
|
||||||
[count]|<Leader>|cu |NERDComUncommentLine|
|
[count]|<Leader>|cu |NERDCommenterUncomment|
|
||||||
Uncomments the selected line(s).
|
Uncomments the selected line(s).
|
||||||
|
|
||||||
|
|
||||||
@@ -145,10 +162,10 @@ With the optional repeat.vim plugin (vimscript #2136), the mappings can also
|
|||||||
be repeated via |.|
|
be repeated via |.|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2 Functionality details *NERDComFunctionalityDetails*
|
3.2 Functionality details *NERDCommenterFunctionalityDetails*
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.1 Comment map *NERDComComment*
|
3.2.1 Comment map *NERDCommenterComment*
|
||||||
|
|
||||||
Default mapping: [count]|<Leader>|cc
|
Default mapping: [count]|<Leader>|cc
|
||||||
Mapped to: <plug>NERDCommenterComment
|
Mapped to: <plug>NERDCommenterComment
|
||||||
@@ -164,7 +181,7 @@ If a [count] is given in normal mode, the mapping works as though that many
|
|||||||
lines were selected in visual-line mode.
|
lines were selected in visual-line mode.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.2 Nested comment map *NERDComNestedComment*
|
3.2.2 Nested comment map *NERDCommenterNested*
|
||||||
|
|
||||||
Default mapping: [count]|<Leader>|cn
|
Default mapping: [count]|<Leader>|cn
|
||||||
Mapped to: <plug>NERDCommenterNested
|
Mapped to: <plug>NERDCommenterNested
|
||||||
@@ -185,7 +202,7 @@ Related options:
|
|||||||
|'NERDDefaultNesting'|
|
|'NERDDefaultNesting'|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.3 Toggle comment map *NERDComToggleComment*
|
3.2.3 Toggle comment map *NERDCommenterToggle*
|
||||||
|
|
||||||
Default mapping: [count]|<Leader>|c<space>
|
Default mapping: [count]|<Leader>|c<space>
|
||||||
Mapped to: <plug>NERDCommenterToggle
|
Mapped to: <plug>NERDCommenterToggle
|
||||||
@@ -202,7 +219,7 @@ If a [count] is given in normal mode, the mapping works as though that many
|
|||||||
lines were selected in visual-line mode.
|
lines were selected in visual-line mode.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.4 Minimal comment map *NERDComMinimalComment*
|
3.2.4 Minimal comment map *NERDCommenterMinimal*
|
||||||
|
|
||||||
Default mapping: [count]|<Leader>|cm
|
Default mapping: [count]|<Leader>|cm
|
||||||
Mapped to: <plug>NERDCommenterMinimal
|
Mapped to: <plug>NERDCommenterMinimal
|
||||||
@@ -224,7 +241,7 @@ If a [count] is given in normal mode, the mapping works as though that many
|
|||||||
lines were selected in visual-line mode.
|
lines were selected in visual-line mode.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.5 Invert comment map *NERDComInvertComment*
|
3.2.5 Invert comment map *NERDCommenterInvert*
|
||||||
|
|
||||||
Default mapping: |<Leader>|ci
|
Default mapping: |<Leader>|ci
|
||||||
Mapped to: <plug>NERDCommenterInvert
|
Mapped to: <plug>NERDCommenterInvert
|
||||||
@@ -241,13 +258,13 @@ If a [count] is given in normal mode, the mapping works as though that many
|
|||||||
lines were selected in visual-line mode.
|
lines were selected in visual-line mode.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.6 Sexy comment map *NERDComSexyComment*
|
3.2.6 Sexy comment map *NERDCommenterSexy*
|
||||||
|
|
||||||
Default mapping: [count]|<Leader>|cs
|
Default mapping: [count]|<Leader>|cs
|
||||||
Mapped to: <plug>NERDCommenterSexy
|
Mapped to: <plug>NERDCommenterSexy
|
||||||
Applicable modes: normal, visual-line.
|
Applicable modes: normal, visual-line.
|
||||||
|
|
||||||
Comments the selected line(s) ``sexily''. See |NERDComSexyComments| for
|
Comments the selected line(s) ``sexily''. See |NERDCommenterSexyComments| for
|
||||||
a description of what sexy comments are. Can only be done on filetypes for
|
a description of what sexy comments are. Can only be done on filetypes for
|
||||||
which there is at least one set of multipart comment delimiters specified.
|
which there is at least one set of multipart comment delimiters specified.
|
||||||
|
|
||||||
@@ -261,7 +278,7 @@ Related options:
|
|||||||
|'NERDCompactSexyComs'|
|
|'NERDCompactSexyComs'|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.7 Yank comment map *NERDComYankComment*
|
3.2.7 Yank comment map *NERDCommenterYank*
|
||||||
|
|
||||||
Default mapping: [count]|<Leader>|cy
|
Default mapping: [count]|<Leader>|cy
|
||||||
Mapped to: <plug>NERDCommenterYank
|
Mapped to: <plug>NERDCommenterYank
|
||||||
@@ -270,7 +287,7 @@ Applicable modes: normal visual visual-line visual-block.
|
|||||||
Same as |<Leader>|cc except that it yanks the line(s) that are commented first.
|
Same as |<Leader>|cc except that it yanks the line(s) that are commented first.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.8 Comment to EOL map *NERDComEOLComment*
|
3.2.8 Comment to EOL map *NERDCommenterToEOL*
|
||||||
|
|
||||||
Default mapping: |<Leader>|c$
|
Default mapping: |<Leader>|c$
|
||||||
Mapped to: <plug>NERDCommenterToEOL
|
Mapped to: <plug>NERDCommenterToEOL
|
||||||
@@ -280,7 +297,7 @@ Comments the current line from the current cursor position up to the end of
|
|||||||
the line.
|
the line.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.9 Append com to line map *NERDComAppendComment*
|
3.2.9 Append com to line map *NERDCommenterAppend*
|
||||||
|
|
||||||
Default mapping: |<Leader>|cA
|
Default mapping: |<Leader>|cA
|
||||||
Mapped to: <plug>NERDCommenterAppend
|
Mapped to: <plug>NERDCommenterAppend
|
||||||
@@ -290,7 +307,7 @@ Appends comment delimiters to the end of the current line and goes
|
|||||||
to insert mode between the new delimiters.
|
to insert mode between the new delimiters.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.10 Insert comment map *NERDComInsertComment*
|
3.2.10 Insert comment map *NERDCommenterInsert*
|
||||||
|
|
||||||
Default mapping: disabled by default.
|
Default mapping: disabled by default.
|
||||||
Map it to: <plug>NERDCommenterInsert
|
Map it to: <plug>NERDCommenterInsert
|
||||||
@@ -306,7 +323,7 @@ mapping add >
|
|||||||
to your vimrc.
|
to your vimrc.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.11 Use alternate delims map *NERDComAltDelim*
|
3.2.11 Use alternate delims map *NERDCommenterAltDelims*
|
||||||
|
|
||||||
Default mapping: |<Leader>|ca
|
Default mapping: |<Leader>|ca
|
||||||
Mapped to: <plug>NERDCommenterAltDelims
|
Mapped to: <plug>NERDCommenterAltDelims
|
||||||
@@ -316,10 +333,11 @@ Changes to the alternative commenting style if one is available. For example,
|
|||||||
if the user is editing a c++ file using // comments and they hit |<Leader>|ca
|
if the user is editing a c++ file using // comments and they hit |<Leader>|ca
|
||||||
then they will be switched over to /**/ comments.
|
then they will be switched over to /**/ comments.
|
||||||
|
|
||||||
See also |NERDComDefaultDelims|
|
See also |NERDCommenterDefaultDelims|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.12 Comment aligned maps *NERDComAlignedComment*
|
3.2.12 Comment aligned maps *NERDCommenterAlignLeft*
|
||||||
|
*NERDCommenterAlignBoth*
|
||||||
|
|
||||||
Default mappings: [count]|<Leader>|cl [count]|<Leader>|cb
|
Default mappings: [count]|<Leader>|cl [count]|<Leader>|cb
|
||||||
Mapped to: <plug>NERDCommenterAlignLeft
|
Mapped to: <plug>NERDCommenterAlignLeft
|
||||||
@@ -334,7 +352,7 @@ If a [count] is given in normal mode, the mapping works as though that many
|
|||||||
lines were selected in visual-line mode.
|
lines were selected in visual-line mode.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.13 Uncomment line map *NERDComUncommentLine*
|
3.2.13 Uncomment line map *NERDCommenterUncomment*
|
||||||
|
|
||||||
Default mapping: [count]|<Leader>|cu
|
Default mapping: [count]|<Leader>|cu
|
||||||
Mapped to: <plug>NERDCommenterUncomment
|
Mapped to: <plug>NERDCommenterUncomment
|
||||||
@@ -347,7 +365,7 @@ When uncommenting, if the line contains multiple sets of delimiters then the
|
|||||||
``outermost'' pair of delimiters will be removed.
|
``outermost'' pair of delimiters will be removed.
|
||||||
|
|
||||||
The script uses a set of heuristics to distinguish ``real'' delimiters from
|
The script uses a set of heuristics to distinguish ``real'' delimiters from
|
||||||
``fake'' ones when uncommenting. See |NERDComIssues| for details.
|
``fake'' ones when uncommenting. See |NERDCommenterIssues| for details.
|
||||||
|
|
||||||
If a [count] is given in normal mode, the mapping works as though that many
|
If a [count] is given in normal mode, the mapping works as though that many
|
||||||
lines were selected in visual-line mode.
|
lines were selected in visual-line mode.
|
||||||
@@ -357,7 +375,7 @@ Related options:
|
|||||||
|'NERDRemoveExtraSpaces'|
|
|'NERDRemoveExtraSpaces'|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.3 Sexy Comments *NERDComSexyComments*
|
3.3 Sexy Comments *NERDCommenterSexyComments*
|
||||||
These are comments that use one set of multipart comment delimiters as well as
|
These are comments that use one set of multipart comment delimiters as well as
|
||||||
one other marker symbol. For example: >
|
one other marker symbol. For example: >
|
||||||
/*
|
/*
|
||||||
@@ -372,7 +390,7 @@ one other marker symbol. For example: >
|
|||||||
Here the multipart delimiters are /* and */ and the marker is *.
|
Here the multipart delimiters are /* and */ and the marker is *.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.4 The NERDComment function *NERDComNERDComment*
|
3.4 The NERDComment function *NERDCommenterNERDComment*
|
||||||
|
|
||||||
All of the NERD commenter mappings and menu items invoke a single function
|
All of the NERD commenter mappings and menu items invoke a single function
|
||||||
which delegates the commenting work to other functions. This function is
|
which delegates the commenting work to other functions. This function is
|
||||||
@@ -393,7 +411,7 @@ For example, if you typed >
|
|||||||
then the script would do a sexy comment on the last visual selection.
|
then the script would do a sexy comment on the last visual selection.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.5 The hooks *NERDComHooks*
|
3.5 The hooks *NERDCommenterHooks*
|
||||||
|fu! NERDCommenter_before()| Before NERDComment/SwitchToAlternativeDelimiters
|
|fu! NERDCommenter_before()| Before NERDComment/SwitchToAlternativeDelimiters
|
||||||
|fu! NERDCommenter_after()| After NERDComment/SwitchToAlternativeDelimiters
|
|fu! NERDCommenter_after()| After NERDComment/SwitchToAlternativeDelimiters
|
||||||
|
|
||||||
@@ -423,10 +441,10 @@ change the filetype back: >
|
|||||||
<
|
<
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
4. Options *NERDComOptions*
|
4. Options *NERDCommenterOptions*
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
4.1 Options summary *NERDComOptionsSummary*
|
4.1 Options summary *NERDCommenterOptionsSummary*
|
||||||
|
|
||||||
|'loaded_nerd_comments'| Turns off the script.
|
|'loaded_nerd_comments'| Turns off the script.
|
||||||
|
|
||||||
@@ -492,12 +510,12 @@ change the filetype back: >
|
|||||||
all selected lines is commented or not.
|
all selected lines is commented or not.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
4.3 Options details *NERDComOptionsDetails*
|
4.3 Options details *NERDCommenterOptionsDetails*
|
||||||
|
|
||||||
To enable any of the below options you should put the given line in your
|
To enable any of the below options you should put the given line in your
|
||||||
~/.vimrc
|
~/.vimrc
|
||||||
|
|
||||||
*'loaded_nerd_comments'*
|
*'loaded_nerd_comments'*
|
||||||
If this script is driving you insane you can turn it off by setting this
|
If this script is driving you insane you can turn it off by setting this
|
||||||
option >
|
option >
|
||||||
let loaded_nerd_comments=1
|
let loaded_nerd_comments=1
|
||||||
@@ -569,7 +587,7 @@ Otherwise, the code block would become: >
|
|||||||
/*} */
|
/*} */
|
||||||
<
|
<
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'NERDCommentEmptyLines'*
|
*'NERDCommentEmptyLines'*
|
||||||
Values: 0 or 1.
|
Values: 0 or 1.
|
||||||
Default: 0.
|
Default: 0.
|
||||||
|
|
||||||
@@ -620,16 +638,16 @@ Note that this option does not affect the behaviour of commenting in
|
|||||||
|visual-block| mode.
|
|visual-block| mode.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'NERDCreateDefaultMappings'*
|
*'NERDCreateDefaultMappings'*
|
||||||
Values: 0 or 1.
|
Values: 0 or 1.
|
||||||
Default: 1.
|
Default: 1.
|
||||||
|
|
||||||
If set to 0, none of the default mappings will be created.
|
If set to 0, none of the default mappings will be created.
|
||||||
|
|
||||||
See also |NERDComMappings|.
|
See also |NERDCommenterMappings|.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'NERDCustomDelimiters'*
|
*'NERDCustomDelimiters'*
|
||||||
Values: A map (format specified below).
|
Values: A map (format specified below).
|
||||||
Default: {}
|
Default: {}
|
||||||
|
|
||||||
@@ -765,7 +783,7 @@ alignment padding. With this option enabled any trailing whitespace will be
|
|||||||
deleted when uncommenting a line.
|
deleted when uncommenting a line.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'NERDDefaultAlign'*
|
*'NERDDefaultAlign'*
|
||||||
Values: 'none', 'left', 'start', 'both'
|
Values: 'none', 'left', 'start', 'both'
|
||||||
Default 'none'.
|
Default 'none'.
|
||||||
|
|
||||||
@@ -804,15 +822,15 @@ you hit |<Leader>|cc on a line that is already commented it will be commented
|
|||||||
again.
|
again.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'NERDToggleCheckAllLines'*
|
.. *'NERDToggleCheckAllLines'*
|
||||||
Values: 0 or 1.
|
Values: 0 or 1.
|
||||||
Default 0.
|
Default 0.
|
||||||
|
|
||||||
When this option is set to 1, NERDCommenterToggle will check all selected line,
|
When this option is set to 1, NERDCommenterToggle will check all selected line,
|
||||||
if there have oneline not be commented, then comment all lines.
|
if there have oneline not be commented, then comment all lines.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'NERDDisableTabsInBlockComm'*
|
.. *'NERDDisableTabsInBlockComm'*
|
||||||
Values: 0 or 1.
|
Values: 0 or 1.
|
||||||
Default 0.
|
Default 0.
|
||||||
|
|
||||||
@@ -837,7 +855,7 @@ file by the following line >
|
|||||||
<
|
<
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.3 Default delimiter customisation *NERDComDefaultDelims*
|
3.3 Default delimiter customisation *NERDCommenterDefaultDelims*
|
||||||
|
|
||||||
If you want the NERD commenter to use the alternative delimiters for a
|
If you want the NERD commenter to use the alternative delimiters for a
|
||||||
specific filetype by default then put a line of this form into your vimrc: >
|
specific filetype by default then put a line of this form into your vimrc: >
|
||||||
@@ -848,13 +866,13 @@ Example: java uses // style comments by default, but you want it to default to
|
|||||||
let g:NERDAltDelims_java = 1
|
let g:NERDAltDelims_java = 1
|
||||||
<
|
<
|
||||||
|
|
||||||
See |NERDComAltDelim| for switching commenting styles at runtime.
|
See |NERDCommenterAltDelims| for switching commenting styles at runtime.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
5. Key mapping customisation *NERDComMappings*
|
5. Key mapping customisation *NERDCommenterMappings*
|
||||||
|
|
||||||
To change a mapping just map another key combo to the internal <plug> mapping.
|
To change a mapping just map another key combo to the internal <plug> mapping.
|
||||||
For example, to remap the |NERDComComment| mapping to ",omg" you would put
|
For example, to remap the |NERDCommenterComment| mapping to ",omg" you would put
|
||||||
this line in your vimrc: >
|
this line in your vimrc: >
|
||||||
map ,omg <plug>NERDCommenterComment
|
map ,omg <plug>NERDCommenterComment
|
||||||
<
|
<
|
||||||
@@ -866,11 +884,46 @@ map to.
|
|||||||
See also |'NERDCreateDefaultMappings'|.
|
See also |'NERDCreateDefaultMappings'|.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
6. Issues with the script *NERDComIssues*
|
6. Interfaces *NERDCommenterInterfaces*
|
||||||
|
|
||||||
|
NERDCommentIsLineCommented({lineNo}) *NERDCommentIsLineCommented()*
|
||||||
|
Check if the line is a comment
|
||||||
|
Note this function checks if the line is **completely** a comment
|
||||||
|
Args:
|
||||||
|
{lineNo}: the line number of the line to check
|
||||||
|
Return: Number, 1 if the line is a comment, 0 else
|
||||||
|
|
||||||
|
|
||||||
|
NERDComment({mode}, {type}) *NERDComment()*
|
||||||
|
This function is a Wrapper for the main commenting functions
|
||||||
|
|
||||||
|
Args:
|
||||||
|
{mode}: character indicating the mode in which the comment
|
||||||
|
is requested:
|
||||||
|
'n' for Normal mode, 'x' for Visual mode
|
||||||
|
{type}: the type of commenting requested. Can be 'Sexy',
|
||||||
|
'Invert', 'Minimal', 'Toggle', 'AlignLeft',
|
||||||
|
'AlignBoth', 'Comment', 'Nested', 'ToEOL', 'Append',
|
||||||
|
'Insert', 'Uncomment', 'Yank'
|
||||||
|
|
||||||
|
|
||||||
|
NERDCommentIsCharCommented({line}, {col}) *NERDCommentIsCharCommented()*
|
||||||
|
Check if the character at [{line}, {col}] is inside a comment
|
||||||
|
Note the Comment delimeter it self is considered as part of the
|
||||||
|
comment
|
||||||
|
|
||||||
|
Args:
|
||||||
|
{line} the line number of the character
|
||||||
|
{col} the column number of the character
|
||||||
|
Return: Number, 1 if the character is inside a comment, 0 else
|
||||||
|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
7. Issues with the script *NERDCommenterIssues*
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
6.1 Delimiter detection heuristics *NERDComHeuristics*
|
7.1 Delimiter detection heuristics *NERDCommenterHeuristics*
|
||||||
|
|
||||||
Heuristics are used to distinguish the real comment delimiters
|
Heuristics are used to distinguish the real comment delimiters
|
||||||
|
|
||||||
@@ -890,7 +943,7 @@ string. These heuristics, while usually pretty accurate, will not work for all
|
|||||||
cases.
|
cases.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
6.2 Nesting issues *NERDComNesting*
|
7.2 Nesting issues *NERDCommenterNesting*
|
||||||
|
|
||||||
If we have some line of code like this: >
|
If we have some line of code like this: >
|
||||||
/*int foo */ = /*5 + 9;*/
|
/*int foo */ = /*5 + 9;*/
|
||||||
@@ -910,228 +963,42 @@ will become: >
|
|||||||
for simplicity)
|
for simplicity)
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
7. About *NERDComAbout*
|
8. About *NERDCommenterAbout*
|
||||||
|
|
||||||
The author of the NERD commenter is Martyzillatron --- the half robot, half
|
This plugin was originally written in 2007 by Martin Grenfell, aka @scrooloose
|
||||||
dinosaur bastard son of Megatron and Godzilla. He enjoys destroying
|
on Github: https://github.com/scrooloose
|
||||||
metropolises and eating tourist buses.
|
|
||||||
|
|
||||||
Drop him a line at martin_grenfell at msn.com. He would love to hear from you.
|
Since 2016 it has been maintained primarily by Caleb Maclennan, aka @alerque
|
||||||
It's a lonely life being the worlds premier terror machine. How would you feel
|
on Github: https://github.com/alerque
|
||||||
if your face looked like a toaster and a t-rex put together? :(
|
|
||||||
|
|
||||||
The latest stable versions can be found at
|
Lots of features and many of the supported filetypes have come from the
|
||||||
http://www.vim.org/scripts/script.php?script_id=1218
|
community, see |NERDCommenterCredits|.
|
||||||
|
|
||||||
The latest dev versions are on github
|
Additional file type support, bug fixes, and new feature contributons are all
|
||||||
http://github.com/scrooloose/nerdcommenter
|
welcome, please send them as Pull Requests on Github. If you can't contribute
|
||||||
|
yourself please also feel free to open issues to report problems or request
|
||||||
|
features: https://github.com/preservim/nerdcommenter
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
8. Changelog *NERDComChangelog*
|
9. Changelog *NERDCommenterChangelog*
|
||||||
|
|
||||||
2.3.0
|
See the included CHANGELOG.md file or the Github Releases page for the latest
|
||||||
- remove all filetypes which have a &commentstring in the standard vim
|
info on tagged releases. https://github.com/preservim/nerdcommenter/releases
|
||||||
runtime for vim > 7.0 unless the script stores an alternate set of
|
|
||||||
delimiters
|
|
||||||
- make the script complain if the user doesn't have filetype plugins enabled
|
|
||||||
- use |<Leader>| instead of comma to start the default mappings
|
|
||||||
- fix a couple of bugs with sexy comments - thanks to Tim Smart
|
|
||||||
- lots of refactoring
|
|
||||||
|
|
||||||
2.2.2
|
The `master` branch is considered stable and will have the latest filetype
|
||||||
- remove the NERDShutup option and the message is suppresses, this makes
|
support and bugfixes.
|
||||||
the plugin silently rely on &commentstring for unknown filetypes.
|
|
||||||
- add support for dhcpd, limits, ntp, resolv, rgb, sysctl, udevconf and
|
|
||||||
udevrules. Thanks to Thilo Six.
|
|
||||||
- match filetypes case insensitively
|
|
||||||
- add support for mp (metapost), thanks to Andrey Skvortsov.
|
|
||||||
- add support for htmlcheetah, thanks to Simon Hengel.
|
|
||||||
- add support for javacc, thanks to Matt Tolton.
|
|
||||||
- make <%# %> the default delims for eruby, thanks to tpope.
|
|
||||||
- add support for javascript.jquery, thanks to Ivan Devat.
|
|
||||||
- add support for cucumber and pdf. Fix sass and railslog delims,
|
|
||||||
thanks to tpope
|
|
||||||
|
|
||||||
2.2.1
|
|
||||||
- add support for newlisp and clojure, thanks to Matthew Lee Hinman.
|
|
||||||
- fix automake comments, thanks to Elias Pipping
|
|
||||||
- make haml comments default to -# with / as the alternative delimiter,
|
|
||||||
thanks to tpope
|
|
||||||
- add support for actionscript and processing thanks to Edwin Benavides
|
|
||||||
- add support for ps1 (powershell), thanks to Jason Mills
|
|
||||||
- add support for hostsaccess, thanks to Thomas Rowe
|
|
||||||
- add support for CVScommit
|
|
||||||
- add support for asciidoc, git and gitrebase. Thanks to Simon Ruderich.
|
|
||||||
- use # for gitcommit comments, thanks to Simon Ruderich.
|
|
||||||
- add support for mako and genshi, thanks to Keitheis.
|
|
||||||
- add support for conkyrc, thanks to David
|
|
||||||
- add support for SVNannotate, thanks to Miguel Jaque Barbero.
|
|
||||||
- add support for sieve, thanks to Stefan Walk
|
|
||||||
- add support for objj, thanks to Adam Thorsen.
|
|
||||||
|
|
||||||
2.2.0
|
|
||||||
- rewrote the mappings system to be more "standard".
|
|
||||||
- removed all the mapping options. Now, mappings to <plug> mappings are
|
|
||||||
used
|
|
||||||
- see :help NERDComMappings, and :help NERDCreateDefaultMappings for
|
|
||||||
more info
|
|
||||||
- remove "prepend comments" and "right aligned comments".
|
|
||||||
- add support for applescript, calbire, man, SVNcommit, potwiki, txt2tags and SVNinfo.
|
|
||||||
Thanks to nicothakis, timberke, sgronblo, mntnoe, Bernhard Grotz, John
|
|
||||||
O'Shea, François and Giacomo Mariani respectively.
|
|
||||||
- bugfix for haskell delimiters. Thanks to mntnoe.
|
|
||||||
2.1.18
|
|
||||||
- add support for llvm. Thanks to nicothakis.
|
|
||||||
- add support for xquery. Thanks to Phillip Kovalev.
|
|
||||||
2.1.17
|
|
||||||
- fixed haskell delimiters (hackily). Thanks to Elias Pipping.
|
|
||||||
- add support for mailcap. Thanks to Pascal Brueckner.
|
|
||||||
- add support for stata. Thanks to Jerónimo Carballo.
|
|
||||||
- applied a patch from ewfalor to fix an error in the help file with the
|
|
||||||
NERDMapleader doc
|
|
||||||
- disable the insert mode ctrl-c mapping by default, see :help
|
|
||||||
NERDComInsertComment if you wish to restore it
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
9. Credits *NERDComCredits*
|
10. Credits *NERDCommenterCredits*
|
||||||
|
|
||||||
Thanks to the follow people for suggestions and patches:
|
Well over 100 people have contributed towards this plugin, it's functions, and
|
||||||
|
specific filetype support. Please check out the up do date list of all
|
||||||
|
contributors on Github:
|
||||||
|
|
||||||
Nick Brettell
|
https://github.com/preservim/nerdcommenter/graphs/contributors
|
||||||
Matthew Hawkins
|
|
||||||
Mathieu Clabaut
|
|
||||||
Greg Searle
|
|
||||||
Nguyen
|
|
||||||
Litchi
|
|
||||||
Jorge Scandaliaris
|
|
||||||
Shufeng Zheng
|
|
||||||
Martin Stubenschrott
|
|
||||||
Markus Erlmann
|
|
||||||
Brent Rice
|
|
||||||
Richard Willis
|
|
||||||
Igor Prischepoff
|
|
||||||
Harry
|
|
||||||
David Bourgeois
|
|
||||||
Eike Von Seggern
|
|
||||||
Torsten Blix
|
|
||||||
Alexander Bosecke
|
|
||||||
Stefano Zacchiroli
|
|
||||||
Norick Chen
|
|
||||||
Joseph Barker
|
|
||||||
Gary Church
|
|
||||||
Tim Carey-Smith
|
|
||||||
Markus Klinik
|
|
||||||
Anders
|
|
||||||
Seth Mason
|
|
||||||
James Hales
|
|
||||||
Heptite
|
|
||||||
Cheng Fang
|
|
||||||
Yongwei Wu
|
|
||||||
David Miani
|
|
||||||
Jeremy Hinegardner
|
|
||||||
Marco
|
|
||||||
Ingo Karkat
|
|
||||||
Zhang Shuhan
|
|
||||||
tpope
|
|
||||||
Ben Schmidt
|
|
||||||
David Fishburn
|
|
||||||
Erik Falor
|
|
||||||
JaGoTerr
|
|
||||||
Elias Pipping
|
|
||||||
mntnoe
|
|
||||||
Mark S.
|
|
||||||
|
|
||||||
|
|
||||||
Thanks to the following people for sending me new filetypes to support:
|
|
||||||
|
|
||||||
The hackers The filetypes~
|
|
||||||
Sam R verilog
|
|
||||||
Jonathan Derque context, plaintext and mail
|
|
||||||
Vigil fetchmail
|
|
||||||
Michael Brunner kconfig
|
|
||||||
Antono Vasiljev netdict
|
|
||||||
Melissa Reid omlet
|
|
||||||
Ilia N Ternovich quickfix
|
|
||||||
John O'Shea RTF, SVNcommitlog and vcscommit, SVNCommit
|
|
||||||
Anders occam
|
|
||||||
Mark Woodward csv
|
|
||||||
fREW gentoo-package-mask,
|
|
||||||
gentoo-package-keywords,
|
|
||||||
gentoo-package-use, and vo_base
|
|
||||||
Alexey verilog_systemverilog, systemverilog
|
|
||||||
Lizendir fstab
|
|
||||||
Michael Böhler autoit, autohotkey and docbk
|
|
||||||
Aaron Small cmake
|
|
||||||
Ramiro htmldjango and django
|
|
||||||
Stefano Zacchiroli debcontrol, debchangelog, mkd
|
|
||||||
Alex Tarkovsky ebuild and eclass
|
|
||||||
Jorge Rodrigues gams
|
|
||||||
Rainer Müller Objective C
|
|
||||||
Jason Mills Groovy, ps1
|
|
||||||
Normandie Azucena vera
|
|
||||||
Florian Apolloner ldif
|
|
||||||
David Fishburn lookupfile
|
|
||||||
Niels Aan de Brugh rst
|
|
||||||
Don Hatlestad ahk
|
|
||||||
Christophe Benz Desktop and xsd
|
|
||||||
Eyolf Østrem lilypond, bbx and lytex
|
|
||||||
Ingo Karkat dosbatch
|
|
||||||
Nicolas Weber markdown, objcpp
|
|
||||||
tinoucas gentoo-conf-d
|
|
||||||
Greg Weber D, haml
|
|
||||||
Bruce Sherrod velocity
|
|
||||||
timberke cobol, calibre
|
|
||||||
Aaron Schaefer factor
|
|
||||||
Mr X asterisk, mplayerconf
|
|
||||||
Kuchma Michael plsql
|
|
||||||
Brett Warneke spectre
|
|
||||||
Pipp lhaskell
|
|
||||||
Renald Buter scala
|
|
||||||
Vladimir Lomov asymptote
|
|
||||||
Marco mrxvtrc, aap
|
|
||||||
nicothakis SVNAnnotate, CVSAnnotate, SVKAnnotate,
|
|
||||||
SVNdiff, gitAnnotate, gitdiff, dtrace
|
|
||||||
llvm, applescript
|
|
||||||
Chen Xing Wikipedia
|
|
||||||
Jacobo Diaz dakota, patran
|
|
||||||
Li Jin gentoo-env-d, gentoo-init-d,
|
|
||||||
gentoo-make-conf, grub, modconf, sudoers
|
|
||||||
SpookeyPeanut rib
|
|
||||||
Greg Jandl pyrex/cython
|
|
||||||
Christophe Benz services, gitcommit
|
|
||||||
A Pontus vimperator
|
|
||||||
Stromnov slice, bzr
|
|
||||||
Martin Kustermann pamconf
|
|
||||||
Indriði Einarsson mason
|
|
||||||
Chris map
|
|
||||||
Krzysztof A. Adamski group
|
|
||||||
Pascal Brueckner mailcap
|
|
||||||
Jerónimo Carballo stata
|
|
||||||
Phillip Kovalev xquery
|
|
||||||
Bernhard Grotz potwiki
|
|
||||||
sgronblo man
|
|
||||||
François txt2tags
|
|
||||||
Giacomo Mariani SVNinfo
|
|
||||||
Matthew Lee Hinman newlisp, clojure
|
|
||||||
Elias Pipping automake
|
|
||||||
Edwin Benavides actionscript, processing
|
|
||||||
Thomas Rowe hostsaccess
|
|
||||||
Simon Ruderich asciidoc, git, gitcommit, gitrebase
|
|
||||||
Keitheis mako, genshi
|
|
||||||
David conkyrc
|
|
||||||
Miguel Jaque Barbero SVNannotate
|
|
||||||
Stefan Walk sieve
|
|
||||||
Adam Thorsen objj
|
|
||||||
Thilo Six dhcpd, limits, ntp, resolv, rgb, sysctl,
|
|
||||||
udevconf, udevrules
|
|
||||||
Andrey Skvortsov mp
|
|
||||||
Simon Hengel htmlcheetah
|
|
||||||
Matt Tolton javacc
|
|
||||||
Ivan Devat javascript.jquery
|
|
||||||
tpope cucumber,pdf
|
|
||||||
Lyude Paul piglit shader_test
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
10. License *NERDComLicense*
|
11. License *NERDCommenterLicense*
|
||||||
|
|
||||||
The NERD commenter is released under the wtfpl.
|
NERD Commenter is released under the Creative-Commons CCO 1.0 Universal
|
||||||
See http://sam.zoy.org/wtfpl/COPYING.
|
license. See the included LICENSE file for details.
|
||||||
103
plugin/nerdcommenter.vim
Normal file
103
plugin/nerdcommenter.vim
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
if exists('loaded_nerd_comments')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
if v:version < 700
|
||||||
|
echoerr "NERDCommenter: this plugin requires vim >= 7. DOWNLOAD IT! You'll thank me later!"
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let loaded_nerd_comments = 1
|
||||||
|
|
||||||
|
" Function: s:InitVariable() function
|
||||||
|
" This function is used to initialise a given variable to a given value. The
|
||||||
|
" variable is only initialised if it does not exist prior
|
||||||
|
"
|
||||||
|
" Args:
|
||||||
|
" -var: the name of the var to be initialised
|
||||||
|
" -value: the value to initialise var to
|
||||||
|
"
|
||||||
|
" Returns:
|
||||||
|
" 0
|
||||||
|
function s:InitVariable(var, value)
|
||||||
|
if !exists(a:var)
|
||||||
|
execute 'let ' . a:var . ' = ' . string(a:value)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Section: variable initialization
|
||||||
|
call s:InitVariable('g:NERDAllowAnyVisualDelims', 1)
|
||||||
|
call s:InitVariable('g:NERDBlockComIgnoreEmpty', 0)
|
||||||
|
call s:InitVariable('g:NERDCommentWholeLinesInVMode', 0)
|
||||||
|
call s:InitVariable('g:NERDCommentEmptyLines', 0)
|
||||||
|
call s:InitVariable('g:NERDCompactSexyComs', 0)
|
||||||
|
call s:InitVariable('g:NERDCreateDefaultMappings', 1)
|
||||||
|
call s:InitVariable('g:NERDDefaultNesting', 1)
|
||||||
|
call s:InitVariable('g:NERDMenuMode', 3)
|
||||||
|
call s:InitVariable('g:NERDLPlace', '[>')
|
||||||
|
call s:InitVariable('g:NERDUsePlaceHolders', 1)
|
||||||
|
call s:InitVariable('g:NERDRemoveAltComs', 1)
|
||||||
|
call s:InitVariable('g:NERDRemoveExtraSpaces', 0)
|
||||||
|
call s:InitVariable('g:NERDRPlace', '<]')
|
||||||
|
call s:InitVariable('g:NERDSpaceDelims', 0)
|
||||||
|
call s:InitVariable('g:NERDDefaultAlign', 'none')
|
||||||
|
call s:InitVariable('g:NERDTrimTrailingWhitespace', 0)
|
||||||
|
call s:InitVariable('g:NERDToggleCheckAllLines', 0)
|
||||||
|
call s:InitVariable('g:NERDDisableTabsInBlockComm', 0)
|
||||||
|
|
||||||
|
" Section: Comment mapping and menu item setup
|
||||||
|
" ===========================================================================
|
||||||
|
|
||||||
|
" Create menu items for the specified modes. If a:combo is not empty, then
|
||||||
|
" also define mappings and show a:combo in the menu items.
|
||||||
|
function! s:CreateMaps(modes, target, desc, combo)
|
||||||
|
" Build up a map command like
|
||||||
|
" 'noremap <silent> <Plug>NERDCommenterComment :call nerdcommenter#Comment("n", "Comment")'
|
||||||
|
let plug = '<Plug>NERDCommenter' . a:target
|
||||||
|
let plug_start = 'noremap <silent> ' . plug . ' :call nerdcommenter#Comment("'
|
||||||
|
let plug_end = '", "' . a:target . '")<CR>'
|
||||||
|
" Build up a menu command like
|
||||||
|
" 'menu <silent> comment.Comment<Tab>\\cc <Plug>NERDCommenterComment'
|
||||||
|
let menuRoot = get(['', 'comment', '&comment', '&Plugin.&comment', '&Plugin.Nerd\ &Commenter'],
|
||||||
|
\ g:NERDMenuMode, '')
|
||||||
|
let menu_command = 'menu <silent> ' . menuRoot . '.' . escape(a:desc, ' ')
|
||||||
|
if strlen(a:combo)
|
||||||
|
let leader = exists('g:mapleader') ? g:mapleader : '\'
|
||||||
|
let menu_command .= '<Tab>' . escape(leader, '\') . a:combo
|
||||||
|
endif
|
||||||
|
let menu_command .= ' ' . (strlen(a:combo) ? plug : a:target)
|
||||||
|
" Execute the commands built above for each requested mode.
|
||||||
|
for mode in (a:modes ==# '') ? [''] : split(a:modes, '\zs')
|
||||||
|
if strlen(a:combo)
|
||||||
|
execute mode . plug_start . mode . plug_end
|
||||||
|
if g:NERDCreateDefaultMappings && !hasmapto(plug, mode)
|
||||||
|
execute mode . 'map <leader>' . a:combo . ' ' . plug
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
" Check if the user wants the menu to be displayed.
|
||||||
|
if g:NERDMenuMode !=# 0
|
||||||
|
execute mode . menu_command
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
call s:CreateMaps('nx', 'Comment', 'Comment', 'cc')
|
||||||
|
call s:CreateMaps('nx', 'Toggle', 'Toggle', 'c<Space>')
|
||||||
|
call s:CreateMaps('nx', 'Minimal', 'Minimal', 'cm')
|
||||||
|
call s:CreateMaps('nx', 'Nested', 'Nested', 'cn')
|
||||||
|
call s:CreateMaps('n', 'ToEOL', 'To EOL', 'c$')
|
||||||
|
call s:CreateMaps('nx', 'Invert', 'Invert', 'ci')
|
||||||
|
call s:CreateMaps('nx', 'Sexy', 'Sexy', 'cs')
|
||||||
|
call s:CreateMaps('nx', 'Yank', 'Yank then comment', 'cy')
|
||||||
|
call s:CreateMaps('n', 'Append', 'Append', 'cA')
|
||||||
|
call s:CreateMaps('', ':', '-Sep-', '')
|
||||||
|
call s:CreateMaps('nx', 'AlignLeft', 'Left aligned', 'cl')
|
||||||
|
call s:CreateMaps('nx', 'AlignBoth', 'Left and right aligned', 'cb')
|
||||||
|
call s:CreateMaps('', ':', '-Sep2-', '')
|
||||||
|
call s:CreateMaps('nx', 'Uncomment', 'Uncomment', 'cu')
|
||||||
|
call s:CreateMaps('n', 'AltDelims', 'Switch Delimiters', 'ca')
|
||||||
|
call s:CreateMaps('i', 'Insert', 'Insert Comment Here', '')
|
||||||
|
call s:CreateMaps('', ':', '-Sep3-', '')
|
||||||
|
call s:CreateMaps('', ':help NERDCommenterContents<CR>', 'Help', '')
|
||||||
|
|
||||||
|
inoremap <silent> <Plug>NERDCommenterInsert <Space><BS><Esc>:call nerdcommenter#Comment('i', "insert")<CR>
|
||||||
|
|
||||||
|
" switch to/from alternative delimiters (does not use wrapper function)
|
||||||
|
nnoremap <Plug>NERDCommenterAltDelims :call nerdcommenter#SwitchToAlternativeDelimiters(1)<CR>
|
||||||
Reference in New Issue
Block a user