<commit_before>function! merlin_find#OccurrencesSearch(mode)
  py vim.command("let [l:start_col, l:current, l:target] = " + merlin.vim_occurrences_search())
  if l:target == ""
    return
  endif
  let l:search = l:current . "\\|" . l:target
  let @/ = l:search
  execute "normal " . a:mode . l:search . "\<cr>"
endfunction

function! merlin_find#IncrementalRename()
  py vim.command("let [w:start_rename_col,l:current,w:rename_target] = " + merlin.vim_occurrences_search())
  if w:rename_target == ""
    echoerr "No occurrences found!"
    return
  endif
  let w:enclosing_rename = matchadd('EnclosingExpr', w:start_rename_col . ".*\\%#\\|" . w:rename_target)
  let @/ = l:current
  call merlin#StopHighlight()
  augroup MerlinAutocmd
    au!
    autocmd InsertLeave <buffer> :call s:IncrementalRenameTerminate()
  augroup END
endfunction

function! s:IncrementalRenameTerminate()
  if !exists('w:enclosing_rename') || w:enclosing_rename == -1
    return
  endif
  call matchdelete(w:enclosing_rename)
  let w:enclosing_rename = -1
  augroup MerlinAutocmd
    au!
  augroup END
  let [l:buffer,l:line,l:col,l:off] = getpos(".")
  let l:inserted = strpart(getline("."), w:start_rename_col, l:col - w:start_rename_col)
  execute "normal! :%s/" . w:rename_target . "/" . l:inserted . "/g\<cr>"<commit_msg>vim bugfix: interactive rename and hlsearch<commit_after>function! merlin_find#OccurrencesSearch(mode)
  py vim.command("let [l:start_col, l:current, l:target] = " + merlin.vim_occurrences_search())
  if l:target == ""
    return
  endif
  let l:search = l:current . "\\|" . l:target
  let @/ = l:search
  execute "normal " . a:mode . l:search . "\<cr>"
endfunction

function! merlin_find#IncrementalRename()
  py vim.command("let [w:start_rename_col,l:current,w:rename_target] = " + merlin.vim_occurrences_search())
  if w:rename_target == ""
    echoerr "No occurrences found!"
    return
  endif
  let l:edit_target = '\%' . line(".") . 'l\%' . (w:start_rename_col + 1) . 'c' . '.*\%#'
  let w:enclosing_rename = matchadd('EnclosingExpr', l:edit_target . '\|' . w:rename_target)
  let @/ = l:current
  call merlin#StopHighlight()
  augroup MerlinAutocmd
    au!
    autocmd InsertEnter <buffer> :let @/=''
    autocmd InsertLeave <buffer> :call s:IncrementalRenameTerminate()
  augroup END
endfunction

function! s:IncrementalRenameTerminate()
  if !exists('w:enclosing_rename') || w:enclosing_rename == -1
    return
  endif
  call matchdelete(w:enclosing_rename)
  let w:enclosing_rename = -1
  augroup MerlinAutocmd
    au!
  augroup END
  let [l:buffer,l:line,l:col,l:off] = getpos(".")
  let l:inserted = strpart(getline("."), w:start_rename_col, l:col - w:start_rename_col)
  execute "normal! :%s/" . w:rename_target . "/" . l:inserted . "/g\<cr>"
{'fraction_non_alphanumeric': 0.1539855072463768, 'fraction_numerical': 0.0018115942028985507, 'mean_word_length': 4.371595330739299, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4993940', 'n_tokens_mistral': 1069, 'n_tokens_neox': 1042, 'n_words': 197}