Skip to content

Commit

Permalink
Need to apply \zs anchor on single-character searches too
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewd authored and tommcdo committed Feb 5, 2018
1 parent b7d8651 commit 75306ac
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions plugin/lion.vim
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ function! s:match_pos(mode, line, char, count, line_number, start, end)
let pattern = '\C' . escape(a:char, '~^$.')
else
let pattern = a:char[1:]
" Add start-of-match anchor at the end if there isn't already one in the pattern
if a:mode ==# 'left' && match(pattern, '\\zs') ==# -1
let pattern .= '\zs'
endif
endif
" Add start-of-match anchor at the end if there isn't already one in the pattern
if a:mode ==# 'left' && match(pattern, '\\zs') == -1
let pattern .= '\zs'
endif
if a:end == -1
let line = a:line
Expand All @@ -177,8 +177,7 @@ endfunction

" Get the first non-whitespace after [count] instances of [char]
function! s:first_non_ws_after(line, pattern, start, count)
let pattern = len(a:pattern) == 1 ? a:pattern . '\zs' : a:pattern
let char_pos = match(a:line, pattern, a:start, a:count)
let char_pos = match(a:line, a:pattern, a:start, a:count)
if char_pos == -1
return -1
else
Expand Down

0 comments on commit 75306ac

Please sign in to comment.