-" Use :help 'option' to see the documentation for the given option.
-if &compatible
- set nocompatible
-endif
-filetype plugin indent on
-syntax on
-
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Try to load minimal package manager
-silent! packadd minpac
-
-if !exists('g:loaded_minpac')
- " Plugin-less settings
-else
- call minpac#init()
- call minpac#add('k-takata/minpac', {'type': 'opt'})
- " editing
- call minpac#add('tpope/vim-repeat', {'type': 'opt'})
- call minpac#add('tpope/vim-surround', {'type': 'opt'})
- call minpac#add('tpope/vim-unimpaired', {'type': 'opt'})
- call minpac#add('tpope/vim-endwise', {'type': 'opt'})
- call minpac#add('tpope/vim-commentary', {'type': 'opt'})
-" call minpac#add('tpope/vim-fugitive', {'type': 'opt'})
- call minpac#add('tpope/vim-vinegar', {'type': 'opt'})
- call minpac#add('ervandew/supertab', {'type': 'opt'})
- " snippets
- call minpac#add('SirVer/ultisnips', {'type': 'opt'})
- call minpac#add('garbas/vim-snipmate', {'type': 'opt'})
- call minpac#add('honza/vim-snippets', {'type': 'opt'})
- call minpac#add('tomtom/tlib_vim', {'type': 'opt'})
- call minpac#add('MarcWeber/vim-addon-mw-utils', {'type': 'opt'})
- " visuals
- call minpac#add('Yggdroot/indentLine', {'type': 'opt'})
- call minpac#add('vim-airline/vim-airline', {'type': 'opt'})
- call minpac#add('mh21/errormarker.vim', {'type': 'opt'})
- call minpac#add('justinmk/vim-syntax-extra', {'type': 'opt'})
- call minpac#add('haya14busa/incsearch.vim', {'type': 'opt'})
- " browsing
- call minpac#add('junegunn/fzf.vim', {'type': 'opt'})
- call minpac#add('majutsushi/tagbar', {'type': 'opt'})
- call minpac#add('jsfaint/gen_tags.vim', {'type': 'opt'})
- call minpac#add('calleerlandsson/pick.vim', {'type': 'opt'})
- " coding->linting->building->testing
- call minpac#add('w0rp/ale', {'type': 'opt'})
- call minpac#add('igankevich/mesonic', {'type': 'opt'})
- call minpac#add('skywind3000/asyncrun.vim', {'type': 'opt'})
- " markdown
- call minpac#add('previm/previm', {'type': 'opt'})
- call minpac#add('tyru/open-browser.vim', {'type': 'opt'})
- call minpac#add('plasticboy/vim-markdown', {'type': 'opt'})
- call minpac#add('vim-pandoc/vim-pandoc', {'type': 'opt'})
- call minpac#add('vim-pandoc/vim-pandoc-syntax', {'type': 'opt'})
- " others
- call minpac#add('thanthese/Tortoise-Typing', {'type': 'opt'})
-
-" Load plugins right now
-"packloadall
-
- " Plugin settings
-endif
-
-" Common settings
-
-
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Key-mappings
-let mapleader = ' '
-let localmapleader = ' '
-
-nnoremap <silent> <Leader><Leader> :Files<CR>
-nnoremap <silent> <Leader><Enter> :Buffers<CR>
-nnoremap <silent> <Leader>L :Lines<CR>
-nnoremap <silent> <Leader>T :Tags<CR>
-nnoremap <silent> <Leader>` :Marks<CR>
-nnoremap <silent> <Leader>C :Commits<CR>
-nnoremap <silent> <Leader>S :Snippets<CR>
-
-nnoremap <silent> <leader>w :update<cr>
-nnoremap <silent> <leader>t :term<cr>
-nnoremap <silent> <leader>* :grep <cword> \| copen<cr><c-l>
-nnoremap <silent> <leader>+ :exe "resize " . (winheight(0) * 3/2)<cr>
-nnoremap <silent> <leader>- :exe "resize " . (winheight(0) * 2/3)<cr>
-"nnoremap <leader>html :-1read ~/.vim/template/html<CR>3jwf>a
-"nnoremap <leader>php :-1read ~/.vim/template/php<CR>2ja
-"
-" Normal Mode
-nnoremap Y y$
-nnoremap n nzzzv
-nnoremap N Nzzzv
-
-" jk | Escaping!
-inoremap jk <Esc>
-xnoremap jk <Esc>
-cnoremap jk <C-c>
-
-" Circular windows
-nnoremap <tab> <C-w>w
-nnoremap <S-tab> <C-w>W
-
-" Movement in insert mode
-inoremap <C-h> <C-o>h
-inoremap <C-l> <C-o>a
-inoremap <C-j> <C-o>j
-inoremap <C-k> <C-o>k
-
-" Movement in command mode
-cnoremap <C-j> <Down>
-cnoremap <C-k> <Up>
-cnoreabbrev w!! w !sudo tee "%"
-
-" Visual Mode indent
-vnoremap < <gv
-vnoremap > >gv
-
-
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" indentation
-set softtabstop=2
-set shiftwidth=2
-set tabstop=4
-set expandtab
-set autoindent
-set copyindent
-set smarttab
-set linebreak
-set textwidth=0
-set breakindent
-set breakindent showbreak=\ +
-set shiftround
-set formatoptions+=j
-set nostartofline
-
-" searching
-set incsearch hlsearch
-set ignorecase smartcase
-set magic
-set showmatch
-set complete-=i
-set virtualedit=block
-if has('unnamedplus')
- set clipboard=unnamed,unnamedplus
-endif
-
-" display
-set scrolloff=5
-set sidescrolloff=5
-set display+=lastline
-set lazyredraw
-set number
-set relativenumber
-set title
-set titlestring=%F
-set matchtime=2
-
-" folding
-set foldmethod=syntax
-set foldnestmax=1
-set nofoldenable
-
-" keyboard
-set backspace=indent,eol,start
-set ttimeoutlen=10
-set winaltkeys=no
-set noerrorbells
-set novisualbell
-set t_vb=
-
-" command/status line
-set showmode
-set showcmd
-set ruler
-set laststatus=2
-set cmdheight=2
-set shortmess=aoOTI
-set wildmenu
-set wildmode=longest:full,full
-set wildignore+=tags,*.pyc,*.jpg,*.png,*.gif,*.zip
-set wildoptions=tagfile
-
-" buffers
+source $VIMRUNTIME/defaults.vim
+set tabstop=2 expandtab autoindent
set hidden
-set autoread
-"set autowrite
-"set autowriteall
-
-" temporary files
-set undofile
-set undodir=~/.vim/undo
-set nobackup
-set noswapfile
-set viminfo=
-set history=1000
-set tags=.git/tags
-set sessionoptions-=optionsj
-let g:session_directory = "~/.vim/session"
-let g:session_autoload = "no"
-let g:session_autosave = "no"
-let g:session_command_aliases = 1
-
-" netrw
-set modifiable
-let g:netrw_dirhistmax = 0
-let g:netrw_banner = 0
-let g:netrw_list_hide = '\(^\|\s\s\)\zs\.\S\+'
-" like Nerdtree
-"let g:netrw_liststyle = 3
-"let g:netrw_browse_split = 4
-"let g:netrw_altv = 1
-"let g:netrw_winsize = 25
-
-" files
-set path=.,,**
-set shell=bash
-let g:is_posix = 1
-if has("win32")
- set shell=cmd
- set shellcmdflag=/c
-endif
-scriptencoding utf-8
-set fileencoding=utf-8
-set fileencodings=utf-8,latin1,unicode
-set fileformat=unix
-set fileformats=unix,dos,mac
-set fileignorecase
-
-" colors
-set background=dark
-set t_Co=256
-set cursorline
-set cursorcolumn
-highlight Cursorline cterm=NONE ctermbg=darkgrey
-highlight Cursorcolumn ctermbg=darkgrey
-highlight linenr ctermfg=grey
-highlight! link folded normal
-highlight BadWhitespace ctermfg=red
-match BadWhitespace /\s\+$/
-
-" fonts and chars
-set list
-if has('multi_byte') && &encoding ==# 'utf-8'
-" let &listchars = 'tab:Ã\83Â\83Ã\82¢Ã\83Â\82Ã\82Â\96Ã\83Â\82Ã\82¸ ,extends:Ã\83Â\83Ã\82¢Ã\83Â\82Ã\82Â\9dÃ\83Â\82Ã\82¯,precedes:Ã\83Â\83Ã\82¢Ã\83Â\82Ã\82Â\9dÃ\83Â\82Ã\82®,nbsp:Ã\83Â\83Ã\82Â\82Ã\83Â\82Ã\82±'
-else
-" let &listchars = 'tab:> ,extends:>,precedes:<,nbsp:.'
-endif
-"let &t_ti.="\e[1 q"
-"let &t_SI.="\e[5 q"
-"let &t_EI.="\e[1 q"
-"let &t_te.="\e[0 q"
-
-
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Functions
-
-" vimgrep file:line:coloumn:message
-set grepformat^=%f:%l:%c:%m
-set grepprg=ag\ --vimgrep\ --skip-vcs-ignores\ --path-to-ignore\ ~/.ignore\ --cpp\ --cc
-command! -nargs=1 Ngrep lvimgrep "<args>" $HOME/cloud/Notes/**/*.md
-
-function! s:CmakeInit()
- let &errorformat="%f(%l) : %t%*\\D%n: %m,%*[^\"]\"%f\"%*\\D%l: %m,%f(%l) : %m,%*[^ ] %f %l: %m,%f:%l:%c:%m,%f(%l):%m,%f|%l| %m"
- set makeprg=cmake
-endfunction
-"command! -bang -nargs=0 -complete=file CmakeInit call s:CmakeInit(<f-args>)
-
-function! s:Doxygen()
- set errorformat+=%f:%l:\ %m
- set makeprg=doxygen
-endfunction
-"command! -bang -nargs=0 -complete=file Doxygen call s:Doxygen(<f-args>)
-
-function! s:Iar()
- set errorformat=%f(%l)\ :\ %m
- set makeprg=vim-iarbuild.cmd
-endfunction
-"command! -bang -nargs=0 -complete=file Iar call s:Iar(<f-args>)
-
-function! Pandoc_Preview()
- let b:curr_file = expand('%:p')
- call system('pandoc --standalone "' . b:curr_file . '" > markdown-preview.html')
- call system('firefox markdown-preview.html 1>/dev/null 2>/dev/null &')
-endfunction
-
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Autocommands
-if has('autocmd')
- augroup filetypes
- autocmd!
- autocmd BufNewFile,BufRead *.{md,mdwn,mkd,mkdn,mark*} set filetype=markdown
- autocmd BufNewfile,BufRead *.gradle set filetype=groovy
- autocmd BufNewfile,BufRead *.json set filetype=json
- autocmd BufNewfile,BufRead *.yml set filetype=yaml
- augroup end
-
- augroup formats
- autocmd!
- autocmd FileType c setlocal expandtab softtabstop=2 shiftwidth=2
- autocmd FileType cpp setlocal expandtab softtabstop=2 shiftwidth=2
- autocmd FileType make setlocal noexpandtab tabstop=8 shiftwidth=8
- autocmd FileType python setlocal expandtab softtabstop=4 shiftwidth=4
- \ formatoptions+=croq colorcolumn=79
- \ cinwords=if,elif,else,for,while,try,except,finally,def,class,with
- autocmd FileType netrw setlocal bufhidden=wipe
- augroup end
-
- augroup saveall
- autocmd!
- autocmd FocusLost * silent! wa
- augroup end
-
- augroup numbers
- autocmd!
- autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
- autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
- augroup end
-
- augroup vimrc
- autocmd!
- autocmd BufWritePost vimrc,gvimrc,vimrc.local source $MYVIMRC
- augroup end
-
- augroup quickfix
- autocmd!
- " autocmd QuickFixCmdPost [^l]* nested cwindow
- " autocmd QuickFixCmdPost l* nested lwindow
- autocmd QuickFixCmdPost * call asyncrun#quickfix_toggle(8, 1)
- augroup end
-endif
-
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-silent! packadd! matchit
-silent! packadd! vim-syntax-extra
-silent! packadd! vim-repeat
-silent! packadd! vim-surround
-silent! packadd! vim-unimpaired
-"silent! packadd! vim-fugitive
-silent! packadd! vim-commentary
-silent! packadd! vim-vinegar
-silent! packadd! vim-endwise
-silent! packadd! supertab
-
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" fzf
-silent! packadd! fzf.vim
-let g:fzf_buffers_jump = 1
-let g:fzf_tags_command = 'ctags -R'
-let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'
-
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-"silent! packadd! indentLine
-"let g:indentLine_enabled = 0
-"autocmd! User indentLine doautocmd indentLine Syntax
-"let g:indentLine_color_term = 239
-"let g:indentLine_color_gui = '#616161'
-
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Airline
-silent! packadd! vim-airline
-
-if exists('*airline')
- let g:airline#extensions#tabline#enabled = 1
- let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
- let g:airline#extensions#ale#enabled = 1
- let g:airline_section_error = airline#section#create_right(['%{g:asyncrun_status}'])
-endif
-
-
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" ALE
-"silent! packadd! ale
-let g:ale_enabled = 1
-
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Tagbar
-"silent! packadd! tagbar
-
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Gtags-Cscope
-if executable('global')
- silent! packadd! gen_tags.vim
-
- let GtagsCscope_Ignore_Case = 1
- let GtagsCscope_Absolute_Path = 1
- let GtagsCscope_Keep_Alive = 1
- let GtagsCscope_Auto_Load = 1
- let GtagsCscope_Quiet = 1
- set csprg=gtags-cscope
- set cscopetag
-endif
-
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Async shell commands
-"silent! packadd! asyncrun.vim
-let g:asyncrun_open = 8
-let g:asyncrun_status = ""
-let g:asyncrun_auto = "make"
-command! -bang -nargs=* -complete=file Make AsyncRun -program=make @ <args>
-command! -bang -nargs=* -complete=file Grep AsyncRun -program=grep @ <args>
-
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Error markers
-"silent! packadd! errormarker.vim
-
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Meson build system
-"silent! packadd! mesonic
-
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Snippets
-if executable('python')
-"silent! packadd! ultisnips
-else
-"silent! packadd! vim-snipmate
-"silent! packadd! vim-snippets
-"silent! packadd! tlib_vim
-"silent! packadd! vim-addon-mw-utils
-endif
-
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Jedi (python)
-"silent! packadd! jedi-vim
-"let g:polyglot_disabled = ['python']
-"let python_highlight_all = 1
-
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" completor (python)
-"silent! packadd! completor.vim
-"let g:completor_clang_binary = '/usr/bin/clang'
-
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" validator (python)
-"silent! packadd! validator.vim
-"let g:completor_clang_tidy_binary = '/usr/bin/run-clang-tidy'
-"let g:validator_c_checkers = ['clang-tidy']
-"let g:validator_cpp_checkers = ['clang-tidy']
-
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" markdown
-"silent! packadd! vim-pandoc
-"silent! packadd! vim-pandoc-syntax
-"silent! packadd! vim-javascript
-"silent! packadd! vim-markdown
-"silent! packadd! vim-markdown
-silent! packadd! open-browser.vim
-silent! packadd! previm
-let g:previm_enable_realtime = 1
-nnoremap <silent><Leader>md :PrevimOpen<cr>
-nnoremap <silent><Leader>pd :call Pandoc_Preview()<CR>
-
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" deoplete
-set pyx=3
-set pyxversion=3
-set encoding=utf-8
-let g:deoplete#enable_at_startup = 1
-
-silent! helptags ALL
-
-" local settings
-if filereadable(expand('~/.vim/vimrc.local'))
- source ~/.vim/vimrc.local
-endif