mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-11-10 02:33:48 -05:00
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.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
" Section: script init stuff {{{1
|
" Section: script init stuff
|
||||||
if exists('loaded_nerd_comments')
|
if exists('loaded_nerd_comments')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
@@ -8,7 +8,7 @@ if v:version < 700
|
|||||||
endif
|
endif
|
||||||
let loaded_nerd_comments = 1
|
let loaded_nerd_comments = 1
|
||||||
|
|
||||||
" Function: s:InitVariable() function {{{2
|
" Function: s:InitVariable() function
|
||||||
" This function is used to initialise a given variable to a given value. The
|
" This function is used to initialise a given variable to a given value. The
|
||||||
" variable is only initialised if it does not exist prior
|
" variable is only initialised if it does not exist prior
|
||||||
"
|
"
|
||||||
@@ -26,14 +26,14 @@ function s:InitVariable(var, value)
|
|||||||
return 0
|
return 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Section: space string init{{{2
|
" Section: space string init
|
||||||
" When putting spaces after the left delimiter and before the right we use
|
" When putting spaces after the left delimiter and before the right we use
|
||||||
" s:spaceStr for the space char. This way we can make it add anything after
|
" s:spaceStr for the space char. This way we can make it add anything after
|
||||||
" the left and before the right by modifying this variable
|
" the left and before the right by modifying this variable
|
||||||
let s:spaceStr = ' '
|
let s:spaceStr = ' '
|
||||||
let s:lenSpaceStr = strlen(s:spaceStr)
|
let s:lenSpaceStr = strlen(s:spaceStr)
|
||||||
|
|
||||||
" Section: variable initialization {{{2
|
" Section: variable initialization
|
||||||
call s:InitVariable('g:NERDAllowAnyVisualDelims', 1)
|
call s:InitVariable('g:NERDAllowAnyVisualDelims', 1)
|
||||||
call s:InitVariable('g:NERDBlockComIgnoreEmpty', 0)
|
call s:InitVariable('g:NERDBlockComIgnoreEmpty', 0)
|
||||||
call s:InitVariable('g:NERDCommentWholeLinesInVMode', 0)
|
call s:InitVariable('g:NERDCommentWholeLinesInVMode', 0)
|
||||||
@@ -482,9 +482,9 @@ if exists('g:NERDCustomDelimiters')
|
|||||||
call extend(s:delimiterMap, g:NERDCustomDelimiters)
|
call extend(s:delimiterMap, g:NERDCustomDelimiters)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Section: Comment mapping functions, autocommands and commands {{{1
|
" Section: Comment mapping functions, autocommands and commands
|
||||||
" ============================================================================
|
" ============================================================================
|
||||||
" Section: Comment enabler autocommands {{{2
|
" Section: Comment enabler autocommands
|
||||||
" ============================================================================
|
" ============================================================================
|
||||||
|
|
||||||
augroup NERDCommenter
|
augroup NERDCommenter
|
||||||
@@ -499,7 +499,7 @@ augroup NERDCommenter
|
|||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
|
||||||
" Function: s:SetUpForNewFiletype(filetype) function {{{2
|
" Function: s:SetUpForNewFiletype(filetype) function
|
||||||
" This function is responsible for setting up buffer scoped variables for the
|
" This function is responsible for setting up buffer scoped variables for the
|
||||||
" given filetype.
|
" given filetype.
|
||||||
"
|
"
|
||||||
@@ -568,7 +568,7 @@ function s:CreateDelimMapFromCms()
|
|||||||
\ 'nestedAlt': 0}
|
\ 'nestedAlt': 0}
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:SwitchToAlternativeDelimiters(printMsgs) function {{{2
|
" Function: s:SwitchToAlternativeDelimiters(printMsgs) function
|
||||||
" This function is used to swap the delimiters that are being used to the
|
" This function is used to swap the delimiters that are being used to the
|
||||||
" alternative delimiters for that filetype. For example, if a c++ file is
|
" alternative delimiters for that filetype. For example, if a c++ file is
|
||||||
" being edited and // comments are being used, after this function is called
|
" being edited and // comments are being used, after this function is called
|
||||||
@@ -618,9 +618,9 @@ function s:SwitchToAlternativeDelimiters(printMsgs)
|
|||||||
return 1
|
return 1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Section: Comment delimiter add/removal functions {{{1
|
" Section: Comment delimiter add/removal functions
|
||||||
" ============================================================================
|
" ============================================================================
|
||||||
" Function: s:AppendCommentToLine(){{{2
|
" Function: s:AppendCommentToLine()
|
||||||
" This function appends comment delimiters at the EOL and places the cursor in
|
" This function appends comment delimiters at the EOL and places the cursor in
|
||||||
" position to start typing the comment
|
" position to start typing the comment
|
||||||
function s:AppendCommentToLine()
|
function s:AppendCommentToLine()
|
||||||
@@ -648,7 +648,7 @@ function s:AppendCommentToLine()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:CommentBlock(top, bottom, lSide, rSide, forceNested ) {{{2
|
" Function: s:CommentBlock(top, bottom, lSide, rSide, forceNested )
|
||||||
" This function is used to comment out a region of code. This region is
|
" This function is used to comment out a region of code. This region is
|
||||||
" specified as a bounding box by arguments to the function.
|
" specified as a bounding box by arguments to the function.
|
||||||
"
|
"
|
||||||
@@ -782,7 +782,7 @@ function s:CommentBlock(top, bottom, lSide, rSide, forceNested )
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:CommentLines(forceNested, alignLeft, alignRight, firstLine, lastLine) {{{2
|
" Function: s:CommentLines(forceNested, alignLeft, alignRight, firstLine, lastLine)
|
||||||
" This function comments a range of lines.
|
" This function comments a range of lines.
|
||||||
"
|
"
|
||||||
" Args:
|
" Args:
|
||||||
@@ -851,7 +851,7 @@ function s:CommentLines(forceNested, align, firstLine, lastLine)
|
|||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:CommentLinesMinimal(firstLine, lastLine) {{{2
|
" Function: s:CommentLinesMinimal(firstLine, lastLine)
|
||||||
" This function comments a range of lines in a minimal style. I
|
" This function comments a range of lines in a minimal style. I
|
||||||
"
|
"
|
||||||
" Args:
|
" Args:
|
||||||
@@ -912,7 +912,7 @@ function s:CommentLinesMinimal(firstLine, lastLine)
|
|||||||
call setline(a:lastLine, theLine)
|
call setline(a:lastLine, theLine)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:CommentLinesSexy(topline, bottomline) function {{{2
|
" Function: s:CommentLinesSexy(topline, bottomline) function
|
||||||
" This function is used to comment lines in the 'Sexy' style. E.g., in c:
|
" This function is used to comment lines in the 'Sexy' style. E.g., in c:
|
||||||
" /*
|
" /*
|
||||||
" * This is a sexy comment
|
" * This is a sexy comment
|
||||||
@@ -1047,7 +1047,7 @@ function s:CommentLinesSexy(topline, bottomline)
|
|||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:CommentLinesToggle(forceNested, firstLine, lastLine) {{{2
|
" Function: s:CommentLinesToggle(forceNested, firstLine, lastLine)
|
||||||
" Applies "toggle" commenting to the given range of lines
|
" Applies "toggle" commenting to the given range of lines
|
||||||
"
|
"
|
||||||
" Args:
|
" Args:
|
||||||
@@ -1104,7 +1104,7 @@ function s:CommentLinesToggle(forceNested, firstLine, lastLine)
|
|||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:CommentRegion(topline, topCol, bottomLine, bottomCol) function {{{2
|
" Function: s:CommentRegion(topline, topCol, bottomLine, bottomCol) function
|
||||||
" This function comments chunks of text selected in visual mode.
|
" This function comments chunks of text selected in visual mode.
|
||||||
" It will comment exactly the text that they have selected.
|
" It will comment exactly the text that they have selected.
|
||||||
" Args:
|
" Args:
|
||||||
@@ -1156,7 +1156,7 @@ function s:CommentRegion(topLine, topCol, bottomLine, bottomCol, forceNested)
|
|||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:InvertComment(firstLine, lastLine) function {{{2
|
" Function: s:InvertComment(firstLine, lastLine) function
|
||||||
" Inverts the comments on the lines between and including the given line
|
" Inverts the comments on the lines between and including the given line
|
||||||
" numbers i.e all commented lines are uncommented and vice versa
|
" numbers i.e all commented lines are uncommented and vice versa
|
||||||
" Args:
|
" Args:
|
||||||
@@ -1205,7 +1205,7 @@ function! NERDCommentIsLineCommented(lineNo)
|
|||||||
return s:IsInSexyComment(a:lineNo) || s:IsCommentedFromStartOfLine(s:Left(), theLine) || s:IsCommentedFromStartOfLine(s:Left({'alt': 1}), theLine)
|
return s:IsInSexyComment(a:lineNo) || s:IsCommentedFromStartOfLine(s:Left(), theLine) || s:IsCommentedFromStartOfLine(s:Left({'alt': 1}), theLine)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: NERDComment(mode, type) function {{{2
|
" Function: NERDComment(mode, type) function
|
||||||
" This function is a Wrapper for the main commenting functions
|
" This function is a Wrapper for the main commenting functions
|
||||||
"
|
"
|
||||||
" Args:
|
" Args:
|
||||||
@@ -1458,7 +1458,7 @@ function! NERDCommentIsCharCommented(line, col) abort
|
|||||||
\ a:col)
|
\ a:col)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:PlaceDelimitersAndInsBetween() function {{{2
|
" Function: s:PlaceDelimitersAndInsBetween() function
|
||||||
" This is function is called to place comment delimiters down and place the
|
" This is function is called to place comment delimiters down and place the
|
||||||
" cursor between them
|
" cursor between them
|
||||||
function s:PlaceDelimitersAndInsBetween()
|
function s:PlaceDelimitersAndInsBetween()
|
||||||
@@ -1508,7 +1508,7 @@ function s:PlaceDelimitersAndInsBetween()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:RemoveDelimiters(left, right, line) {{{2
|
" Function: s:RemoveDelimiters(left, right, line)
|
||||||
" this function is called to remove the first left comment delimiter and the
|
" this function is called to remove the first left comment delimiter and the
|
||||||
" last right delimiter of the given line.
|
" last right delimiter of the given line.
|
||||||
"
|
"
|
||||||
@@ -1557,7 +1557,7 @@ function s:RemoveDelimiters(left, right, line)
|
|||||||
return line
|
return line
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:SetupStateBeforeLineComment(topLine, bottomLine) {{{2
|
" Function: s:SetupStateBeforeLineComment(topLine, bottomLine)
|
||||||
" Changes ignorecase and foldmethod options before commenting lines and saves
|
" Changes ignorecase and foldmethod options before commenting lines and saves
|
||||||
" their original values in a dict, which is returned as a result
|
" their original values in a dict, which is returned as a result
|
||||||
"
|
"
|
||||||
@@ -1586,7 +1586,7 @@ function s:SetupStateBeforeLineComment(topLine, bottomLine)
|
|||||||
return state
|
return state
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:RecoverStateAfterLineComment(state) {{{2
|
" Function: s:RecoverStateAfterLineComment(state)
|
||||||
" Receives the state returned by s:SetupStateBeforeLineComment and restores
|
" Receives the state returned by s:SetupStateBeforeLineComment and restores
|
||||||
" the state accordingly
|
" the state accordingly
|
||||||
"
|
"
|
||||||
@@ -1602,7 +1602,7 @@ function s:RecoverStateAfterLineComment(state)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:TrimTrailingWhitespace(line) {{{2
|
" Function: s:TrimTrailingWhitespace(line)
|
||||||
" This function removes all the trailing whitespace
|
" This function removes all the trailing whitespace
|
||||||
" Args:
|
" Args:
|
||||||
" -line: the target line
|
" -line: the target line
|
||||||
@@ -1611,7 +1611,7 @@ function s:TrimTrailingWhitespace(line)
|
|||||||
return toReturn
|
return toReturn
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:UncommentLines(topLine, bottomLine) {{{2
|
" Function: s:UncommentLines(topLine, bottomLine)
|
||||||
" This function uncomments the given lines
|
" This function uncomments the given lines
|
||||||
"
|
"
|
||||||
" Args:
|
" Args:
|
||||||
@@ -1657,7 +1657,7 @@ function s:UncommentLines(topLine, bottomLine)
|
|||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:UncommentLinesSexy(topline, bottomline) {{{2
|
" Function: s:UncommentLinesSexy(topline, bottomline)
|
||||||
" This function removes all the comment characters associated with the sexy
|
" This function removes all the comment characters associated with the sexy
|
||||||
" comment spanning the given lines
|
" comment spanning the given lines
|
||||||
" Args:
|
" Args:
|
||||||
@@ -1788,7 +1788,7 @@ function s:UncommentLinesSexy(topline, bottomline)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:UncommentLineNormal(line) {{{2
|
" Function: s:UncommentLineNormal(line)
|
||||||
" uncomments the given line and returns the result
|
" uncomments the given line and returns the result
|
||||||
" Args:
|
" Args:
|
||||||
" -line: the line to uncomment
|
" -line: the line to uncomment
|
||||||
@@ -1865,7 +1865,7 @@ function s:UncommentLineNormal(line)
|
|||||||
return line
|
return line
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:UncommentLinesNormal(topline, bottomline) {{{2
|
" Function: s:UncommentLinesNormal(topline, bottomline)
|
||||||
" This function is called to uncomment lines that aren't a sexy comment
|
" This function is called to uncomment lines that aren't a sexy comment
|
||||||
" Args:
|
" Args:
|
||||||
" -topline/bottomline: the top/bottom line numbers of the comment
|
" -topline/bottomline: the top/bottom line numbers of the comment
|
||||||
@@ -1879,16 +1879,16 @@ function s:UncommentLinesNormal(topline, bottomline)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" Section: Other helper functions {{{1
|
" Section: Other helper functions
|
||||||
" ============================================================================
|
" ============================================================================
|
||||||
|
|
||||||
" Function: s:AddLeftDelim(delim, theLine) {{{2
|
" Function: s:AddLeftDelim(delim, theLine)
|
||||||
" Args:
|
" Args:
|
||||||
function s:AddLeftDelim(delim, theLine)
|
function s:AddLeftDelim(delim, theLine)
|
||||||
return substitute(a:theLine, '^\([ \t]*\)', '\1' . a:delim, '')
|
return substitute(a:theLine, '^\([ \t]*\)', '\1' . a:delim, '')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:AddLeftDelimAligned(delim, theLine) {{{2
|
" Function: s:AddLeftDelimAligned(delim, theLine)
|
||||||
" Args:
|
" Args:
|
||||||
function s:AddLeftDelimAligned(delim, theLine, alignIndx)
|
function s:AddLeftDelimAligned(delim, theLine, alignIndx)
|
||||||
|
|
||||||
@@ -1902,7 +1902,7 @@ function s:AddLeftDelimAligned(delim, theLine, alignIndx)
|
|||||||
return strpart(theLine, 0, a:alignIndx) . a:delim . strpart(theLine, a:alignIndx)
|
return strpart(theLine, 0, a:alignIndx) . a:delim . strpart(theLine, a:alignIndx)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:AddRightDelim(delim, theLine) {{{2
|
" Function: s:AddRightDelim(delim, theLine)
|
||||||
" Args:
|
" Args:
|
||||||
function s:AddRightDelim(delim, theLine)
|
function s:AddRightDelim(delim, theLine)
|
||||||
if a:delim ==# ''
|
if a:delim ==# ''
|
||||||
@@ -1912,7 +1912,7 @@ function s:AddRightDelim(delim, theLine)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:AddRightDelimAligned(delim, theLine, alignIndx) {{{2
|
" Function: s:AddRightDelimAligned(delim, theLine, alignIndx)
|
||||||
" Args:
|
" Args:
|
||||||
function s:AddRightDelimAligned(delim, theLine, alignIndx)
|
function s:AddRightDelimAligned(delim, theLine, alignIndx)
|
||||||
if a:delim ==# ''
|
if a:delim ==# ''
|
||||||
@@ -1930,19 +1930,19 @@ function s:AddRightDelimAligned(delim, theLine, alignIndx)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:AltMultipart() {{{2
|
" Function: s:AltMultipart()
|
||||||
" returns 1 if the alternative delimiters are multipart
|
" returns 1 if the alternative delimiters are multipart
|
||||||
function s:AltMultipart()
|
function s:AltMultipart()
|
||||||
return b:NERDCommenterDelims['rightAlt'] !=# ''
|
return b:NERDCommenterDelims['rightAlt'] !=# ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:AltNested() {{{2
|
" Function: s:AltNested()
|
||||||
" returns 1 if the alternate multipart (if any) delimiters allow nesting
|
" returns 1 if the alternate multipart (if any) delimiters allow nesting
|
||||||
function s:AltNested()
|
function s:AltNested()
|
||||||
return b:NERDCommenterDelims['nestedAlt']
|
return b:NERDCommenterDelims['nestedAlt']
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:CanCommentLine(forceNested, line) {{{2
|
" Function: s:CanCommentLine(forceNested, line)
|
||||||
"This function is used to determine whether the given line can be commented.
|
"This function is used to determine whether the given line can be commented.
|
||||||
"It returns 1 if it can be and 0 otherwise
|
"It returns 1 if it can be and 0 otherwise
|
||||||
"
|
"
|
||||||
@@ -1979,7 +1979,7 @@ function s:CanCommentLine(forceNested, lineNum)
|
|||||||
return 0
|
return 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:CanPlaceCursor(line, col) {{{2
|
" Function: s:CanPlaceCursor(line, col)
|
||||||
" returns 1 if the cursor can be placed exactly in the given position
|
" returns 1 if the cursor can be placed exactly in the given position
|
||||||
function s:CanPlaceCursor(line, col)
|
function s:CanPlaceCursor(line, col)
|
||||||
let c = col('.')
|
let c = col('.')
|
||||||
@@ -1990,7 +1990,7 @@ function s:CanPlaceCursor(line, col)
|
|||||||
return success
|
return success
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:CanSexyCommentLines(topline, bottomline) {{{2
|
" Function: s:CanSexyCommentLines(topline, bottomline)
|
||||||
" Return: 1 if the given lines can be commented sexually, 0 otherwise
|
" Return: 1 if the given lines can be commented sexually, 0 otherwise
|
||||||
function s:CanSexyCommentLines(topline, bottomline)
|
function s:CanSexyCommentLines(topline, bottomline)
|
||||||
" see if the selected regions have any sexy comments
|
" see if the selected regions have any sexy comments
|
||||||
@@ -2008,7 +2008,7 @@ function s:CanSexyCommentLines(topline, bottomline)
|
|||||||
endwhile
|
endwhile
|
||||||
return 1
|
return 1
|
||||||
endfunction
|
endfunction
|
||||||
" Function: s:CanToggleCommentLine(forceNested, line) {{{2
|
" Function: s:CanToggleCommentLine(forceNested, line)
|
||||||
"This function is used to determine whether the given line can be toggle commented.
|
"This function is used to determine whether the given line can be toggle commented.
|
||||||
"It returns 1 if it can be and 0 otherwise
|
"It returns 1 if it can be and 0 otherwise
|
||||||
"
|
"
|
||||||
@@ -2034,7 +2034,7 @@ function s:CanToggleCommentLine(forceNested, lineNum)
|
|||||||
return 1
|
return 1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:ConvertLeadingSpacesToTabs(line) {{{2
|
" Function: s:ConvertLeadingSpacesToTabs(line)
|
||||||
" This function takes a line and converts all leading tabs on that line into
|
" This function takes a line and converts all leading tabs on that line into
|
||||||
" spaces
|
" spaces
|
||||||
"
|
"
|
||||||
@@ -2050,7 +2050,7 @@ function s:ConvertLeadingSpacesToTabs(line)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" Function: s:ConvertLeadingTabsToSpaces(line) {{{2
|
" Function: s:ConvertLeadingTabsToSpaces(line)
|
||||||
" This function takes a line and converts all leading spaces on that line into
|
" This function takes a line and converts all leading spaces on that line into
|
||||||
" tabs
|
" tabs
|
||||||
"
|
"
|
||||||
@@ -2065,7 +2065,7 @@ function s:ConvertLeadingTabsToSpaces(line)
|
|||||||
return toReturn
|
return toReturn
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:ConvertLeadingWhiteSpace(line) {{{2
|
" Function: s:ConvertLeadingWhiteSpace(line)
|
||||||
" Converts the leading white space to tabs/spaces depending on &tabstop
|
" Converts the leading white space to tabs/spaces depending on &tabstop
|
||||||
"
|
"
|
||||||
" Args:
|
" Args:
|
||||||
@@ -2084,7 +2084,7 @@ function s:ConvertLeadingWhiteSpace(line)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" Function: s:CountNonESCedOccurances(str, searchstr, escChar) {{{2
|
" Function: s:CountNonESCedOccurances(str, searchstr, escChar)
|
||||||
" This function counts the number of substrings contained in another string.
|
" This function counts the number of substrings contained in another string.
|
||||||
" These substrings are only counted if they are not escaped with escChar
|
" These substrings are only counted if they are not escaped with escChar
|
||||||
" Args:
|
" Args:
|
||||||
@@ -2111,7 +2111,7 @@ function s:CountNonESCedOccurances(str, searchstr, escChar)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
" Function: s:DoesBlockHaveDelim(delim, top, bottom) {{{2
|
" Function: s:DoesBlockHaveDelim(delim, top, bottom)
|
||||||
" Returns 1 if the given block of lines has a delimiter (a:delim) in it
|
" Returns 1 if the given block of lines has a delimiter (a:delim) in it
|
||||||
" Args:
|
" Args:
|
||||||
" -delim: the comment delimiter to check the block for
|
" -delim: the comment delimiter to check the block for
|
||||||
@@ -2129,7 +2129,7 @@ function s:DoesBlockHaveDelim(delim, top, bottom)
|
|||||||
return 0
|
return 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:DoesBlockHaveMultipartDelim(top, bottom) {{{2
|
" Function: s:DoesBlockHaveMultipartDelim(top, bottom)
|
||||||
" Returns 1 if the given block has a >= 1 multipart delimiter in it
|
" Returns 1 if the given block has a >= 1 multipart delimiter in it
|
||||||
" Args:
|
" Args:
|
||||||
" -top: the top line number of the block
|
" -top: the top line number of the block
|
||||||
@@ -2146,14 +2146,14 @@ function s:DoesBlockHaveMultipartDelim(top, bottom)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" Function: s:Esc(str) {{{2
|
" Function: s:Esc(str)
|
||||||
" Escapes all the tricky chars in the given string
|
" Escapes all the tricky chars in the given string
|
||||||
function s:Esc(str)
|
function s:Esc(str)
|
||||||
let charsToEsc = '*/\."&$+'
|
let charsToEsc = '*/\."&$+'
|
||||||
return escape(a:str, charsToEsc)
|
return escape(a:str, charsToEsc)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:FindDelimiterIndex(delimiter, line) {{{2
|
" Function: s:FindDelimiterIndex(delimiter, line)
|
||||||
" This function is used to get the string index of the input comment delimiter
|
" This function is used to get the string index of the input comment delimiter
|
||||||
" on the input line. If no valid comment delimiter is found in the line then
|
" on the input line. If no valid comment delimiter is found in the line then
|
||||||
" -1 is returned
|
" -1 is returned
|
||||||
@@ -2206,7 +2206,7 @@ function s:FindDelimiterIndex(delimiter, line)
|
|||||||
return -1
|
return -1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:FindBoundingLinesOfSexyCom(lineNum) {{{2
|
" Function: s:FindBoundingLinesOfSexyCom(lineNum)
|
||||||
" This function takes in a line number and tests whether this line number is
|
" This function takes in a line number and tests whether this line number is
|
||||||
" the top/bottom/middle line of a sexy comment. If it is then the top/bottom
|
" the top/bottom/middle line of a sexy comment. If it is then the top/bottom
|
||||||
" lines of the sexy comment are returned
|
" lines of the sexy comment are returned
|
||||||
@@ -2281,7 +2281,7 @@ function s:FindBoundingLinesOfSexyCom(lineNum)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" Function: s:GetSexyComMarker() {{{2
|
" Function: s:GetSexyComMarker()
|
||||||
" Returns the sexy comment marker for the current filetype.
|
" Returns the sexy comment marker for the current filetype.
|
||||||
"
|
"
|
||||||
" C style sexy comments are assumed if possible. If not then the sexy comment
|
" C style sexy comments are assumed if possible. If not then the sexy comment
|
||||||
@@ -2333,7 +2333,7 @@ function s:GetSexyComMarker(space, esc)
|
|||||||
return sexyComMarker
|
return sexyComMarker
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:SexyNested() {{{2
|
" Function: s:SexyNested()
|
||||||
" Returns 1 if the sexy delimeters allow nesting
|
" Returns 1 if the sexy delimeters allow nesting
|
||||||
" TODO this is ugly copy&paste from the GetSexyComLeft/Right functions,
|
" TODO this is ugly copy&paste from the GetSexyComLeft/Right functions,
|
||||||
" these could all be cleaned up
|
" these could all be cleaned up
|
||||||
@@ -2356,7 +2356,7 @@ function s:SexyNested()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:GetSexyComLeft(space, esc) {{{2
|
" Function: s:GetSexyComLeft(space, esc)
|
||||||
" Returns the left delimiter for sexy comments for this filetype or -1 if
|
" Returns the left delimiter for sexy comments for this filetype or -1 if
|
||||||
" there is none. C style sexy comments are used if possible
|
" there is none. C style sexy comments are used if possible
|
||||||
" Args:
|
" Args:
|
||||||
@@ -2393,7 +2393,7 @@ function s:GetSexyComLeft(space, esc)
|
|||||||
return left
|
return left
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:GetSexyComRight(space, esc) {{{2
|
" Function: s:GetSexyComRight(space, esc)
|
||||||
" Returns the right delimiter for sexy comments for this filetype or -1 if
|
" Returns the right delimiter for sexy comments for this filetype or -1 if
|
||||||
" there is none. C style sexy comments are used if possible.
|
" there is none. C style sexy comments are used if possible.
|
||||||
" Args:
|
" Args:
|
||||||
@@ -2431,13 +2431,13 @@ function s:GetSexyComRight(space, esc)
|
|||||||
return right
|
return right
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:HasMultipartDelims() {{{2
|
" Function: s:HasMultipartDelims()
|
||||||
" Returns 1 if the current filetype has at least one set of multipart delimiters
|
" Returns 1 if the current filetype has at least one set of multipart delimiters
|
||||||
function s:HasMultipartDelims()
|
function s:HasMultipartDelims()
|
||||||
return s:Multipart() || s:AltMultipart()
|
return s:Multipart() || s:AltMultipart()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:HasLeadingTabs(...) {{{2
|
" Function: s:HasLeadingTabs(...)
|
||||||
" Returns 1 if any of the given strings have leading tabs
|
" Returns 1 if any of the given strings have leading tabs
|
||||||
function s:HasLeadingTabs(...)
|
function s:HasLeadingTabs(...)
|
||||||
for s in a:000
|
for s in a:000
|
||||||
@@ -2447,13 +2447,13 @@ function s:HasLeadingTabs(...)
|
|||||||
endfor
|
endfor
|
||||||
return 0
|
return 0
|
||||||
endfunction
|
endfunction
|
||||||
" Function: s:HasCStyleComments() {{{2
|
" Function: s:HasCStyleComments()
|
||||||
" Returns 1 if the current filetype has c style comment delimiters
|
" Returns 1 if the current filetype has c style comment delimiters
|
||||||
function s:HasCStyleComments()
|
function s:HasCStyleComments()
|
||||||
return (s:Left() ==# '/*' && s:Right() ==# '*/') || (s:Left({'alt': 1}) ==# '/*' && s:Right({'alt': 1}) ==# '*/')
|
return (s:Left() ==# '/*' && s:Right() ==# '*/') || (s:Left({'alt': 1}) ==# '/*' && s:Right({'alt': 1}) ==# '*/')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:IsCommentedNormOrSexy(lineNum) {{{2
|
" Function: s:IsCommentedNormOrSexy(lineNum)
|
||||||
"This function is used to determine whether the given line is commented with
|
"This function is used to determine whether the given line is commented with
|
||||||
"either set of delimiters or if it is part of a sexy comment
|
"either set of delimiters or if it is part of a sexy comment
|
||||||
"
|
"
|
||||||
@@ -2474,7 +2474,7 @@ function s:IsCommentedNormOrSexy(lineNum)
|
|||||||
return 0
|
return 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:IsCommented(left, right, line) {{{2
|
" Function: s:IsCommented(left, right, line)
|
||||||
"This function is used to determine whether the given line is commented with
|
"This function is used to determine whether the given line is commented with
|
||||||
"the given delimiters
|
"the given delimiters
|
||||||
"
|
"
|
||||||
@@ -2489,7 +2489,7 @@ function s:IsCommented(left, right, line)
|
|||||||
return 0
|
return 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:IsCommentedFromStartOfLine(left, line) {{{2
|
" Function: s:IsCommentedFromStartOfLine(left, line)
|
||||||
"This function is used to determine whether the given line is commented with
|
"This function is used to determine whether the given line is commented with
|
||||||
"the given delimiters at the start of the line i.e the left delimiter is the
|
"the given delimiters at the start of the line i.e the left delimiter is the
|
||||||
"first thing on the line (apart from spaces\tabs)
|
"first thing on the line (apart from spaces\tabs)
|
||||||
@@ -2504,7 +2504,7 @@ function s:IsCommentedFromStartOfLine(left, line)
|
|||||||
return delimIndx ==# numSpaces
|
return delimIndx ==# numSpaces
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:IsCommentedOutermost(left, right, leftAlt, rightAlt, line) {{{2
|
" Function: s:IsCommentedOutermost(left, right, leftAlt, rightAlt, line)
|
||||||
" Finds the type of the outermost delimiters on the line
|
" Finds the type of the outermost delimiters on the line
|
||||||
"
|
"
|
||||||
" Args:
|
" Args:
|
||||||
@@ -2547,7 +2547,7 @@ function s:IsCommentedOutermost(left, right, leftAlt, rightAlt, line)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" Function: s:IsDelimValid(delimiter, delIndx, line) {{{2
|
" Function: s:IsDelimValid(delimiter, delIndx, line)
|
||||||
" This function is responsible for determining whether a given instance of a
|
" This function is responsible for determining whether a given instance of a
|
||||||
" comment delimiter is a real delimiter or not. For example, in java the
|
" comment delimiter is a real delimiter or not. For example, in java the
|
||||||
" // string is a comment delimiter but in the line:
|
" // string is a comment delimiter but in the line:
|
||||||
@@ -2624,7 +2624,7 @@ function s:IsDelimValid(delimiter, delIndx, line)
|
|||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:IsNumEven(num) {{{2
|
" Function: s:IsNumEven(num)
|
||||||
" A small function the returns 1 if the input number is even and 0 otherwise
|
" A small function the returns 1 if the input number is even and 0 otherwise
|
||||||
" Args:
|
" Args:
|
||||||
" -num: the number to check
|
" -num: the number to check
|
||||||
@@ -2632,7 +2632,7 @@ function s:IsNumEven(num)
|
|||||||
return (a:num % 2) ==# 0
|
return (a:num % 2) ==# 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:IsEscaped(str, indx, escChar) {{{2
|
" Function: s:IsEscaped(str, indx, escChar)
|
||||||
" This function takes a string, an index into that string and an esc char and
|
" This function takes a string, an index into that string and an esc char and
|
||||||
" returns 1 if the char at the index is escaped (i.e if it is preceded by an
|
" returns 1 if the char at the index is escaped (i.e if it is preceded by an
|
||||||
" odd number of esc chars)
|
" odd number of esc chars)
|
||||||
@@ -2661,13 +2661,13 @@ function s:IsEscaped(str, indx, escChar)
|
|||||||
return !s:IsNumEven(numEscChars)
|
return !s:IsNumEven(numEscChars)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:IsInSexyComment(line) {{{2
|
" Function: s:IsInSexyComment(line)
|
||||||
" returns 1 if the given line number is part of a sexy comment
|
" returns 1 if the given line number is part of a sexy comment
|
||||||
function s:IsInSexyComment(line)
|
function s:IsInSexyComment(line)
|
||||||
return !empty(s:FindBoundingLinesOfSexyCom(a:line))
|
return !empty(s:FindBoundingLinesOfSexyCom(a:line))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:IsSexyComment(topline, bottomline) {{{2
|
" Function: s:IsSexyComment(topline, bottomline)
|
||||||
" This function takes in 2 line numbers and returns 1 if the lines between and
|
" This function takes in 2 line numbers and returns 1 if the lines between and
|
||||||
" including the given line numbers are a sexy comment. It returns 0 otherwise.
|
" including the given line numbers are a sexy comment. It returns 0 otherwise.
|
||||||
" Args:
|
" Args:
|
||||||
@@ -2748,7 +2748,7 @@ function s:IsSexyComment(topline, bottomline)
|
|||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:LastIndexOfDelim(delim, str) {{{2
|
" Function: s:LastIndexOfDelim(delim, str)
|
||||||
" This function takes a string and a delimiter and returns the last index of
|
" This function takes a string and a delimiter and returns the last index of
|
||||||
" that delimiter in string
|
" that delimiter in string
|
||||||
" Args:
|
" Args:
|
||||||
@@ -2786,7 +2786,7 @@ function s:LastIndexOfDelim(delim, str)
|
|||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:Left(...) {{{2
|
" Function: s:Left(...)
|
||||||
" returns left delimiter data
|
" returns left delimiter data
|
||||||
function s:Left(...)
|
function s:Left(...)
|
||||||
let params = a:0 ? a:1 : {}
|
let params = a:0 ? a:1 : {}
|
||||||
@@ -2808,7 +2808,7 @@ function s:Left(...)
|
|||||||
return delim
|
return delim
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:LeftMostIndx(countCommentedLines, countEmptyLines, topline, bottomline) {{{2
|
" Function: s:LeftMostIndx(countCommentedLines, countEmptyLines, topline, bottomline)
|
||||||
" This function takes in 2 line numbers and returns the index of the left most
|
" This function takes in 2 line numbers and returns the index of the left most
|
||||||
" char (that is not a space or a tab) on all of these lines.
|
" char (that is not a space or a tab) on all of these lines.
|
||||||
" Args:
|
" Args:
|
||||||
@@ -2852,13 +2852,13 @@ function s:LeftMostIndx(countCommentedLines, countEmptyLines, topline, bottomlin
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:Multipart() {{{2
|
" Function: s:Multipart()
|
||||||
" returns 1 if the current delimiters are multipart
|
" returns 1 if the current delimiters are multipart
|
||||||
function s:Multipart()
|
function s:Multipart()
|
||||||
return s:Right() !=# ''
|
return s:Right() !=# ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:NerdEcho(msg, typeOfMsg) {{{2
|
" Function: s:NerdEcho(msg, typeOfMsg)
|
||||||
" Args:
|
" Args:
|
||||||
" -msg: the message to echo
|
" -msg: the message to echo
|
||||||
" -typeOfMsg: 0 = warning message
|
" -typeOfMsg: 0 = warning message
|
||||||
@@ -2873,25 +2873,25 @@ function s:NerdEcho(msg, typeOfMsg)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:Nested() {{{2
|
" Function: s:Nested()
|
||||||
" returns 1 if the current multipart (if any) delimiters allow nesting
|
" returns 1 if the current multipart (if any) delimiters allow nesting
|
||||||
function s:Nested()
|
function s:Nested()
|
||||||
return b:NERDCommenterDelims['nested']
|
return b:NERDCommenterDelims['nested']
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:NumberOfLeadingTabs(s) {{{2
|
" Function: s:NumberOfLeadingTabs(s)
|
||||||
" returns the number of leading tabs in the given string
|
" returns the number of leading tabs in the given string
|
||||||
function s:NumberOfLeadingTabs(s)
|
function s:NumberOfLeadingTabs(s)
|
||||||
return strlen(substitute(a:s, '^\(\t*\).*$', '\1', ''))
|
return strlen(substitute(a:s, '^\(\t*\).*$', '\1', ''))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:NumLinesInBuf() {{{2
|
" Function: s:NumLinesInBuf()
|
||||||
" Returns the number of lines in the current buffer
|
" Returns the number of lines in the current buffer
|
||||||
function s:NumLinesInBuf()
|
function s:NumLinesInBuf()
|
||||||
return line('$')
|
return line('$')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:ReplaceDelims(toReplace1, toReplace2, replacor1, replacor2, str) {{{2
|
" Function: s:ReplaceDelims(toReplace1, toReplace2, replacor1, replacor2, str)
|
||||||
" This function takes in a string, 2 delimiters in that string and 2 strings
|
" This function takes in a string, 2 delimiters in that string and 2 strings
|
||||||
" to replace these delimiters with.
|
" to replace these delimiters with.
|
||||||
"
|
"
|
||||||
@@ -2907,7 +2907,7 @@ function s:ReplaceDelims(toReplace1, toReplace2, replacor1, replacor2, str)
|
|||||||
return line
|
return line
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:ReplaceLeftMostDelim(toReplace, replacor, str) {{{2
|
" Function: s:ReplaceLeftMostDelim(toReplace, replacor, str)
|
||||||
" This function takes a string and a delimiter and replaces the left most
|
" This function takes a string and a delimiter and replaces the left most
|
||||||
" occurrence of this delimiter in the string with a given string
|
" occurrence of this delimiter in the string with a given string
|
||||||
"
|
"
|
||||||
@@ -2931,7 +2931,7 @@ function s:ReplaceLeftMostDelim(toReplace, replacor, str)
|
|||||||
return a:str
|
return a:str
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:ReplaceRightMostDelim(toReplace, replacor, str) {{{2
|
" Function: s:ReplaceRightMostDelim(toReplace, replacor, str)
|
||||||
" This function takes a string and a delimiter and replaces the right most
|
" This function takes a string and a delimiter and replaces the right most
|
||||||
" occurrence of this delimiter in the string with a given string
|
" occurrence of this delimiter in the string with a given string
|
||||||
"
|
"
|
||||||
@@ -2956,7 +2956,7 @@ function s:ReplaceRightMostDelim(toReplace, replacor, str)
|
|||||||
return line
|
return line
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:RestoreScreenState() {{{2
|
"FUNCTION: s:RestoreScreenState()
|
||||||
"
|
"
|
||||||
"Sets the screen state back to what it was when s:SaveScreenState was last
|
"Sets the screen state back to what it was when s:SaveScreenState was last
|
||||||
"called.
|
"called.
|
||||||
@@ -2971,7 +2971,7 @@ function s:RestoreScreenState()
|
|||||||
call setpos('.', t:NERDComOldPos)
|
call setpos('.', t:NERDComOldPos)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:Right(...) {{{2
|
" Function: s:Right(...)
|
||||||
" returns right delimiter data
|
" returns right delimiter data
|
||||||
function s:Right(...)
|
function s:Right(...)
|
||||||
let params = a:0 ? a:1 : {}
|
let params = a:0 ? a:1 : {}
|
||||||
@@ -2993,7 +2993,7 @@ function s:Right(...)
|
|||||||
return delim
|
return delim
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:RightMostIndx(countCommentedLines, countEmptyLines, topline, bottomline) {{{2
|
" Function: s:RightMostIndx(countCommentedLines, countEmptyLines, topline, bottomline)
|
||||||
" This function takes in 2 line numbers and returns the index of the right most
|
" This function takes in 2 line numbers and returns the index of the right most
|
||||||
" char on all of these lines.
|
" char on all of these lines.
|
||||||
" Args:
|
" Args:
|
||||||
@@ -3032,7 +3032,7 @@ function s:RightMostIndx(countCommentedLines, countEmptyLines, topline, bottomli
|
|||||||
return rightMostIndx
|
return rightMostIndx
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:SaveScreenState() {{{2
|
"FUNCTION: s:SaveScreenState()
|
||||||
"Saves the current cursor position in the current buffer and the window
|
"Saves the current cursor position in the current buffer and the window
|
||||||
"scroll position
|
"scroll position
|
||||||
function s:SaveScreenState()
|
function s:SaveScreenState()
|
||||||
@@ -3040,7 +3040,7 @@ function s:SaveScreenState()
|
|||||||
let t:NERDComOldTopLine = line('w0')
|
let t:NERDComOldTopLine = line('w0')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:SwapOuterMultiPartDelimsForPlaceHolders(line) {{{2
|
" Function: s:SwapOuterMultiPartDelimsForPlaceHolders(line)
|
||||||
" This function takes a line and swaps the outer most multi-part delimiters for
|
" This function takes a line and swaps the outer most multi-part delimiters for
|
||||||
" place holders
|
" place holders
|
||||||
" Args:
|
" Args:
|
||||||
@@ -3068,7 +3068,7 @@ function s:SwapOuterMultiPartDelimsForPlaceHolders(line)
|
|||||||
return line2
|
return line2
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:SwapOuterPlaceHoldersForMultiPartDelims(line) {{{2
|
" Function: s:SwapOuterPlaceHoldersForMultiPartDelims(line)
|
||||||
" This function takes a line and swaps the outermost place holders for
|
" This function takes a line and swaps the outermost place holders for
|
||||||
" multi-part delimiters
|
" multi-part delimiters
|
||||||
" Args:
|
" Args:
|
||||||
@@ -3088,7 +3088,8 @@ function s:SwapOuterPlaceHoldersForMultiPartDelims(line)
|
|||||||
let line = s:ReplaceDelims(g:NERDLPlace, g:NERDRPlace, left, right, a:line)
|
let line = s:ReplaceDelims(g:NERDLPlace, g:NERDRPlace, left, right, a:line)
|
||||||
return line
|
return line
|
||||||
endfunction
|
endfunction
|
||||||
" Function: s:TabbedCol(line, col) {{{2
|
|
||||||
|
" Function: s:TabbedCol(line, col)
|
||||||
" Gets the col number for given line and existing col number. The new col
|
" Gets the col number for given line and existing col number. The new col
|
||||||
" number is the col number when all leading spaces are converted to tabs
|
" number is the col number when all leading spaces are converted to tabs
|
||||||
" Args:
|
" Args:
|
||||||
@@ -3099,7 +3100,8 @@ function s:TabbedCol(line, col)
|
|||||||
let lineSpacesToTabs = substitute(lineTruncated, s:TabSpace(), '\t', 'g')
|
let lineSpacesToTabs = substitute(lineTruncated, s:TabSpace(), '\t', 'g')
|
||||||
return strlen(lineSpacesToTabs)
|
return strlen(lineSpacesToTabs)
|
||||||
endfunction
|
endfunction
|
||||||
"FUNCTION: s:TabSpace() {{{2
|
|
||||||
|
"FUNCTION: s:TabSpace()
|
||||||
"returns a string of spaces equal in length to &tabstop
|
"returns a string of spaces equal in length to &tabstop
|
||||||
function s:TabSpace()
|
function s:TabSpace()
|
||||||
let tabSpace = ''
|
let tabSpace = ''
|
||||||
@@ -3111,7 +3113,7 @@ function s:TabSpace()
|
|||||||
return tabSpace
|
return tabSpace
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:UnEsc(str, escChar) {{{2
|
" Function: s:UnEsc(str, escChar)
|
||||||
" This function removes all the escape chars from a string
|
" This function removes all the escape chars from a string
|
||||||
" Args:
|
" Args:
|
||||||
" -str: the string to remove esc chars from
|
" -str: the string to remove esc chars from
|
||||||
@@ -3120,7 +3122,7 @@ function s:UnEsc(str, escChar)
|
|||||||
return substitute(a:str, a:escChar, '', 'g')
|
return substitute(a:str, a:escChar, '', 'g')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:UntabbedCol(line, col) {{{2
|
" Function: s:UntabbedCol(line, col)
|
||||||
" Takes a line and a col and returns the absolute column of col taking into
|
" Takes a line and a col and returns the absolute column of col taking into
|
||||||
" account that a tab is worth 3 or 4 (or whatever) spaces.
|
" account that a tab is worth 3 or 4 (or whatever) spaces.
|
||||||
" Args:
|
" Args:
|
||||||
@@ -3131,7 +3133,7 @@ function s:UntabbedCol(line, col)
|
|||||||
let lineTabsToSpaces = substitute(lineTruncated, '\t', s:TabSpace(), 'g')
|
let lineTabsToSpaces = substitute(lineTruncated, '\t', s:TabSpace(), 'g')
|
||||||
return strlen(lineTabsToSpaces)
|
return strlen(lineTabsToSpaces)
|
||||||
endfunction
|
endfunction
|
||||||
" Section: Comment mapping and menu item setup {{{1
|
" Section: Comment mapping and menu item setup
|
||||||
" ===========================================================================
|
" ===========================================================================
|
||||||
|
|
||||||
" Create menu items for the specified modes. If a:combo is not empty, then
|
" Create menu items for the specified modes. If a:combo is not empty, then
|
||||||
@@ -3193,5 +3195,3 @@ nnoremap <plug>NERDCommenterAltDelims :call <SID>SwitchToAlternativeDelimiters(1
|
|||||||
" This is a workaround to enable lazy-loading from supported plugin managers:
|
" This is a workaround to enable lazy-loading from supported plugin managers:
|
||||||
" See https://github.com/preservim/nerdcommenter/issues/176
|
" See https://github.com/preservim/nerdcommenter/issues/176
|
||||||
call s:SetUpForNewFiletype(&filetype, 1)
|
call s:SetUpForNewFiletype(&filetype, 1)
|
||||||
|
|
||||||
" vim: set foldmethod=marker :
|
|
||||||
|
|||||||
Reference in New Issue
Block a user