-" options
-" ---------------------
+syntax on
+filetype plugin indent on
+" Colors and Fonts
+highlight Normal guibg=black guifg=white
+set background=dark
+set t_Co=256
+if (&t_Co > 2 || has("gui_running"))
+ 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
+endif
+
+" 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"
+
+" General options
silent !mkdir -p ~/.local/share/vim/{swap,backup,undo}
set directory=~/.local/share/vim/swap
set backupdir=~/.local/share/vim/backup
set undodir=~/.local/share/vim/undo
set viminfo+=n~/.local/share/vim/viminfo
-
set path=.,,**,C:\programs\IAR\\\ System\EWB_V850_V360\common\bin
set fileformats=unix,dos,mac
set printoptions=paper:letter
set undofile
set autoread
set autowrite
-
-"set autoindent
set backspace=2
set breakindent showbreak=\ +
-
set clipboard=unnamed
-"set clipboard=unnamedplus
-
"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 lazyredraw
set linebreak
-
set mouse=nvi
set mousemodel=popup
-
set number
set scrolloff=1
set shiftround
set shortmess=aoOtI
-set laststatus=2 " always show status line
+set laststatus=2
set cmdheight=2
-set showcmd " show (partial) command in status line.
-
-set showmatch " show matching brackets.
+set showcmd
+set showmatch
set sidescrolloff=5
-set smartcase " case insensitive searches become sensitive with capitals
+set smartcase
"setglobal tags=./tags;
-
set timeoutlen=500 " leader key timeout
set ttimeoutlen=50 " make esc work faster
-
set visualbell
set virtualedit=block
set updatetime=250
-
set wildmenu
set wildmode=longest:full,full
set wildignore+=tags,.*.un~,*.pyc
set winaltkeys=no
+" Programs
+
+" make
+"set makeprg=cmake\ --build\ .
+set makeprg=msbuild
+set errorformat=\ %#%f(%l):\ %m " Visual studio 2013
+"set errorformat=%.%#>\ %#%f(%l)\ :\ %m " Visual studio 2008
+"set makeprg=vim-iarbuild.cmd " IAR compiler
+"set errorformat=%f(%l)\ :\ %m
+
+" grep
+set grepprg=ag\ --vimgrep\ --skip-vcs-ignores\ --path-to-ignore\ ~/.ignore\ --cpp\ --cc
+set grepformat^=%f:%l:%c:%m " file:line:coloumn:message
+
let mapleader = ","
-" visual
-" ---------------------
-highlight Normal guibg=black guifg=white
-set background=dark
-set t_Co=256
+" Normal mode Mappings
+nnoremap <leader>* :silent grep <cword> \| copen<CR><C-l>
+nnoremap <Leader>t :tags<CR>
+nnoremap <space> za
+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>
+nnoremap <C-n> :bnext<CR>
+nnoremap <C-p> :bNext<CR>
-" 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
+" Insert Mappings
+" Command Mappings
- if exists("syntax_on") || exists("syntax_manual")
- else
- syntax on
- endif
-endif
+" Command aliases
+cnoreabbrev w!! w !sudo tee "%"
-" 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"
+" Commands
-" plugins
-" ---------------------
+" Plugins
+
+" Tagbar
packadd tagbar
+
+" Fugitive
packadd vim-fugitive
+
+" Gtags
packadd vim-gtags
+
+" Unimpaired
packadd vim-unimpaired
-" netrw
-" ---------------------
+" Netrw
let g:netrw_liststyle=3
let g:netrw_banner = 0
let g:netrw_sort_sequence = '[\/]$,*'
-" ranger
-" ---------------------
-function! RangeChooser()
- let temp = tempname()
- " The option "--choosefiles" was added in ranger 1.5.1. Use the next line
- " with ranger 1.4.2 through 1.5.0 instead.
- "exec 'silent !ranger --choosefile=' . shellescape(temp)
- if has("gui_running")
- exec 'silent !xterm -e ranger --choosefiles=' . shellescape(temp)
- else
- exec 'silent !ranger --choosefiles=' . shellescape(temp)
- endif
- if !filereadable(temp)
- redraw!
- " Nothing to read.
- return
- endif
- let names = readfile(temp)
- if empty(names)
- redraw!
- " Nothing to open.
- return
- endif
- " Edit the first item.
- exec 'edit ' . fnameescape(names[0])
- " Add any remaning items to the arg list/buffer list.
- for name in names[1:]
- exec 'argadd ' . fnameescape(name)
- endfor
- redraw!
-endfunction
-command! -bar RangerChooser call RangeChooser()
-nnoremap <leader>r :<C-U>RangerChooser<CR>
-
-" airline
-" ---------------------
+" Ranger
+packadd vim-ranger
+let g:ranger_on_exit = 'bw!'
+let g:ranger_open_mode = 'edit'
+
+" Airline
packadd vim-airline
let g:airline#extensions#tabline#enabled = 1
-" editorconfig
-" ---------------------
+" Editorconfig
packadd editorconfig-vim
let g:editorconfig_exclude_patterns = ['fugitive://.*', 'scp://.*']
let g:editorconfig_verbose = 1
-
if has("win32")
let g:EditorConfig_exec_path = "C:\programs\editorconfig\bin\editorconfig.exe"
else
let g:editorconfig_core_mode = "python_builtin"
endif
-" make
-" ---------------------
-"set makeprg=cmake\ --build\ .
-set makeprg=msbuild
-" Visual studio 2013
-set errorformat=\ %#%f(%l):\ %m
-" Visual studio 2008
-"set errorformat=%.%#>\ %#%f(%l)\ :\ %m
-"
-" IAR compiler
-"if executable('vim-iarbuild.cmd')
-" set makeprg=vim-iarbuild.cmd
-" 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
-" grep under cursor
-nnoremap <leader>* :silent grep <cword> \| copen<CR><C-l> " <C-l> redraws the screen
-
-" ctrl-p
-" ---------------------
+" CtrlP
packadd ctrlp.vim
-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'
-
-" mappings
-" ---------------------
-
-" buffers
-nnoremap <Leader>b :buffer<cr>
-
-" tags
-nnoremap <Leader>t :tags<CR>
-
-" 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>
-
-
-" 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>
-
-if bufwinnr(1)
-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
-
-" force save
-ca w!! w !sudo tee "%"
+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>b :CtrlPBuffer<CR>
+nnoremap <Leader>m :CtrlPMRU<CR>
" 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
+autocmd BufReadPost quickfix nnoremap <buffer> <CR> <CR>
+autocmd bufnewfile,bufread *.md set filetype=markdown
+autocmd bufnewfile,bufread *.gradle set filetype=groovy
" local
-" ---------------------
if filereadable(expand('~/.vim/vimrc.local'))
source ~/.vim/vimrc.local
endif