230 Commits

Author SHA1 Message Date
fyusuf-a
c60dd99e1b Merge fa4bf8b29e into 66c07e4083 2024-12-02 02:39:10 +00:00
Kelvin Davis
66c07e4083 Added comments for typst (#538)
Some checks failed
Vint / vint (push) Has been cancelled
2024-10-22 16:38:52 +03:00
Caleb Maclennan
3f860f2d98 Merge pull request #531 from svalaskevicius/master 2024-08-08 12:33:49 +03:00
Igor Prusov
c9b1078807 Add delimeters fof Device Tree Source (DTS) files (#535) 2024-08-08 12:33:00 +03:00
Mark Huang
7bb1f72e80 Add comment delimiters to support aptconf (#533) 2024-05-13 13:37:01 +03:00
Sarunas Valaskevicius
fea637c3c2 Fix alternative delimiter usage in alternate buffers
Copy the configuration for a file rather than capture by reference.

Due to the logic in the alternative delimiter configurator, which swaps the
delimiters when called, every second buffer the script is used swaps the
delimiter order in the original config. This leads to incorrect
delimiters being used in every second buffer.

This change makes a copy for each buffer so swapping the order will not
affect the next loaded buffer.
2024-01-14 15:27:11 +00:00
Mark Huang
e361a44230 Add delimiter for pamenv (#530) 2023-12-18 22:49:10 +03:00
zhaoyunfeng
da948e160d fix: Ensure #Setup is run in #IsCharCommented (#527) 2023-11-02 14:24:05 +03:00
jwellhofer
c52b6e731c Add delimiters for Alloy files (#526)
Co-authored-by: Johannes Wellhöfer <johannes.wellhofer@gmail.com>
2023-10-23 11:47:28 +03:00
Christian Segundo
d2e21d417f feat: Add delimiter for HCL files (#525) 2023-08-13 01:12:53 +03:00
qizidog
ab2ae4d502 docs: Fix title numbering error in chapter-4 (#524) 2023-06-26 11:21:32 +03:00
Rich Churcher
844b211a4c Add Dart to supported languages (#523) 2023-06-26 11:19:48 +03:00
Krzysztof Leśniak
b0b09ea46c Fix use on VIM 8 with proper arguments to bufnr() (#521) 2023-06-05 11:34:33 +03:00
Christian Segundo
2045211689 Add support for jq filter files (#520) 2023-05-17 20:39:52 +03:00
Yuxin Wu
277bdfc679 fix: Reference current buffer not '1' re b:NERDCommenterFirstInit (#519) 2023-05-08 14:58:24 +03:00
YuyaKoda
1fe9e1cfea style: Remove stray whitespaces & normalize format (#517) 2023-04-26 18:20:01 +03:00
YuyaKoda
e23f55e735 feat: Add vcl (Varnish Configuration Language) (#516) 2023-04-26 16:46:33 +03:00
Yuxin Wu
91499c76a7 Prevent caching of buffer commentstring (#515)
Co-authored-by: Yuxin Wu <ppwwyyxx@users.noreply.github.com>
2023-04-21 09:44:44 +03:00
Caleb Maclennan
bd1a29536d Revert "Prevent caching of buffer commentstring (#514)"
This reverts commit 457b383767.
2023-04-20 19:50:28 +03:00
林千里
c6766698d8 Recompute indxLeft after line has changed (#507) 2023-04-20 19:44:06 +03:00
Hazael Sanchez
c5b0f78820 Add support for CEL (#512) 2023-04-20 19:42:45 +03:00
Yuxin Wu
78029a0e90 Fix support for embedded lua in vimscript (#513)
Co-authored-by: Yuxin Wu <ppwwyyxx@users.noreply.github.com>
2023-04-20 19:42:14 +03:00
Yuxin Wu
457b383767 Prevent caching of buffer commentstring (#514) 2023-04-20 19:38:56 +03:00
Chris
d069f7fb56 Update starkware cairo comments to latest syntax (#511) 2023-02-05 23:14:12 +03:00
Dmitrii Mishutin
06f6166e5d feat(dosbatch): change delimiters (#508) 2023-01-27 21:30:52 +03:00
Caleb Maclennan
c406bba57d Fix comment syntax blooper from #510 2023-01-27 17:00:07 +03:00
Konstantin-Glukhov
ea6a4f76fa Fix bug for unable to uncomment indented comments in vim files (#510)
Closes https://github.com/preservim/nerdcommenter/issues/491
2023-01-27 13:01:58 +03:00
Sankhesh Jhaveri
1caf560df1 Allow hooks to change filetype and comment deilmiters (#509)
Fixes https://github.com/preservim/nerdcommenter/pull/479
2023-01-26 20:57:08 +03:00
Caleb Maclennan
98cc4a2d64 Fixup manual install instructions to be complete
Closes #506

Co-authored-by: Yuri Schaeffer <yuri@schaeffer.tk>
2022-11-09 12:45:12 +03:00
Caleb Maclennan
f575c18d05 Release 2.7.0 (for those using releases, tracking upstream master is recommended) 2022-11-05 12:34:59 +03:00
Allen Guan
fd2114b46d Update outdated example code in readme (#504) 2022-10-29 12:40:51 +03:00
Brian Wo
fe74a1b890 Add support for Justfile (#503) 2022-10-11 10:03:52 +03:00
Brian Wo
60f3a2bc2b Add support for Svelte (#502) 2022-10-07 10:43:59 +03:00
Giuliano
2a0a05ff98 Add support for TLA+ modeling and specification language (#497) 2022-09-12 09:15:28 +03:00
Christian Segundo
6d30ebcd42 Add support for Zig (#492) 2022-05-20 23:15:25 +03:00
Caleb Maclennan
f8671f783b Add alternate delimiter to SILE format to ease switching to Lua 2022-02-24 23:22:41 +03:00
fyusuf-a
fa4bf8b29e fix: added a space to Haskell one-line commands (for example, it transforms '&&' to '-- &&' so that it is not interpreted as the '--&&' infix operator) 2022-02-15 14:28:00 +01:00
Chris
ec002e8f5d Add support for Starkware cairo (#487) 2022-02-12 17:08:52 +03:00
Caleb Maclennan
f9c5f0fbda Merge pull request #482 from tomtomjhj/insert 2022-01-15 21:13:53 +03:00
Jaehwang Jerry Jung
ac512fe158 Do not break undo sequence when moving cursor 2022-01-16 00:10:51 +09:00
Jaehwang Jerry Jung
867618364f Simplify and fix NERDCommenterInsert
* Simplify comment delimiter insertion.
* Remove the code that unnecessarily touches the leading spaces/tabs.
* Fix a bug in which `<Plug>NERDCommenterInsert` inserts the comment
  delimiters in a wrong position when `col('.')==1`.
  Example: `1|234` (cursor at `|`) → `/* */1234`.
* NOTE: Should avoid `feedkey(.., 'ni')` for inserting comment
  delimiters to ensure that `NERDCommenter_after` is called after
  inserting the delimiters. `feedkey` only adds the input to the queue,
  which will be processed after exiting the script context. On the other
  hand, `:normal` and `feedkey(.., 'x')` are eagerly processed.
2022-01-16 00:10:51 +09:00
Caleb Maclennan
97317fc319 Merge pull request #486 from phlip9/master 2022-01-15 15:51:20 +03:00
Philip Hayes
37298c471e Add support for ATS and Lean 2022-01-14 16:38:49 -08:00
Caleb Maclennan
9fffd4c022 Merge pull request #485 from ftfunjth/master 2021-12-28 13:31:54 +03:00
ftfunjth
2e7a775dd2 Add SetUp call in IsLineCommented function definition 2021-12-28 18:13:13 +08:00
Caleb Maclennan
eddd535bdf Release 2.6.0 (for those using releases, tracking upstream master is recommended) 2021-11-27 07:22:42 +03:00
Caleb Maclennan
13d00954a6 Merge pull request #481 from dsirov/fasm+json5-syntax 2021-11-24 20:38:07 +03:00
David Sirovsky
ab67976bea autoload/nerdcommenter.vim: json5 support 2021-11-24 12:20:12 +02:00
David Sirovsky
fa9b74ff69 autoload/nerdcommenter.vim: fasm support 2021-11-24 12:19:56 +02:00
Caleb Maclennan
a65465d321 Merge pull request #479 from jiaobuzuji/master 2021-09-02 22:33:20 +03:00
Jiaobuzuji
9d5c12e126 fix 'g:NERDAllowAnyVisualDelims' action
fix 'g:NERDAllowAnyVisualDelims' action.

                                                    *'NERDAllowAnyVisualDelims'*
Values: 0 or 1.
Default: 1.

If set to 1 then, when doing a visual or visual-block comment (but not a
visual-line comment), the script will choose the right delimiters to use for
the comment. This means either using the current delimiters if they are
multipart or using the alternative delimiters if THEY are multipart.  For
example if we are editing the following java code: >
    float foo = 1221;
    float bar = 324;
    System.out.println(foo * bar);
<
If we are using // comments and select the "foo" and "bar" in visual-block
mode, as shown left below (where '|'s are used to represent the visual-block
boundary), and comment it then the script will use the alternative delimiters
as shown on the right: >

    float |foo| = 1221;                   float /*foo*/ = 1221;
    float |bar| = 324;                    float /*bar*/ = 324;
    System.out.println(foo * bar);        System.out.println(foo * bar);
<
2021-09-02 22:27:38 +08:00
Caleb Maclennan
2c87cae76e Merge pull request #475 from tomtomjhj/refactor 2021-07-31 20:24:00 +03:00
Jaehwang Jerry Jung
f7333809b6 Prefer single quoted strings 2021-08-01 00:57:34 +09:00
Jaehwang Jerry Jung
576bd64482 {Save,Restore}ScreenState → win{save,rest}view 2021-08-01 00:45:16 +09:00
Jaehwang Jerry Jung
ed591cb2a2 substitute(.., '..\(pat\)..', '\1') → matchstr() 2021-08-01 00:33:13 +09:00
Jaehwang Jerry Jung
d398a0278c [ \t] → \s, [^ \t] → \S 2021-08-01 00:33:13 +09:00
Caleb Maclennan
85364c56c4 Merge pull request #473 from preservim/shim-functions 2021-07-29 17:41:36 +03:00
Caleb Maclennan
b1bb758f14 Fix vimscript lint warnings 2021-07-29 17:26:06 +03:00
Caleb Maclennan
eeabded555 Pass range data through, error on case we can't shim 2021-07-29 17:20:35 +03:00
Caleb Maclennan
918592cdc6 Add warning messages to deprecated function calls 2021-07-29 16:49:12 +03:00
Caleb Maclennan
8e935a6367 Restore use to IsCharCommented function after autoload refactor goof 2021-07-29 16:48:31 +03:00
Caleb Maclennan
f21b0f8fab Add shim functions to pass through to autoload namespace 2021-07-29 16:23:49 +03:00
Caleb Maclennan
c526e3957f Move docs to proper namespace matching autoload 2021-07-29 15:42:53 +03:00
Caleb Maclennan
47ab32444d Merge pull request #470 from tomtomjhj/setup 2021-07-29 13:02:07 +03:00
Jaehwang Jerry Jung
8e8d74faaf fix and refactor SetUpForNewFiletype
* fix: variables are not set for a new buffer with filetype = s:last_filetype
* remove unused parameter and simplify name
2021-07-29 18:07:13 +09:00
Caleb Maclennan
dbc631adf9 Merge pull request #376 from Houl/autoload
Refactor using VIM's autoload plugin system
2021-07-27 17:04:53 +03:00
Caleb Maclennan
ea11ba5a79 Use the abort attribute for functions in autoload 2021-07-27 16:58:12 +03:00
antonk52
3768b28aa4 expose delimeter map via nerdcommenter#delimiterMap 2021-07-24 22:05:07 +01:00
antonk52
f12042b675 setup global variables and keymaps in plugin/nerdcommenter.vim 2021-07-24 21:55:50 +01:00
Caleb Maclennan
dec06b1fb9 Merge branch 'master' into autoload 2021-07-20 12:46:30 +03:00
Jaehwang Jerry Jung
a5d1663185 Fix multibyte character bug in block comment (#469)
<Plug>NERDCommenterComment using block comment on visual block whose
last char is unicode breaks up the unicode char. Example:

    a가 → /* a<ea> */<b0><80>

To fix this, add the character's byte length to the index used for
chopping the right part of the text block to be commented.
2021-05-29 14:00:30 +03:00
Caleb Maclennan
ab475e1325 Add filetype for exim configs 2021-04-30 12:31:25 +03:00
Caleb Maclennan
d9366fc27c Add filetype for bind-named (similar to named, used by some plugins) 2021-04-30 12:31:10 +03:00
Caleb Maclennan
1b53686d5f Merge pull request #466 from natesire/master 2021-04-13 08:23:21 +03:00
Nate Sire
b2642c8ed9 Add Directions for Vim 8+ Packages 2021-04-13 08:21:08 +03:00
Nate Sire
d4855b233e Wrap installation blurbs in expandable summary/detail blocks 2021-04-13 08:20:25 +03:00
Gabriel Nagy
6d0ab7dec9 Add hocon filetype (#465)
Add support for commenting hocon files.

[1] https://github.com/lightbend/config/blob/main/HOCON.md#comments
2021-04-06 09:57:40 +03:00
Adrien Lemaire
16ecc429ec Add neo4j cypher filetype (#464)
Let nerdcommenter properly comment cypher files.

* [extension recommendation](https://neo4j.com/docs/cypher-manual/current/styleguide/#cypher-styleguide-general-recommendations)
* [comments syntax](https://neo4j.com/docs/cypher-manual/current/syntax/comments/)
2021-02-27 12:25:37 +03:00
Bertold Sedlak
1c7b57608e Add UC4 Filetype (#462)
Add Support for UC4 Scripts as used by Automic Automation Engine
See docs for details:
https://docs.automic.com/documentation/webhelp/english/AWA/11.2/AE/11.2/All%20Guides/Content/ucabqx.htm
2021-02-18 06:44:26 +03:00
kevinhwang91
b83e9cdf83 fix: uncomment Lua in sexy mode with NERDCompactSexyComs=1 (#451) 2021-02-02 10:29:10 +03:00
John Flores
898de2de1b Update rego comment to # (#459) 2021-01-31 09:41:13 +03:00
Alex Hübner
2955d669dc Fix leftAlt for filetype rmd (#458) 2021-01-27 11:22:41 +03:00
Tiger Nie
7be3292b8d Add support for jsonc (#455) 2021-01-19 12:38:54 +03:00
Rich Churcher
7d2fb974a3 Add a note on binds for text object motions (#454) 2021-01-12 07:33:59 +03:00
Repon Kumar Roy
119b99d166 Add support for the jsonnet language (#450)
Co-authored-by: Repon Kumar Roy <kowshik.roy@grabtaxi.com>
2020-12-11 12:19:05 +03:00
Cristiano De Michele
f02686f2f6 Fix alternative delimiter issue #425 (#440)
Co-authored-by: Cristiano De Michele <cristiano.demichele@uniroma1.it>
2020-12-03 12:33:37 +03:00
Priyansh Saxena
3441a98b2d Add support for Rego (Open Policy Agent) (#446) 2020-12-01 09:37:49 +03:00
Wynell
253eafd3a7 Mention g:NERDCreateDefaultMappings in README.md (#445) 2020-11-19 12:25:03 +03:00
Sybrand Aarnoutse
85750560a6 Add delimiter for the nix language. (#442) 2020-10-30 22:25:01 +03:00
Caleb Maclennan
19f677513c Fix lint errors intoduced during autoload refactor 2020-06-08 18:26:34 +03:00
Caleb Maclennan
7caf7b58a1 Merge branch 'master' into autoload 2020-06-08 18:16:18 +03:00
Andy Wokula
1f4a238e73 Merge remote-tracking branch 'upstream/master'
Ignored changes in other README!
2020-06-08 18:16:01 +03:00
Andy Wokula
2e50bcbb8d Add one more menu mode 2020-06-08 18:16:00 +03:00
Andy Wokula
a5772187fa Use more cautious init check 2020-06-08 18:15:55 +03:00
Andy Wokula
592d5767e0 Use string() 2020-06-08 18:15:55 +03:00
Andy Wokula
5a5bad0ece Merge remote-tracking branch 'upstream/master' 2020-06-08 18:15:55 +03:00
Andy Wokula
656f6b5beb Normalize case in keycodes 2020-06-08 18:15:43 +03:00
Andy Wokula
cb5fb95a81 Remove loading guards not needed in autoload scripts 2020-06-08 16:16:52 +03:00
Andy Wokula
f9a87bf68f Rename functions, add plug function 2020-06-08 16:16:52 +03:00
Andy Wokula
f62c4ca1d4 Move plugin file to autoload 2020-06-08 15:59:21 +03:00
Caleb Maclennan
fade3d4b26 Merge pull request #427 from preservim/remove-cruft 2020-06-08 15:24:46 +03:00
Caleb Maclennan
bedc6dc384 Add vint configuratio to enforce more sensitive rules 2020-06-08 15:23:56 +03:00
Caleb Maclennan
6b49172f9b Remove obsolete (unmaintained) fold markers
The fold markers were unmaintained anyway and hence not working. No
folding is better than broken folding, and setting nothing allows user
configs such as language syntax based folding to work properly.
2020-06-08 15:21:00 +03:00
Caleb Maclennan
c3e308c2ca Drop rakefile historically used to cut releases
We no longer release this way at all, nor is this the way to install it
locally.
2020-06-08 15:17:05 +03:00
Caleb Maclennan
95af34d581 Merge pull request #412 from preservim/credits 2020-06-08 14:58:20 +03:00
Caleb Maclennan
be1a24d6d8 Backfill some Changelog data from Github releases 2020-06-08 14:57:15 +03:00
Caleb Maclennan
5e2aeffb03 Move change log to separate file for easier maintenance 2020-06-08 14:57:15 +03:00
Caleb Maclennan
700b7d2916 Update About section with current relevant links 2020-06-08 14:42:05 +03:00
Caleb Maclennan
90f7606234 Remove contributor list from help docs, link to Contributors
Not only is the list hopelessly out of date, it's almost impossible to
keep it up to date in any balance way. The only reasonably thing I could
think to put here would be a normalized list of authors scrapped from
git commit history, but Github's view of that is nicer anyway.
2020-06-08 14:35:34 +03:00
Caleb Maclennan
480799db6d Merge pull request #411 from preservim/license-cc0 2020-06-08 14:25:18 +03:00
Caleb Maclennan
8f375b0bbb Update help documentation with relicense to CC0 2020-06-08 14:23:07 +03:00
Caleb Maclennan
f72adff404 Remove obsolete file comments header
The days when vim plugins were distributed as individual files are long
gone, these days they are almost always git repositories or tarballs. As
such the relevant meta data is included, just not in this way. Not only
does this information have a habit of being absurdly out of date, it's
not really useful any more to try to update it.
2020-06-08 14:17:44 +03:00
Caleb Maclennan
97c79a541f Split push vs. pull_request lint tooling (#426) 2020-06-08 14:01:59 +03:00
Jaehwang Jerry Jung
c62e618a1a Make insert independent of whichwrap setting (#419)
If `set whichwrap+=l`, `normal! l` may move the cursor to the next line.
Use `feedkeys('a', 'ni')` instead.
2020-02-19 07:52:10 +03:00
Caleb Maclennan
cbadb3d93e Fix minor syntax error in help file, see #416 2020-01-25 13:33:48 +03:00
Caleb Maclennan
fa00e9820c Use Jinja comment style first, HTML as alternate (closes #414) 2020-01-23 23:36:27 +03:00
Caleb Maclennan
6f1f2894cb Use HTML comment syntax for Rmarkdown
Closes #415

While Markdown doesn't officially have a comment syntax, HTML comments
are widely parsed as such. This is what most Markdown treat as Markdown
comments. As a Markdown derivative it seams logical to do the same thing
in Rmarkdown.

The previously added '#' syntax seems to be for inside code blocks, and
that would be language dependent anyway. I've left the hash option as
the alternate.
2020-01-23 22:18:50 +03:00
Caleb Maclennan
96a6c3e452 Merge pull request #416 from li-zyang/feat_api_NERDCommentIsCharCommented
Feature: API 'NERDCommentIsCharCommented(line, col)'
2020-01-23 18:42:47 +02:00
li-zhaoyang
53f5710627 Added 'Interface' section to the documention 2020-01-21 14:42:18 +08:00
li-zhaoyang
eb6243c0c8 Finished and tested NERDCommentIsCharCommented() 2020-01-21 04:16:18 +08:00
li-zhaoyang
70b5b933cd First version of 'NERDCommentIsCharCommented' API (Untested) 2020-01-20 19:49:52 +08:00
Caleb Maclennan
ec16c09a0b Add blurb to readme about original author and current contribution status 2019-12-30 12:33:26 +03:00
Caleb Maclennan
e6510c1a71 Create LICENSE file for CC0 2019-12-30 12:21:34 +03:00
Caleb Maclennan
24df32304e Add automated PR review comments based on Vint linter (#410) 2019-12-30 11:25:16 +03:00
Caleb Maclennan
0384b5bf34 Merge pull request #409 from preservim/lint
Fix vimscript lint issues
2019-12-30 11:13:51 +03:00
Caleb Maclennan
6295aeba66 Fix lint warning: use the full option names 2019-12-30 11:12:01 +03:00
Caleb Maclennan
277986725d Fix lint warning: use robust operators 2019-12-30 11:10:13 +03:00
Caleb Maclennan
ac3db1e70a Fix lint warning: prefer single quoted strings 2019-12-30 10:59:03 +03:00
Caleb Maclennan
6d51d1b334 Fix VimL syntax error 2019-12-30 10:51:34 +03:00
Caleb Maclennan
8a68872933 Add vimscript linter as CI check 2019-12-30 10:42:26 +03:00
Caleb Maclennan
8786861a3c Update repository URLs with new org namespace
See https://github.com/preservim/nerdcommenter/issues/400

Old URLs will continue to work for the foreseeable future since Github
forwards them, but new users in particular should be encouraged to use
the new org namespace when installing the plugin.
2019-12-29 11:15:59 +03:00
Caleb Maclennan
f5525720ec Create FUNDING.yml 2019-12-29 11:15:59 +03:00
Jaskaran Singh
ce590719f6 Add semantic patch (.cocci) to delimiterMap (#408)
Coccinelle is a tool used for transforming C source code. It
uses the Semantic Patch Language (.cocci files) for doing this.
The conventional notation for commenting in semantic patches
is "//".

Used in conjunction with this plugin:

https://github.com/ahf/cocci-syntax

The cocci filetype is set, following which NERD_commenter can
be used in .cocci files.

Signed-off-by: Jaskaran Singh <jaskaransingh7654321@gmail.com>
2019-12-21 10:59:38 +03:00
Caleb Maclennan
023f2d10d5 Add snakemake filetype support, closes #313 2019-12-20 07:39:47 +03:00
Nicholas Cronquist
023cc20324 Add new delimiter for Hashicorp 'sentinel' files (#406)
- Sentinel is a new language developed by Hashicorp
- Sentinel supports three types of comments, `#` and `//` for single
  line comments and `/* ... */` for multi-line comments as described
  in their documentation - https://docs.hashicorp.com/sentinel/language/spec/#comments
  - Since sentinel and terraform, .tf extension, are related, the `#`
    symbol was chosen to keep in line with the tf single line comment
2019-11-26 10:11:36 +03:00
Rory Bradford
9208286236 Add syntax for troff family languages (#397) 2019-10-05 17:39:51 +03:00
Caleb Maclennan
a4b7c046b3 Fix Fluent file type as set by fluent.vim 2019-09-26 14:32:49 +03:00
horst5000
50f307bbf6 Change delimiters of CUDA to match the defaults of C/C++ 2019-09-20 09:34:14 +03:00
Caleb Maclennan
8228c7b0a7 Add comment syntax for FTL (Fluent) filetype 2019-09-13 14:30:20 +03:00
impulse
2504a3d84e Add comment styles for React filetypes .jsx/.tsx (#393)
Note that to-date there has not been an official vim filetype for
React-Javascript and React-Typescript. The `javascriptreact` and
`typescriptreact` filetypes were added upstream to both Vim (8.1.1890)
and NeoVim during the course of discussion on this PR.

Some other Vim plugins are known to use filetype hacks such as
`javascript.jsx` or `typescript.jsx`. This plugin supports the now
official upstream designations. If this conflicts with your usage you
can either tweak the other plugins (and/or submit a fix to use the
official filetypes upstream) or add custom file type comment setting in
your vim rc/init file.

Co-Authored-By: Caleb Maclennan <caleb@alerque.com>
2019-08-27 13:58:11 +03:00
Nagidal
a05185584d Added help section about the Leader key (#385) 2019-08-07 17:27:35 +03:00
ufengzh
df2f6825f4 Add proto filetype to support protobuf (#390) 2019-08-06 16:08:49 +03:00
Brent McKain
7f5c217f79 Add multipart/block comments to SQL filetype
Fixes #382
2019-07-03 16:47:32 +03:00
Edison Lim
14cd7719ac feat: added scilla support (#381) 2019-06-18 09:16:06 +03:00
Caleb Maclennan
17cec9747e Add Ledger file support 2019-06-08 14:12:40 +03:00
grenzionky
e6fd663def Add gdscript filetype (#378) 2019-06-04 16:58:21 +03:00
James P. Harvey
25c2920fe8 Update documentation for 11 year old NERDCommenter[A-Z] style (#377)
11 years ago, b54d3bb renamed NERDCom[A-Z] mappings to <plug>NERDCommenter[A-Z] mappings.  But, the docs were never updated.  When README.md was later created, it kept the old NERDCom[A-Z] names.

Split tag NERDComAlignedComment and use new form NERDCommenterAlign{Left,Both}

Update other help tags from NERDCom[A-Z] pattern to NERDCommenter[A-Z]
2019-06-02 09:32:34 +03:00
Jingchang Shi
17b68e47d7 Add an option: NERDDisableTabsInBlockComm (#374)
* Add an option: NERDDisableTabsInBlockComm. 1 disables adding tabs before the comment symbols in the block style.
* Add doc for the new option.
2019-04-17 12:11:07 +03:00
Lane
67950d4b5d Make g:NERDToggleCheckAllLines not check blank/whitespace-only lines (#355) 2019-04-17 09:49:38 +03:00
Caleb Maclennan
f46226bcd6 Remove apparently bogus filetype
I can't find any record of this being a legitimate filetype. It isn't in
vim or nvim's filetype detection system and nothing comes up in search.
If it's legit somebody can complain and we'll add it back, but it seems
likely this was left over from a fat-fingered mistake during the initial
development of the plugin.

Fixes #363
2019-03-07 12:00:42 +03:00
Caleb Maclennan
5100f47542 Add kivy file format, fixes #361 2019-02-14 09:50:24 +03:00
Caleb Maclennan
5ac43900e9 Strip trailing whitespace 2019-02-14 09:48:49 +03:00
MeNsaaH
3427b2f4ef updated Django comments (#359)
* updated Django comments
* Adding alternate comments for django
2019-02-04 12:13:20 +03:00
glegodais
371e4d0e09 Add support for Faust (#354) 2018-12-26 14:11:50 +03:00
Maarten van der Hoef
d24868bc85 Terraform replacing Transcript File (#350) 2018-12-03 16:22:57 +03:00
keysen
fdf950f20b Fix ruby comments, totally broken with =begin and =end (#340) 2018-07-31 20:29:13 +03:00
Zachary Churchill
f9dd87271a Swap default comment style to be more idiomatic of haskell (#343)
See discussion at https://github.com/scrooloose/nerdcommenter/pull/343
2018-07-28 06:52:07 +03:00
fcying
9a32fd2534 Add NERDToggleCheckAllLines option to NERDCommenterToggle (#334) 2018-06-21 11:06:22 +03:00
Jiaobuzuji
e679d8a341 Add support for 'sdc' filetype (#327) 2018-03-03 15:16:47 +03:00
dandersson
670dba1bb5 Add support for Robot Framework files (#323) 2018-02-07 12:19:12 +03:00
Sean
2f973bd4fa Fix Markdown formatting 2018-02-02 12:56:54 +03:00
tlsvc
ff3d8d7d7c Add support for ANSYS Parametric Design Language (apdl) (#317) 2018-01-13 11:47:04 +03:00
Alec Shaw
af8bb4258d Add support for Praat scripting language (#316)
[Praat][1] is a program for phonetics research which has a scripting interface.

[1]: http://www.fon.hum.uva.nl/praat/
2017-12-26 11:02:19 +03:00
Caleb Maclennan
fd61bc71f6 Udate version and date strings 2017-11-07 10:46:22 +03:00
Caleb Maclennan
3e99b39f4f Add sshconfig filetype to complement sshdconfig
Mentioned in #313
2017-11-07 10:38:04 +03:00
Caleb Maclennan
09b07d50ba Merge branch 'pr/266'
Closes #266
2017-11-07 10:17:06 +03:00
Caleb Maclennan
013cfec44d Merge branch 'pr/279'
Closes #279

Since original author of this PR has deleted their Github account
I squashed their two commits and added one to fix the issue with the
implementation as noted in the PR.
2017-11-07 10:12:51 +03:00
Caleb Maclennan
d4548ebb0c Fix implementation of renpy to not include python hack 2017-11-07 10:12:00 +03:00
Komeji Koishi
c321b3460b Added filetype 'renpy' support.
Renpy is an extension of python syntax and it uses '#' comments.
2017-11-07 10:11:59 +03:00
Carlos Eduardo de Andrade
63ba1a1123 Adding support to MiniZinc constraint modeling language. (#311) 2017-10-31 18:53:26 +02:00
Ratan
376838672d Add julia multiline comment chars (#312) 2017-10-31 18:52:28 +02:00
Caleb Maclennan
285902752f Cleanup code formatting in file support matrix 2017-04-07 11:53:35 +03:00
m-pilia
d1ac2382b2 add gl shaders language (#293) 2017-04-06 13:59:25 +03:00
Lyude
a6b3cc6842 Add support for piglit's shader_test files (#292)
This adds support for shader_test files in piglit, the open source
test suite for OpenGL implementations such as mesa. More information on
piglit can be found at:

https://piglit.freedesktop.org/
2017-03-25 13:19:06 +02:00
Caleb Maclennan
d05cfd190b Revert "add support for react/jsx comments (Closes #280) (#290)"
This reverts commit 0e1f6f6866.

Given the unexpected behaviour of this and disruption to people's
established work flows, I'm reverting this until a better solution can
be found that only handles the special comment format inside React code
blocks.
2017-03-15 13:18:09 +03:00
Lucas Charles
0e1f6f6866 add support for react/jsx comments (Closes #280) (#290) 2017-03-12 09:08:58 +02:00
Dylan Baker
41e686824a Add support for the meson build system. (#289) 2017-02-28 08:04:50 +02:00
Zack Youngren
59552f2e88 Add multi-line comments for Elm (#283)
Technically the minimum necessary syntax for block comments requires
only a single hyphen (`-}`, `{-`), but I have found that using a double
hyphen plays a bit more nicely with the elmcast/elm-vim auto-formatting.
Further, uncommenting when using the single dashes leaves an extra level
of indentation (again, when using elmcast/elm-vim).
2017-02-20 09:08:14 +02:00
Alexandr
c5f8cbf70d Fix removing space when uncommenting spaced AltDelims multipart comment (#286) 2017-02-20 09:03:41 +02:00
alejandrogallo
607253203d Add gitignore support (#284) 2017-01-22 08:05:45 +02:00
Chuck Wilson
18cfe81550 Add support for augeas file types (#277) 2016-12-15 10:06:26 +02:00
Chris Linstid
057f6150bd Add ansible file type (#276) 2016-11-17 07:01:25 +02:00
Jorge Marin
ecdde217c0 Remove trailing whitespace for top and bottom line (#269)
Fixes #268

Remove trailing whitespace for top and bottom line when uncommenting a sexy commented block.
2016-11-15 17:20:51 +02:00
Alejandro Gallo
e1af5dae7d Add support for molpro and vasp chemistry packages
Closes #275
2016-11-15 18:15:54 +03:00
Roland Hieber
97cb982f1f add support for M4 macro processor (#271)
M4 knows about two types of ignoring text.  But the concept which the
GNU M4 manual refers to as "comments" [0] (i.e., lines prefixed with
hash signs) is actually telling the interpreter "ignore this text, but
pass it to the output".  Most of the time, people don't want the macro
comments in their output, so instead the `dnl` ("discard to next line")
macro [1] is usually used for comments in the document-my-thoughts
sense.

[0]: https://www.gnu.org/software/m4/manual/m4.html#Comments
[1]: https://www.gnu.org/software/m4/manual/m4.html#Dnl
2016-10-10 17:24:21 +03:00
Caleb Maclennan
3d13266034 Add alternate delimiters for autohotkey (matching ahk)
Fixes #272
2016-10-10 17:21:01 +03:00
Aluriak
c51f5992b2 add support for turtle (.ttl) files 2016-09-10 01:20:29 +02:00
Caleb Maclennan
fdc611c8f4 Enable TrimTrailingWhitespace when commenting (#264)
Previously the `NERDTrimTrailingWhitespace` option was only evaluated when uncommenting a line. However sometimes trailing whitespace was being added when commenting, notably when commenting empty lines. This checks for and removes such space at comment time.
2016-08-31 11:42:37 +03:00
kaidiren
45689b2356 can enable TrimTrailingWhitespace when comment 2016-08-31 14:32:26 +08:00
Wael M. Nasreddine
c3d6a2069b README.md: fix vim-plug installation instructions (#254) 2016-07-14 13:13:26 +03:00
Keunchan Park
ec0f4753d0 Add hive filetype (#255) 2016-07-14 13:12:25 +03:00
Alexandre Constantino
e2d47bec26 Add option to allow deleting trailing whitespace (#251)
Add option g:NERDTrimTrailingWhitespace to allow deleting trailing
whitespace when uncommenting a line.
2016-06-10 17:49:17 +03:00
Alexandre Constantino
e1aeec12be Allow commenting empty lines given configuration (#250)
* Allow commenting empty lines given configuration

    If g:NERDCommentEmptyLines=1 then it will comment empty line, which is
    useful when commenting blocks.

    When uncommenting it will delete any trailing whitespace.

* Add documentation for NERDCommentEmptyLines
2016-06-08 17:00:05 +03:00
Caleb Maclennan
06c3184b2e Merge pull request #249 from xream/master
Add hook functions for NERDComment and SwitchToAlternativeDelimiters
2016-05-31 17:59:10 +03:00
Hsiaoyi Hsu
ce414bf622 Add filetype pug. Jade has been renamed to pug. 2016-05-31 22:30:37 +08:00
Hsiaoyi Hsu
dde288a9cc Add doc for NERDComHooks and fix doc of NERDComSexyComments and NERDComNERDComment 2016-05-31 22:27:10 +08:00
Hsiaoyi Hsu
7f07dcde28 Add hook functions for NERDComment and SwitchToAlternativeDelimiters 2016-05-31 14:28:56 +08:00
Caleb Maclennan
63bd306a7e Sort file type list alphabetically 2016-05-27 09:04:44 +03:00
Lucas Bourneuf
df647acefc fix asp support (doublon) 2016-05-27 08:59:05 +03:00
ARM9
e48cc752f3 Fix rust Alt comments (#248) 2016-05-26 17:25:29 +03:00
Alexander Alzate
4760e57514 Start Insertion in Append Mode When no Right Delim (#234) 2016-05-26 08:24:47 +03:00
dkim
c3afedbe22 Use getbufvar in an old-fashioned way for backward compatibility (#247)
getbufvar accepts only two arguments in Vim 7.3 (at least the one
included in OS X 10.11.5), and returns an empty string when the buffer
or variable does not exist: getbufvar({buffer}, {variable}).

Vim 7.4 has extended the built-in function so that it additionally
accepts an optional argument which determines the default return value:
getbufvar({buffer}, {variable}, [, {default}]). When the third argument
is not given and the buffer or variable does not exists, getbufvar
returns an empty string as before.

getbufvar({buffer}, {variable}) works in both Vim 7.3 and 7.4, and is
practically equivalent to getbufvar({buffer}, {variable}, 0) because an
empty string is coerced to 0 if necessary.
2016-05-25 23:17:10 +03:00
Caleb Maclennan
e91be123f0 Simplify and document the config key for toggling language defaults
Closes #33
2016-05-24 20:55:37 +03:00
Caleb Maclennan
8291af4c7c Merge pull request #155 from saep/master
Implement functionality to chose the alternative comment style
2016-05-24 20:50:59 +03:00
Caleb Maclennan
6af02e1442 Fix powershell blooper 2016-05-24 20:22:04 +03:00
Caleb Maclennan
9425289459 Add common settings and overhaul README formatting, esp. bindings section 2016-05-24 20:14:10 +03:00
Caleb Maclennan
9e8410e1b9 Overhaul installation instructions
See discussion in #241
2016-05-24 19:50:50 +03:00
Caleb Maclennan
d59f0b614f Merge pull request #241 from zwhitchcox/master
alternative pathogen download instructions
2016-05-24 19:09:56 +03:00
zane.hitchcox@one.verizon.com
1158546091 include entire repository in manual install 2016-05-24 11:09:20 -05:00
Zane Hitchcox
0cbbcb5674 alternative pathogen download instructions 2016-05-24 10:41:58 -05:00
Caleb Maclennan
ff0b875c8d Add alt delimiter to R filetype for Roxygen strings 2016-05-24 18:02:14 +03:00
Caleb Maclennan
e0c4a25696 Merge pull request #246 from stevenweaver/master
adding hyphy filetype
2016-05-24 17:42:48 +03:00
Caleb Maclennan
00e9729661 Add multiline delimiter support to ASY file type 2016-05-24 17:36:01 +03:00
Caleb Maclennan
1d07874610 Add ASP filetype support 2016-05-24 17:35:14 +03:00
Caleb Maclennan
560d7f0f77 Merge pull request #245 from hightemp/master
Add ruby multiline comment tags
2016-05-24 17:09:28 +03:00
Caleb Maclennan
0a186faad1 Merge pull request #244 from svermeulen/working
Add file format and function for identifying commented lines from outside plugin
2016-05-24 17:04:55 +03:00
Caleb Maclennan
32cd2b9362 Merge pull request #243 from sailorfeng/master
Add lpc filetype support
2016-05-24 16:57:44 +03:00
Caleb Maclennan
821fa9ad9e Merge pull request #242 from lanjiann/master
Pull in documentation updates from old fork (found in network graph)
2016-05-24 16:56:03 +03:00
Caleb Maclennan
264be25aa1 Use full English names when explaining functions 2016-05-24 16:24:20 +03:00
Caleb Maclennan
ec802fe1d3 Merge pull request #151 from klaasb/realnesting
Support automatic real nesting of comments without placeholders, if supported by the language.
2016-05-24 16:17:09 +03:00
Klaas Boesche
c2fc065b33 Automatic real nesting for languages with support
Removes the placeholder workaround (forceNested) for languages which
allow truly nested comments and automatically applies them.
Enabled for haskell, racket, scheme, scala, lisp, ocaml, sml.
Fixes issue #131
2016-05-24 13:52:21 +02:00
Steven Weaver
60bd8664ba adding hyphy filetype 2016-04-19 15:51:07 -04:00
Sebastian Witte
d4f41d2697 Use state variable to determine whether the alternate delimiters have already been switched 2015-01-14 18:14:08 +01:00
Sebastian Witte
59c79279b5 Implement functionality to configure alternate comment style (fixes #145)
The change requires the variable to have global scope which is also updated in
the documentation.
2014-09-30 12:04:12 +02:00
Anton Panov
1b62184305 Add ruby multiline comment tags 2014-07-30 01:54:34 +04:00
svermeulen
f1a23cde6d Fix for teak 2014-06-16 16:11:42 -03:00
Jian Lan
785386db76 Update NERD_commenter.txt
Add one empty line between every two items. Add a period at the end of a sentence:(regardless of whether NERDSpaceDelims is set)
2013-10-17 03:22:44 -06:00
Jian Lan
8c73eef0ea Update NERD_commenter.txt
Delete the excess the in "If the a selected line is commented then it is uncommented and vice versa. "
2013-10-17 02:52:26 -06:00
sailorfeng
289d2d64ec Update NERD_commenter.vim
add lpc support
2013-09-11 17:40:50 +08:00
svermeulen
fbe3bd3c35 Exposed function to check whether a line is commented 2013-05-25 15:31:00 -03:00
12 changed files with 1585 additions and 1043 deletions

1
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1 @@
github: [alerque, scrooloose]

16
.github/workflows/reviewdog.yml vendored Normal file
View 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
View 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
View File

@@ -1,3 +1,4 @@
*~
*.swp
tags
DEBUG

5
.vintrc.yaml Normal file
View File

@@ -0,0 +1,5 @@
cmdargs:
severity: style_problem
color: true
env:
neovim: false

96
CHANGELOG.md Normal file
View File

@@ -0,0 +1,96 @@
# Changelog
### 2.7.0
* Support for many more filetypes
* Sort out race condition when using utility functions directly
* Fixup undo support when commenting results in cursor moves
* Refactor comment insertion code
### 2.6.0
* Refactor code to run as autoload plugin
* Add lots of community contributed file types
* Fix several languages with idiosyncrasies
* Improve interoperability with other vim settings
* Improve handling of ranges
* Improve help documentation
* Cleanup and fix vimscript issues
### 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
View 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.

229
README.md
View File

@@ -1,95 +1,212 @@
# Installation
# NERD Commenter
_\*For simplicity, let's use **[VIM_ROOT]** which will mean ~/.vim (\*nix) or ~/vimfiles (Windows)_
[![Vint](https://github.com/preservim/nerdcommenter/workflows/Vint/badge.svg)](https://github.com/preservim/nerdcommenter/actions?workflow=Vint)
The NERD Commenter requires Vim 7 or higher is comprised of 2 files:
Comment functions so powerful—no comment necessary.
plugin/NERD_commenter.vim
doc/NERD_commenter.txt
## Installation
### Classic Install
### Via Plugin Manager (Recommended)
1. Extract the plugin files into your **[VIM_ROOT]**/plugin and **[VIM_ROOT]**/doc folders respectively.
2. Finish the install by updating your help files. Run:
<details>
<summary>Vim Plug</summary>
#### [Vim-Plug](https://github.com/junegunn/vim-plug)
<pre><code>:helptags [VIM_ROOT]/doc</code></pre>
1. Add `Plug 'preservim/nerdcommenter'` to your vimrc file.
2. Reload your vimrc or restart
3. Run `:PlugInstall`
See **|add-local-help|** for more details.
</details>
### Pathogen Install
1. Navigate to your **[VIM_ROOT]/bundle** directory in your local Vim setup
2. `git clone https://github.com/scrooloose/nerdcommenter.git`
<details>
<summary>Vundle</summary>
### Vundle Install
1. Add `Plugin 'scrooloose/nerdcommenter'` to your .vimrc file.
2. Run `:BundleInstall`
#### [Vundle](https://github.com/VundleVim/Vundle.vim) or similar
### Post Install
After the **'Classic'** or **'Pathogen'** install, make sure that you have filetype plugins enabled, as the script makes use of
**|'commentstring'|** where possible (which is usually set in a filetype plugin).
See **|filetype-plugin-on|** for details, but basically, stick this in your vimrc:
1. Add `Plugin 'preservim/nerdcommenter'` to your vimrc file.
2. Reload your vimrc or restart
3. Run `:BundleInstall`
filetype plugin on
</details>
# Usage
<details>
<summary>NeoBundle</summary>
#### [NeoBundle](https://github.com/Shougo/neobundle.vim)
The following key mappings are provided by default (there is also a menu
provided that contains menu items corresponding to all the below mappings):
1. Add `NeoBundle 'preservim/nerdcommenter'` to your vimrc file.
2. Reload your vimrc or restart
3. Run `:NeoUpdate`
Most of the following mappings are for normal/visual mode only. The |NERDComInsertComment| mapping is for insert mode only.
</details>
**[count]\<leader\>cc |NERDComComment|**
Comment out the current line or text selected in visual mode.
<details>
<summary>Pathogen</summary>
#### [Pathogen](https://github.com/tpope/vim-pathogen)
```sh
cd ~/.vim/bundle
git clone https://github.com/preservim/nerdcommenter.git
```
</details>
**[count]\<leader\>cn |NERDComNestedComment|**
Same as \<leader\>cc but forces nesting.
<details>
<summary>Vim 8+ Packages</summary>
git clone https://github.com/preservim/nerdcommenter.git ~/.vim/pack/vendor/start/nerdcommenter
</details>
**[count]\<leader\>c\<space\> |NERDComToggleComment|**
Toggles the comment state of the selected line(s). If the topmost selected
line is commented, all selected lines are uncommented and vice versa.
### Manual Installation
<details>
<summary>Unix</summary>
#### Unix
**[count]\<leader\>cm |NERDComMinimalComment|**
Comments the given lines using only one set of multipart delimiters.
(For Neovim, change `~/.vim/` to `~/.config/nvim/`.)
```sh
curl -fLo ~/.vim/plugin/nerdcommenter.vim --create-dirs \
https://raw.githubusercontent.com/preservim/nerdcommenter/master/plugin/nerdcommenter.vim
curl -fLo ~/.vim/doc/nerdcommenter.txt --create-dirs \
https://raw.githubusercontent.com/preservim/nerdcommenter/master/doc/nerdcommenter.txt
curl -fLo ~/.vim/autoload/nerdcommenter.vim --create-dirs \
https://raw.githubusercontent.com/preservim/nerdcommenter/master/autoload/nerdcommenter.vim
```
</details>
**[count]\<leader\>ci |NERDComInvertComment|**
Toggles the comment state of the selected line(s) individually.
<details>
<summary>Windows</summary>
#### Windows (PowerShell)
```powershell
md ~\vimfiles\plugin
md ~\vimfiles\doc
$pluguri = 'https://raw.githubusercontent.com/preservim/nerdcommenter/master/plugin/nerdcommenter.vim'
$docsuri = 'https://raw.githubusercontent.com/preservim/nerdcommenter/master/doc/nerdcommenter.txt'
(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\nerdcommenter.txt"))
```
</details>
**[count]\<leader\>cs |NERDComSexyComment|**
Comments out the selected lines ``sexily''
### Post Installation
Make sure that you have filetype plugins enabled, as the plugin makes use of **|commentstring|** where possible (which is usually set in a filetype plugin). See **|filetype-plugin-on|** for details, but the short version is make sure this line appears in your vimrc:
**[count]\<leader\>cy |NERDComYankComment|**
Same as \<leader\>cc except that the commented line(s) are yanked first.
```sh
filetype plugin on
```
## Usage
**\<leader\>c$ |NERDComEOLComment|**
Comments the current line from the cursor to the end of line.
### Documentation
Please see the vim help system for full documentation of all options: `:help nerdcommenter`
**\<leader\>cA |NERDComAppendComment|**
Adds comment delimiters to the end of line and goes into insert mode between
them.
### Settings
Several settings can be added to your vimrc to change the default behavior. Some examples:
**|NERDComInsertComment|**
Adds comment delimiters at the current cursor position and inserts between.
Disabled by default.
```vim
" Create default mappings
let g:NERDCreateDefaultMappings = 1
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
**\<leader\>ca |NERDComAltDelim|**
Switches to the alternative set of delimiters.
" Use compact syntax for prettified multi-line comments
let g:NERDCompactSexyComs = 1
" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'
**[count]\<leader\>cl**
**[count]\<leader\>cb |NERDComAlignedComment|**
Same as |NERDComComment| except that the delimiters are aligned down the
left side (\<leader\>cl) or both sides (\<leader\>cb).
" Set a language to use its alternate delimiters by default
let g:NERDAltDelims_java = 1
" Add your own custom formats or override the defaults
let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } }
**[count]\<leader\>cu |NERDComUncommentLine|**
Uncomments the selected line(s).
" Allow commenting and inverting empty lines (useful when commenting a region)
let g:NERDCommentEmptyLines = 1
" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1
" Enable NERDCommenterToggle to check all selected lines is commented or not
let g:NERDToggleCheckAllLines = 1
```
### 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):
Most of the following mappings are for normal/visual mode only. The **|NERDCommenterInsert|** mapping is for insert mode only.
* `[count]<leader>cc` **|NERDCommenterComment|**
Comment out the current line or text selected in visual mode.
* `[count]<leader>cn` **|NERDCommenterNested|**
Same as <leader>cc but forces nesting.
* `[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.
* `[count]<leader>cm` **|NERDCommenterMinimal|**
Comments the given lines using only one set of multipart delimiters.
* `[count]<leader>ci` **|NERDCommenterInvert|**
Toggles the comment state of the selected line(s) individually.
* `[count]<leader>cs` **|NERDCommenterSexy|**
Comments out the selected lines with a pretty block formatted layout.
* `[count]<leader>cy` **|NERDCommenterYank|**
Same as <leader>cc except that the commented line(s) are yanked first.
* `<leader>c$` **|NERDCommenterToEOL|**
Comments the current line from the cursor to the end of line.
* `<leader>cA` **|NERDCommenterAppend|**
Adds comment delimiters to the end of line and goes into insert mode between them.
* **|NERDCommenterInsert|**
Adds comment delimiters at the current cursor position and inserts between. Disabled by default.
* `<leader>ca` **|NERDCommenterAltDelims|**
Switches to the alternative set of delimiters.
* `[count]<leader>cl` **|NERDCommenterAlignLeft**
`[count]<leader>cb` **|NERDCommenterAlignBoth**
Same as **|NERDCommenterComment|** except that the delimiters are aligned down the left side (`<leader>cl`) or both sides (`<leader>cb`).
* `[count]<leader>cu` **|NERDCommenterUncomment|**
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 nerdcommenter#Comment('x', 'toggle')<CR>
nnoremap <silent> <leader>c{ V{:call nerdcommenter#Comment('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.

View File

@@ -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

View File

@@ -1,4 +1,4 @@
*NERD_commenter.txt* Plugin for commenting code
*nerdcommenter.txt* Plugin for commenting code
NERD COMMENTER REFERENCE MANUAL~
@@ -11,37 +11,41 @@
CONTENTS *NERDCommenterContents*
1.Intro...................................|NERDCommenter|
2.Installation............................|NERDComInstallation|
3.Functionality provided..................|NERDComFunctionality|
3.1 Functionality Summary.............|NERDComFunctionalitySummary|
3.2 Functionality Details.............|NERDComFunctionalityDetails|
3.2.1 Comment map.................|NERDComComment|
3.2.2 Nested comment map..........|NERDComNestedComment|
3.2.3 Toggle comment map..........|NERDComToggleComment|
3.2.4 Minimal comment map.........|NERDComMinimalComment|
3.2.5 Invert comment map..........|NERDComInvertComment|
3.2.6 Sexy comment map............|NERDComSexyComment|
3.2.7 Yank comment map............|NERDComYankComment|
3.2.8 Comment to EOL map..........|NERDComEOLComment|
3.2.9 Append com to line map......|NERDComAppendComment|
3.2.10 Insert comment map.........|NERDComInsertComment|
3.2.11 Use alternate delims map...|NERDComAltDelim|
3.2.12 Comment aligned maps.......|NERDComAlignedComment|
3.2.13 Uncomment line map.........|NERDComUncommentLine|
3.4 Sexy Comments.....................|NERDComSexyComments|
3.5 The NERDComment function..........|NERDComNERDComment|
4.Options.................................|NERDComOptions|
4.1 Options summary...................|NERDComOptionsSummary|
4.2 Options details...................|NERDComOptionsDetails|
4.3 Default delimiter Options.........|NERDComDefaultDelims|
5. Customising key mappings...............|NERDComMappings|
6. Issues with the script.................|NERDComIssues|
6.1 Delimiter detection heuristics....|NERDComHeuristics|
6.2 Nesting issues....................|NERDComNesting|
7.About.. ............................|NERDComAbout|
8.Changelog...............................|NERDComChangelog|
9.Credits.................................|NERDComCredits|
10.License................................|NERDComLicense|
1.1 Leader............................|NERDCommenterLeader|
2.Installation............................|NERDCommenterInstallation|
3.Functionality provided..................|NERDCommenterFunctionality|
3.1 Functionality Summary.............|NERDCommenterFunctionalitySummary|
3.2 Functionality Details.............|NERDCommenterFunctionalityDetails|
3.2.1 Comment map.................|NERDCommenterComment|
3.2.2 Nested comment map..........|NERDCommenterNested|
3.2.3 Toggle comment map..........|NERDCommenterToggle|
3.2.4 Minimal comment map.........|NERDCommenterMinimal|
3.2.5 Invert comment map..........|NERDCommenterInvert|
3.2.6 Sexy comment map............|NERDCommenterSexy|
3.2.7 Yank comment map............|NERDCommenterYank|
3.2.8 Comment to EOL map..........|NERDCommenterToEOL|
3.2.9 Append com to line map......|NERDCommenterAppend|
3.2.10 Insert comment map.........|NERDCommenterInsert|
3.2.11 Use alternate delims map...|NERDCommenterAltDelims|
3.2.12 Comment aligned maps.......|NERDCommenterAlignLeft|
|NERDCommenterAlignBoth|
3.2.13 Uncomment line map.........|NERDCommenterUncomment|
3.3 Sexy Comments.....................|NERDCommenterSexyComments|
3.4 The NERDComment function..........|NERDCommenterNERDComment|
3.5 The Hooks.........................|NERDCommenterHooks|
4.Options.................................|NERDCommenterOptions|
4.1 Options summary...................|NERDCommenterOptionsSummary|
4.2 Options details...................|NERDCommenterOptionsDetails|
4.3 Default delimiter Options.........|NERDCommenterDefaultDelims|
5. Customising key mappings...............|NERDCommenterMappings|
6. Interfaces.............................|NERDCommenterInterfaces|
7. Issues with the script.................|NERDCommenterIssues|
7.1 Delimiter detection heuristics....|NERDCommenterHeuristics|
7.2 Nesting issues....................|NERDCommenterNesting|
8.About.. ............................|NERDCommenterAbout|
9.Changelog...............................|NERDCommenterChangelog|
10.Credits................................|NERDCommenterCredits|
11.License................................|NERDCommenterLicense|
==============================================================================
1. Intro *NERDCommenter*
@@ -53,15 +57,29 @@ for most filetypes.
There are also options that allow to tweak the commenting engine to your
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.
Extract the plugin files in your ~/.vim (*nix) or ~/vimfiles (Windows). You
should have 2 files: >
plugin/NERD_commenter.vim
doc/NERD_commenter.txt
plugin/nerdcommenter.vim
doc/nerdcommenter.txt
<
Next, to finish installing the help file run: >
:helptags ~/.vim/doc
@@ -75,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
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.
[count]|<Leader>|cn |NERDComNestedComment|
[count]|<Leader>|cn |NERDCommenterNested|
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.
[count]|<Leader>|cm |NERDComMinimalComment|
[count]|<Leader>|cm |NERDCommenterMinimal|
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.
[count]|<Leader>|cs |NERDComSexyComment|
[count]|<Leader>|cs |NERDCommenterSexy|
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.
|<Leader>|c$ |NERDComEOLComment|
|<Leader>|c$ |NERDCommenterToEOL|
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.
|NERDComInsertComment|
|NERDCommenterInsert|
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.
[count]|<Leader>|cl
[count]|<Leader>|cb |NERDComAlignedComment|
Same as |NERDComComment| except that the delimiters are aligned down the
[count]|<Leader>|cl |NERDCommenterAlignLeft|
[count]|<Leader>|cb |NERDCommenterAlignBoth|
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).
@@ -144,10 +162,10 @@ With the optional repeat.vim plugin (vimscript #2136), the mappings can also
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
Mapped to: <plug>NERDCommenterComment
@@ -163,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.
------------------------------------------------------------------------------
3.2.2 Nested comment map *NERDComNestedComment*
3.2.2 Nested comment map *NERDCommenterNested*
Default mapping: [count]|<Leader>|cn
Mapped to: <plug>NERDCommenterNested
@@ -184,7 +202,7 @@ Related options:
|'NERDDefaultNesting'|
------------------------------------------------------------------------------
3.2.3 Toggle comment map *NERDComToggleComment*
3.2.3 Toggle comment map *NERDCommenterToggle*
Default mapping: [count]|<Leader>|c<space>
Mapped to: <plug>NERDCommenterToggle
@@ -201,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.
------------------------------------------------------------------------------
3.2.4 Minimal comment map *NERDComMinimalComment*
3.2.4 Minimal comment map *NERDCommenterMinimal*
Default mapping: [count]|<Leader>|cm
Mapped to: <plug>NERDCommenterMinimal
@@ -223,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.
------------------------------------------------------------------------------
3.2.5 Invert comment map *NERDComInvertComment*
3.2.5 Invert comment map *NERDCommenterInvert*
Default mapping: |<Leader>|ci
Mapped to: <plug>NERDCommenterInvert
@@ -240,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.
------------------------------------------------------------------------------
3.2.6 Sexy comment map *NERDComSexyComment*
3.2.6 Sexy comment map *NERDCommenterSexy*
Default mapping: [count]|<Leader>|cs
Mapped to: <plug>NERDCommenterSexy
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
which there is at least one set of multipart comment delimiters specified.
@@ -260,7 +278,7 @@ Related options:
|'NERDCompactSexyComs'|
------------------------------------------------------------------------------
3.2.7 Yank comment map *NERDComYankComment*
3.2.7 Yank comment map *NERDCommenterYank*
Default mapping: [count]|<Leader>|cy
Mapped to: <plug>NERDCommenterYank
@@ -269,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.
------------------------------------------------------------------------------
3.2.8 Comment to EOL map *NERDComEOLComment*
3.2.8 Comment to EOL map *NERDCommenterToEOL*
Default mapping: |<Leader>|c$
Mapped to: <plug>NERDCommenterToEOL
@@ -279,7 +297,7 @@ Comments the current line from the current cursor position up to the end of
the line.
------------------------------------------------------------------------------
3.2.9 Append com to line map *NERDComAppendComment*
3.2.9 Append com to line map *NERDCommenterAppend*
Default mapping: |<Leader>|cA
Mapped to: <plug>NERDCommenterAppend
@@ -289,7 +307,7 @@ Appends comment delimiters to the end of the current line and goes
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.
Map it to: <plug>NERDCommenterInsert
@@ -305,7 +323,7 @@ mapping add >
to your vimrc.
------------------------------------------------------------------------------
3.2.11 Use alternate delims map *NERDComAltDelim*
3.2.11 Use alternate delims map *NERDCommenterAltDelims*
Default mapping: |<Leader>|ca
Mapped to: <plug>NERDCommenterAltDelims
@@ -315,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
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
Mapped to: <plug>NERDCommenterAlignLeft
@@ -333,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.
------------------------------------------------------------------------------
3.2.13 Uncomment line map *NERDComUncommentLine*
3.2.13 Uncomment line map *NERDCommenterUncomment*
Default mapping: [count]|<Leader>|cu
Mapped to: <plug>NERDCommenterUncomment
@@ -346,7 +365,7 @@ When uncommenting, if the line contains multiple sets of delimiters then the
``outermost'' pair of delimiters will be removed.
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
lines were selected in visual-line mode.
@@ -356,7 +375,7 @@ Related options:
|'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
one other marker symbol. For example: >
/*
@@ -371,7 +390,7 @@ one other marker symbol. For example: >
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
which delegates the commenting work to other functions. This function is
@@ -391,54 +410,107 @@ For example, if you typed >
<
then the script would do a sexy comment on the last visual selection.
------------------------------------------------------------------------------
3.5 The hooks *NERDCommenterHooks*
|fu! NERDCommenter_before()| Before NERDComment/SwitchToAlternativeDelimiters
|fu! NERDCommenter_after()| After NERDComment/SwitchToAlternativeDelimiters
For example, in order to handle different language blocks embedded in the same
file such as |vim-vue|, you can change the filetype, comment something and
change the filetype back: >
let g:ft = ''
fu! NERDCommenter_before()
if &ft == 'vue'
let g:ft = 'vue'
let stack = synstack(line('.'), col('.'))
if len(stack) > 0
let syn = synIDattr((stack)[0], 'name')
if len(syn) > 0
let syn = tolower(syn)
exe 'setf '.syn
endif
endif
endif
endfu
fu! NERDCommenter_after()
if g:ft == 'vue'
setf vue
let g:ft = ''
endif
endfu
<
==============================================================================
4. Options *NERDComOptions*
4. Options *NERDCommenterOptions*
------------------------------------------------------------------------------
4.1 Options summary *NERDComOptionsSummary*
4.1 Options summary *NERDCommenterOptionsSummary*
|'loaded_nerd_comments'| Turns off the script.
|'NERDAllowAnyVisualDelims'| Allows multipart alternative delimiters
to be used when commenting in
visual/visual-block mode.
|'NERDBlockComIgnoreEmpty'| Forces right delimiters to be placed
when doing visual-block comments.
|'NERDCommentEmptyLines'| Specifies if empty lines should be
commented (useful with regions).
|'NERDCommentWholeLinesInVMode'| Changes behaviour of visual comments.
|'NERDCreateDefaultMappings'| Turn the default mappings on/off.
|'NERDCustomDelimiters'| Add or override delimiters for any
filetypes.
|'NERDDefaultNesting'| Tells the script to use nested comments
by default.
|'NERDMenuMode'| Specifies how the NERD commenter menu
will appear (if at all).
|'NERDLPlace'| Specifies what to use as the left
delimiter placeholder when nesting
comments.
|'NERDUsePlaceHolders'| Specifies which filetypes may use
placeholders when nesting comments.
|'NERDRemoveAltComs'| Tells the script whether to remove
alternative comment delimiters when
uncommenting.
|'NERDRemoveExtraSpaces'| Tells the script to always remove the
extra spaces when uncommenting
(regardless of whether NERDSpaceDelims
is set)
is set).
|'NERDRPlace'| Specifies what to use as the right
delimiter placeholder when nesting
comments.
|'NERDSpaceDelims'| Specifies whether to add extra spaces
around delimiters when commenting, and
whether to remove them when
uncommenting.
|'NERDTrimTrailingWhitespace'| Specifies if trailing whitespace
should be deleted when uncommenting.
|'NERDCompactSexyComs'| Specifies whether to use the compact
style sexy comments.
|'NERDDefaultAlign'| Specifies the default alignment to use,
one of 'none', 'left', 'start', or
'both'.
|'NERDToggleCheckAllLines'| Enable NERDCommenterToggle to check
all selected lines is commented or not.
------------------------------------------------------------------------------
4.3 Options details *NERDComOptionsDetails*
4.2 Options details *NERDCommenterOptionsDetails*
To enable any of the below options you should put the given line in your
~/.vimrc
@@ -514,6 +586,15 @@ Otherwise, the code block would become: >
}
/*} */
<
------------------------------------------------------------------------------
*'NERDCommentEmptyLines'*
Values: 0 or 1.
Default: 0.
This option affects commenting of empty lines. If this option is turned on,
then empty lines will be commented as well. Useful when commenting regions of
code.
------------------------------------------------------------------------------
*'NERDCommentWholeLinesInVMode'*
Values: 0, 1 or 2.
@@ -563,7 +644,7 @@ Default: 1.
If set to 0, none of the default mappings will be created.
See also |NERDComMappings|.
See also |NERDCommenterMappings|.
------------------------------------------------------------------------------
*'NERDCustomDelimiters'*
@@ -692,6 +773,15 @@ If you want spaces to be added then set NERDSpaceDelims to 1 in your vimrc.
See also |'NERDRemoveExtraSpaces'|.
------------------------------------------------------------------------------
*'NERDTrimTrailingWhitespace'*
Values: 0 or 1.
Default 0.
When uncommenting an empty line some whitespace may be left as a result of
alignment padding. With this option enabled any trailing whitespace will be
deleted when uncommenting a line.
------------------------------------------------------------------------------
*'NERDDefaultAlign'*
Values: 'none', 'left', 'start', 'both'
@@ -732,24 +822,57 @@ you hit |<Leader>|cc on a line that is already commented it will be commented
again.
------------------------------------------------------------------------------
3.3 Default delimiter customisation *NERDComDefaultDelims*
*'NERDToggleCheckAllLines'*
Values: 0 or 1.
Default 0.
When this option is set to 1, NERDCommenterToggle will check all selected line,
if there have oneline not be commented, then comment all lines.
------------------------------------------------------------------------------
*'NERDDisableTabsInBlockComm'*
Values: 0 or 1.
Default 0.
When this option is set to 1, NERDDisableTabsInBlockComm will not add
whitespaces align the start location of the ending comment symbol with the
end location of the starting comment symbol. For example, in Fortran, the new
style will be as the following: >
close (inpt,iostat=ierr,iomsg=error_message)
call io_error(pname,input_fname,2,__LINE__,__FILE__,ierr,error_message)
<
to >
!===BEGIN===!
! close (inpt,iostat=ierr,iomsg=error_message)
! call io_error(pname,input_fname,2,__LINE__,__FILE__,ierr,error_message)
!===END===!
<
for the block comment style if customized comment symbols are set up in vimrc
file by the following line >
let g:NERDCustomDelimiters = {
\ 'fortran':{'left':'!','leftAlt':'!===BEGIN===!','rightAlt':'!===END===!'}
\ }
<
------------------------------------------------------------------------------
4.3 Default delimiter customisation *NERDCommenterDefaultDelims*
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: >
let NERD_<filetype>_alt_style=1
let g:NERDAltDelims_<filetype> = 1
<
Example: java uses // style comments by default, but you want it to default to
/* */ style comments instead. You would put this line in your vimrc: >
let NERD_java_alt_style=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.
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: >
map ,omg <plug>NERDCommenterComment
<
@@ -761,11 +884,46 @@ map to.
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
@@ -785,7 +943,7 @@ string. These heuristics, while usually pretty accurate, will not work for all
cases.
------------------------------------------------------------------------------
6.2 Nesting issues *NERDComNesting*
7.2 Nesting issues *NERDCommenterNesting*
If we have some line of code like this: >
/*int foo */ = /*5 + 9;*/
@@ -805,227 +963,42 @@ will become: >
for simplicity)
==============================================================================
7. About *NERDComAbout*
8. About *NERDCommenterAbout*
The author of the NERD commenter is Martyzillatron --- the half robot, half
dinosaur bastard son of Megatron and Godzilla. He enjoys destroying
metropolises and eating tourist buses.
This plugin was originally written in 2007 by Martin Grenfell, aka @scrooloose
on Github: https://github.com/scrooloose
Drop him a line at martin_grenfell at msn.com. He would love to hear from you.
It's a lonely life being the worlds premier terror machine. How would you feel
if your face looked like a toaster and a t-rex put together? :(
Since 2016 it has been maintained primarily by Caleb Maclennan, aka @alerque
on Github: https://github.com/alerque
The latest stable versions can be found at
http://www.vim.org/scripts/script.php?script_id=1218
Lots of features and many of the supported filetypes have come from the
community, see |NERDCommenterCredits|.
The latest dev versions are on github
http://github.com/scrooloose/nerdcommenter
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: https://github.com/preservim/nerdcommenter
==============================================================================
8. Changelog *NERDComChangelog*
9. Changelog *NERDCommenterChangelog*
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
See the included CHANGELOG.md file or the Github Releases page for the latest
info on tagged releases. https://github.com/preservim/nerdcommenter/releases
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
NERDComInsertComment if you wish to restore it
The `master` branch is considered stable and will have the latest filetype
support and bugfixes.
==============================================================================
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
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.
https://github.com/preservim/nerdcommenter/graphs/contributors
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
==============================================================================
10. License *NERDComLicense*
11. License *NERDCommenterLicense*
The NERD commenter is released under the wtfpl.
See http://sam.zoy.org/wtfpl/COPYING.
NERD Commenter is released under the Creative-Commons CCO 1.0 Universal
license. See the included LICENE file for details.

131
plugin/nerdcommenter.vim Normal file
View File

@@ -0,0 +1,131 @@
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)
call s:InitVariable('g:NERDSuppressWarnings', 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', '')
" Shim functions so old code gets passed through to the autoload functions
function! NERDComment(mode, type) range
if !g:NERDSuppressWarnings
echom 'Function NERDComment() has been deprecated, please use nerdcommenter#Comment() instead'
endif
if a:firstline != a:lastline
echoerr "Sorry! We can't pass a range through this deprecation shim, please update your code."
return v:false
endif
return nerdcommenter#Comment(a:mode, a:type)
endfunction
function! NERDCommentIsLineCommented(lineNo)
if !g:NERDSuppressWarnings
echom 'Function NERDCommentIsLineCommented() has been deprecated, please use nerdcommenter#IsLineCommented() instead'
endif
return nerdcommenter#IsLineCommented(a:lineNo)
endfunction
function! NERDCommentIsCharCommented(line, col)
if !g:NERDSuppressWarnings
echom 'Function NERDCommentIsCharCommented() has been deprecated, please use nerdcommenter#IsCharCommented() instead'
endif
return nerdcommenter#IsCharCommented(a:line, a:col)
endfunction
inoremap <silent> <Plug>NERDCommenterInsert <C-\><C-O>:call nerdcommenter#Comment('i', "Insert")<CR>
" switch to/from alternative delimiters (does not use wrapper function)
nnoremap <Plug>NERDCommenterAltDelims :call nerdcommenter#SwitchToAlternativeDelimiters(1)<CR>