<commit_before>" impaired.vim - trimmed down version of unimpaired.vim
" Author: <NAME> <<EMAIL>>

" Original work is attributed as follows:
" unimpaired.vim: https://github.com/tpope/vim-unimpaired
" Copyright (c) <NAME>. Distributed under the same terms as Vim itself. See
" `:help license`.

" This file is expressly distributed with the Vim license (`:help license`).

" Quickfix motions {{{1
nnoremap ]q :cnext<CR>
nnoremap [q :cprevious<CR>
nnoremap ]l :lnext<CR>
nnoremap [l :lprevious<CR>
" }}}

" Line operations {{{1
function! s:BlankUp(count) abort
  put!=repeat(nr2char(10), a:count)
  ']+1
  silent! call repeat#set("\<Plug>impairedBlankUp", a:count)
endfunction

function! s:BlankDown(count) abort
  put =repeat(nr2char(10), a:count)
  '[-1
  silent! call repeat#set("\<Plug>impairedBlankDown", a:count)
endfunction

nnoremap <silent> <Plug>impairedBlankUp   :<C-U>call <SID>BlankUp(v:count1)<CR>
nnoremap <silent> <Plug>impairedBlankDown :<C-U>call <SID>BlankDown(v:count1)<CR>
nmap [<Space> <Plug>impairedBlankUp
nmap ]<Space> <Plug>impairedBlankDown
" }}}

" SCM conflict motions {{{1
nnoremap <silent> [n :call <SID>Context(1)<CR>
nnoremap <silent> ]n :call <SID>Context(0)<CR>
onoremap <silent> [n :call <SID>ContextMotion(1)<CR>
onoremap <silent> ]n :call <SID>ContextMotion(0)<CR>

function! s:Context(reverse)
  call search('^\(@@ .* @@\|[<=>|]\{7}[<=>|]\@!\)', a:reverse ? 'bW' : 'W')
endfunction

function! s:ContextMotion(reverse)
  if a:reverse
    -
  endif
  call search('^@@ .* @@\|^diff \|^[<=>|]\{7}[<=>|]\@!', 'bWc')
  if getline('.') =~# '^diff '
    let end = search('^diff ', 'Wn') - 1
    if end < 0
      let end = line('$')
    endif
  elseif getline('.') =~# '^@@ '
    let end = search('^@@ .* @@\|^diff ', 'Wn') - 1
    if end < 0
      let end = line('$')
    endif
  elseif getline('.') =~# '^=\{7\}'
    +
    let end = search('^>\{7}>\@!', 'Wnc')
  elseif getline('.') =~# '^[<=>|]\{7\}'
    let end = search('^[<=>|]\{7}[<=>|]\@!', 'Wn') - 1
  else
    return
  endif
  if end > line('.')
    execute 'normal! V'.(end - line('.')).'j'
  elseif end == line('.')
    normal! V
  endif
endfunction
" }}}

" Option toggling {{{1
function! s:toggle(op) abort
  execute 'setlocal' a:op . '!' a:op . '?'
endfunction

nnoremap =ol :call <SID>toggle('list')<CR>
nnoremap =oc :call <SID>toggle('cursorline')<CR>
nnoremap =os :call <SID>toggle('spell')<CR>
nnoremap =ow :call <SID>toggle('wrap')<CR>
" }}}

" Put mappings {{{1
function! s:putline(how) abort<commit_msg>Add impaired toggle map for 'number'<commit_after>" impaired.vim - trimmed down version of unimpaired.vim
" Author: <NAME> <<EMAIL>>

" Original work is attributed as follows:
" unimpaired.vim: https://github.com/tpope/vim-unimpaired
" Copyright (c) <NAME>. Distributed under the same terms as Vim itself. See
" `:help license`.

" This file is expressly distributed with the Vim license (`:help license`).

" Quickfix motions {{{1
nnoremap ]q :cnext<CR>
nnoremap [q :cprevious<CR>
nnoremap ]l :lnext<CR>
nnoremap [l :lprevious<CR>
" }}}

" Line operations {{{1
function! s:BlankUp(count) abort
  put!=repeat(nr2char(10), a:count)
  ']+1
  silent! call repeat#set("\<Plug>impairedBlankUp", a:count)
endfunction

function! s:BlankDown(count) abort
  put =repeat(nr2char(10), a:count)
  '[-1
  silent! call repeat#set("\<Plug>impairedBlankDown", a:count)
endfunction

nnoremap <silent> <Plug>impairedBlankUp   :<C-U>call <SID>BlankUp(v:count1)<CR>
nnoremap <silent> <Plug>impairedBlankDown :<C-U>call <SID>BlankDown(v:count1)<CR>
nmap [<Space> <Plug>impairedBlankUp
nmap ]<Space> <Plug>impairedBlankDown
" }}}

" SCM conflict motions {{{1
nnoremap <silent> [n :call <SID>Context(1)<CR>
nnoremap <silent> ]n :call <SID>Context(0)<CR>
onoremap <silent> [n :call <SID>ContextMotion(1)<CR>
onoremap <silent> ]n :call <SID>ContextMotion(0)<CR>

function! s:Context(reverse)
  call search('^\(@@ .* @@\|[<=>|]\{7}[<=>|]\@!\)', a:reverse ? 'bW' : 'W')
endfunction

function! s:ContextMotion(reverse)
  if a:reverse
    -
  endif
  call search('^@@ .* @@\|^diff \|^[<=>|]\{7}[<=>|]\@!', 'bWc')
  if getline('.') =~# '^diff '
    let end = search('^diff ', 'Wn') - 1
    if end < 0
      let end = line('$')
    endif
  elseif getline('.') =~# '^@@ '
    let end = search('^@@ .* @@\|^diff ', 'Wn') - 1
    if end < 0
      let end = line('$')
    endif
  elseif getline('.') =~# '^=\{7\}'
    +
    let end = search('^>\{7}>\@!', 'Wnc')
  elseif getline('.') =~# '^[<=>|]\{7\}'
    let end = search('^[<=>|]\{7}[<=>|]\@!', 'Wn') - 1
  else
    return
  endif
  if end > line('.')
    execute 'normal! V'.(end - line('.')).'j'
  elseif end == line('.')
    normal! V
  endif
endfunction
" }}}

" Option toggling {{{1
function! s:toggle(op) abort
  execute 'setlocal' a:op . '!' a:op . '?'
endfunction

nnoremap =ol :call <SID>toggle('list')<CR>
nnoremap =oc :call <SID>toggle('cursorline')<CR>
nnoremap =os :call <SID>toggle('spell')<CR>
nnoremap =ow :call <SID>toggle('wrap')<CR>
nnoremap =on :call <SID>toggle('number')<CR>
" }}}

" Put mappings {{{1
function! s:putline(how) abort
{'fraction_non_alphanumeric': 0.22261623325453112, 'fraction_numerical': 0.01182033096926714, 'mean_word_length': 4.401063829787234, 'pattern_counts': {'":': 0, '<': 111, '<?xml version=': 0, '>': 113, 'https://': 2, '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': '5359596', 'n_tokens_mistral': 2140, 'n_tokens_neox': 2037, 'n_words': 484}