<commit_before>" Plugins managed by vim-plug (https://github.com/junegunn/vim-plug#installation)
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
	silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
		\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
	autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif

call plug#begin('~/.local/share/nvim/plugged')

Plug 'arcticicestudio/nord-vim'
Plug 'autozimu/LanguageClient-neovim', { 'branch': 'next', 'do': 'bash install.sh', }
Plug 'benmills/vimux'
Plug 'brooth/far.vim'
Plug 'christoomey/vim-tmux-navigator'
Plug 'dense-analysis/ale'
Plug 'dyng/ctrlsf.vim'
Plug 'edkolev/tmuxline.vim', { 'do': ':TmuxlineSnapshot! ~/.dotfiles/tmux/tmuxline.conf' }
Plug 'fatih/vim-go'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' }
Plug 'junegunn/fzf.vim'
Plug 'machakann/vim-sandwich'
Plug 'othree/eregex.vim'
Plug 'preservim/nerdcommenter'
Plug 'roxma/vim-paste-easy'
Plug 'roxma/vim-tmux-clipboard'
Plug 'sbdchd/neoformat'
Plug 'sebdah/vim-delve'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-sleuth'
Plug 'vim-airline/vim-airline'
Plug 'zivyangll/git-blame.vim'

call plug#end()

" Use the Nord color scheme with true color support
colorscheme nord
set termguicolors

" Tell far to use ack
let g:far#source = 'acknvim'

" Disable netrw history
let g:netrw_dirhistmax = 0

" Don't color in the gutter
highlight clear SignColumn
highlight LineNr guibg=NONE

" Let tmux set active pane colors
hi Normal guibg=NONE ctermbg=NONE

" Use Escape to exit insert mode in the terminal
:tnoremap <Esc> <C-\><C-n>

" Trim trailing whitespace on save
autocmd BufWritePre * :%s/\s\+$//e

" Reload this config file easily
command! Reload :source $MYVIMRC

" Preview replaces live
set inccommand=nosplit

" Don't open scratch windows
set completeopt-=preview

" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1

" Quickly toggle Go breakpoints
nnoremap <Leader>b :DlvToggleBreakpoint<CR>

" Use deoplete with tab
let g:deoplete#enable_at_startup = 1
highlight Pmenu ctermfg=236 ctermbg=243
highlight PmenuSel ctermfg=236 ctermbg=255
inoremap <silent><expr><tab> pumvisible() ? "\<C-n>" : "\<TAB>"
inoremap <silent><expr><s-tab> pumvisible() ? "\<C-p>" : "\<S-TAB>"

" Enable a shortcut for inserting bash shebangs
command! Shebang :normal! i#!/usr/bin/env bash<CR><Esc>

" Make a shortcut for killing smart quotes
command! SmartQuotes :%s/’/'/ge | :%s/[“”]/"/ge

" Use an Omni pattern for Go completions
call deoplete#custom#option('omni_patterns', {
	\ 'go': '[^. *\t]\.\w*',
	\})

" Configure vim-airline
let g:airline_theme='nord'
let g:airline_powerline_fonts=1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
let g:airline_left_sep = ''
let g:airline_left_alt_sep = '|'
let g:airline_right_sep = ''
let g:airline_right_alt_sep = '|'

" Don't run too many calculations on the git repo
let g:airline#extensions#branch#vcs_checks = []

" Customize the tmuxline display
let g:tmuxline_powerline_separators = 0
let g:tmuxline_preset = {
      \'a'    : '#S',
      \'b'    : '#H',
      \'win'  : '#I#F #W',
      \'cwin' : '#I#F #W',
      \'y'    : '%a, %b %e',
      \'z'    : '%l:%M %P'}

" Tab between buffers
nnoremap  <silent>   <tab>  :if &modifiable && !&readonly && &modified <CR> :write<CR> :endif<CR>:bnext<CR>
nnoremap  <silent> <s-tab>  :if &modifiable && !&readonly && &modified <CR> :write<CR> :endif<CR>:bprevious<CR>

" Enable easier pasting
autocmd VimEnter * PasteEasyEnable

