mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-11-08 09:53:47 -05:00
Compare commits
73 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a32fd2534 | ||
|
|
e679d8a341 | ||
|
|
670dba1bb5 | ||
|
|
2f973bd4fa | ||
|
|
ff3d8d7d7c | ||
|
|
af8bb4258d | ||
|
|
fd61bc71f6 | ||
|
|
3e99b39f4f | ||
|
|
09b07d50ba | ||
|
|
013cfec44d | ||
|
|
d4548ebb0c | ||
|
|
c321b3460b | ||
|
|
63ba1a1123 | ||
|
|
376838672d | ||
|
|
285902752f | ||
|
|
d1ac2382b2 | ||
|
|
a6b3cc6842 | ||
|
|
d05cfd190b | ||
|
|
0e1f6f6866 | ||
|
|
41e686824a | ||
|
|
59552f2e88 | ||
|
|
c5f8cbf70d | ||
|
|
607253203d | ||
|
|
18cfe81550 | ||
|
|
057f6150bd | ||
|
|
ecdde217c0 | ||
|
|
e1af5dae7d | ||
|
|
97cb982f1f | ||
|
|
3d13266034 | ||
|
|
c51f5992b2 | ||
|
|
fdc611c8f4 | ||
|
|
45689b2356 | ||
|
|
c3d6a2069b | ||
|
|
ec0f4753d0 | ||
|
|
e2d47bec26 | ||
|
|
e1aeec12be | ||
|
|
06c3184b2e | ||
|
|
ce414bf622 | ||
|
|
dde288a9cc | ||
|
|
7f07dcde28 | ||
|
|
63bd306a7e | ||
|
|
df647acefc | ||
|
|
e48cc752f3 | ||
|
|
4760e57514 | ||
|
|
c3afedbe22 | ||
|
|
e91be123f0 | ||
|
|
8291af4c7c | ||
|
|
6af02e1442 | ||
|
|
9425289459 | ||
|
|
9e8410e1b9 | ||
|
|
d59f0b614f | ||
|
|
1158546091 | ||
|
|
0cbbcb5674 | ||
|
|
ff0b875c8d | ||
|
|
e0c4a25696 | ||
|
|
00e9729661 | ||
|
|
1d07874610 | ||
|
|
560d7f0f77 | ||
|
|
0a186faad1 | ||
|
|
32cd2b9362 | ||
|
|
821fa9ad9e | ||
|
|
264be25aa1 | ||
|
|
ec802fe1d3 | ||
|
|
c2fc065b33 | ||
|
|
60bd8664ba | ||
|
|
d4f41d2697 | ||
|
|
59c79279b5 | ||
|
|
1b62184305 | ||
|
|
f1a23cde6d | ||
|
|
785386db76 | ||
|
|
8c73eef0ea | ||
|
|
289d2d64ec | ||
|
|
fbe3bd3c35 |
176
README.md
176
README.md
@@ -1,95 +1,159 @@
|
||||
# Installation
|
||||
# NERD Commenter
|
||||
|
||||
_\*For simplicity, let's use **[VIM_ROOT]** which will mean ~/.vim (\*nix) or ~/vimfiles (Windows)_
|
||||
Comment functions so powerful—no comment necessary.
|
||||
|
||||
The NERD Commenter requires Vim 7 or higher is comprised of 2 files:
|
||||
## Installation
|
||||
|
||||
plugin/NERD_commenter.vim
|
||||
doc/NERD_commenter.txt
|
||||
### Via Plugin Manager (Recommended)
|
||||
|
||||
### Classic Install
|
||||
#### [Vim-Plug](https://github.com/junegunn/vim-plug)
|
||||
|
||||
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:
|
||||
1. Add `Plug 'scrooloose/nerdcommenter'` to your vimrc file.
|
||||
2. Reload your vimrc or restart
|
||||
3. Run `:PlugInstall`
|
||||
|
||||
<pre><code>:helptags [VIM_ROOT]/doc</code></pre>
|
||||
#### [Vundle](https://github.com/VundleVim/Vundle.vim) or similar
|
||||
|
||||
See **|add-local-help|** for more details.
|
||||
1. Add `Plugin 'scrooloose/nerdcommenter'` to your vimrc file.
|
||||
2. Reload your vimrc or restart
|
||||
3. Run `:BundleInstall`
|
||||
|
||||
### Pathogen Install
|
||||
1. Navigate to your **[VIM_ROOT]/bundle** directory in your local Vim setup
|
||||
2. `git clone https://github.com/scrooloose/nerdcommenter.git`
|
||||
#### [NeoBundle](https://github.com/Shougo/neobundle.vim)
|
||||
|
||||
### Vundle Install
|
||||
1. Add `Plugin 'scrooloose/nerdcommenter'` to your .vimrc file.
|
||||
2. Run `:BundleInstall`
|
||||
1. Add `NeoBundle 'scrooloose/nerdcommenter'` to your vimrc file.
|
||||
2. Reload your vimrc or restart
|
||||
3. Run `:NeoUpdate`
|
||||
|
||||
### 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:
|
||||
#### [Pathogen](https://github.com/tpope/vim-pathogen)
|
||||
|
||||
filetype plugin on
|
||||
```sh
|
||||
cd ~/.vim/bundle
|
||||
git clone https://github.com/scrooloose/nerdcommenter.git
|
||||
```
|
||||
|
||||
# Usage
|
||||
### Manual Installation
|
||||
|
||||
The following key mappings are provided by default (there is also a menu
|
||||
provided that contains menu items corresponding to all the below mappings):
|
||||
#### Unix
|
||||
|
||||
Most of the following mappings are for normal/visual mode only. The |NERDComInsertComment| mapping is for insert mode only.
|
||||
(For Neovim, change `~/.vim/` to `~/.config/nvim/`.)
|
||||
|
||||
**[count]\<leader\>cc |NERDComComment|**
|
||||
Comment out the current line or text selected in visual mode.
|
||||
```sh
|
||||
curl -fLo ~/.vim/plugin/NERD_Commenter.vim --create-dirs \
|
||||
https://raw.githubusercontent.com/scrooloose/nerdcommenter/master/plugin/NERD_commenter.vim
|
||||
curl -fLo ~/.vim/doc/NERD_Commenter.txt --create-dirs \
|
||||
https://raw.githubusercontent.com/scrooloose/nerdcommenter/master/doc/NERD_commenter.txt
|
||||
```
|
||||
|
||||
#### Windows (PowerShell)
|
||||
|
||||
**[count]\<leader\>cn |NERDComNestedComment|**
|
||||
Same as \<leader\>cc but forces nesting.
|
||||
```powershell
|
||||
md ~\vimfiles\plugin
|
||||
md ~\vimfiles\doc
|
||||
$pluguri = 'https://raw.githubusercontent.com/scrooloose/nerdcommenter/master/plugin/NERD_commenter.vim'
|
||||
$docsuri = 'https://raw.githubusercontent.com/scrooloose/nerdcommenter/master/doc/NERD_commenter.txt'
|
||||
(New-Object Net.WebClient).DownloadFile($pluguri, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("~\vimfiles\plugin\NERD_commenter.vim"))
|
||||
(New-Object Net.WebClient).DownloadFile($docsuri, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("~\vimfiles\doc\NERD_commenter.txt"))
|
||||
```
|
||||
|
||||
### Post Installation
|
||||
|
||||
**[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.
|
||||
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:
|
||||
|
||||
```sh
|
||||
filetype plugin on
|
||||
```
|
||||
|
||||
**[count]\<leader\>cm |NERDComMinimalComment|**
|
||||
Comments the given lines using only one set of multipart delimiters.
|
||||
## Usage
|
||||
|
||||
### Documentation
|
||||
|
||||
**[count]\<leader\>ci |NERDComInvertComment|**
|
||||
Toggles the comment state of the selected line(s) individually.
|
||||
Please see the vim help system for full documentation of all options: `:help nerdcommenter`
|
||||
|
||||
### Settings
|
||||
|
||||
**[count]\<leader\>cs |NERDComSexyComment|**
|
||||
Comments out the selected lines ``sexily''
|
||||
Several settings can be added to your vimrc to change the default behavior. Some examples:
|
||||
|
||||
```vim
|
||||
" Add spaces after comment delimiters by default
|
||||
let g:NERDSpaceDelims = 1
|
||||
|
||||
**[count]\<leader\>cy |NERDComYankComment|**
|
||||
Same as \<leader\>cc except that the commented line(s) are yanked first.
|
||||
" 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'
|
||||
|
||||
**\<leader\>c$ |NERDComEOLComment|**
|
||||
Comments the current line from the cursor to the end of line.
|
||||
" 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': '*/' } }
|
||||
|
||||
**\<leader\>cA |NERDComAppendComment|**
|
||||
Adds comment delimiters to the end of line and goes into insert mode between
|
||||
them.
|
||||
" 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
|
||||
|
||||
**|NERDComInsertComment|**
|
||||
Adds comment delimiters at the current cursor position and inserts between.
|
||||
Disabled by default.
|
||||
" Enable NERDCommenterToggle to check all selected lines is commented or not
|
||||
let g:NERDToggleCheckAllLines = 1
|
||||
```
|
||||
|
||||
### Default mappings
|
||||
|
||||
**\<leader\>ca |NERDComAltDelim|**
|
||||
Switches to the alternative set of delimiters.
|
||||
The following key mappings are provided by default (there is also a menu provided that contains menu items corresponding to all the below mappings):
|
||||
|
||||
Most of the following mappings are for normal/visual mode only. The **|NERDComInsertComment|** mapping is for insert mode only.
|
||||
|
||||
**[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).
|
||||
* `[count]<leader>cc` **|NERDComComment|**
|
||||
|
||||
Comment out the current line or text selected in visual mode.
|
||||
|
||||
**[count]\<leader\>cu |NERDComUncommentLine|**
|
||||
Uncomments the selected line(s).
|
||||
* `[count]<leader>cn` **|NERDComNestedComment|**
|
||||
|
||||
Same as <leader>cc but forces nesting.
|
||||
|
||||
* `[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.
|
||||
|
||||
* `[count]<leader>cm` **|NERDComMinimalComment|**
|
||||
|
||||
Comments the given lines using only one set of multipart delimiters.
|
||||
|
||||
* `[count]<leader>ci` **|NERDComInvertComment|**
|
||||
|
||||
Toggles the comment state of the selected line(s) individually.
|
||||
|
||||
* `[count]<leader>cs` **|NERDComSexyComment|**
|
||||
|
||||
Comments out the selected lines with a pretty block formatted layout.
|
||||
|
||||
* `[count]<leader>cy` **|NERDComYankComment|**
|
||||
|
||||
Same as <leader>cc except that the commented line(s) are yanked first.
|
||||
|
||||
* `<leader>c$` **|NERDComEOLComment|**
|
||||
|
||||
Comments the current line from the cursor to the end of line.
|
||||
|
||||
* `<leader>cA` **|NERDComAppendComment|**
|
||||
|
||||
Adds comment delimiters to the end of line and goes into insert mode between them.
|
||||
|
||||
* **|NERDComInsertComment|**
|
||||
|
||||
Adds comment delimiters at the current cursor position and inserts between. Disabled by default.
|
||||
|
||||
* `<leader>ca` **|NERDComAltDelim|**
|
||||
|
||||
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 left side (`<leader>cl`) or both sides (`<leader>cb`).
|
||||
|
||||
* `[count]<leader>cu` **|NERDComUncommentLine|**
|
||||
|
||||
Uncomments the selected line(s).
|
||||
|
||||
@@ -28,8 +28,9 @@ CONTENTS *NERDCommenterContents*
|
||||
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|
|
||||
3.3 Sexy Comments.....................|NERDComSexyComments|
|
||||
3.4 The NERDComment function..........|NERDComNERDComment|
|
||||
3.5 The Hooks.........................|NERDComHooks|
|
||||
4.Options.................................|NERDComOptions|
|
||||
4.1 Options summary...................|NERDComOptionsSummary|
|
||||
4.2 Options details...................|NERDComOptionsDetails|
|
||||
@@ -391,6 +392,35 @@ For example, if you typed >
|
||||
<
|
||||
then the script would do a sexy comment on the last visual selection.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.5 The hooks *NERDComHooks*
|
||||
|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*
|
||||
@@ -399,44 +429,68 @@ then the script would do a sexy comment on the last visual selection.
|
||||
4.1 Options summary *NERDComOptionsSummary*
|
||||
|
||||
|'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*
|
||||
|
||||
@@ -514,6 +568,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.
|
||||
@@ -692,6 +755,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'
|
||||
@@ -731,16 +803,25 @@ When this option is set to 1, comments are nested automatically. That is, if
|
||||
you hit |<Leader>|cc on a line that is already commented it will be commented
|
||||
again.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'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.
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.3 Default delimiter customisation *NERDComDefaultDelims*
|
||||
|
||||
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.
|
||||
@@ -1024,6 +1105,7 @@ Simon Hengel htmlcheetah
|
||||
Matt Tolton javacc
|
||||
Ivan Devat javascript.jquery
|
||||
tpope cucumber,pdf
|
||||
Lyude Paul piglit shader_test
|
||||
==============================================================================
|
||||
10. License *NERDComLicense*
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
" Description: vim global plugin that provides easy code commenting
|
||||
" Author: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
" Maintainer: Caleb Maclennan <caleb@alerque.com>
|
||||
" Version: 2.4.0
|
||||
" Last Change: Tue May 24 14:03:29 EEST 2016
|
||||
" Version: 2.5.1
|
||||
" Last Change: Tue Nov 7 10:45:53 +03 2017
|
||||
" License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
@@ -64,6 +64,8 @@ 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)
|
||||
|
||||
let s:NERDFileNameEscape="[]#*$%'\" ?`!&();<>\\"
|
||||
|
||||
@@ -78,19 +80,23 @@ let s:delimiterMap = {
|
||||
\ 'amiga': { 'left': ';' },
|
||||
\ 'aml': { 'left': '/*' },
|
||||
\ 'ampl': { 'left': '#' },
|
||||
\ 'ansible': { 'left': '#' },
|
||||
\ 'apache': { 'left': '#' },
|
||||
\ 'apachestyle': { 'left': '#' },
|
||||
\ 'asciidoc': { 'left': '//' },
|
||||
\ 'apdl': { 'left': '!' },
|
||||
\ 'applescript': { 'left': '--', 'leftAlt': '(*', 'rightAlt': '*)' },
|
||||
\ 'armasm': { 'left': ';' },
|
||||
\ 'asm68k': { 'left': ';' },
|
||||
\ 'asciidoc': { 'left': '//' },
|
||||
\ 'asm': { 'left': ';', 'leftAlt': '#' },
|
||||
\ 'asm68k': { 'left': ';' },
|
||||
\ 'asn': { 'left': '--' },
|
||||
\ 'asp': { 'left': '%', 'leftAlt': '%*', 'rightAlt': '*%' },
|
||||
\ 'aspvbs': { 'left': '''', 'leftAlt': '<!--', 'rightAlt': '-->' },
|
||||
\ 'asterisk': { 'left': ';' },
|
||||
\ 'asy': { 'left': '//' },
|
||||
\ 'asy': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'atlas': { 'left': 'C', 'right': '$' },
|
||||
\ 'autohotkey': { 'left': ';' },
|
||||
\ 'augeas': { 'left': '(*', 'right': '*)' },
|
||||
\ 'autohotkey': { 'left': ';', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'autoit': { 'left': ';' },
|
||||
\ 'ave': { 'left': "'" },
|
||||
\ 'awk': { 'left': '#' },
|
||||
@@ -102,11 +108,11 @@ let s:delimiterMap = {
|
||||
\ 'blade': { 'left': '{{--', 'right': '--}}' },
|
||||
\ 'bst': { 'left': '%' },
|
||||
\ 'btm': { 'left': '::' },
|
||||
\ 'c': { 'left': '/*', 'right': '*/', 'leftAlt': '//' },
|
||||
\ 'cabal': { 'left': '--' },
|
||||
\ 'caos': { 'left': '*' },
|
||||
\ 'calibre': { 'left': '//' },
|
||||
\ 'caos': { 'left': '*' },
|
||||
\ 'catalog': { 'left': '--', 'right': '--' },
|
||||
\ 'c': { 'left': '/*','right': '*/', 'leftAlt': '//' },
|
||||
\ 'cf': { 'left': '<!---', 'right': '--->' },
|
||||
\ 'cfg': { 'left': '#' },
|
||||
\ 'cg': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
@@ -121,26 +127,26 @@ let s:delimiterMap = {
|
||||
\ 'context': { 'left': '%', 'leftAlt': '--' },
|
||||
\ 'coq': { 'left': '(*', 'right': '*)' },
|
||||
\ 'cpp': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'cuda': { 'left': '/*','right': '*/', 'leftAlt': '//' },
|
||||
\ 'crontab': { 'left': '#' },
|
||||
\ 'cs': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'csp': { 'left': '--' },
|
||||
\ 'cterm': { 'left': '*' },
|
||||
\ 'cucumber': { 'left': '#' },
|
||||
\ 'cython': { 'left': '# ', 'leftAlt': '#' },
|
||||
\ 'cuda': { 'left': '/*', 'right': '*/', 'leftAlt': '//' },
|
||||
\ 'cvs': { 'left': 'CVS:' },
|
||||
\ 'cython': { 'left': '# ', 'leftAlt': '#' },
|
||||
\ 'd': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'dcl': { 'left': '$!' },
|
||||
\ 'dakota': { 'left': '#' },
|
||||
\ 'dcl': { 'left': '$!' },
|
||||
\ 'debcontrol': { 'left': '#' },
|
||||
\ 'debsources': { 'left': '#' },
|
||||
\ 'def': { 'left': ';' },
|
||||
\ 'desktop': { 'left': '#' },
|
||||
\ 'dhcpd': { 'left': '#' },
|
||||
\ 'diff': { 'left': '#' },
|
||||
\ 'django': { 'left': '<!--','right': '-->', 'leftAlt': '{#', 'rightAlt': '#}' },
|
||||
\ 'docbk': { 'left': '<!--', 'right': '-->' },
|
||||
\ 'django': { 'left': '<!--', 'right': '-->', 'leftAlt': '{#', 'rightAlt': '#}' },
|
||||
\ 'dns': { 'left': ';' },
|
||||
\ 'docbk': { 'left': '<!--', 'right': '-->' },
|
||||
\ 'dockerfile': { 'left': '#' },
|
||||
\ 'dosbatch': { 'left': 'REM ', 'leftAlt': '::' },
|
||||
\ 'dosini': { 'left': ';' },
|
||||
@@ -155,7 +161,7 @@ let s:delimiterMap = {
|
||||
\ 'eiffel': { 'left': '--' },
|
||||
\ 'elf': { 'left': "'" },
|
||||
\ 'elixir': { 'left': '#' },
|
||||
\ 'elm': { 'left': '--' },
|
||||
\ 'elm': { 'left': '--', 'leftAlt': '{--', 'rightAlt': '--}' },
|
||||
\ 'elmfilt': { 'left': '#' },
|
||||
\ 'ember-script': { 'left': '#' },
|
||||
\ 'emblem': { 'left': '/' },
|
||||
@@ -164,8 +170,8 @@ let s:delimiterMap = {
|
||||
\ 'esmtprc': { 'left': '#' },
|
||||
\ 'expect': { 'left': '#' },
|
||||
\ 'exports': { 'left': '#' },
|
||||
\ 'fancy': { 'left': '#' },
|
||||
\ 'factor': { 'left': '! ', 'leftAlt': '!# ' },
|
||||
\ 'fancy': { 'left': '#' },
|
||||
\ 'fgl': { 'left': '#' },
|
||||
\ 'focexec': { 'left': '-*' },
|
||||
\ 'form': { 'left': '*' },
|
||||
@@ -179,7 +185,7 @@ let s:delimiterMap = {
|
||||
\ 'gdb': { 'left': '#' },
|
||||
\ 'gdmo': { 'left': '--' },
|
||||
\ 'geek': { 'left': 'GEEK_COMMENT:' },
|
||||
\ 'genshi': { 'left': '<!--','right': '-->', 'leftAlt': '{#', 'rightAlt': '#}' },
|
||||
\ 'genshi': { 'left': '<!--', 'right': '-->', 'leftAlt': '{#', 'rightAlt': '#}' },
|
||||
\ 'gentoo-conf-d': { 'left': '#' },
|
||||
\ 'gentoo-env-d': { 'left': '#' },
|
||||
\ 'gentoo-init-d': { 'left': '#' },
|
||||
@@ -189,31 +195,36 @@ let s:delimiterMap = {
|
||||
\ 'gentoo-package-use': { 'left': '#' },
|
||||
\ 'gitcommit': { 'left': '#' },
|
||||
\ 'gitconfig': { 'left': ';' },
|
||||
\ 'gitignore': { 'left': '#' },
|
||||
\ 'gitrebase': { 'left': '#' },
|
||||
\ 'glsl': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'gnuplot': { 'left': '#' },
|
||||
\ 'go': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'groovy': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'gsp': { 'left': '<%--', 'right': '--%>', 'leftAlt': '<!--','rightAlt': '-->'},
|
||||
\ 'gsp': { 'left': '<%--', 'right': '--%>', 'leftAlt': '<!--', 'rightAlt': '-->' },
|
||||
\ 'gtkrc': { 'left': '#' },
|
||||
\ 'haskell': { 'left': '{-','right': '-}', 'leftAlt': '--' },
|
||||
\ 'hb': { 'left': '#' },
|
||||
\ 'h': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'haml': { 'left': '-#', 'leftAlt': '/' },
|
||||
\ 'haxe': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'handlebars': { 'left': '{{!-- ', 'right': ' --}}' },
|
||||
\ 'haskell': { 'left': '{-', 'right': '-}', 'nested': 1, 'leftAlt': '--', 'nestedAlt': 1 },
|
||||
\ 'haxe': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'hb': { 'left': '#' },
|
||||
\ 'hbs': { 'left': '{{!-- ', 'right': ' --}}' },
|
||||
\ 'hercules': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'hive': { 'left': '-- ' },
|
||||
\ 'hog': { 'left': '#' },
|
||||
\ 'hostsaccess': { 'left': '#' },
|
||||
\ 'htmlcheetah': { 'left': '##' },
|
||||
\ 'htmldjango': { 'left': '<!--','right': '-->', 'leftAlt': '{#', 'rightAlt': '#}' },
|
||||
\ 'htmldjango': { 'left': '<!--', 'right': '-->', 'leftAlt': '{#', 'rightAlt': '#}' },
|
||||
\ 'htmlos': { 'left': '#', 'right': '/#' },
|
||||
\ 'hxml': { 'left': '#' },
|
||||
\ 'hyphy': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'ia64': { 'left': '#' },
|
||||
\ 'icon': { 'left': '#' },
|
||||
\ 'idlang': { 'left': ';' },
|
||||
\ 'idl': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'idlang': { 'left': ';' },
|
||||
\ 'idris': { 'leftAlt': '--', 'left': '{-', 'right': '-}' },
|
||||
\ 'incar': { 'left': '!' },
|
||||
\ 'inform': { 'left': '!' },
|
||||
\ 'inittab': { 'left': '#' },
|
||||
\ 'ishd': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
@@ -226,30 +237,32 @@ let s:delimiterMap = {
|
||||
\ 'javascript.jquery': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'jess': { 'left': ';' },
|
||||
\ 'jgraph': { 'left': '(*', 'right': '*)' },
|
||||
\ 'jinja': { 'left': '<!--','right': '-->', 'leftAlt': '{#', 'rightAlt': '#}' },
|
||||
\ 'jinja': { 'left': '<!--', 'right': '-->', 'leftAlt': '{#', 'rightAlt': '#}' },
|
||||
\ 'jproperties': { 'left': '#' },
|
||||
\ 'jsp': { 'left': '<%--', 'right': '--%>' },
|
||||
\ 'julia': { 'left': '#' },
|
||||
\ 'julia': { 'left': '# ', 'leftAlt': '#=', 'rightAlt': '=#' },
|
||||
\ 'kix': { 'left': ';' },
|
||||
\ 'kscript': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'lace': { 'left': '--' },
|
||||
\ 'laravel': { 'left': '{{--', 'right': '--}}' },
|
||||
\ 'laravel': { 'left': '{{--', 'right': '--}}' },
|
||||
\ 'ldif': { 'left': '#' },
|
||||
\ 'less': { 'left': '/*','right': '*/' },
|
||||
\ 'lhaskell': { 'left': '>{-','right': '-}', 'leftAlt': '>-- ' },
|
||||
\ 'less': { 'left': '/*', 'right': '*/' },
|
||||
\ 'lhaskell': { 'left': '>{-', 'right': '-}', 'leftAlt': '>-- ' },
|
||||
\ 'lilo': { 'left': '#' },
|
||||
\ 'lilypond': { 'left': '%' },
|
||||
\ 'liquid': { 'left': '{% comment %}', 'right': '{% endcomment %}' },
|
||||
\ 'lisp': { 'left': ';', 'leftAlt': '#|', 'rightAlt': '|#' },
|
||||
\ 'lisp': { 'left': ';', 'nested': 1, 'leftAlt': '#|', 'rightAlt': '|#', 'nestedAlt': 1 },
|
||||
\ 'llvm': { 'left': ';' },
|
||||
\ 'lotos': { 'left': '(*', 'right': '*)' },
|
||||
\ 'lout': { 'left': '#' },
|
||||
\ 'lpc': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'lprolog': { 'left': '%' },
|
||||
\ 'lscript': { 'left': "'" },
|
||||
\ 'lss': { 'left': '#' },
|
||||
\ 'lua': { 'left': '--', 'leftAlt': '--[[', 'rightAlt': ']]' },
|
||||
\ 'lynx': { 'left': '#' },
|
||||
\ 'lytex': { 'left': '%' },
|
||||
\ 'm4': { 'left': 'dnl ' },
|
||||
\ 'mail': { 'left': '> ' },
|
||||
\ 'mako': { 'left': '##' },
|
||||
\ 'man': { 'left': '."' },
|
||||
@@ -261,15 +274,18 @@ let s:delimiterMap = {
|
||||
\ 'master': { 'left': '$' },
|
||||
\ 'matlab': { 'left': '%', 'leftAlt': '%{', 'rightAlt': '%}' },
|
||||
\ 'mel': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'meson': { 'left': '#' },
|
||||
\ 'mib': { 'left': '--' },
|
||||
\ 'mips': { 'left': '#'},
|
||||
\ 'mirah': {'left': '#'},
|
||||
\ 'minizinc': { 'left': '% ', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'mips': { 'left': '#' },
|
||||
\ 'mirah': {'left': '#' },
|
||||
\ 'mkd': { 'left': '<!---', 'right': '-->' },
|
||||
\ 'mma': { 'left': '(*', 'right': '*)' },
|
||||
\ 'model': { 'left': '$', 'right': '$' },
|
||||
\ 'moduala.': { 'left': '(*', 'right': '*)' },
|
||||
\ 'modula2': { 'left': '(*', 'right': '*)' },
|
||||
\ 'modula3': { 'left': '(*', 'right': '*)' },
|
||||
\ 'molpro': { 'left': '!' },
|
||||
\ 'monk': { 'left': ';' },
|
||||
\ 'mush': { 'left': '#' },
|
||||
\ 'mustache': { 'left': '{{!', 'right': '}}' },
|
||||
@@ -288,7 +304,7 @@ let s:delimiterMap = {
|
||||
\ 'objc': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'objcpp': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'objj': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'ocaml': { 'left': '(*', 'right': '*)' },
|
||||
\ 'ocaml': { 'left': '(*', 'right': '*)', 'nested': 1 },
|
||||
\ 'occam': { 'left': '--' },
|
||||
\ 'octave': { 'left': '%', 'leftAlt': '#' },
|
||||
\ 'omlet': { 'left': '(*', 'right': '*)' },
|
||||
@@ -300,7 +316,7 @@ let s:delimiterMap = {
|
||||
\ 'ox': { 'left': '//' },
|
||||
\ 'paludis-use-conf': { 'left': '#' },
|
||||
\ 'pandoc': { 'left': '<!--', 'right': '-->' },
|
||||
\ 'pascal': { 'left': '{','right': '}', 'leftAlt': '(*', 'rightAlt': '*)' },
|
||||
\ 'pascal': { 'left': '{', 'right': '}', 'leftAlt': '(*', 'rightAlt': '*)' },
|
||||
\ 'patran': { 'left': '$', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'pcap': { 'left': '#' },
|
||||
\ 'pccts': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
@@ -315,50 +331,57 @@ let s:delimiterMap = {
|
||||
\ 'plm': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'plsql': { 'left': '-- ', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'po': { 'left': '#' },
|
||||
\ 'poscar': { 'left': '!' },
|
||||
\ 'postscr': { 'left': '%' },
|
||||
\ 'pov': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'povini': { 'left': ';' },
|
||||
\ 'ppd': { 'left': '%' },
|
||||
\ 'ppwiz': { 'left': ';;' },
|
||||
\ 'praat': { 'left': '#' },
|
||||
\ 'privoxy': { 'left': '#' },
|
||||
\ 'processing': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'prolog': { 'left': '%', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'ps1': { 'left': '#' },
|
||||
\ 'psf': { 'left': '#' },
|
||||
\ 'ptcap': { 'left': '#' },
|
||||
\ 'pug': { 'left': '//-', 'leftAlt': '//' },
|
||||
\ 'puppet': { 'left': '#' },
|
||||
\ 'pyrex': { 'left': '# ', 'leftAlt': '#' },
|
||||
\ 'python': { 'left': '# ', 'leftAlt': '#' },
|
||||
\ 'racket': { 'left': ';', 'leftAlt': '#|', 'rightAlt': '|#' },
|
||||
\ 'r': { 'left': '#', 'leftAlt': '#''' },
|
||||
\ 'racket': { 'left': ';', 'nested': 1, 'leftAlt': '#|', 'rightAlt': '|#', 'nestedAlt': 1 },
|
||||
\ 'radiance': { 'left': '#' },
|
||||
\ 'ratpoison': { 'left': '#' },
|
||||
\ 'r': { 'left': '#' },
|
||||
\ 'rc': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'rebol': { 'left': ';' },
|
||||
\ 'registry': { 'left': ';' },
|
||||
\ 'remind': { 'left': '#' },
|
||||
\ 'renpy': { 'left': '# ' },
|
||||
\ 'resolv': { 'left': '#' },
|
||||
\ 'rgb': { 'left': '!' },
|
||||
\ 'rib': { 'left': '#' },
|
||||
\ 'rmd': { 'left': '#' },
|
||||
\ 'robot': { 'left': '#' },
|
||||
\ 'robots': { 'left': '#' },
|
||||
\ 'rspec': { 'left': '#' },
|
||||
\ 'ruby': { 'left': '# ', 'leftAlt': '#' },
|
||||
\ 'rust': { 'left': '//', 'leftAlt': '///', 'rightAlt': '///' },
|
||||
\ 'ruby': { 'left': '#', 'leftAlt': '=begin', 'rightAlt': '=end' },
|
||||
\ 'rust': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'sa': { 'left': '--' },
|
||||
\ 'samba': { 'left': ';', 'leftAlt': '#' },
|
||||
\ 'sass': { 'left': '//', 'leftAlt': '/*' },
|
||||
\ 'sather': { 'left': '--' },
|
||||
\ 'scala': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'scons': { 'left': '#' },
|
||||
\ 'scheme': { 'left': ';', 'leftAlt': '#|', 'rightAlt': '|#' },
|
||||
\ 'scala': { 'left': '//', 'nested': 1, 'leftAlt': '/*', 'rightAlt': '*/', 'nestedAlt': 1 },
|
||||
\ 'scheme': { 'left': ';', 'nested': 1, 'leftAlt': '#|', 'rightAlt': '|#', 'nestedAlt': 1 },
|
||||
\ 'scilab': { 'left': '//' },
|
||||
\ 'scons': { 'left': '#' },
|
||||
\ 'scsh': { 'left': ';' },
|
||||
\ 'scss': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/'},
|
||||
\ 'scss': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'sdc': { 'left': '#' },
|
||||
\ 'sed': { 'left': '#' },
|
||||
\ 'sgmldecl': { 'left': '--', 'right': '--' },
|
||||
\ 'sgmllnx': { 'left': '<!--', 'right': '-->' },
|
||||
\ 'sh': { 'left': '#' },
|
||||
\ 'shader_test': { 'left': '#' },
|
||||
\ 'sicad': { 'left': '*' },
|
||||
\ 'sile': { 'left': '%' },
|
||||
\ 'simula': { 'left': '%', 'leftAlt': '--' },
|
||||
@@ -373,7 +396,7 @@ let s:delimiterMap = {
|
||||
\ 'smarty': { 'left': '{*', 'right': '*}' },
|
||||
\ 'smil': { 'left': '<!', 'right': '>' },
|
||||
\ 'smith': { 'left': ';' },
|
||||
\ 'sml': { 'left': '(*', 'right': '*)' },
|
||||
\ 'sml': { 'left': '(*', 'right': '*)', 'nested': 1 },
|
||||
\ 'snippets': { 'left': '#' },
|
||||
\ 'snnsnet': { 'left': '#' },
|
||||
\ 'snnspat': { 'left': '#' },
|
||||
@@ -390,18 +413,20 @@ let s:delimiterMap = {
|
||||
\ 'sqr': { 'left': '!' },
|
||||
\ 'squid': { 'left': '#' },
|
||||
\ 'ss': { 'left': ';', 'leftAlt': '#|', 'rightAlt': '|#' },
|
||||
\ 'sshconfig': { 'left': '#' },
|
||||
\ 'sshdconfig': { 'left': '#' },
|
||||
\ 'st': { 'left': '"' },
|
||||
\ 'stan': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'stp': { 'left': '/*','right': '*/', 'leftAlt': '//' },
|
||||
\ 'swift': { 'left': '/*','right': '*/', 'leftAlt': '//' },
|
||||
\ 'stp': { 'left': '/*', 'right': '*/', 'leftAlt': '//' },
|
||||
\ 'supercollider': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'swift': { 'left': '/*', 'right': '*/', 'leftAlt': '//' },
|
||||
\ 'systemverilog': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'tads': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'tags': { 'left': ';' },
|
||||
\ 'tak': { 'left': '$' },
|
||||
\ 'tasm': { 'left': ';' },
|
||||
\ 'tcl': { 'left': '#' },
|
||||
\ 'teak': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'terraform': { 'left': '#', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'tex': { 'left': '%' },
|
||||
\ 'texinfo': { 'left': "@c " },
|
||||
@@ -415,17 +440,19 @@ let s:delimiterMap = {
|
||||
\ 'tsalt': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'tsscl': { 'left': '#' },
|
||||
\ 'tssgm': { 'left': "comment = '", 'right': "'" },
|
||||
\ 'ttl': { 'left': '#' },
|
||||
\ 'tup': { 'left': '#' },
|
||||
\ 'twig': { 'left': '{#', 'right': '#}' },
|
||||
\ 'txt2tags': { 'left': '%' },
|
||||
\ 'typescript': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'twig': { 'left': '{#', 'right': '#}' },
|
||||
\ 'uc': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'uil': { 'left': '!' },
|
||||
\ 'upstart': { 'left': '#' },
|
||||
\ 'vala': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'vasp': { 'left': '!' },
|
||||
\ 'vb': { 'left': "'" },
|
||||
\ 'velocity': { 'left': "##", 'right': "", 'leftAlt': '#*', 'rightAlt': '*#' },
|
||||
\ 'vera': { 'left': '/*','right': '*/', 'leftAlt': '//' },
|
||||
\ 'vera': { 'left': '/*', 'right': '*/', 'leftAlt': '//' },
|
||||
\ 'verilog': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'verilog_systemverilog': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'vgrindefs': { 'left': '#' },
|
||||
@@ -436,7 +463,7 @@ let s:delimiterMap = {
|
||||
\ 'vsejcl': { 'left': '/*' },
|
||||
\ 'webmacro': { 'left': '##' },
|
||||
\ 'wget': { 'left': '#' },
|
||||
\ 'Wikipedia': { 'left': '<!--', 'right': '-->' },
|
||||
\ 'wikipedia': { 'left': '<!--', 'right': '-->' },
|
||||
\ 'winbatch': { 'left': ';' },
|
||||
\ 'wml': { 'left': '#' },
|
||||
\ 'wvdial': { 'left': ';' },
|
||||
@@ -505,6 +532,17 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
let b:NERDCommenterDelims[i] = ''
|
||||
endif
|
||||
endfor
|
||||
for i in ['nested', 'nestedAlt']
|
||||
if !has_key(b:NERDCommenterDelims, i)
|
||||
let b:NERDCommenterDelims[i] = 0
|
||||
endif
|
||||
endfor
|
||||
" if g:NERD_<filetype>_alt_style is defined, use the alternate style
|
||||
let b:NERDCommenterFirstInit = getbufvar(1,"NERDCommenterFirstInit")
|
||||
if exists('g:NERDAltDelims_'.ft) && eval('g:NERDAltDelims_'.ft) && !b:NERDCommenterFirstInit
|
||||
call s:SwitchToAlternativeDelimiters(0)
|
||||
let b:NERDCommenterFirstInit = 1
|
||||
endif
|
||||
else
|
||||
let b:NERDCommenterDelims = s:CreateDelimMapFromCms()
|
||||
endif
|
||||
@@ -524,8 +562,10 @@ function s:CreateDelimMapFromCms()
|
||||
return {
|
||||
\ 'left': substitute(&commentstring, '\([^ \t]*\)\s*%s.*', '\1', ''),
|
||||
\ 'right': substitute(&commentstring, '.*%s\s*\(.*\)', '\1', 'g'),
|
||||
\ 'nested': 0,
|
||||
\ 'leftAlt': '',
|
||||
\ 'rightAlt': '' }
|
||||
\ 'rightAlt': '',
|
||||
\ 'nestedAlt': 0}
|
||||
endfunction
|
||||
|
||||
" Function: s:SwitchToAlternativeDelimiters(printMsgs) function {{{2
|
||||
@@ -538,6 +578,9 @@ endfunction
|
||||
" -printMsgs: if this is 1 then a message is echoed to the user telling them
|
||||
" if this function changed the delimiters or not
|
||||
function s:SwitchToAlternativeDelimiters(printMsgs)
|
||||
if exists('*NERDCommenter_before')
|
||||
exe "call NERDCommenter_before()"
|
||||
endif
|
||||
"if both of the alternative delimiters are empty then there is no
|
||||
"alternative comment style so bail out
|
||||
if b:NERDCommenterDelims['leftAlt'] == '' && b:NERDCommenterDelims['rightAlt'] == ''
|
||||
@@ -550,20 +593,28 @@ function s:SwitchToAlternativeDelimiters(printMsgs)
|
||||
"save the current delimiters
|
||||
let tempLeft = s:Left()
|
||||
let tempRight = s:Right()
|
||||
let tempNested = s:Nested()
|
||||
|
||||
"swap current delimiters for alternative
|
||||
let b:NERDCommenterDelims['left'] = b:NERDCommenterDelims['leftAlt']
|
||||
let b:NERDCommenterDelims['right'] = b:NERDCommenterDelims['rightAlt']
|
||||
"set information on whether these are nested
|
||||
let b:NERDCommenterDelims['nested'] = b:NERDCommenterDelims['nestedAlt']
|
||||
|
||||
"set the previously current delimiters to be the new alternative ones
|
||||
let b:NERDCommenterDelims['leftAlt'] = tempLeft
|
||||
let b:NERDCommenterDelims['rightAlt'] = tempRight
|
||||
let b:NERDCommenterDelims['nestedAlt'] = tempNested
|
||||
|
||||
"tell the user what comment delimiters they are now using
|
||||
if a:printMsgs
|
||||
call s:NerdEcho("Now using " . s:Left() . " " . s:Right() . " to delimit comments", 1)
|
||||
endif
|
||||
|
||||
if exists('*NERDCommenter_after')
|
||||
exe "call NERDCommenter_after()"
|
||||
endif
|
||||
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
@@ -584,15 +635,17 @@ function s:AppendCommentToLine()
|
||||
|
||||
"stick the delimiters down at the end of the line. We have to format the
|
||||
"comment with spaces as appropriate
|
||||
execute ":normal! " . insOrApp . (isLineEmpty ? '' : ' ') . left . right
|
||||
execute ":normal! " . insOrApp . (isLineEmpty ? '' : ' ') . left . right
|
||||
|
||||
" if there is a right delimiter then we gotta move the cursor left
|
||||
" by the length of the right delimiter so we insert between the delimiters
|
||||
if lenRight > 0
|
||||
let leftMoveAmount = lenRight - 1
|
||||
execute ":normal! " . leftMoveAmount . "h"
|
||||
startinsert
|
||||
else
|
||||
startinsert!
|
||||
endif
|
||||
startinsert
|
||||
endfunction
|
||||
|
||||
" Function: s:CommentBlock(top, bottom, lSide, rSide, forceNested ) {{{2
|
||||
@@ -713,6 +766,10 @@ function s:CommentBlock(top, bottom, lSide, rSide, forceNested )
|
||||
let theLine = s:ConvertLeadingSpacesToTabs(theLine)
|
||||
endif
|
||||
|
||||
if g:NERDTrimTrailingWhitespace == 1
|
||||
let theLine = s:TrimTrailingWhitespace(theLine)
|
||||
endif
|
||||
|
||||
call setline(currentLine, theLine)
|
||||
endif
|
||||
|
||||
@@ -755,7 +812,7 @@ function s:CommentLines(forceNested, align, firstLine, lastLine)
|
||||
if s:CanCommentLine(a:forceNested, currentLine)
|
||||
"if the user has specified forceNesting then we check to see if we
|
||||
"need to switch delimiters for place-holders
|
||||
if a:forceNested && g:NERDUsePlaceHolders
|
||||
if a:forceNested && g:NERDUsePlaceHolders && !s:Nested()
|
||||
let theLine = s:SwapOuterMultiPartDelimsForPlaceHolders(theLine)
|
||||
endif
|
||||
|
||||
@@ -783,6 +840,10 @@ function s:CommentLines(forceNested, align, firstLine, lastLine)
|
||||
let theLine = s:ConvertLeadingSpacesToTabs(theLine)
|
||||
endif
|
||||
|
||||
if g:NERDTrimTrailingWhitespace == 1
|
||||
let theLine = s:TrimTrailingWhitespace(theLine)
|
||||
endif
|
||||
|
||||
" we are done with this line
|
||||
call setline(currentLine, theLine)
|
||||
let currentLine = currentLine + 1
|
||||
@@ -801,9 +862,11 @@ function s:CommentLinesMinimal(firstLine, lastLine)
|
||||
throw 'NERDCommenter.Delimiters exception: Minimal comments can only be used for filetypes that have multipart delimiters'
|
||||
endif
|
||||
|
||||
let sexyNested = s:SexyNested()
|
||||
|
||||
"if we need to use place holders for the comment, make sure they are
|
||||
"enabled for this filetype
|
||||
if !g:NERDUsePlaceHolders && s:DoesBlockHaveMultipartDelim(a:firstLine, a:lastLine)
|
||||
"enabled for this filetype, or the delimiterss allow nesting
|
||||
if !g:NERDUsePlaceHolders && !sexyNested && s:DoesBlockHaveMultipartDelim(a:firstLine, a:lastLine)
|
||||
throw 'NERDCommenter.Settings exception: Place holders are required but disabled.'
|
||||
endif
|
||||
|
||||
@@ -813,13 +876,15 @@ function s:CommentLinesMinimal(firstLine, lastLine)
|
||||
|
||||
"make sure all multipart delimiters on the lines are replaced with
|
||||
"placeholders to prevent illegal syntax
|
||||
let currentLine = a:firstLine
|
||||
while(currentLine <= a:lastLine)
|
||||
let theLine = getline(currentLine)
|
||||
let theLine = s:ReplaceDelims(left, right, g:NERDLPlace, g:NERDRPlace, theLine)
|
||||
call setline(currentLine, theLine)
|
||||
let currentLine = currentLine + 1
|
||||
endwhile
|
||||
if !sexyNested
|
||||
let currentLine = a:firstLine
|
||||
while(currentLine <= a:lastLine)
|
||||
let theLine = getline(currentLine)
|
||||
let theLine = s:ReplaceDelims(left, right, g:NERDLPlace, g:NERDRPlace, theLine)
|
||||
call setline(currentLine, theLine)
|
||||
let currentLine = currentLine + 1
|
||||
endwhile
|
||||
endif
|
||||
|
||||
"add the delimiter to the top line
|
||||
let theLine = getline(a:firstLine)
|
||||
@@ -839,6 +904,11 @@ function s:CommentLinesMinimal(firstLine, lastLine)
|
||||
if lineHasLeadingTabs
|
||||
let theLine = s:ConvertLeadingSpacesToTabs(theLine)
|
||||
endif
|
||||
|
||||
if g:NERDTrimTrailingWhitespace == 1
|
||||
let theLine = s:TrimTrailingWhitespace(theLine)
|
||||
endif
|
||||
|
||||
call setline(a:lastLine, theLine)
|
||||
endfunction
|
||||
|
||||
@@ -859,7 +929,7 @@ function s:CommentLinesSexy(topline, bottomline)
|
||||
throw 'NERDCommenter.Delimiters exception: cannot perform sexy comments with available delimiters.'
|
||||
endif
|
||||
|
||||
"make sure the lines aren't already commented sexually
|
||||
"make sure the lines aren't already commented sexually or we can nest
|
||||
if !s:CanSexyCommentLines(a:topline, a:bottomline)
|
||||
throw 'NERDCommenter.Nesting exception: cannot nest sexy comments'
|
||||
endif
|
||||
@@ -884,7 +954,9 @@ function s:CommentLinesSexy(topline, bottomline)
|
||||
if lineHasTabs
|
||||
let theLine = s:ConvertLeadingTabsToSpaces(theLine)
|
||||
endif
|
||||
let theLine = s:SwapOuterMultiPartDelimsForPlaceHolders(theLine)
|
||||
if !s:SexyNested()
|
||||
let theLine = s:SwapOuterMultiPartDelimsForPlaceHolders(theLine)
|
||||
endif
|
||||
let theLine = s:AddLeftDelimAligned(left . spaceString, theLine, leftAlignIndx)
|
||||
if lineHasTabs
|
||||
let theLine = s:ConvertLeadingSpacesToTabs(theLine)
|
||||
@@ -898,7 +970,9 @@ function s:CommentLinesSexy(topline, bottomline)
|
||||
if lineHasTabs
|
||||
let theLine = s:ConvertLeadingTabsToSpaces(theLine)
|
||||
endif
|
||||
let theLine = s:SwapOuterMultiPartDelimsForPlaceHolders(theLine)
|
||||
if !s:SexyNested()
|
||||
let theLine = s:SwapOuterMultiPartDelimsForPlaceHolders(theLine)
|
||||
endif
|
||||
endif
|
||||
let theLine = s:AddRightDelim(spaceString . right, theLine)
|
||||
if lineHasTabs
|
||||
@@ -943,7 +1017,9 @@ function s:CommentLinesSexy(topline, bottomline)
|
||||
let theLine = s:ConvertLeadingTabsToSpaces(theLine)
|
||||
endif
|
||||
|
||||
let theLine = s:SwapOuterMultiPartDelimsForPlaceHolders(theLine)
|
||||
if !s:SexyNested()
|
||||
let theLine = s:SwapOuterMultiPartDelimsForPlaceHolders(theLine)
|
||||
endif
|
||||
|
||||
" add the sexyComMarker
|
||||
let theLine = repeat(' ', leftAlignIndx) . repeat(' ', strlen(left)-strlen(sexyComMarker)) . sexyComMarkerSpaced . strpart(theLine, leftAlignIndx)
|
||||
@@ -952,6 +1028,9 @@ function s:CommentLinesSexy(topline, bottomline)
|
||||
let theLine = s:ConvertLeadingSpacesToTabs(theLine)
|
||||
endif
|
||||
|
||||
if g:NERDTrimTrailingWhitespace == 1
|
||||
let theLine = s:TrimTrailingWhitespace(theLine)
|
||||
endif
|
||||
|
||||
" set the line and move onto the next one
|
||||
call setline(currentLine, theLine)
|
||||
@@ -985,7 +1064,7 @@ function s:CommentLinesToggle(forceNested, firstLine, lastLine)
|
||||
|
||||
"if the user has specified forceNesting then we check to see if we
|
||||
"need to switch delimiters for place-holders
|
||||
if g:NERDUsePlaceHolders
|
||||
if g:NERDUsePlaceHolders && !s:Nested()
|
||||
let theLine = s:SwapOuterMultiPartDelimsForPlaceHolders(theLine)
|
||||
endif
|
||||
|
||||
@@ -1006,6 +1085,10 @@ function s:CommentLinesToggle(forceNested, firstLine, lastLine)
|
||||
let theLine = s:ConvertLeadingSpacesToTabs(theLine)
|
||||
endif
|
||||
|
||||
if g:NERDTrimTrailingWhitespace == 1
|
||||
let theLine = s:TrimTrailingWhitespace(theLine)
|
||||
endif
|
||||
|
||||
" we are done with this line
|
||||
call setline(currentLine, theLine)
|
||||
let currentLine = currentLine + 1
|
||||
@@ -1103,6 +1186,11 @@ function s:InvertComment(firstLine, lastLine)
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! NERDCommentIsLineCommented(lineNo)
|
||||
let theLine = getline(a:lineNo)
|
||||
return s:IsInSexyComment(a:lineNo) || s:IsCommentedFromStartOfLine(s:Left(), theLine) || s:IsCommentedFromStartOfLine(s:Left({'alt': 1}), theLine)
|
||||
endfunction
|
||||
|
||||
" Function: NERDComment(mode, type) function {{{2
|
||||
" This function is a Wrapper for the main commenting functions
|
||||
"
|
||||
@@ -1113,6 +1201,10 @@ endfunction
|
||||
" 'Minimal', 'Toggle', 'AlignLeft', 'AlignBoth', 'Comment',
|
||||
" 'Nested', 'ToEOL', 'Append', 'Insert', 'Uncomment', 'Yank'
|
||||
function! NERDComment(mode, type) range
|
||||
if exists('*NERDCommenter_before')
|
||||
exe "call NERDCommenter_before()"
|
||||
endif
|
||||
|
||||
let isVisual = a:mode =~ '[vsx]'
|
||||
|
||||
if !exists("g:did_load_ftplugin") || g:did_load_ftplugin != 1
|
||||
@@ -1167,12 +1259,29 @@ function! NERDComment(mode, type) range
|
||||
endtry
|
||||
|
||||
elseif a:type ==? 'Toggle'
|
||||
let theLine = getline(firstLine)
|
||||
|
||||
if s:IsInSexyComment(firstLine) || s:IsCommentedFromStartOfLine(s:Left(), theLine) || s:IsCommentedFromStartOfLine(s:Left({'alt': 1}), theLine)
|
||||
call s:UncommentLines(firstLine, lastLine)
|
||||
if g:NERDToggleCheckAllLines ==# 0
|
||||
let theLine = getline(firstLine)
|
||||
if s:IsInSexyComment(firstLine) || s:IsCommentedFromStartOfLine(s:Left(), theLine) || s:IsCommentedFromStartOfLine(s:Left({'alt': 1}), theLine)
|
||||
call s:UncommentLines(firstLine, lastLine)
|
||||
else
|
||||
call s:CommentLinesToggle(forceNested, firstLine, lastLine)
|
||||
endif
|
||||
else
|
||||
let l:commentAllLines = 0
|
||||
for i in range(firstLine, lastLine)
|
||||
let theLine = getline(i)
|
||||
" if have one line no comment, then comment all lines
|
||||
if !s:IsInSexyComment(firstLine) && !s:IsCommentedFromStartOfLine(s:Left(), theLine) && !s:IsCommentedFromStartOfLine(s:Left({'alt': 1}), theLine)
|
||||
let l:commentAllLines = 1
|
||||
break
|
||||
else
|
||||
endif
|
||||
endfor
|
||||
if l:commentAllLines ==# 1
|
||||
call s:CommentLinesToggle(forceNested, firstLine, lastLine)
|
||||
else
|
||||
call s:UncommentLines(firstLine, lastLine)
|
||||
endif
|
||||
endif
|
||||
|
||||
elseif a:type ==? 'Minimal'
|
||||
@@ -1217,6 +1326,11 @@ function! NERDComment(mode, type) range
|
||||
else
|
||||
silent! call repeat#set("\<Plug>NERDCommenter". a:type)
|
||||
endif
|
||||
|
||||
if exists('*NERDCommenter_after')
|
||||
exe "call NERDCommenter_after()"
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
" Function: s:PlaceDelimitersAndInsBetween() function {{{2
|
||||
@@ -1305,13 +1419,13 @@ function s:RemoveDelimiters(left, right, line)
|
||||
endif
|
||||
|
||||
"look for the right delimiter, if we find it, remove it
|
||||
let rightIndx = s:FindDelimiterIndex(a:right, line)
|
||||
let rightIndx = s:LastIndexOfDelim(a:right, line)
|
||||
if rightIndx != -1
|
||||
let line = strpart(line, 0, rightIndx) . strpart(line, rightIndx+lenRight)
|
||||
|
||||
"if the user has specified that there is a space before the right delimiter
|
||||
"then check for the space and remove it if it is there
|
||||
if delimsSpaced && strpart(line, rightIndx-s:lenSpaceStr, s:lenSpaceStr) == s:spaceStr && s:Multipart()
|
||||
if delimsSpaced && strpart(line, rightIndx-s:lenSpaceStr, s:lenSpaceStr) == s:spaceStr && (s:Multipart() || s:AltMultipart())
|
||||
let line = strpart(line, 0, rightIndx-s:lenSpaceStr) . strpart(line, rightIndx)
|
||||
endif
|
||||
endif
|
||||
@@ -1333,7 +1447,7 @@ function s:SetupStateBeforeLineComment(topLine, bottomLine)
|
||||
let state = {'foldmethod' : &foldmethod,
|
||||
\'ignorecase' : &ignorecase}
|
||||
|
||||
" Vim's foldmethods are evaluated every time we use 'setline', which can
|
||||
" Vim's foldmethods are evaluated every time we use 'setline', which can
|
||||
" make commenting wide ranges of lines VERY slow. We'll change it to
|
||||
" manual, do the commenting stuff and recover it later. To avoid slowing
|
||||
" down commenting few lines, we avoid doing this for ranges smaller than
|
||||
@@ -1364,6 +1478,15 @@ function s:RecoverStateAfterLineComment(state)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Function: s:TrimTrailingWhitespace(line) {{{2
|
||||
" This function removes all the trailing whitespace
|
||||
" Args:
|
||||
" -line: the target line
|
||||
function s:TrimTrailingWhitespace(line)
|
||||
let toReturn = substitute(a:line, '\s\+$', '', 'g')
|
||||
return toReturn
|
||||
endfunction
|
||||
|
||||
" Function: s:UncommentLines(topLine, bottomLine) {{{2
|
||||
" This function uncomments the given lines
|
||||
"
|
||||
@@ -1456,6 +1579,10 @@ function s:UncommentLinesSexy(topline, bottomline)
|
||||
|
||||
let theLine = s:ConvertLeadingWhiteSpace(theLine)
|
||||
|
||||
if g:NERDTrimTrailingWhitespace == 1
|
||||
let theLine = s:TrimTrailingWhitespace(theLine)
|
||||
endif
|
||||
|
||||
" move onto the next line
|
||||
call setline(currentLine, theLine)
|
||||
let currentLine = currentLine + 1
|
||||
@@ -1525,6 +1652,16 @@ function s:UncommentLinesSexy(topline, bottomline)
|
||||
let theLine = s:SwapOuterPlaceHoldersForMultiPartDelims(theLine)
|
||||
call setline(bottomline, theLine)
|
||||
endif
|
||||
|
||||
" remove trailing whitespaces for first and last line
|
||||
if g:NERDTrimTrailingWhitespace == 1
|
||||
let theLine = getline(a:bottomline)
|
||||
let theLine = s:TrimTrailingWhitespace(theLine)
|
||||
call setline(a:bottomline, theLine)
|
||||
let theLine = getline(a:topline)
|
||||
let theLine = s:TrimTrailingWhitespace(theLine)
|
||||
call setline(a:topline, theLine)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Function: s:UncommentLineNormal(line) {{{2
|
||||
@@ -1537,8 +1674,8 @@ function s:UncommentLineNormal(line)
|
||||
"get the positions of all delimiter types on the line
|
||||
let indxLeft = s:FindDelimiterIndex(s:Left(), line)
|
||||
let indxLeftAlt = s:FindDelimiterIndex(s:Left({'alt': 1}), line)
|
||||
let indxRight = s:FindDelimiterIndex(s:Right(), line)
|
||||
let indxRightAlt = s:FindDelimiterIndex(s:Right({'alt': 1}), line)
|
||||
let indxRight = s:LastIndexOfDelim(s:Right(), line)
|
||||
let indxRightAlt = s:LastIndexOfDelim(s:Right({'alt': 1}), line)
|
||||
|
||||
"get the comment status on the line so we know how it is commented
|
||||
let lineCommentStatus = s:IsCommentedOutermost(s:Left(), s:Right(), s:Left({'alt': 1}), s:Right({'alt': 1}), line)
|
||||
@@ -1597,6 +1734,10 @@ function s:UncommentLineNormal(line)
|
||||
|
||||
let line = s:ConvertLeadingWhiteSpace(line)
|
||||
|
||||
if g:NERDTrimTrailingWhitespace == 1
|
||||
let line = s:TrimTrailingWhitespace(line)
|
||||
endif
|
||||
|
||||
return line
|
||||
endfunction
|
||||
|
||||
@@ -1671,6 +1812,12 @@ function s:AltMultipart()
|
||||
return b:NERDCommenterDelims['rightAlt'] != ''
|
||||
endfunction
|
||||
|
||||
" Function: s:AltNested() {{{2
|
||||
" returns 1 if the alternate multipart (if any) delimiters allow nesting
|
||||
function s:AltNested()
|
||||
return b:NERDCommenterDelims['nestedAlt']
|
||||
endfunction
|
||||
|
||||
" Function: s:CanCommentLine(forceNested, line) {{{2
|
||||
"This function is used to determine whether the given line can be commented.
|
||||
"It returns 1 if it can be and 0 otherwise
|
||||
@@ -1701,7 +1848,7 @@ function s:CanCommentLine(forceNested, lineNum)
|
||||
endif
|
||||
|
||||
"if the line is commented but nesting is allowed then return true
|
||||
if a:forceNested && (!s:Multipart() || g:NERDUsePlaceHolders)
|
||||
if s:Nested() || (a:forceNested && (!s:Multipart() || g:NERDUsePlaceHolders))
|
||||
return 1
|
||||
endif
|
||||
|
||||
@@ -1723,6 +1870,11 @@ endfunction
|
||||
" Return: 1 if the given lines can be commented sexually, 0 otherwise
|
||||
function s:CanSexyCommentLines(topline, bottomline)
|
||||
" see if the selected regions have any sexy comments
|
||||
" however, if the language allows nested comments,
|
||||
" we allow nested sexy comments
|
||||
if s:SexyNested()
|
||||
return 1
|
||||
endif
|
||||
let currentLine = a:topline
|
||||
while(currentLine <= a:bottomline)
|
||||
if s:IsInSexyComment(currentLine)
|
||||
@@ -1744,8 +1896,9 @@ function s:CanToggleCommentLine(forceNested, lineNum)
|
||||
return 0
|
||||
endif
|
||||
|
||||
" make sure we don't comment lines that are just spaces or tabs or empty.
|
||||
if theLine =~ "^[ \t]*$"
|
||||
" make sure we don't comment lines that are just spaces or tabs or empty,
|
||||
" unless configured otherwise
|
||||
if g:NERDCommentEmptyLines == 0 && theLine =~ "^[ \t]*$"
|
||||
return 0
|
||||
endif
|
||||
|
||||
@@ -2056,6 +2209,29 @@ function s:GetSexyComMarker(space, esc)
|
||||
return sexyComMarker
|
||||
endfunction
|
||||
|
||||
" Function: s:SexyNested() {{{2
|
||||
" Returns 1 if the sexy delimeters allow nesting
|
||||
" TODO this is ugly copy&paste from the GetSexyComLeft/Right functions,
|
||||
" these could all be cleaned up
|
||||
function s:SexyNested()
|
||||
let lenLeft = strlen(s:Left())
|
||||
let lenLeftAlt = strlen(s:Left({'alt': 1}))
|
||||
|
||||
"assume c style sexy comments if possible
|
||||
if s:HasCStyleComments()
|
||||
return (s:Left() == '/*' && s:Nested()) || (s:Left({'alt': 1}) == '/*' && s:AltNested())
|
||||
else
|
||||
"grab the longest left delim that has a right
|
||||
if s:Multipart() && lenLeft >= lenLeftAlt
|
||||
return s:Nested()
|
||||
elseif s:AltMultipart()
|
||||
return s:AltNested()
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Function: s:GetSexyComLeft(space, esc) {{{2
|
||||
" Returns the left delimiter for sexy comments for this filetype or -1 if
|
||||
" there is none. C style sexy comments are used if possible
|
||||
@@ -2183,7 +2359,7 @@ endfunction
|
||||
" -left/right: the left and right delimiters to check for
|
||||
function s:IsCommented(left, right, line)
|
||||
"if the line isn't commented return true
|
||||
if s:FindDelimiterIndex(a:left, a:line) != -1 && (s:FindDelimiterIndex(a:right, a:line) != -1 || !s:Multipart())
|
||||
if s:FindDelimiterIndex(a:left, a:line) != -1 && (s:LastIndexOfDelim(a:right, a:line) != -1 || !s:Multipart())
|
||||
return 1
|
||||
endif
|
||||
return 0
|
||||
@@ -2407,7 +2583,7 @@ function s:IsSexyComment(topline, bottomline)
|
||||
endif
|
||||
|
||||
"if there is a right delimiter on the top line then this isn't a sexy comment
|
||||
if s:FindDelimiterIndex(right, getline(a:topline)) != -1
|
||||
if s:LastIndexOfDelim(right, getline(a:topline)) != -1
|
||||
return 0
|
||||
endif
|
||||
|
||||
@@ -2436,7 +2612,7 @@ function s:IsSexyComment(topline, bottomline)
|
||||
|
||||
"if there is a right delimiter in an intermediate line then the block isn't
|
||||
"a sexy comment
|
||||
if s:FindDelimiterIndex(right, theLine) != -1
|
||||
if s:LastIndexOfDelim(right, theLine) != -1
|
||||
return 0
|
||||
endif
|
||||
|
||||
@@ -2573,6 +2749,12 @@ function s:NerdEcho(msg, typeOfMsg)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Function: s:Nested() {{{2
|
||||
" returns 1 if the current multipart (if any) delimiters allow nesting
|
||||
function s:Nested()
|
||||
return b:NERDCommenterDelims['nested']
|
||||
endfunction
|
||||
|
||||
" Function: s:NumberOfLeadingTabs(s) {{{2
|
||||
" returns the number of leading tabs in the given string
|
||||
function s:NumberOfLeadingTabs(s)
|
||||
|
||||
Reference in New Issue
Block a user