mirror of
https://github.com/chenasraf/vim-matchup.git
synced 2026-05-17 17:38:01 +00:00
@@ -383,6 +383,13 @@ let g:matchup_delim_stopline = 1500
|
||||
```
|
||||
default: 1500
|
||||
|
||||
To disable matching within strings and comments,
|
||||
```vim
|
||||
let g:matchup_delim_noskips = 1 " recognize symbols within comments
|
||||
let g:matchup_delim_noskips = 2 " don't recognize anything in comments
|
||||
```
|
||||
default: 0 (matching is enabled within strings and comments)
|
||||
|
||||
### Variables
|
||||
|
||||
match-up understands the following variables from matchit.
|
||||
|
||||
@@ -29,6 +29,7 @@ function! s:init_options()
|
||||
\ get(g:, 'matchparen_insert_timeout', 60))
|
||||
|
||||
call s:init_option('matchup_delim_count_fail', 0)
|
||||
call s:init_option('matchup_delim_noskips', 0)
|
||||
|
||||
call s:init_option('matchup_motion_enabled', 1)
|
||||
call s:init_option('matchup_motion_cursor_end', 1)
|
||||
|
||||
@@ -349,14 +349,16 @@ function! s:get_delim(opts) " {{{1
|
||||
let s:invert_skip = 0
|
||||
|
||||
if a:opts.direction ==# 'current'
|
||||
let l:check_skip = get(a:opts, 'check_skip', 0)
|
||||
let l:check_skip = get(a:opts, 'check_skip',
|
||||
\ g:matchup_delim_noskips >= 2)
|
||||
if l:check_skip && matchup#delim#skip(line('.'), l:cursorpos)
|
||||
return {}
|
||||
endif
|
||||
else
|
||||
" check skip if cursor is not currently in skip
|
||||
let l:check_skip = get(a:opts, 'check_skip',
|
||||
\ !matchup#delim#skip(line('.'), l:cursorpos))
|
||||
\ !matchup#delim#skip(line('.'), l:cursorpos)
|
||||
\ || g:matchup_delim_noskips >= 2)
|
||||
endif
|
||||
|
||||
let a:opts.cursorpos = l:cursorpos
|
||||
@@ -398,10 +400,16 @@ function! s:get_delim(opts) " {{{1
|
||||
\ : searchpos(l:re, 'bcnW', line('.'))
|
||||
if l:lnum == 0 | break | endif
|
||||
|
||||
let l:wordish_skip = g:matchup_delim_noskips == 1
|
||||
\ && getline(l:lnum)[l:cnum-1] =~ '[^[:punct:]]'
|
||||
if a:opts.direction ==# 'current' && l:wordish_skip
|
||||
return {}
|
||||
endif
|
||||
|
||||
" note: the skip here should not be needed
|
||||
" in 'current' mode, but be explicit
|
||||
if a:opts.direction !=# 'current'
|
||||
\ && l:check_skip
|
||||
\ && (l:check_skip || l:wordish_skip)
|
||||
\ && matchup#delim#skip(l:lnum, l:cnum)
|
||||
|
||||
" invalid match, move cursor and keep looking
|
||||
|
||||
@@ -412,6 +412,19 @@ Options~
|
||||
|
||||
Default: 1500
|
||||
|
||||
*g:matchup_delim_noskips*
|
||||
|
||||
This option controls whether matching is done within strings and comments.
|
||||
By default, it is set to 0 which means all valid matches are made within
|
||||
strings and comments. If set to 1, symbols like `()` will still be matched
|
||||
but words like `for` and `end` will not. If set to 2, nothing will be
|
||||
matched within strings and comments. >
|
||||
|
||||
let g:matchup_delim_noskips = 1
|
||||
let g:matchup_delim_noskips = 2
|
||||
<
|
||||
Default: 0 (matching enabled within strings and comments)
|
||||
|
||||
Variables~
|
||||
|
||||
*b:match_words*
|
||||
|
||||
9
test/issues/26/example.rb
Normal file
9
test/issues/26/example.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
class Example
|
||||
def initialize
|
||||
@text = 'for text'
|
||||
@text2 = 'end text2'
|
||||
@text3 = '( text )'
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user