" Map fzf's file search to Control + P
nnoremap <C-P> :Files<CR>
tnoremap <C-P> :Files<CR>

" Map fzf's string search to Control + F
nnoremap <C-F> :RG<CR>
tnoremap <C-F> :RG<CR>

" Actually call ripgrep while searching instead of fzf-ing through ripgrep output
function! RipgrepFzf(query, fullscreen)
  let command_fmt = "rg --files | rg --color=always --smart-case %s | sed 's/$/:1:1:/'; rg --column --line-number --no-heading --color=always --smart-case %s || true"
  let initial_command = printf(command_fmt, shellescape(a:query), shellescape(a:query))
  let reload_command = printf(command_fmt, '{q}', '{q}')
  let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
  call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
endfunction
command! -nargs=* -bang RG call RipgrepFzf(<q-args>, <bang>0)

" Use ripgrep to search for the word under the cursor
nnoremap <silent> <Leader>rg :RG <C-R><C-W><CR>

" Hide the fzf statusline when started inside a :terminal (the default in Neovim)
autocmd! FileType fzf set laststatus=0 noshowmode noruler
  \| autocmd BufLeave <buffer> set laststatus=2 showmode ruler

" Customize fzf colors to match your color scheme
" - fzf#wrap translates this to a set of `--color` options
let g:fzf_colors =
\ { 'fg':      ['fg', 'Normal'],
  \ 'bg':      ['bg', 'Normal'],
  \ 'hl':      ['fg', 'Comment'],
  \ 'fg+':     ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
  \ 'bg+':     ['bg', 'CursorLine', 'CursorColumn'],
  \ 'hl+':     ['fg', 'Statement'],
  \ 'info':    ['fg', 'PreProc'],
  \ 'border':  ['fg', 'Comment'],
  \ 'prompt':  ['fg', 'Conditional'],
  \ 'pointer': ['fg', 'Exception'],<commit_msg>Removing a --color=always that isn't doing anything<commit_after>" Plugins managed by vim-plug (https://github.com/junegunn/vim-plug#installation)
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
	silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
		\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
	autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif

call plug#begin('~/.local/share/nvim/plugged')

Plug 'arcticicestudio/nord-vim'
Plug 'autozimu/LanguageClient-neovim', { 'branch': 'next', 'do': 'bash install.sh', }
Plug 'benmills/vimux'
Plug 'brooth/far.vim'
Plug 'christoomey/vim-tmux-navigator'
Plug 'dense-analysis/ale'
Plug 'dyng/ctrlsf.vim'
Plug 'edkolev/tmuxline.vim', { 'do': ':TmuxlineSnapshot! ~/.dotfiles/tmux/tmuxline.conf' }
Plug 'fatih/vim-go'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' }
Plug 'junegunn/fzf.vim'
Plug 'machakann/vim-sandwich'
Plug 'othree/eregex.vim'
Plug 'preservim/nerdcommenter'
Plug 'roxma/vim-paste-easy'
Plug 'roxma/vim-tmux-clipboard'
Plug 'sbdchd/neoformat'
Plug 'sebdah/vim-delve'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-sleuth'
Plug 'vim-airline/vim-airline'
Plug 'zivyangll/git-blame.vim'

call plug#end()

" Use the Nord color scheme with true color support
colorscheme nord
set termguicolors

" Tell far to use ack
let g:far#source = 'acknvim'

" Disable netrw history
let g:netrw_dirhistmax = 0

" Don't color in the gutter
highlight clear SignColumn
highlight LineNr guibg=NONE

" Let tmux set active pane colors
hi Normal guibg=NONE ctermbg=NONE

" Use Escape to exit insert mode in the terminal
:tnoremap <Esc> <C-\><C-n>

" Trim trailing whitespace on save
autocmd BufWritePre * :%s/\s\+$//e

" Reload this config file easily
command! Reload :source $MYVIMRC

" Preview replaces live
set inccommand=nosplit

" Don't open scratch windows
set completeopt-=preview

" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1

" Quickly toggle Go breakpoints
nnoremap <Leader>b :DlvToggleBreakpoint<CR>

" Use deoplete with tab
let g:deoplete#enable_at_startup = 1
highlight Pmenu ctermfg=236 ctermbg=243
highlight PmenuSel ctermfg=236 ctermbg=255
inoremap <silent><expr><tab> pumvisible() ? "\<C-n>" : "\<TAB>"
inoremap <silent><expr><s-tab> pumvisible() ? "\<C-p>" : "\<S-TAB>"

" Enable a shortcut for inserting bash shebangs
command! Shebang :normal! i#!/usr/bin/env bash<CR><Esc>

" Make a shortcut for killing smart quotes
command! SmartQuotes :%s/’/'/ge | :%s/[“”]/"/ge

" Use an Omni pattern for Go completions
call deoplete#custom#option('omni_patterns', {
	\ 'go': '[^. *\t]\.\w*',
	\})

