+" Use :help 'option' to see the documentation for the given option.
set nocompatible
filetype plugin indent on
syntax on
-" Use :help 'option' to see the documentation for the given option.
-
" indentation
set expandtab
set shiftwidth=2
set autoindent
set copyindent
set smarttab
-set nolinebreak
+set linebreak
+set textwidth=0
set breakindent
set breakindent showbreak=\ +
set shiftround
set relativenumber
set title
set titlestring=%F
+set matchtime=2
" folding
set foldmethod=syntax
" buffers
set hidden
set autoread
-set autowrite
-set autowriteall
+"set autowrite
+"set autowriteall
" temporary files
silent !mkdir -p ~/.vim/undo
set undodir=~/.vim/undo
set viminfo+=n~/.vim/viminfo
set history=1000
-setglobal tags-=./tags tags-=./tags; tags^=./tags;
-
-" sessions
+set tags=.git/tags
set sessionoptions-=options
let g:session_directory = "~/.vim/session"
let g:session_autoload = "no"
" system
set path=.,,**
set shell=bash
+let g:is_posix = 1
if has("win32")
set shell=cmd
set shellcmdflag=/c
endif
+scriptencoding utf-8
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8,latin1,unicode
let &t_EI.="\e[1 q"
let &t_te.="\e[0 q"
+"General Mappings
let mapleader = ","
+let maplocalleader = " "
+
set pastetoggle=<leader>p
-" Netrw (buildin)
+nnoremap <silent> <leader>* :grep <cword> \| copen<cr><c-l>
+nnoremap <Leader>t :TagbarToggle<CR>
+command! -nargs=1 Ngrep lvimgrep "<args>" $HOME/cloud/Notes/**/*.md
+command! -range=% Rst :'<,'>!pandoc -f markdown -t rst
+
+noremap <c-h> <c-w><c-h>
+noremap <c-j> <c-w><c-j>
+noremap <c-k> <c-w><c-k>
+noremap <c-l> <c-w><c-l>
+noremap <silent> <c-n> :bn<cr>
+noremap <silent> <c-p> :bp<cr>
+noremap! <C-a> <Home>
+noremap! <C-e> <End>
+"noremap <leader>z :bp<CR>
+"noremap <leader>q :bp<CR>
+"noremap <leader>x :bn<CR>
+"noremap <leader>w :bn<CR>
+"noremap <leader>c :bd<CR>
+
+" Normal Mode Mappings
+nnoremap ; :
+nnoremap : ;
+nnoremap n nzzzv
+nnoremap N Nzzzv
+nnoremap <silent><leader>+ :exe "resize " . (winheight(0) * 3/2)<cr>
+nnoremap <silent><leader>- :exe "resize " . (winheight(0) * 2/3)<cr>
+nnoremap <silent><leader><space> :noh<cr>
+nnoremap <silent><leader>ev :edit $MYVIMRC<cr>
+"nnoremap <silent><leader>sv :source $MYVIMRC<cr>
+nnoremap <silent><leader>sh :terminal<CR>
+"nnoremap <silent><leader>html :-1read ~/.vim/template/html<CR>3jwf>a
+"nnoremap <silent><leader>php :-1read ~/.vim/template/php<CR>2ja
+
+"" Visual Mode Mappings
+vmap < <gv
+vmap > >gv
+
+" Insert Mode Mappings
+inoremap <C-U> <C-G>u<C-U>
+
+" Command Mode Mappings
+cnoremap <C-p> <Up>
+cnoremap <C-n> <Down>
+
+" Command aliases
+cnoreabbrev w!! w !sudo tee "%"
+
+" Termninal Mappings
+tnoremap <C-h> <C-\><C-n><C-w>h
+tnoremap <C-j> <C-\><C-n><C-w>j
+tnoremap <C-k> <C-\><C-n><C-w>k
+tnoremap <C-l> <C-\><C-n><C-w>l
+tnoremap <silent> <c-n> <C-\><C-n>:bnext<cr>
+tnoremap <silent> <c-p> <C-\><C-n>:bprev<cr>
+
+" Functions
+
+" Netrw
let g:netrw_liststyle=3
let g:netrw_banner = 0
let g:netrw_sort_sequence = '[\/]$,*'
-" grep (buildin)
+" grep
" file:line:coloumn:message
set grepformat^=%f:%l:%c:%m
set grepprg=ag\ --vimgrep\ --skip-vcs-ignores\ --path-to-ignore\ ~/.ignore\ --cpp\ --cc
-nnoremap <silent> <leader>* :grep <cword> \| copen<cr><c-l>
-" plugins
+
+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>)
+
+" Autocommands
+if has('autocmd')
+ augroup expandtabs
+ au!
+ au FileType c setlocal expandtab softtabstop=2 shiftwidth=2
+ au FileType cpp setlocal expandtab softtabstop=2 shiftwidth=2
+ au FileType make setlocal noexpandtab tabstop=8 shiftwidth=8
+ au FileType python setlocal expandtab softtabstop=4 shiftwidth=4
+ \ formatoptions+=croq colorcolumn=79
+ \ cinwords=if,elif,else,for,while,try,except,finally,def,class,with
+ augroup end
+
+ augroup filetypes
+ au!
+ au bufnewfile,bufread *.md,*.txt set filetype=pandoc
+ au bufnewfile,bufread *.gradle set filetype=groovy
+ au bufnewfile,bufread *.json set filetype=json
+ au bufnewfile,bufread *.yml set filetype=yaml
+ augroup end
+
+ augroup saveall
+ autocmd!
+ au focuslost * wall
+ augroup end
+
+ augroup numbers
+ au!
+ au bufenter,focusgained,insertleave * set relativenumber
+ au bufleave,focuslost,insertenter * set norelativenumber
+ augroup end
+
+ augroup vimrc
+ au!
+ au bufwritepost ~/.vim/gvimrc silent source %
+ au bufwritepost ~/.vim/vimrc silent source %
+ au bufwritepost ~/.vim/vimrc.local silent source %
+ au BufWritePost * silent FufRenewCache
+ augroup end
+
+ augroup quickfix
+" autocmd QuickFixCmdPost [^l]* nested cwindow
+" autocmd QuickFixCmdPost l* nested lwindow
+ au QuickFixCmdPost * call asyncrun#quickfix_toggle(8, 1)
+ augroup end
+endif
+
+" Packages
" Airline
packadd! vim-airline
" Tagbar
packadd! tagbar
-nnoremap <Leader>t :TagbarToggle<CR>
" Fugitive
packadd! vim-fugitive
packadd! bclose.vim
let g:ranger_replace_netrw = 1
-" CtrlP
-"packadd! ctrlp.vim
-"let g:ctrlp_map = '<Leader>p'
-"let g:ctrlp_cmd = 'CtrlP'
-"let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
-"let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
-"nnoremap <Leader>p :CtrlP<CR>
-"nnoremap <Leader>b :CtrlPBuffer<CR>
-"nnoremap <Leader>m :CtrlPMRU<CR>
-
-" matchit
+" Matchit
packadd! matchit
" termdebug
"let python_highlight_all = 1
" completor
-packadd completor.vim
-let g:completor_clang_binary = '/usr/bin/clang'
+"packadd completor.vim
+"let g:completor_clang_binary = '/usr/bin/clang'
" validator
packadd validator.vim
let g:validator_cpp_checkers = ['clang-tidy']
-" General Mappings
-noremap <c-h> <c-w><c-h>
-noremap <c-j> <c-w><c-j>
-noremap <c-k> <c-w><c-k>
-noremap <c-l> <c-w><c-l>
-noremap <silent> <c-n> :bn<cr>
-noremap <silent> <c-p> :bp<cr>
-"noremap <leader>z :bp<CR>
-"noremap <leader>q :bp<CR>
-"noremap <leader>x :bn<CR>
-"noremap <leader>w :bn<CR>
-"noremap <leader>c :bd<CR>
-
-" Normal Mode Mappings
-nnoremap ; :
-nnoremap : ;
-nnoremap n nzzzv
-nnoremap N Nzzzv
-nnoremap <silent><leader>+ :exe "resize " . (winheight(0) * 3/2)<cr>
-nnoremap <silent><leader>- :exe "resize " . (winheight(0) * 2/3)<cr>
-nnoremap <silent><leader><space> :noh<cr>
-nnoremap <silent><leader>ev :vsplit $MYVIMRC<cr>
-"nnoremap <silent><leader>sv :source $MYVIMRC<cr>
-nnoremap <silent><leader>sh :terminal<CR>
-"nnoremap <silent><leader>html :-1read ~/.vim/template/html<CR>3jwf>a
-"nnoremap <silent><leader>php :-1read ~/.vim/template/php<CR>2ja
-
+" Pandoc
+packadd vim-pandoc
+packadd vim-pandoc-syntax
-"" Visual Mode Mappings
-vmap < <gv
-vmap > >gv
-
-" Insert Mode Mappings
-inoremap <C-U> <C-G>u<C-U>
-
-" Command Mode Mappings
-
-" Command aliases
-cnoreabbrev w!! w !sudo tee "%"
-
-" Termninal Mappings
-tnoremap <C-h> <C-\><C-n><C-w>h
-tnoremap <C-j> <C-\><C-n><C-w>j
-tnoremap <C-k> <C-\><C-n><C-w>k
-tnoremap <C-l> <C-\><C-n><C-w>l
-tnoremap <silent> <c-n> <C-\><C-n>:bnext<cr>
-tnoremap <silent> <c-p> <C-\><C-n>:bprev<cr>
-
-" Functions
+" Fuzzy finder
+packadd L9
+packadd FuzzyFinder
-function! s:setupWrapping()
- set wrapscan
- set wrap
- set wrapmargin=2
- set textwidth=79
-endfunction
-
-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>)
-
-
-" Autocommands
-if has('autocmd')
- " c
- augroup vimrc-c
- autocmd!
- autocmd FileType c setlocal tabstop=2 shiftwidth=2 expandtab
- autocmd FileType cpp setlocal tabstop=2 shiftwidth=2 expandtab
- augroup END
-
- " python
- augroup vimrc-python
- autocmd!
- autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=8 colorcolumn=79
- \ formatoptions+=croq softtabstop=4
- \ cinwords=if,elif,else,for,while,try,except,finally,def,class,with
- augroup END
-
- " txt
- augroup vimrc-txt
- autocmd!
- autocmd BufRead,BufNewFile *.txt call s:setupWrapping()
- augroup END
-
- augroup filetypes
- autocmd!
- autocmd bufnewfile,buffilepre,bufread *.md set filetype=markdown
- autocmd bufnewfile,buffilepre,bufread *.gradle set filetype=groovy
- autocmd bufnewfile,buffilepre,bufread *.json set filetype=json
- autocmd bufnewfile,buffilepre,bufread *.yml set filetype=yaml
- augroup END
-
- augroup saveall
- autocmd!
- autocmd focuslost * wall
- augroup END
-
- augroup numbers
- autocmd!
- autocmd bufenter,focusgained,insertleave * set relativenumber
- autocmd bufleave,focuslost,insertenter * set norelativenumber
- augroup END
-
- augroup vimrc
- autocmd!
- autocmd bufwritepost ~/.vim/gvimrc source %
- autocmd bufwritepost ~/.vim/vimrc source %
- autocmd bufwritepost ~/.vim/vimrc.local source %
- augroup END
-
- augroup quickfix
-" autocmd QuickFixCmdPost [^l]* nested cwindow
-" autocmd QuickFixCmdPost l* nested lwindow
- autocmd QuickFixCmdPost * call asyncrun#quickfix_toggle(8, 1)
- augroup END
-endif
+packloadall
+silent! helptags ALL
" local settings
if filereadable(expand('~/.vim/vimrc.local'))
source ~/.vim/vimrc.local
endif
-" Load all plugins now.
-packloadall
-silent! helptags ALL