<commit_before>
if &term =~? 'xterm' || &term =~? 'screen'
  function! WrapForTmux(s)
    if !exists('$TMUX')
      return a:s
    endif

    let tmux_start = "\<Esc>Ptmux;"
    let tmux_end = "\<Esc>\\"

    return tmux_start . substitute(a:s, "\<Esc>", "\<Esc>\<Esc>", 'g') . tmux_end
  endfunction

  let &t_SI .= WrapForTmux("\<Esc>[?2004h")
  let &t_EI .= WrapForTmux("\<Esc>[?2004l")

  function! XTermPasteBegin(ret)
    set pastetoggle=<Esc>[201~
    set paste
    return a:ret
  endfunction

  inoremap <special> <expr> <Esc>[200~ XTermPasteBegin("<C-g>u")
  " normal mode off
  "noremap <special> <expr> <Esc>[200~ XTermPasteBegin("0i")
  "cnoremap <special> <Esc>[200~ <nop>
  "cnoremap <special> <Esc>[201~ <nop>
endif
<commit_msg>Fix autopaste after tmux2.4<commit_after>
if &term =~? 'xterm' || &term =~? 'screen'
  function! WrapForTmux(s)
    " Remove all wrapping
    return a:s
  endfunction

  let &t_ti .= WrapForTmux("\<Esc>[?2004h")
  let &t_te .= WrapForTmux("\<Esc>[?2004l")

  function! XTermPasteBegin(ret)
    " Debugging
    echom "XTermPasteBegin() called"
    set pastetoggle=<f29>
    set paste
    return a:ret
  endfunction

  execute "set <f28>=\<Esc>[200~"
  execute "set <f29>=\<Esc>[201~"
  "map <expr> <f28> XTermPasteBegin("i")
  imap <expr> <f28> XTermPasteBegin("<C-g>u")
  "vmap <expr> <f28> XTermPasteBegin("c")
  cmap <f28> <nop>
  cmap <f29> <nop>

endif

{'fraction_non_alphanumeric': 0.18642857142857142, 'fraction_numerical': 0.04, 'mean_word_length': 3.8645833333333335, 'pattern_counts': {'":': 0, '<': 42, '<?xml version=': 0, '>': 42, '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': '7034621', 'n_tokens_mistral': 663, 'n_tokens_neox': 584, 'n_words': 125}