-" section: environment {{{1
+" options
" ---------------------
silent !mkdir -p ~/.local/share/vim/{swap,backup,undo}
set undodir=~/.local/share/vim/undo
set viminfo+=n~/.local/share/vim/viminfo
-" section: options {{{1
-" ---------------------
-"set autoindent
+set undofile
+set fileformats=unix,dos,mac
+set printoptions=paper:letter
+set shell=/bin/bash
+
set autoread
set autowrite " automatically save before commands like :next and :make
+
+"set autoindent
set backspace=2
-if exists('+breakindent')
- set breakindent showbreak=\ +
-endif
-set cmdheight=2
-setglobal commentstring=#\ %s
-set complete-=i " searching includes can be slow
-"if has("win32") || has("win64")
-" does not work for msys2
+set breakindent showbreak=\ +
+
set clipboard=unnamed
-"else
"set clipboard=unnamedplus
-"endif
-set fileformats=unix,dos,mac
+
"set foldmethod=syntax
"set foldlevel=1
"set foldclose=all
"set foldopen+=jump
+
set guioptions+=a
"set guioptions-=m "menu bar
set guioptions-=T "toolbar
set guioptions-=r "scroolbar
+
+set complete-=i " searching includes can be slow
set history=200
set incsearch " incremental search
set laststatus=2 " always show status line
set lazyredraw
set linebreak
+
set mouse=nvi
set mousemodel=popup
+
set number
-"set pastetoggle=<f2>
-set printoptions=paper:letter
set scrolloff=1
set shiftround
set shortmess=aoOtI
-"set showcmd " show (partial) command in status line.
+set cmdheight=2
+set showcmd " show (partial) command in status line.
+
set showmatch " show matching brackets.
set sidescrolloff=5
set smartcase " case insensitive searches become sensitive with capitals
"setglobal tags=./tags;
+"
set timeoutlen=500 " leader key timeout
set ttimeoutlen=50 " make esc work faster
+
set visualbell
-if exists('+undofile')
- set undofile
-endif
set virtualedit=block
set updatetime=250
+
set wildmenu
set wildmode=longest:full,full
set wildignore+=tags,.*.un~,*.pyc
set winaltkeys=no
-set shell=/bin/bash
+
+" visual
+"""""""""""""""""""""""""""""""""""""""""
+
+highlight Normal guibg=black guifg=white
+set background=dark
+set t_Co=256
+
+" switch syntax highlighting on, when the terminal has colors
+if (&t_Co > 2 || has("gui_running")) && has("syntax")
+ if exists("&guifont")
+ if has("mac")
+ set guifont=monaco:h11
+ elseif has("unix")
+ set guifont=inconsolata\ 11
+ elseif has("win32")
+" set guifont=consolas:h11,courier\ new:h10
+ set guifont=consolas:h10:cANSI:qDRAFT
+ endif
+ endif
+
+
+ if exists("syntax_on") || exists("syntax_manual")
+ else
+ syntax on
+ endif
+endif
+
+
+" make
+"""""""""""""""""""""""""""""""""""""""""
+
set path=.,,**,C:\programs\IAR\\\ System\EWB_V850_V360\common\bin
"set makeprg=cmake\ --build\ .
" set errorformat=%f(%l)\ :\ %m
"endif
+" grep
+"""""""""""""""""""""""""""""""""""""""""
+
if executable('ag')
set grepprg=ag\ --vimgrep\ --skip-vcs-ignores\ --path-to-ignore\ ~/.ignore\ --cpp\ --cc
set grepformat^=%f:%l:%c:%m " file:line:coloumn:message
endif
-"syn match pythonDefStatement /^\s*\%(def\|class\)/
-" \ nextgroup=pythonFunction skipwhite
-"syn region pythonFunctionFold start="^\z(\s*\)\%(def\|class\)\>"
-" \ end="\ze\%(\s*\n\)\+\%(\z1\s\)\@!." fold transparent
-"hi link pythonDefStatement Statement
+" settings
+"""""""""""""""""""""""""""""""""""""""""
-"let g:syntastic_quiet_messages = { "type": "style" }
+" block cursor in normal mode
+let &t_ti.="\e[1 q"
+let &t_SI.="\e[5 q"
+let &t_EI.="\e[1 q"
+let &t_te.="\e[0 q"
-" plugin settings {{{1
+" netrw
let g:netrw_liststyle=3
let g:netrw_banner = 0
let g:netrw_sort_sequence = '[\/]$,*'
-"let g:markdown_fenced_languages = ['html', 'python', 'bash=sh']
-"let g:markdown_syntax_conceal = 0
-
-
-"for airline
+" airline
let g:airline#extensions#tabline#enabled = 1
-
-
+" editorconfig
let g:editorconfig_exclude_patterns = ['fugitive://.*', 'scp://.*']
let g:editorconfig_verbose = 1
let g:editorconfig_core_mode = "python_builtin"
endif
-"set colorcolumn=80
-"highlight ColorColumn ctermbg=9
-" block cursor in normal mode
-let &t_ti.="\e[1 q"
-let &t_SI.="\e[5 q"
-let &t_EI.="\e[1 q"
-let &t_te.="\e[0 q"
-
-let python_folding = 1
-" }}}2
-" section: commands {{{1
-"-----------------------
-
-if has("cscope")
- set nocscopetag
- set cscopequickfix=s-,c-,d-,i-,t-,e-
- set nocscopeverbose
- if filereadable(".git/cscope.out")
- cscope add .git/cscope.out
- endif
- set cscopeverbose
-
- function! Cscoperebuild()
- cscope kill .git/cscope.out
- silent execute "!./.git/hooks/cscope"
- if v:shell_error
- redraw!
- echohl errormsg | echo "unable to run cscope command." | echohl none
- else
- if filereadable(".git/cscope.out")
- redraw!
- cscope add .git/cscope.out
- else
- redraw!
- echohl errormsg | echo "unable to read cscope database." | echohl none
- endif
- endif
- endfunction
-
- command! Cscope call Cscoperebuild()
-endif"
-
-
-" section: mappings {{{1
-" ----------------------
-"
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" mappings
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let mapleader = ","
-" Grep the word under cursor
+" grep under cursor
nnoremap <leader>* :silent grep <cword> \| copen<CR><C-l> " <C-l> redraws the screen
-" Quickly edit/reload the vimrc file
-nmap <silent> <leader>ev :e $MYVIMRC<CR>
-nmap <silent> <leader>sv :so $MYVIMRC<CR>
+" buffers
+nnoremap <Leader>b :buffer<cr>
-" Minibufferexplorer
-nnoremap <Leader>b :MBEToggle<cr>
-"let g:miniBufExplMapWindowNavVim = 1
-"let g:miniBufExplMapCTabSwitchBufs = 1
-"
-" Tagbar
-nnoremap <Leader>t :TagbarToggle<CR>
-
-" copy/paste from system clipboard
-if has("win32")
-vnoremap <Leader>y "*y
-vnoremap <Leader>d "*d
-nnoremap <Leader>p "*p
-nnoremap <Leader>P "*P
-
-vnoremap <Leader>p "*p
-vnoremap <Leader>P "*P
-else
-" nnoremap <Leader>y "*y
-" nnoremap <Leader>p "*p
-" nnoremap <Leader>Y "+y
-" nnoremap <Leader>P "+p
-" nnoremap <Leader>y "*y
-" nnoremap <Leader>yy "*yy
-" noremap <Leader>p "*p
-" noremap <Leader>P "*P
-endif
+" tags
+nnoremap <Leader>t :tags<CR>
-if has("cscope")
-" cnoreabbrev <expr> csa
-" \ ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs add' : 'csa')
-" cnoreabbrev <expr> csf
-" \ ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs find' : 'csf')
-" cnoreabbrev <expr> csk
-" \ ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs kill' : 'csk')
-" cnoreabbrev <expr> csr
-" \ ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs reset' : 'csr')
-" cnoreabbrev <expr> css
-" \ ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs show' : 'css')
-" cnoreabbrev <expr> csh
-" \ ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs help' : 'csh')
-
- nnoremap <leader>fa :call CscopeFindInteractive(expand('<cword>'))<CR>
- nnoremap <leader>l :call ToggleLocationList()<CR>
-
- " s: Find this C symbol
- nnoremap <leader>fs :call CscopeFind('s', expand('<cword>'))<CR>
- " g: Find this definition
- nnoremap <leader>fg :call CscopeFind('g', expand('<cword>'))<CR>
- " d: Find functions called by this function
- nnoremap <leader>fd :call CscopeFind('d', expand('<cword>'))<CR>
- " c: Find functions calling this function
- nnoremap <leader>fc :call CscopeFind('c', expand('<cword>'))<CR>
- " t: Find this text string
- nnoremap <leadpr>ft :call CscopeFind('t', expand('<cword>'))<CR>
- " e: Find this egrep pattern
- nnoremap <leader>fe :call CscopeFind('e', expand('<cword>'))<CR>
- " f: Find this file
- nnoremap <leader>ff :call CscopeFind('f', expand('<cword>'))<CR>
- " i: Find files #including this file
- nnoremap <leader>fi :call CscopeFind('i', expand('<cword>'))<CR>
-
- "todo: figure out how to get cstag output in quickfix or a popup menu.
- map <c-_> :cstag <c-r>=expand("<cword>")<cr><cr>
-endif
-
-" Ctrl-P
+" ctrl-p
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
-" Maps Ctrl-[h,j,k,l,+,-] to windows split navigations and resizing
-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>
+" ctrl-hjkl to windows navigation and resizing
+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>
+
if bufwinnr(1)
-nnoremap <Leader>j :exe "resize " . (winheight(0) * 2/3)<CR>
-nnoremap <Leader>k :exe "resize " . (winheight(0) * 3/2)<CR>
+nnoremap <C-j> :exe "resize " . (winheight(0) * 2/3)<CR>
+nnoremap <C-k> :exe "resize " . (winheight(0) * 3/2)<CR>
endif
" folding
noremap <space> za
-" In the quickfix window, <CR> is used to jump to the error under the
-" cursor, so undefine the mapping there.
-autocmd BufReadPost quickfix nnoremap <buffer> <CR> <CR>
-" section: autocommands {{{1
-" --------------------------
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" autocommands
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
if has("autocmd")
filetype plugin indent on
+ autocmd BufReadPost quickfix nnoremap <buffer> <CR> <CR>
autocmd bufnewfile,bufread *.md set filetype=markdown
autocmd bufnewfile,bufread *.gradle set filetype=groovy
-endif " has("autocmd")
-" }}}1
-" section: visual {{{1
-" --------------------
-
-" switch syntax highlighting on, when the terminal has colors
-if (&t_Co > 2 || has("gui_running")) && has("syntax")
- if exists("&guifont")
- if has("mac")
- set guifont=monaco:h11
- elseif has("unix")
- set guifont=inconsolata\ 11
- elseif has("win32")
-" set guifont=consolas:h11,courier\ new:h10
- set guifont=Consolas:h10:cANSI:qDRAFT
- endif
- endif
-
-
- if exists("syntax_on") || exists("syntax_manual")
- else
- syntax on
- endif
endif
-"colorscheme dark default
-highlight Normal guibg=black guifg=white
-set background=dark
-set t_Co=256
-" }}}1
-
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if filereadable(expand('~/.vim/vimrc.local'))
source ~/.vim/vimrc.local
endif