Skip to content

Commit

Permalink
feat: added vcl
Browse files Browse the repository at this point in the history
  • Loading branch information
ponkio-o committed Apr 26, 2023
1 parent 91499c7 commit 2a425ef
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions autoload/nerdcommenter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ let s:delimiterMap = {
\ 'vala': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
\ 'vasp': { 'left': '!' },
\ 'vb': { 'left': "'" },
\ 'vcl': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
\ 'velocity': { 'left': '##', 'right': '', 'leftAlt': '#*', 'rightAlt': '*#' },
\ 'vera': { 'left': '/*', 'right': '*/', 'leftAlt': '//' },
\ 'verilog': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
Expand Down Expand Up @@ -1308,15 +1309,15 @@ endfunction
" Function: nerdcommenter#IsCharCommented(line, col) abort
" Check if the character at [line, col] is inside a comment
" Note the Comment delimeter it self is considered as part of the comment
"
"
" Args:
" -line the line number of the character
" -col the column number of the character
" Return: Number, 1 if the character is inside a comment, 0 if is not
function! nerdcommenter#IsCharCommented(line, col) abort
" Function: s:searchfor(str, line, col, direction, [maxline])
" search str in the buffer, including the character at [line, col]
" Args:
" Args:
" -str: the string for search
" -line: the line number where search begins
" -col: the column number where search begins
Expand Down Expand Up @@ -1384,14 +1385,14 @@ function! nerdcommenter#IsCharCommented(line, col) abort
let leftpos = s:searchfor(a:left, a:line, a:col, 1)
if leftpos == [0, 0]
if !blockcommented | let blockcommented = 0 | endif
else
else
" 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)
if rightpos != [0, 0]
if rightpos[0] < a:line
if !blockcommented | let blockcommented = 0 | endif
elseif rightpos[0] == a:line
if !blockcommented
if !blockcommented
let blockcommented = (rightpos[1] + strlen(a:right) > a:col) ? 1 : 0
endif
else " rightpos > a:line
Expand All @@ -1405,14 +1406,14 @@ function! nerdcommenter#IsCharCommented(line, col) abort
return linecommented || blockcommented
endfunction
return s:checkwith(
\ b:NERDCommenterDelims['left'],
\ b:NERDCommenterDelims['right'],
\ a:line,
\ a:col) ||
\ b:NERDCommenterDelims['left'],
\ b:NERDCommenterDelims['right'],
\ a:line,
\ a:col) ||
\ s:checkwith(
\ b:NERDCommenterDelims['leftAlt'],
\ b:NERDCommenterDelims['rightAlt'],
\ a:line,
\ b:NERDCommenterDelims['leftAlt'],
\ b:NERDCommenterDelims['rightAlt'],
\ a:line,
\ a:col)
endfunction

Expand Down Expand Up @@ -2527,7 +2528,7 @@ function! s:IsDelimValid(delimiter, delIndx, line) abort

"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
"some conditions especially for vim.
"some conditions especially for vim.
"Also check &commentstring because it may be overwritten for embedded lua.
if &filetype ==# 'vim' && &commentstring[0] ==# '"'
if !s:IsNumEven(s:CountNonESCedOccurances(preComStr, '"', "\\"))
Expand Down

0 comments on commit 2a425ef

Please sign in to comment.