<commit_before>let mapleader='\'

" Movement
inoremap <c-h> <left>
inoremap <c-j> <down>
inoremap <c-k> <up>
inoremap <c-l> <right>
" inoremap <m-h> 
" inoremap <m-j> 
" inoremap <m-k> 
" inoremap <m-l> 

nnoremap <leader><leader> <c-^>
" Buffer mappings
nnoremap <leader>bd :bd<cr>
nnoremap <leader>w :w<cr>
nnoremap <leader>q :q<cr>

" Window mappings
nnoremap <c-_> <c-w><c-_>
nnoremap <c-h> <c-w><c-h>
nnoremap <c-j> <c-w><c-j>
nnoremap <c-k> <c-w><c-k>
nnoremap <c-l> <c-w><c-l>
nnoremap <c-w>B :Tex<cr>
nnoremap <c-w>S :Sex<cr>
nnoremap <c-w>V :Vex<cr>

" Tab mappings
nnoremap <leader>tc :tabclose<cr>
nnoremap <leader>tm0 :tabmove0<cr>

" Editing
" Folding
nnoremap <Space> za
nnoremap <S-Space> zA
nnoremap <leader>re :e<cr>
nnoremap <leader>rt :retab<cr>
" yank to system clipboard
nnoremap <leader>y "*yiw
vnoremap <leader>y "*y
" copy entire buffer to system clipboard and return to current line
map <leader>c gg"*yG``
" paste lines from unnamed register and fix indentation
nmap <leader>p pV`]=
nmap <leader>P PV`]=
" <Tab> indents if at the beginning of a line; otherwise does completion
function! InsertTabWrapper()
  let col = col('.') - 1
  if !col || getline('.')[col - 1] !~ '\k'
    return "\<tab>"
  else
    return "\<c-p>"
  endif
endfunction
" inoremap <tab> <c-r>=InsertTabWrapper()<cr>
" inoremap <s-tab> <c-n>
imap <c-space> <c-x><c-o>

" Searching
map <leader>h "0yiw:help <c-r>0
map <leader># "0yiw?\v^((<c-r>0)@!.)*\n<cr>
map <leader>* "0yiw/\v^((<c-r>0)@!.)*\n<cr>
" bind K to grep word under cursor
nnoremap K :Ack! "\b<C-R><C-W>\b"<CR>:cw<CR>
vnoremap K "*y :Ack! "\b<C-R>*\b"<CR>:cw<CR>

" Quick RC editing
nnoremap <leader>ev :tabedit ~/.vimrc<cr>
nnoremap <leader>sv :source ~/.vimrc<cr>
nnoremap <leader>Ev bd ~/.vimrc<cr>

" Ex mode mappings
" cnoremap <C-a> <Home>
nnoremap <leader>vrd :redir @*> \|  \| redir END<left><left><left><left><left><left><left><left><left><left><left><left>

" Misc
<commit_msg>new window map to :Ex<commit_after>let mapleader='\'

" Movement
inoremap <c-h> <left>
inoremap <c-j> <down>
inoremap <c-k> <up>
inoremap <c-l> <right>
" inoremap <m-h> 
" inoremap <m-j> 
" inoremap <m-k> 
" inoremap <m-l> 

nnoremap <leader><leader> <c-^>
" Buffer mappings
nnoremap <leader>bd :bd<cr>
nnoremap <leader>w :w<cr>
nnoremap <leader>q :q<cr>

" Window mappings
nnoremap <c-_> <c-w><c-_>
nnoremap <c-h> <c-w><c-h>
nnoremap <c-j> <c-w><c-j>
nnoremap <c-k> <c-w><c-k>
nnoremap <c-l> <c-w><c-l>
nnoremap <c-w>B :Tex<cr>
nnoremap <c-w>E :Ex<cr>
nnoremap <c-w>S :Sex<cr>
nnoremap <c-w>V :Vex<cr>

" Tab mappings
nnoremap <leader>tc :tabclose<cr>
nnoremap <leader>tm0 :tabmove0<cr>

" Editing
" Folding
nnoremap <Space> za
nnoremap <S-Space> zA
nnoremap <leader>re :e<cr>
nnoremap <leader>rt :retab<cr>
" yank to system clipboard
nnoremap <leader>y "*yiw
vnoremap <leader>y "*y
" copy entire buffer to system clipboard and return to current line
map <leader>c gg"*yG``
" paste lines from unnamed register and fix indentation
nmap <leader>p pV`]=
nmap <leader>P PV`]=
" <Tab> indents if at the beginning of a line; otherwise does completion
function! InsertTabWrapper()
  let col = col('.') - 1
  if !col || getline('.')[col - 1] !~ '\k'
    return "\<tab>"
  else
    return "\<c-p>"
  endif
endfunction
" inoremap <tab> <c-r>=InsertTabWrapper()<cr>
" inoremap <s-tab> <c-n>
imap <c-space> <c-x><c-o>

" Searching
map <leader>h "0yiw:help <c-r>0
map <leader># "0yiw?\v^((<c-r>0)@!.)*\n<cr>
map <leader>* "0yiw/\v^((<c-r>0)@!.)*\n<cr>
" bind K to grep word under cursor
nnoremap K :Ack! "\b<C-R><C-W>\b"<CR>:cw<CR>
vnoremap K "*y :Ack! "\b<C-R>*\b"<CR>:cw<CR>

" Quick RC editing
nnoremap <leader>ev :tabedit ~/.vimrc<cr>
nnoremap <leader>sv :source ~/.vimrc<cr>
nnoremap <leader>Ev bd ~/.vimrc<cr>

" Ex mode mappings
" cnoremap <C-a> <Home>
nnoremap <leader>vrd :redir @*> \|  \| redir END<left><left><left><left><left><left><left><left><left><left><left><left>

" Misc

{'fraction_non_alphanumeric': 0.20882202957674656, 'fraction_numerical': 0.005099439061703213, 'mean_word_length': 4.612303290414879, 'pattern_counts': {'":': 0, '<': 213, '<?xml version=': 0, '>': 215, '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': '466969', 'n_tokens_mistral': 1891, 'n_tokens_neox': 1808, 'n_words': 439}