Skip to content

Commit

Permalink
Introduce s:fts_hash_comment
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxGyver83 committed Feb 25, 2024
1 parent 5179833 commit 31c3ced
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions plugin/paredit.vim
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ let s:fts_multiline_comment = '.*\(scheme\|racket\).*'
" Filetypes with datum comment #;(...)
let s:fts_datum_comment = '.*\(scheme\).*'

" Filetypes with hash comment
let s:fts_hash_comment = '.*\(janet\).*'

" =====================================================================
" General utility functions
" =====================================================================
Expand Down Expand Up @@ -592,7 +595,10 @@ function! s:InsideComment( ... )
let line = strpart( getline(l), 0, c - 1 )
let line = substitute( line, '\\"', '', 'g' )
let line = substitute( line, '"[^"]*"', '', 'g' )
if &ft == 'janet' | let comment_char = '#' | else | let comment_char = ';' | end
let comment_char = ';'
if &ft =~ s:fts_hash_comment
let comment_char = '#'
endif
return match( line, comment_char ) >= 0
endif
if s:SynIDMatch( 'clojureComment', l, c, 1 )
Expand Down Expand Up @@ -749,7 +755,10 @@ function! s:GetMatchedChars( lines, start_in_string, start_in_comment )
let matched = strpart( matched, 0, i ) . a:lines[i] . strpart( matched, i+1 )
let inside_string = 1
endif
if &ft == 'janet' | let comment_char = '#' | else | let comment_char = ';' | end
let comment_char = ';'
if &ft =~ s:fts_hash_comment
let comment_char = '#'
endif
if a:lines[i] == comment_char
let inside_comment = 1
if &ft =~ s:fts_datum_comment && i > 0 && a:lines[i-1] == '#'
Expand Down Expand Up @@ -1208,7 +1217,10 @@ function! s:EraseFwd( count, startcol )
let ve_save = &virtualedit
set virtualedit=all
let c = a:count
if &ft == 'janet' | let comment_char = '#' | else | let comment_char = ';' | end
let comment_char = ';'
if &ft =~ s:fts_hash_comment
let comment_char = '#'
endif
while c > 0
if line[pos] == '\' && line[pos+1] =~ b:any_matched_char && (pos < 1 || line[pos-1] != '\')
" Erasing an escaped matched character
Expand Down

0 comments on commit 31c3ced

Please sign in to comment.