mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-11-08 18:03:46 -05:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a32fd2534 | ||
|
|
e679d8a341 | ||
|
|
670dba1bb5 | ||
|
|
2f973bd4fa | ||
|
|
ff3d8d7d7c | ||
|
|
af8bb4258d | ||
|
|
fd61bc71f6 | ||
|
|
3e99b39f4f | ||
|
|
09b07d50ba | ||
|
|
013cfec44d | ||
|
|
d4548ebb0c | ||
|
|
c321b3460b | ||
|
|
63ba1a1123 | ||
|
|
376838672d | ||
|
|
285902752f | ||
|
|
d1ac2382b2 | ||
|
|
a6b3cc6842 | ||
|
|
d05cfd190b | ||
|
|
0e1f6f6866 | ||
|
|
41e686824a | ||
|
|
c51f5992b2 |
@@ -22,7 +22,7 @@ Comment functions so powerful—no comment necessary.
|
||||
|
||||
1. Add `NeoBundle 'scrooloose/nerdcommenter'` to your vimrc file.
|
||||
2. Reload your vimrc or restart
|
||||
3. Run `:NeoUpdate``
|
||||
3. Run `:NeoUpdate`
|
||||
|
||||
#### [Pathogen](https://github.com/tpope/vim-pathogen)
|
||||
|
||||
@@ -94,6 +94,9 @@ 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
|
||||
|
||||
@@ -488,6 +488,9 @@ change the filetype back: >
|
||||
one of 'none', 'left', 'start', or
|
||||
'both'.
|
||||
|
||||
|'NERDToggleCheckAllLines'| Enable NERDCommenterToggle to check
|
||||
all selected lines is commented or not.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
4.3 Options details *NERDComOptionsDetails*
|
||||
|
||||
@@ -800,6 +803,15 @@ 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*
|
||||
|
||||
@@ -1093,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
|
||||
@@ -65,6 +65,7 @@ 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="[]#*$%'\" ?`!&();<>\\"
|
||||
|
||||
@@ -82,6 +83,7 @@ let s:delimiterMap = {
|
||||
\ 'ansible': { 'left': '#' },
|
||||
\ 'apache': { 'left': '#' },
|
||||
\ 'apachestyle': { 'left': '#' },
|
||||
\ 'apdl': { 'left': '!' },
|
||||
\ 'applescript': { 'left': '--', 'leftAlt': '(*', 'rightAlt': '*)' },
|
||||
\ 'armasm': { 'left': ';' },
|
||||
\ 'asciidoc': { 'left': '//' },
|
||||
@@ -195,6 +197,7 @@ let s:delimiterMap = {
|
||||
\ 'gitconfig': { 'left': ';' },
|
||||
\ 'gitignore': { 'left': '#' },
|
||||
\ 'gitrebase': { 'left': '#' },
|
||||
\ 'glsl': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'gnuplot': { 'left': '#' },
|
||||
\ 'go': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'groovy': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
@@ -237,7 +240,7 @@ let s:delimiterMap = {
|
||||
\ 'jinja': { 'left': '<!--', 'right': '-->', 'leftAlt': '{#', 'rightAlt': '#}' },
|
||||
\ 'jproperties': { 'left': '#' },
|
||||
\ 'jsp': { 'left': '<%--', 'right': '--%>' },
|
||||
\ 'julia': { 'left': '#' },
|
||||
\ 'julia': { 'left': '# ', 'leftAlt': '#=', 'rightAlt': '=#' },
|
||||
\ 'kix': { 'left': ';' },
|
||||
\ 'kscript': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'lace': { 'left': '--' },
|
||||
@@ -271,7 +274,9 @@ let s:delimiterMap = {
|
||||
\ 'master': { 'left': '$' },
|
||||
\ 'matlab': { 'left': '%', 'leftAlt': '%{', 'rightAlt': '%}' },
|
||||
\ 'mel': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'meson': { 'left': '#' },
|
||||
\ 'mib': { 'left': '--' },
|
||||
\ 'minizinc': { 'left': '% ', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'mips': { 'left': '#' },
|
||||
\ 'mirah': {'left': '#' },
|
||||
\ 'mkd': { 'left': '<!---', 'right': '-->' },
|
||||
@@ -332,6 +337,7 @@ let s:delimiterMap = {
|
||||
\ 'povini': { 'left': ';' },
|
||||
\ 'ppd': { 'left': '%' },
|
||||
\ 'ppwiz': { 'left': ';;' },
|
||||
\ 'praat': { 'left': '#' },
|
||||
\ 'privoxy': { 'left': '#' },
|
||||
\ 'processing': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'prolog': { 'left': '%', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
@@ -350,10 +356,12 @@ let s:delimiterMap = {
|
||||
\ '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': '=begin', 'rightAlt': '=end' },
|
||||
@@ -368,10 +376,12 @@ let s:delimiterMap = {
|
||||
\ 'scons': { 'left': '#' },
|
||||
\ 'scsh': { 'left': ';' },
|
||||
\ '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': '--' },
|
||||
@@ -403,6 +413,7 @@ let s:delimiterMap = {
|
||||
\ 'sqr': { 'left': '!' },
|
||||
\ 'squid': { 'left': '#' },
|
||||
\ 'ss': { 'left': ';', 'leftAlt': '#|', 'rightAlt': '|#' },
|
||||
\ 'sshconfig': { 'left': '#' },
|
||||
\ 'sshdconfig': { 'left': '#' },
|
||||
\ 'st': { 'left': '"' },
|
||||
\ 'stan': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
@@ -429,6 +440,7 @@ let s:delimiterMap = {
|
||||
\ 'tsalt': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||
\ 'tsscl': { 'left': '#' },
|
||||
\ 'tssgm': { 'left': "comment = '", 'right': "'" },
|
||||
\ 'ttl': { 'left': '#' },
|
||||
\ 'tup': { 'left': '#' },
|
||||
\ 'twig': { 'left': '{#', 'right': '#}' },
|
||||
\ 'txt2tags': { 'left': '%' },
|
||||
@@ -1247,13 +1259,30 @@ function! NERDComment(mode, type) range
|
||||
endtry
|
||||
|
||||
elseif a:type ==? 'Toggle'
|
||||
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'
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user