<commit_before>function! deleft#Deindent(from, to)
  let saved_cursor = getpos('.')
  silent exe a:from.','.a:to.'<'
  call setpos('.', saved_cursor)
endfunction

function! deleft#Remove(start, end)
  let strategy = g:deleft_remove_strategy

  if strategy == 'delete'
    exe a:start.','.a:end.'delete _'
    return 1
  elseif strategy == 'comment'
    if exists(':TComment')
      call deleft#Deindent(a:start, a:end)
      exe a:start.','.a:end.'TComment'
      return 1
    else
      echoerr
            \ "No supported comment plugin installed."
            \ "Possible plugins: TComment"
      return 0
    endif
  elseif strategy == 'spaces'
    call deleft#Deindent(a:start, a:end)
    call append(a:end, '')
    call append(a:start - 1, '')
    return 1
  else
    echoerr
          \ "Unknown removal strategy: '".strategy."'."
          \ "Available strategies: 'delete', 'comment'."
    return 0
  endif
endfunction

function! deleft#Run(params)
  let indent_filetype = a:params.indent

  let matchit_info = deleft#matchit#Parse({'indent': indent_filetype})
  if matchit_info == {}
    if indent_filetype
      return deleft#indent#SimpleDeleft()
    else
      return deleft#closing#SimpleDeleft()
    endif
  endif

  let [current_start, current_end] = matchit_info.current_group
  if current_start >= 0
    call deleft#Deindent(current_start, current_end)
  endif

  for entry in matchit_info.ItemsToRemove()
    let [type, line_range] = entry
    let [start, end] = line_range

    if type == 'delimiter'
      exe start.','.end.'delete _'
    elseif type == 'inactive_group'
      if !deleft#Remove(start, end)
        return
      endif
    else
      echoerr "Unknown type of an item to removed: '".type."'"
      return
    endif
  endfor
endfunction

function! deleft#Flatten(list)
  let flat_list = []

  for item in a:list
    if type(item) == type([])
      call extend(flat_list, deleft#Flatten(item))
    else
      call add(flat_list, item)
    endif
  endfor

  return flat_list
endfunction<commit_msg>Implement commenting with the NERDCommenter<commit_after>function! deleft#Deindent(from, to)
  let saved_cursor = getpos('.')
  silent exe a:from.','.a:to.'<'
  call setpos('.', saved_cursor)
endfunction

function! deleft#Remove(start, end)
  let strategy = g:deleft_remove_strategy

  if strategy == 'delete'
    exe a:start.','.a:end.'delete _'
    return 1
  elseif strategy == 'comment'
    return s:Comment(a:start, a:end)
  elseif strategy == 'spaces'
    call deleft#Deindent(a:start, a:end)
    call append(a:end, '')
    call append(a:start - 1, '')
    return 1
  else
    echoerr
          \ "Unknown removal strategy: '".strategy."'."
          \ "Available strategies: 'delete', 'comment'."
    return 0
  endif
endfunction

function! deleft#Run(params)
  let indent_filetype = a:params.indent

  let matchit_info = deleft#matchit#Parse({'indent': indent_filetype})
  if matchit_info == {}
    if indent_filetype
      return deleft#indent#SimpleDeleft()
    else
      return deleft#closing#SimpleDeleft()
    endif
  endif

  let [current_start, current_end] = matchit_info.current_group
  if current_start >= 0
    call deleft#Deindent(current_start, current_end)
  endif

  for entry in matchit_info.ItemsToRemove()
    let [type, line_range] = entry
    let [start, end] = line_range

    if type == 'delimiter'
      exe start.','.end.'delete _'
    elseif type == 'inactive_group'
      if !deleft#Remove(start, end)
        return
      endif
    else
      echoerr "Unknown type of an item to removed: '".type."'"
      return
    endif
  endfor
endfunction

function! deleft#Flatten(list)
  let flat_list = []

  for item in a:list
    if type(item) == type([])
      call extend(flat_list, deleft#Flatten(item))
    else
      call add(flat_list, item)
    endif
  endfor

  return flat_list
endfunction

function! s:Comment(start, end)
  if exists(':TComment')
    call deleft#Deindent(a:start, a:end)
    exe a:start.','.a:end.'TComment'
    return 1
  elseif exists('g:loaded_nerd_comments')
    call deleft#Deindent(a:start, a:end)
    let saved_cursor = getpos('.')

    exe a:start
    if a:end > a:start
      exe 'normal! V'.(a:end - a:start).'j'
    else
      exe 'normal! V'
    endif

    exe "normal \<Plug>NERDCommenterComment"
    call setpos('.', saved_cursor)
    return 1
  else
    echoerr
          \ "No supported comment plugin installed."
          \ "Possible plugins: TComment"
    return 0
  endif
endfunction
{'fraction_non_alphanumeric': 0.11762085096903542, 'fraction_numerical': 0.003341501447983961, 'mean_word_length': 3.037769784172662, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 7, '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': '1634691', 'n_tokens_mistral': 1533, 'n_tokens_neox': 1476, 'n_words': 382}