mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-11-10 02:33:48 -05:00
style: Remove stray whitespaces & normalize format (#517)
This commit is contained in:
@@ -1309,7 +1309,7 @@ endfunction
|
|||||||
" Function: nerdcommenter#IsCharCommented(line, col) abort
|
" Function: nerdcommenter#IsCharCommented(line, col) abort
|
||||||
" Check if the character at [line, col] is inside a comment
|
" Check if the character at [line, col] is inside a comment
|
||||||
" Note the Comment delimeter it self is considered as part of the comment
|
" Note the Comment delimeter it self is considered as part of the comment
|
||||||
"
|
"
|
||||||
" Args:
|
" Args:
|
||||||
" -line the line number of the character
|
" -line the line number of the character
|
||||||
" -col the column number of the character
|
" -col the column number of the character
|
||||||
@@ -1317,7 +1317,7 @@ endfunction
|
|||||||
function! nerdcommenter#IsCharCommented(line, col) abort
|
function! nerdcommenter#IsCharCommented(line, col) abort
|
||||||
" Function: s:searchfor(str, line, col, direction, [maxline])
|
" Function: s:searchfor(str, line, col, direction, [maxline])
|
||||||
" search str in the buffer, including the character at [line, col]
|
" search str in the buffer, including the character at [line, col]
|
||||||
" Args:
|
" Args:
|
||||||
" -str: the string for search
|
" -str: the string for search
|
||||||
" -line: the line number where search begins
|
" -line: the line number where search begins
|
||||||
" -col: the column number where search begins
|
" -col: the column number where search begins
|
||||||
@@ -1385,14 +1385,14 @@ function! nerdcommenter#IsCharCommented(line, col) abort
|
|||||||
let leftpos = s:searchfor(a:left, a:line, a:col, 1)
|
let leftpos = s:searchfor(a:left, a:line, a:col, 1)
|
||||||
if leftpos == [0, 0]
|
if leftpos == [0, 0]
|
||||||
if !blockcommented | let blockcommented = 0 | endif
|
if !blockcommented | let blockcommented = 0 | endif
|
||||||
else
|
else
|
||||||
" call s:searchfor(a:right, a:line, a:col, 0)
|
" call s:searchfor(a:right, a:line, a:col, 0)
|
||||||
let rightpos = s:searchfor(a:right, leftpos[0], leftpos[1] + strlen(a:right) + 1, 0)
|
let rightpos = s:searchfor(a:right, leftpos[0], leftpos[1] + strlen(a:right) + 1, 0)
|
||||||
if rightpos != [0, 0]
|
if rightpos != [0, 0]
|
||||||
if rightpos[0] < a:line
|
if rightpos[0] < a:line
|
||||||
if !blockcommented | let blockcommented = 0 | endif
|
if !blockcommented | let blockcommented = 0 | endif
|
||||||
elseif rightpos[0] == a:line
|
elseif rightpos[0] == a:line
|
||||||
if !blockcommented
|
if !blockcommented
|
||||||
let blockcommented = (rightpos[1] + strlen(a:right) > a:col) ? 1 : 0
|
let blockcommented = (rightpos[1] + strlen(a:right) > a:col) ? 1 : 0
|
||||||
endif
|
endif
|
||||||
else " rightpos > a:line
|
else " rightpos > a:line
|
||||||
@@ -1406,14 +1406,14 @@ function! nerdcommenter#IsCharCommented(line, col) abort
|
|||||||
return linecommented || blockcommented
|
return linecommented || blockcommented
|
||||||
endfunction
|
endfunction
|
||||||
return s:checkwith(
|
return s:checkwith(
|
||||||
\ b:NERDCommenterDelims['left'],
|
\ b:NERDCommenterDelims['left'],
|
||||||
\ b:NERDCommenterDelims['right'],
|
\ b:NERDCommenterDelims['right'],
|
||||||
\ a:line,
|
\ a:line,
|
||||||
\ a:col) ||
|
\ a:col) ||
|
||||||
\ s:checkwith(
|
\ s:checkwith(
|
||||||
\ b:NERDCommenterDelims['leftAlt'],
|
\ b:NERDCommenterDelims['leftAlt'],
|
||||||
\ b:NERDCommenterDelims['rightAlt'],
|
\ b:NERDCommenterDelims['rightAlt'],
|
||||||
\ a:line,
|
\ a:line,
|
||||||
\ a:col)
|
\ a:col)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -2528,7 +2528,7 @@ function! s:IsDelimValid(delimiter, delIndx, line) abort
|
|||||||
|
|
||||||
"vim comments are so fucking stupid!! Why the hell do they have comment
|
"vim comments are so fucking stupid!! Why the hell do they have comment
|
||||||
"delimiters that are used elsewhere in the syntax?!?! We need to check
|
"delimiters that are used elsewhere in the syntax?!?! We need to check
|
||||||
"some conditions especially for vim.
|
"some conditions especially for vim.
|
||||||
"Also check &commentstring because it may be overwritten for embedded lua.
|
"Also check &commentstring because it may be overwritten for embedded lua.
|
||||||
if &filetype ==# 'vim' && &commentstring[0] ==# '"'
|
if &filetype ==# 'vim' && &commentstring[0] ==# '"'
|
||||||
if !s:IsNumEven(s:CountNonESCedOccurances(preComStr, '"', "\\"))
|
if !s:IsNumEven(s:CountNonESCedOccurances(preComStr, '"', "\\"))
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ creates a namespace so that custom commands don't interfere with Vim's
|
|||||||
built-in shortcuts.
|
built-in shortcuts.
|
||||||
|
|
||||||
The leader key can be mapped to whatever the user likes (see :help mapleader).
|
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
|
In the definition of custom commands |<Leader>| is the placeholder for the
|
||||||
leader key. To see the current mapping for |<Leader>| type :echo mapleader.
|
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
|
If it reports an undefined variable it means the leader key is set to the
|
||||||
default of '\'.
|
default of '\'.
|
||||||
@@ -464,38 +464,38 @@ change the filetype back: >
|
|||||||
|
|
||||||
|'NERDCustomDelimiters'| Add or override delimiters for any
|
|'NERDCustomDelimiters'| Add or override delimiters for any
|
||||||
filetypes.
|
filetypes.
|
||||||
|
|
||||||
|'NERDDefaultNesting'| Tells the script to use nested comments
|
|'NERDDefaultNesting'| Tells the script to use nested comments
|
||||||
by default.
|
by default.
|
||||||
|
|
||||||
|'NERDMenuMode'| Specifies how the NERD commenter menu
|
|'NERDMenuMode'| Specifies how the NERD commenter menu
|
||||||
will appear (if at all).
|
will appear (if at all).
|
||||||
|
|
||||||
|'NERDLPlace'| Specifies what to use as the left
|
|'NERDLPlace'| Specifies what to use as the left
|
||||||
delimiter placeholder when nesting
|
delimiter placeholder when nesting
|
||||||
comments.
|
comments.
|
||||||
|
|
||||||
|'NERDUsePlaceHolders'| Specifies which filetypes may use
|
|'NERDUsePlaceHolders'| Specifies which filetypes may use
|
||||||
placeholders when nesting comments.
|
placeholders when nesting comments.
|
||||||
|
|
||||||
|'NERDRemoveAltComs'| Tells the script whether to remove
|
|'NERDRemoveAltComs'| Tells the script whether to remove
|
||||||
alternative comment delimiters when
|
alternative comment delimiters when
|
||||||
uncommenting.
|
uncommenting.
|
||||||
|
|
||||||
|'NERDRemoveExtraSpaces'| Tells the script to always remove the
|
|'NERDRemoveExtraSpaces'| Tells the script to always remove the
|
||||||
extra spaces when uncommenting
|
extra spaces when uncommenting
|
||||||
(regardless of whether NERDSpaceDelims
|
(regardless of whether NERDSpaceDelims
|
||||||
is set).
|
is set).
|
||||||
|
|
||||||
|'NERDRPlace'| Specifies what to use as the right
|
|'NERDRPlace'| Specifies what to use as the right
|
||||||
delimiter placeholder when nesting
|
delimiter placeholder when nesting
|
||||||
comments.
|
comments.
|
||||||
|
|
||||||
|'NERDSpaceDelims'| Specifies whether to add extra spaces
|
|'NERDSpaceDelims'| Specifies whether to add extra spaces
|
||||||
around delimiters when commenting, and
|
around delimiters when commenting, and
|
||||||
whether to remove them when
|
whether to remove them when
|
||||||
uncommenting.
|
uncommenting.
|
||||||
|
|
||||||
|'NERDTrimTrailingWhitespace'| Specifies if trailing whitespace
|
|'NERDTrimTrailingWhitespace'| Specifies if trailing whitespace
|
||||||
should be deleted when uncommenting.
|
should be deleted when uncommenting.
|
||||||
|
|
||||||
@@ -506,7 +506,7 @@ change the filetype back: >
|
|||||||
one of 'none', 'left', 'start', or
|
one of 'none', 'left', 'start', or
|
||||||
'both'.
|
'both'.
|
||||||
|
|
||||||
|'NERDToggleCheckAllLines'| Enable NERDCommenterToggle to check
|
|'NERDToggleCheckAllLines'| Enable NERDCommenterToggle to check
|
||||||
all selected lines is commented or not.
|
all selected lines is commented or not.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
@@ -826,7 +826,7 @@ again.
|
|||||||
Values: 0 or 1.
|
Values: 0 or 1.
|
||||||
Default 0.
|
Default 0.
|
||||||
|
|
||||||
When this option is set to 1, NERDCommenterToggle will check all selected line,
|
When this option is set to 1, NERDCommenterToggle will check all selected line,
|
||||||
if there have oneline not be commented, then comment all lines.
|
if there have oneline not be commented, then comment all lines.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
@@ -901,15 +901,15 @@ NERDComment({mode}, {type}) *NERDComment()*
|
|||||||
{mode}: character indicating the mode in which the comment
|
{mode}: character indicating the mode in which the comment
|
||||||
is requested:
|
is requested:
|
||||||
'n' for Normal mode, 'x' for Visual mode
|
'n' for Normal mode, 'x' for Visual mode
|
||||||
{type}: the type of commenting requested. Can be 'Sexy',
|
{type}: the type of commenting requested. Can be 'Sexy',
|
||||||
'Invert', 'Minimal', 'Toggle', 'AlignLeft',
|
'Invert', 'Minimal', 'Toggle', 'AlignLeft',
|
||||||
'AlignBoth', 'Comment', 'Nested', 'ToEOL', 'Append',
|
'AlignBoth', 'Comment', 'Nested', 'ToEOL', 'Append',
|
||||||
'Insert', 'Uncomment', 'Yank'
|
'Insert', 'Uncomment', 'Yank'
|
||||||
|
|
||||||
|
|
||||||
NERDCommentIsCharCommented({line}, {col}) *NERDCommentIsCharCommented()*
|
NERDCommentIsCharCommented({line}, {col}) *NERDCommentIsCharCommented()*
|
||||||
Check if the character at [{line}, {col}] is inside a comment
|
Check if the character at [{line}, {col}] is inside a comment
|
||||||
Note the Comment delimeter it self is considered as part of the
|
Note the Comment delimeter it self is considered as part of the
|
||||||
comment
|
comment
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|||||||
Reference in New Issue
Block a user