<commit_before>" Rename file function.
" Call using :Rename new_file_name.txt
function RenameFile()
  let oldpath = expand('%')
  let newpath = input('New file name: ', expand('%'), 'file')
  let file_modified = getbufvar(oldpath, '&modified')
  echohl ErrorMsg
  if file_modified == 1
    echomsg oldpath . " has been modified, please save before renaming!"
  else
    let renamed = rename(oldpath, newpath)
    if renamed != 0
      echomsg "Failed to rename file to " . newpath . "!"
    else
      bd
      call delete(oldpath)
      exec "e " . newpath
    endif
  endif
  echohl None
endfunction
map <leader>n :call RenameFile()<cr><commit_msg>Restore 'Rename' command<commit_after>" Rename file function.
" Call using :Rename
function RenameFile()
  let oldpath = expand('%')
  let newpath = input('New file name: ', expand('%'), 'file')
  let file_modified = getbufvar(oldpath, '&modified')
  echohl ErrorMsg
  if file_modified == 1
    echomsg oldpath . " has been modified, please save before renaming!"
  else
    let renamed = rename(oldpath, newpath)
    if renamed != 0
      echomsg "Failed to rename file to " . newpath . "!"
    else
      bd
      call delete(oldpath)
      exec "e " . newpath
    endif
  endif
  echohl None
endfunction
command! -nargs=* -complete=file Rename call RenameFile()
map <leader>n :call RenameFile()<cr>
{'fraction_non_alphanumeric': 0.11028867505551443, 'fraction_numerical': 0.0029607698001480384, 'mean_word_length': 3.3754045307443366, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6680482', 'n_tokens_mistral': 454, 'n_tokens_neox': 427, 'n_words': 144}