" Configure vim-airline
let g:airline_theme='nord'
let g:airline_powerline_fonts=1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
let g:airline_left_sep = ''
let g:airline_left_alt_sep = '|'
let g:airline_right_sep = ''
let g:airline_right_alt_sep = '|'

" Don't run too many calculations on the git repo
let g:airline#extensions#branch#vcs_checks = []

" Customize the tmuxline display
let g:tmuxline_powerline_separators = 0
let g:tmuxline_preset = {
      \'a'    : '#S',
      \'b'    : '#H',
      \'win'  : '#I#F #W',
      \'cwin' : '#I#F #W',
      \'y'    : '%a, %b %e',
      \'z'    : '%l:%M %P'}

" Tab between buffers
nnoremap  <silent>   <tab>  :if &modifiable && !&readonly && &modified <CR> :write<CR> :endif<CR>:bnext<CR>
nnoremap  <silent> <s-tab>  :if &modifiable && !&readonly && &modified <CR> :write<CR> :endif<CR>:bprevious<CR>

" Enable easier pasting
autocmd VimEnter * PasteEasyEnable

" Map fzf's file search to Control + P
nnoremap <C-P> :Files<CR>
tnoremap <C-P> :Files<CR>

" Map fzf's string search to Control + F
nnoremap <C-F> :RG<CR>
tnoremap <C-F> :RG<CR>

" Actually call ripgrep while searching instead of fzf-ing through ripgrep output
function! RipgrepFzf(query, fullscreen)
  let command_fmt = "rg --files | rg --smart-case %s | sed 's/$/:1:1:/'; rg --column --line-number --no-heading --color=always --smart-case %s || true"
  let initial_command = printf(command_fmt, shellescape(a:query), shellescape(a:query))
  let reload_command = printf(command_fmt, '{q}', '{q}')
  let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
  call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
endfunction
command! -nargs=* -bang RG call RipgrepFzf(<q-args>, <bang>0)

" Use ripgrep to search for the word under the cursor
nnoremap <silent> <Leader>rg :RG <C-R><C-W><CR>

" Hide the fzf statusline when started inside a :terminal (the default in Neovim)
autocmd! FileType fzf set laststatus=0 noshowmode noruler
  \| autocmd BufLeave <buffer> set laststatus=2 showmode ruler

" Customize fzf colors to match your color scheme
" - fzf#wrap translates this to a set of `--color` options
let g:fzf_colors =
\ { 'fg':      ['fg', 'Normal'],
  \ 'bg':      ['bg', 'Normal'],
  \ 'hl':      ['fg', 'Comment'],
  \ 'fg+':     ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
  \ 'bg+':     ['bg', 'CursorLine', 'CursorColumn'],
  \ 'hl+':     ['fg', 'Statement'],
  \ 'info':    ['fg', 'PreProc'],
  \ 'border':  ['fg', 'Comment'],
  \ 'prompt':  ['fg', 'Conditional'],
  \ 'pointer': ['fg', 'Exception'],
{'fraction_non_alphanumeric': 0.16541423137582337, 'fraction_numerical': 0.004453103256331756, 'mean_word_length': 4.50561797752809, 'pattern_counts': {'":': 0, '<': 93, '<?xml version=': 0, '>': 93, 'https://': 4, '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': '491579', 'n_tokens_mistral': 4375, 'n_tokens_neox': 4117, 'n_words': 1046}