Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
"
" ███████████████████████████
" ███████▀▀▀░░░░░░░▀▀▀███████
" ████▀░░░░░░░░░░░░░░░░░▀████
" ███│░░░░░░░░░░░░░░░░░░░│███
" ██▌│░░░░░░░░░░░░░░░░░░░│▐██
" ██░└┐░░░░░░░░░░░░░░░░░┌┘░██
" ██░░└┐░░░░░░░░░░░░░░░┌┘░░██
" ██░░┌┘▄▄▄▄▄░░░░░▄▄▄▄▄└┐░░██
" ██▌░│██████▌░░░▐██████│░▐██
" ███░│▐███▀▀░░▄░░▀▀███▌│░███
" ██▀─┘░░░░░░░▐█▌░░░░░░░└─▀██
" ██▄░░░▄▄▄▓░░▀█▀░░▓▄▄▄░░░▄██
" ████▄─┘██▌░░░░░░░▐██└─▄████
" █████░░▐█─┬┬┬┬┬┬┬─█▌░░█████
" ████▌░░░▀┬┼┼┼┼┼┼┼┬▀░░░▐████
" █████▄░░░└┴┴┴┴┴┴┴┘░░░▄█████
" ███████▄░░░░░░░░░░░▄███████
" ██████████▄▄▄▄▄▄▄██████████
" ███████████████████████████
"
" You are about to experience a potent dosage of Vim. Watch your steps.
"
" ╔══════════════════════════════════════════╗
" ║ ⎋ HERE BE VIMPIRES ⎋ ║
" ╚══════════════════════════════════════════╝
let s:is_win = has('win32')
let $v = $HOME.(s:is_win ? '\vimfiles' : '/.vim')
if s:is_win
set shell=cmd.exe
set shellcmdflag=/c
set encoding=utf-8
endif
" Plug {{{1
let s:bundle_dir = $v.'/bundle'
let g:plug_shallow = 0
let g:plug_window = 'enew'
let g:plug_pwindow = 'vertical rightbelow new'
call plug#begin(s:bundle_dir)
Plug 'jonathanfilip/vim-lucius'
Plug 'arcticicestudio/nord-vim'
Plug 'mhartington/oceanic-next'
Plug 'joshdick/onedark.vim'
Plug 'AndrewRadev/splitjoin.vim'
Plug 'chrisbra/unicode.vim', {'on': ['UnicodeName', 'UnicodeTable']}
Plug 'godlygeek/csapprox', {'for': 'fugitiveblame' }
Plug 'junegunn/fzf', has('win32') ? {} : {'on': 'FZF', 'dir': '~/local/fzf', 'do': './install --bin'}
Plug 'junegunn/vim-easy-align', {'on': '<plug>(LiveEasyAlign)'}
Plug 'junegunn/vim-plug'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-rhubarb'
Plug 'tpope/vim-rsi'
Plug 'tpope/vim-scriptease'
Plug 'tpope/vim-surround'
if has('nvim-0.5')
Plug 'neovim/nvim-lspconfig'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'nvim-treesitter/nvim-treesitter-refactor'
Plug 'nvim-treesitter/nvim-treesitter-textobjects'
Plug 'nvim-treesitter/playground'
Plug 'norcalli/nvim-colorizer.lua'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'mhinz/telescope-spotlight.nvim'
Plug 'bfredl/luarefvim'
Plug 'phaazon/hop.nvim'
endif
let g:plug_url_format = 'git@github.com:%s.git'
Plug 'mhinz/vim-crates'
Plug 'mhinz/vim-grepper'
Plug 'mhinz/vim-halo'
Plug 'mhinz/vim-janah'
Plug 'mhinz/vim-lookup'
Plug 'mhinz/vim-mix-format'
Plug 'mhinz/vim-rfc'
Plug 'mhinz/vim-sayonara', {'on': 'Sayonara'}
Plug 'mhinz/vim-signify'
Plug 'mhinz/vim-startify'
Plug 'mhinz/vim-tree'
unlet! g:plug_url_format
call plug#end()
if has('nvim-0.5')
lua require 'config'
lua require 'tree'
endif
" Init {{{1
if has('nvim')
let $GIT_EDITOR = 'nvr -cc split --remote-wait'
let $ELIXIR_EDITOR = 'nvr -l +__LINE__ __FILE__'
if v:progpath =~# 'build/bin/nvim$'
" for build/runtime/syntax/vim/generated.vim
let &runtimepath .= ','.$VIM.'/build/runtime'
endif
else
filetype plugin indent on
syntax on
packadd! matchit
endif
let g:vimsyn_embed = 'l'
let g:vimsyn_folding = 'f'
let g:is_bash = 1
let g:lisp_rainbow = 1
let g:markdown_fenced_languages = ['vim']
let g:loaded_2html_plugin = 1
let g:loaded_getscriptPlugin = 1
let g:loaded_gzip = 1
let g:loaded_logipat = 1
" let g:loaded_matchit = 1
" let g:loaded_matchparen = 1
let g:loaded_rrhelper = 1
let g:loaded_spellfile_plugin = 1
let g:loaded_tarPlugin = 1
let g:loaded_vimballPlugin = 1
let g:loaded_zipPlugin = 1
augroup vimrc
autocmd!
augroup END
" Option {{{1
" indent settings
set autoindent
set cinoptions =l1,p0,)50,*50,t0
set expandtab
set smarttab
set softtabstop =2
set shiftwidth =2
set shiftround
" backup/swap/info/undo settings
set nobackup
set nowritebackup
set undofile
set swapfile
if has('nvim')
set backupdir -=.
set shada ='100
else
set backupdir =$v/files/backup
set directory =$v/files/swap//
set undodir =$v/files/undo
set viewdir =$v/files/view
set viminfo ='100,n$v/files/info/viminfo
endif
" better navigation
set cursorline
set foldmethod =marker
set foldopen -=hor
set foldopen +=jump
set foldtext =mhi#foldy()
set hlsearch
set incsearch
set mouse =a
set scrolloff =4
set sidescroll =5
set ignorecase
set smartcase
set tagcase =match
" misc settings
set autoread
set backspace =indent,eol,start
set clipboard =unnamed
set complete -=i
set completeopt +=noselect
set diffopt +=vertical,foldcolumn:0,indent-heuristic,algorithm:patience
set fileformats =unix,dos,mac
set hidden
set history =1000
set lazyredraw
set more
set mousemodel =popup
set noautowrite
set noautowriteall
set noequalalways
set noerrorbells
set nofsync
set nojoinspaces
set wrapscan
set nrformats =hex
set pastetoggle =<F5>
set norelativenumber
set report =0
set sessionoptions-=options
set sessionoptions+=localoptions
set showfulltag
set showtabline =1
set splitbelow
set splitright
set switchbuf =
set synmaxcol =200
set tags ^=./.git/tags;
set timeout
set timeoutlen =1000
set titlestring =VIM:\ %f
set ttimeout
set ttimeoutlen =10
set ttyfast
set virtualedit =onemore,block
set whichwrap =h,l
" wild stuff
set suffixes +=.a,.1,.class
set wildignore +=*.o,*.so,*.zip,*.png
set wildmenu
set wildoptions =tagfile
if has('nvim')
set wildoptions+=pum
else
set wildmode=list:longest,full
endif
" display settings
set display +=lastline
set laststatus =2
set list
set modeline
set modelines =1
set nostartofline
set numberwidth =1
set ruler
set shortmess =aoOTI
set showcmd
set showmatch
set showmode
" spelling
set spellfile =~/.vim/spell/en.utf-8.add,~/.vim/spell/de.utf-8.add
set spelllang =en,de
" breaking
set wrap
set nolinebreak
set breakindent
set breakindentopt=min:40
"set highlight +=@:SpecialKey
set cpoptions =aABcefFqsZ
set formatoptions =tcrqnj
if has('multi_byte') && &encoding ==# 'utf-8'
let &listchars = 'tab:▸ ,extends:❯,precedes:❮,nbsp:±,trail:⣿'
let &fillchars = 'vert: ,diff: ' "
let &showbreak = ''
highlight VertSplit ctermfg=242
" augroup vimrc
" autocmd InsertEnter * set listchars-=trail:⣿
" autocmd InsertLeave * set listchars+=trail:⣿
" augroup END
else
let &listchars = 'tab:> ,extends:>,precedes:<,nbsp:.'
let &fillchars = 'vert: ,stlnc:#'
let &showbreak = '-> '
augroup vimrc
autocmd InsertEnter * set listchars-=trail:.
autocmd InsertLeave * set listchars+=trail:.
augroup END
endif
if has('nvim')
set signcolumn=auto:2
endif
" Mapping {{{1
let mapleader = ';'
nnoremap \ ;
inoremap jf <esc>
nnoremap gh :call mhi#github_open_issue()<cr>
nnoremap gH :call mhi#github_open_slug()<cr>
inoremap <expr> <tab> mhi#tab_yeah()
inoremap <expr> <c-]> mhi#close_bracket()
nnoremap <silent> <tab> <c-w>w:call halo#run()<cr>
nnoremap <silent> <c-p> :call mhi#switch_buffer('bprevious')<cr>
nnoremap <silent> <c-n> :call mhi#switch_buffer('bnext')<cr>
nnoremap <silent> [b :call mhi#switch_buffer('bprevious')<cr>
nnoremap <silent> ]b :call mhi#switch_buffer('bnext')<cr>
nnoremap <silent> [q :cprevious<bar>call halo#run()<cr>
nnoremap <silent> ]q :cnext<bar>call halo#run()<cr>
nnoremap <silent> [l :lprevious<bar>call halo#run()<cr>
nnoremap <silent> ]l :lnext<bar>call halo#run()<cr>
nnoremap <silent> [t :tabprevious<bar>call halo#run()<cr>
nnoremap <silent> ]t :tabnext<bar>call halo#run()<cr>
nnoremap [<space> :<c-u>put! =repeat(nr2char(10), v:count1)<cr>'[
nnoremap ]<space> :<c-u>put =repeat(nr2char(10), v:count1)<cr>
nnoremap [e :<c-u>execute 'move -1-'. v:count1<cr>
nnoremap ]e :<c-u>execute 'move +'. v:count1<cr>
" switch comma-separated arguments
nnoremap [w :normal F,h]w2w<cr>
nnoremap ]w :let s=&isk \| setl isk+=\",' \| exe "norm diwmmebgPdw'mP" \| let &isk=s<cr>
nnoremap } }zz
nnoremap { {zz
nnoremap ]] ]]zz
nnoremap [[ [[zz
nnoremap [] []zz
nnoremap ][ ][zz
nnoremap g; g;zvzz
nnoremap g, g,zvzz
nnoremap <left> <c-w>>
nnoremap <right> <c-w><
nnoremap <up> <c-w>-
nnoremap <down> <c-w>+
nnoremap <silent><a-h> :<c-u>call mhi#tmux_navigate('h')<cr>
nnoremap <silent><a-j> :<c-u>call mhi#tmux_navigate('j')<cr>
nnoremap <silent><a-k> :<c-u>call mhi#tmux_navigate('k')<cr>
nnoremap <silent><a-l> :<c-u>call mhi#tmux_navigate('l')<cr>
xnoremap < <gv
xnoremap > >gv
onoremap gv :<c-u>normal! gv<cr>
nnoremap Q gqap
nnoremap <leader>ev :edit $MYVIMRC<cr>
nnoremap <leader>em :edit ~/.vim/autoload/mhi.vim<cr>
nnoremap <leader>si :echo mhi#syninfo()<cr>
nnoremap <leader>ss :echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')<cr>
nnoremap <leader>m :Messages<cr>
nnoremap <leader>M :<c-u><c-r><c-r>='let @'. v:register .' = '. string(getreg(v:register))<cr><c-f><left>
" nnoremap <leader>o :!echo `git url`/blob/`git rev-parse --abbrev-ref HEAD`/%\#L<C-R>=line('.')<cr> \| xargs open<cr><cr>
nnoremap <leader>o :silent !open <c-r>=fnameescape('<c-r><c-a>')<cr><cr>
nnoremap <leader>w :update<cr>
nnoremap <leader>x :xit<cr>
nnoremap <leader>l :noh<bar>diffupdate<bar>call clearmatches()<bar>syntax sync fromstart<cr><c-l>
nnoremap <leader>v :Runtime<cr>
nnoremap <leader>t :Tree<cr>
nnoremap <silent> <leader>d :Dirview<cr>
" nnoremap <silent> <leader>d :exe 'sil !open' fnameescape(printf('https://devdocs.io/#q=%s%%20%s', &ft, expand('<cword>')))<cr>
nnoremap <silent><leader>b :call mhi#git_blame_current_line()<cr>
nnoremap ' `
nnoremap ` '
nnoremap <bs> <c-t>
nnoremap <silent><cr> :call mhi#jump()<cr>
cnoremap <expr> <c-n> wildmenumode() ? "\<c-n>" : "\<down>"
cnoremap <expr> <c-p> wildmenumode() ? "\<c-p>" : "\<up>"
cnoremap <leader>r $VIMRUNTIME/
cnoremap <leader>ft ~/.vim/after/ftplugin/
nnoremap <silent> n :call mhi#search_highlight_next_match('Nn'[v:searchforward])<cr>
nnoremap <silent> N :call mhi#search_highlight_next_match('nN'[v:searchforward])<cr>
xnoremap * :<c-u>call mhi#search()<cr>//<cr>
xnoremap # :<c-u>call mhi#search()<cr>??<cr>
if has('nvim')
nnoremap <leader>T :vsplit +terminal<cr>
tnoremap <esc> <c-\><c-n>
tnoremap <silent><a-h> <c-\><c-n>:<c-u>call mhi#tmux_navigate('h')<cr>
tnoremap <silent><a-j> <c-\><c-n>:<c-u>call mhi#tmux_navigate('j')<cr>
tnoremap <silent><a-k> <c-\><c-n>:<c-u>call mhi#tmux_navigate('k')<cr>
tnoremap <silent><a-l> <c-\><c-n>:<c-u>call mhi#tmux_navigate('l')<cr>
endif
if !has('nvim')
if empty($TMUX)
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
let &t_SR = "\<Esc>]50;CursorShape=2\x7"
else
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
let &t_SR = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=2\x7\<Esc>\\"
endif
endif
" Autocmd {{{1
augroup vimrc
" foldopen=hor sucks
autocmd BufWinEnter * normal! zvzz
if has('nvim')
autocmd TermOpen,BufEnter term://* startinsert
endif
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ execute 'normal! g`"' |
\ endif
autocmd WinEnter * set cursorline
autocmd WinLeave * set nocursorline
autocmd InsertEnter * set nocursorline
autocmd InsertLeave * set cursorline
autocmd FocusGained * call halo#run()
autocmd CompleteDone * pclose
augroup END
" Command {{{1
command! -nargs=1 -complete=command Scratch call mhi#scratch(<f-args>)
command! CleanSpell runtime! spell/cleanadd.vim
command! Cd call mhi#cd()
command! -range Evo call mhi#git_log_evolution(<line1>, <line2>, expand('%'))
command! Changed exe 'args' join(map(systemlist('git diff --name-only --relative "$@" 2>/dev/null'), 'fnameescape(v:val)'))
command! -nargs=1 -bang T call mhi#terminal(<bang>0, <f-mods>, <f-args>)
command! Signs PP sign_getplaced('.', {'lnum': line('.'), 'group': '*'})
if has('nvim')
command! LuaG lua print(vim.inspect(_G))
command! LspClients lua print(vim.inspect(vim.lsp.buf_get_clients()))
endif
" Color {{{1
function! s:colors_default() abort
" highlight Comment cterm=italic
highlight link User1 StatusLine " master branch
highlight link User2 StatusLine " other branch
highlight link User3 StatusLine " separators
highlight link User4 StatusLine " filename at beginning
highlight link User5 StatusLine " ~changes
" highlight SignifySignAdd ctermfg=151 ctermbg=NONE cterm=NONE
" highlight SignifySignDelete ctermfg=181 ctermbg=NONE cterm=NONE
" highlight SignifySignChange ctermfg=187 ctermbg=NONE cterm=NONE
" highlight Halo guifg=white guibg=#F92672 ctermfg=white ctermbg=197
endfunction
function! s:colors_fnord() abort
highlight link StartifyPath Identifier
highlight link StartifyFile Directory
endfunction
function! s:colors_janah() abort
highlight User1 ctermfg=192 ctermbg=237 cterm=NONE
highlight User2 ctermfg=167 ctermbg=237 cterm=NONE
highlight User3 ctermfg=245 ctermbg=237 cterm=NONE
highlight User4 ctermfg=215 ctermbg=237 cterm=NONE
highlight User5 ctermfg=111 ctermbg=237 cterm=NONE
endfunction
function! s:colors_lucius() abort
if &background ==# 'light'
highlight Normal ctermbg=NONE guibg=NONE
highlight CursorLine ctermbg=255
highlight User1 ctermfg=84 ctermbg=237 cterm=NONE
highlight User2 ctermfg=222 ctermbg=237 cterm=NONE
highlight User3 ctermfg=237 ctermbg=237 cterm=NONE
highlight User4 ctermfg=255 ctermbg=237 cterm=NONE
highlight User5 ctermfg=255 ctermbg=237 cterm=NONE
highlight StatusLine ctermbg=237 cterm=NONE
highlight SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
highlight Question ctermfg=24 ctermbg=255 cterm=NONE
highlight Search ctermfg=fg ctermbg=222 cterm=NONE
highlight Folded ctermbg=253 cterm=NONE
" highlight NormalFloat ctermfg=231 ctermbg=240 cterm=NONE
highlight NormalFloat ctermfg=0 ctermbg=223 cterm=NONE
highlight DirviewArchive ctermfg=31
highlight DirviewDirectory ctermfg=88
highlight DirviewImage ctermfg=29
highlight DirviewVideo ctermfg=115
endif
endfunction
augroup vimrc
autocmd ColorScheme * call s:colors_default()
autocmd ColorScheme janah call s:colors_janah()
autocmd ColorScheme lucius call s:colors_lucius()
autocmd ColorScheme fnord call s:colors_fnord()
augroup END
if has('gui_running')
set background=light
colorscheme lucius
set guioptions=a
set mousehide
if s:is_win
autocmd GUIEnter * simalt ~x
let &guifont = 'Consolas:h10:b'
elseif has('gui_macvim')
set macmeta
let &guifont = 'Source Code Pro:h13'
endif
command! Bigger let &guifont = substitute(&guifont, '\d\+', '\=submatch(0)+1', '')
command! Smaller let &guifont = substitute(&guifont, '\d\+', '\=submatch(0)-1', '')
else
set termguicolors
if !has('nvim')
let &t_8f = "\<Esc>[38:2:%lu:%lu:%lum"
let &t_8b = "\<Esc>[48:2:%lu:%lu:%lum"
endif
if $TERM =~ 'alacritty'
set background=dark
color janah
highlight Normal ctermbg=236
elseif $ITERM_PROFILE == 'Light'
set background=light
colorscheme lucius
else
set background=dark
colorscheme fnord
endif
endif
" Statusline {{{1
command! -bar ToggleStatusline let b:stl_location = !get(b:, 'stl_location')
command! -bar ToggleHighlight let b:stl_highlight = !get(b:, 'stl_highlight')
nnoremap <silent><f10> :ToggleStatusline<cr>
nnoremap <silent><f11> :ToggleHighlight<cr>
set statusline=%!SetStatusline()
function! SetStatusline()
let stl = ' %4*%<%f%*'
if exists('b:git_dir')
let stl .= '%3*:%*'
let branch = fugitive#head(8)
let stl .= ((branch =~# 'master\|main') ? '%1*' : '%2*'). branch .'%*'
let stl .= mhi#sy_stats_wrapper()
endif
let stl .= '%m%r%h%w '
" right side
let stl .=
\ '%= '
\ . '%#ErrorMsg#%{&paste ? " paste " : ""}%*'
\ . '%#WarningMsg#%{&ff != "unix" ? " ".&ff." ":""}%* '
\ . '%#warningmsg#%{&fenc != "utf-8" && &fenc != "" ? " ".&fenc." " :""}%* '
if get(b:, 'stl_highlight')
let id = synID(line('.'), col('.'), 1)
let stl .=
\ '%#WarningMsg#['
\ . '%{synIDattr('.id.',"name")} as '
\ . '%{synIDattr(synIDtrans('.id.'),"name")}'
\ . ']%* '
endif
if get(b:, 'stl_location')
let stl .=
\ '%3*[%*%v%3*,%*%l%3*/%*%L%3*]%* '
\ . '%p%3*%%%* '
endif
return stl
endfunction
" }}}1
" Plugin {{{1
" Plugin: fzf {{{2
set runtimepath+=~/local/fzf
let g:fzf_layout = {'down': '40%'}
nnoremap <leader><leader> :Buffers<cr>
nnoremap <leader>C :Colorschemes<cr>
nnoremap <leader>P :Plugins<cr>
nnoremap <leader>S :Scriptnames<cr>
nnoremap <leader>f :FZF<cr>
function! s:buflist()
return map(filter(range(1, bufnr('$')),
\ 'bufloaded(v:val)'), 'printf("%s: %s", v:val, bufname(v:val))')
endfunction
function! s:bufopen(lines)
if len(a:lines) < 2 | return | endif
let cmd = get({
\ 'ctrl-s': 'split',
\ 'ctrl-v': 'vsplit',
\ 'ctrl-t': 'tabedit'
\ }, a:lines[0], 'edit')
execute cmd '+b'.matchstr(a:lines[1], '^\d\+')
endfunction
function! s:plugopen(entry)
execute 'Dirvish' expand(s:bundle_dir) .'/'. a:entry
execute 'lcd' expand('%')
endfunction
command! Buffers let bl = reverse(s:buflist()) | call fzf#run({
\ 'source': bl,
\ 'sink*': function('<sid>bufopen'),
\ 'options': '+m --expect=ctrl-s,ctrl-v,ctrl-t',
\ 'down': len(bl) + 2,
\ }) | unlet bl
command! Plugins call fzf#run({
\ 'source': reverse(sort(map(globpath(s:bundle_dir, '*', 0, 1), 'fnamemodify(v:val, ":t")'))),
\ 'sink': function('<sid>plugopen'),
\ 'options': '+m',
\ 'left': 30
\ })
command! Colorschemes call fzf#run({
\ 'source': reverse(sort(map(globpath(&rtp, 'colors/*.vim', 0, 1), 'fnamemodify(v:val, ":t:r")'))),
\ 'sink': 'colorscheme',
\ 'options': '+m',
\ 'left': 30
\ })
" Plugin: netrw {{{2
" let g:loaded_netrwPlugin = 1
let g:netrw_banner = 0
let g:netrw_bufsettings = 'relativenumber'
let g:netrw_keepdir = 0
let g:netrw_liststyle = 1
let g:netrw_sort_options = 'i'
" Plugin: surround {{{2
let g:surround_indent = 1
let g:surround_{char2nr('k')} = "<kbd>\r</kbd>"
" Plugin: tagbar {{{2
nnoremap <f2> :TagbarToggle<cr>
let g:tagbar_width = 40
let g:tagbar_autoclose = 0
let g:tagbar_autofocus = 1
let g:tagbar_compact = 1
" Plugin: vim-easy-align {{{2
xmap <cr> <plug>(LiveEasyAlign)
" Plugin: vim-grepper {{{2
nnoremap <leader>g :Grepper<cr>
nmap gs <plug>(GrepperOperator)
xmap gs <plug>(GrepperOperator)
highlight GrepperSideFile ctermfg=161 cterm=reverse
highlight Conceal ctermfg=NONE ctermbg=250
let g:grepper = {}
let g:grepper.dir = 'repo,filecwd'
let g:grepper.tools = ['git', 'rg', 'rubocop']
let g:grepper.rubocop = {
\ 'grepprg': 'rubocop -femacs',
\ 'grepformat': '%f:%l:%c: %t: %m' }
command! Todo Grepper -noprompt -tool rg -query '(TODO|FIX|FIXME|XXX|NOTE|HACK|OPTIMIZE):'
" Plugin: vim-sayonara {{{2
nnoremap <silent><leader>q :Sayonara<cr>
nnoremap <silent><leader>Q :Sayonara!<cr>
let g:sayonara_confirm_quit = 0
" Plugin: vim-startify {{{2
nnoremap <leader>st :Startify<cr>
let g:startify_change_to_dir = 0
" let g:startify_custom_header = 'startify#pad(startify#fortune#boxed())'
let g:startify_enable_special = 0
let g:startify_fortune_use_unicode = 1
let g:startify_update_oldfiles = 1
let g:startify_use_env = 1
" Filetype {{{1
augroup vimrc
" Filetype: Assembly {{{2
let g:asmsyntax = 'nasm'
" vim-commentary uses 'commentstring', not 'comments'
autocmd FileType nasm let &commentstring = '; %s'
" Filetype: C {{{2
autocmd FileType c,cpp setl com=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/
autocmd BufLeave *.{c,cpp} mark C
autocmd BufLeave *.h mark H
" Filetype: cmake {{{2
autocmd FileType cmake setlocal commentstring=#\ %s
" Filetype: crontab {{{2
autocmd FileType crontab setlocal nobackup nowritebackup
" Filetype: Erlang {{{2
autocmd FileType erlang setl com-=:%
" Filetype: Go {{{2
let g:go_bin_path = $v.'/vendor/go'
let g:go_fmt_command = 'goimports'
let g:gofmt_on_save = 0
autocmd FileType go setlocal noet sts& sw& com-=:// isk-=. lcs+=tab:\ \
" Filetype: Help {{{2
autocmd FileType help
\ setl noet
\| execute 'silent wincmd' 'TL'[winnr('$') == 2]
" Filetype: HTML {{{2
autocmd FileType html setl et sts=2 sw=2
" Filetype: Lua {{{2
autocmd FileType lua setl com-=:# sts=2 sw=2
" Filetype: Perl {{{2
let perl_include_pod = 1
autocmd FileType perl
\ setlocal com-=:# kp=perldoc\ -f
\| compiler perl
autocmd BufRead,BufNewFile *.html.ep{,l} set ft=html.epl
" Filetype: Python {{{2
let python_highlight_all = 1
autocmd FileType python
\ setlocal kp=pydoc mp=./%
\| compiler pyunit
" Filetype: Ruby {{{2
let g:ruby_operators = 1
let g:ruby_space_errors = 1
let g:rubycomplete_buffer_loading = 1
let g:rubycomplete_classes_in_global = 1
let g:rubycomplete_rails = 1
function! s:ruby()
command! -buffer -bang Rubocop exe 'Grepper -tool rubocop -noprompt' ['-buffer',''][<bang>0]
command! -buffer -nargs=* -bang Rspec exe '<mods> T clear; bundle exec rspec <args>' expand('%:p').['', ':'.line('.')][<bang>0]
nnoremap <buffer> <leader>rs :vertical Rspec!<cr>
endfunction
autocmd BufNewFile *.rb call append(0, ['#!/usr/bin/env ruby', ''])
autocmd FileType ruby call s:ruby()
" -> after/ftplugin/ruby.vim
" Filetype: Rust {{{2
if has('nvim')
autocmd BufRead Cargo.toml call crates#toggle()
endif
" Filetype: Sh, Zsh {{{2
au FileType zsh,sh setl com-=:# sts=4 sw=4
\| com! -buffer Lint Grepper -noprompt -buffer -grepprg shellcheck -fgcc
" Filetype: Text, Mail, Markdown {{{2
let g:instant_markdown_autostart = 0
let g:instant_markdown_slow = 1
autocmd FileType mail setl tw=72 wrap lbr
autocmd FileType markdown setl tw=80 mp=gomali\ %
autocmd FileType text setl tw=80 fo+=t
" Filetype: VCS {{{2
autocmd FileType git,gitcommit setl tw=80 fo+=t
" fugitive
autocmd BufReadPost fugitive:// setlocal bufhidden=delete
autocmd FileType fugitiveblame nmap q gq
autocmd User fugitive
\ if get(b:, 'fugitive_type', '') =~# '\v^%(tree|blob)$'
\| nnoremap <buffer> .. :edit %:h<cr>
\| endif
" signify
let g:signify_sign_show_text = 1
let g:signify_sign_add = ''
let g:signify_sign_change = ''
let g:signify_sign_delete = ''
omap ic <plug>(signify-motion-inner-pending)
xmap ic <plug>(signify-motion-inner-visual)
omap ac <plug>(signify-motion-outer-pending)
xmap ac <plug>(signify-motion-outer-visual)
nnoremap <silent><leader>p :SignifyHunkDiff<cr>
nnoremap <silent><leader>u :SignifyHunkUndo<cr>
autocmd User SignifyAutocmds autocmd! signify CursorHold,CursorHoldI
" Filetype: Vim, Vader {{{2
autocmd FileType vim nnoremap <buffer><silent> <bs> :call lookup#pop()<bar>call halo#run()<cr>
autocmd FileType vim setl sts=2 sw=2 isk-=#
" }}}2
augroup END
" }}}1
if filereadable($v.'/magic.vim')
source $v/magic.vim
endif
" vim: sw=2 sts=2 tw=0 fdm=marker