260 lines
5.9 KiB
VimL
260 lines
5.9 KiB
VimL
set nocompatible " required
|
||
filetype off " required
|
||
|
||
"""" VUNDLE
|
||
" set the runtime path to include Vundle and initialize
|
||
set rtp+=~/.vim/bundle/vundle/
|
||
call vundle#rc()
|
||
" alternatively, pass a path where Vundle should install bundles
|
||
"let path = '~/some/path/here'
|
||
"call vundle#rc(path)
|
||
|
||
" let Vundle manage Vundle, required
|
||
Plugin 'gmarik/vundle'
|
||
|
||
Plugin 'bling/vim-airline'
|
||
Plugin 'tpope/vim-endwise'
|
||
Plugin 'danro/rename.vim'
|
||
Plugin 'pbrisbin/vim-mkdir'
|
||
Plugin 'Lokaltog/vim-easymotion'
|
||
Plugin 'tpope/vim-sensible'
|
||
Plugin 'tpope/vim-eunuch'
|
||
Plugin 'tpope/vim-fugitive'
|
||
Plugin 'scrooloose/nerdtree'
|
||
Plugin 'tomtom/tcomment_vim'
|
||
Plugin 'tpope/vim-characterize'
|
||
Plugin 'jonathanfilip/vim-lucius'
|
||
Plugin 'nanotech/jellybeans.vim'
|
||
Plugin 'majutsushi/tagbar'
|
||
Plugin 'bling/vim-bufferline'
|
||
Plugin 'sjl/gundo.vim'
|
||
Plugin 'SirVer/ultisnips'
|
||
Plugin 'kien/ctrlp.vim'
|
||
Plugin 'terryma/vim-multiple-cursors'
|
||
Plugin 'myusuf3/numbers.vim'
|
||
Plugin 'mhinz/vim-signify'
|
||
Plugin 'nathanaelkane/vim-indent-guides'
|
||
Plugin 'tpope/vim-surround'
|
||
Plugin 'scrooloose/syntastic'
|
||
Plugin 'christoomey/vim-tmux-navigator'
|
||
Plugin 'Valloric/YouCompleteMe'
|
||
|
||
" YouCompleteMe
|
||
nnoremap K :YcmCompleter GoTo<CR>
|
||
nnoremap ˚ :YcmCompleter GoToDeclaration<CR>
|
||
let g:ycm_goto_buffer_command = 'horizontal-split'
|
||
let g:ycm_autoclose_preview_window_after_insertion = 1
|
||
|
||
filetype plugin indent on " required
|
||
""" end vundle
|
||
|
||
"""" PLUGIN SETTINGS
|
||
"
|
||
""" Easymotion
|
||
map / <Plug>(easymotion-sn)
|
||
omap / <Plug>(easymotion-tn)
|
||
map n <Plug>(easymotion-next)
|
||
map N <Plug>(easymotion-prev)
|
||
let g:EasyMotion_landing_highlight = 1
|
||
""" CtrlP
|
||
" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher
|
||
if executable('ag')
|
||
" Use Ag over Grep
|
||
set grepprg=ag\ --nogroup\ --nocolor
|
||
|
||
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
|
||
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
|
||
|
||
" ag is fast enough that CtrlP doesn't need to cache
|
||
let g:ctrlp_use_caching = 0
|
||
endif
|
||
|
||
""" Gundo
|
||
map <leader>u :GundoToggle<CR>
|
||
|
||
"""" END PLUGIN SETTINGS
|
||
|
||
let mapleader=","
|
||
set nobackup
|
||
set noswapfile
|
||
set pastetoggle=<F2>
|
||
|
||
filetype on
|
||
filetype plugin indent on
|
||
syntax on
|
||
|
||
try
|
||
colorscheme lucius
|
||
catch
|
||
" deal with it
|
||
endtry
|
||
|
||
set t_Co=256
|
||
if &term =~ 'xterm-color'
|
||
set t_ut=
|
||
endif
|
||
set nocompatible
|
||
set laststatus=2
|
||
|
||
if v:version >= 703
|
||
"undo settings
|
||
set undodir=~/.vim/undofiles
|
||
set undofile
|
||
|
||
set colorcolumn=+1 "mark the ideal max text width
|
||
endif
|
||
|
||
|
||
set hidden
|
||
set showmode
|
||
set number
|
||
set numberwidth=1
|
||
set background=dark
|
||
set cursorline
|
||
set cursorcolumn
|
||
set ruler
|
||
" do not redraw while macroing
|
||
set lazyredraw
|
||
|
||
set matchpairs+=<:>
|
||
|
||
set list
|
||
set listchars=tab:>-,trail:-,extends:>,precedes:<,nbsp:+,eol:$
|
||
set ts=2
|
||
set shiftwidth=2
|
||
set expandtab
|
||
|
||
" Open new split panes to right and bottom, which feels more natural
|
||
set splitbelow
|
||
set splitright
|
||
|
||
" Use the OS clipboard by default (on versions compiled with `+clipboard`)
|
||
set clipboard=unnamed
|
||
|
||
""" Searching and Patterns
|
||
set ignorecase
|
||
set smartcase
|
||
set smarttab
|
||
set hlsearch
|
||
" Add the g flag to search/replace by default
|
||
set gdefault
|
||
|
||
""" Folding
|
||
set nofoldenable
|
||
|
||
"recalculate the trailing whitespace warning when idle, and after saving
|
||
autocmd cursorhold,bufwritepost * unlet! b:statusline_trailing_space_warning
|
||
|
||
"return '[\s]' if trailing white space is detected return '' otherwise
|
||
function! StatuslineTrailingSpaceWarning()
|
||
if !exists("b:statusline_trailing_space_warning")
|
||
|
||
if !&modifiable
|
||
let b:statusline_trailing_space_warning = ''
|
||
return b:statusline_trailing_space_warning
|
||
endif
|
||
|
||
if search('\s\+$', 'nw') != 0
|
||
let b:statusline_trailing_space_warning = '[\s]'
|
||
else
|
||
let b:statusline_trailing_space_warning = ''
|
||
endif
|
||
endif
|
||
return b:statusline_trailing_space_warning
|
||
endfunction
|
||
|
||
|
||
""" Handy remaps
|
||
noremap ; :
|
||
inoremap jj <Esc>
|
||
map <silent> <leader>V :source ~/.vimrc<CR>:filetype detect<CR>:exe ":echo 'vimrc reloaded'"<CR>
|
||
"nnoremap <leader>d :NERDTreeToggle<cr>
|
||
map \q :q<CR>
|
||
map \w :w<CR>
|
||
noremap Q <nop>
|
||
" Quicker window movement
|
||
nnoremap <C-j> <C-w>j
|
||
nnoremap <C-k> <C-w>k
|
||
nnoremap <C-h> <C-w>h
|
||
nnoremap <C-l> <C-w>l
|
||
|
||
" Don’t reset cursor to start of line when moving around.
|
||
set nostartofline
|
||
" minimal number of lines to keep above/below cursorline
|
||
set scrolloff=10
|
||
|
||
""" Use the mouse
|
||
set mouse=a
|
||
|
||
""" smart path
|
||
set path=.,,**
|
||
|
||
command! -complete=shellcmd -nargs=+ Shell call s:RunShellCommand(<q-args>)
|
||
function! s:RunShellCommand(cmdline)
|
||
echo a:cmdline
|
||
let expanded_cmdline = a:cmdline
|
||
for part in split(a:cmdline, ' ')
|
||
if part[0] =~ '\v[%#<]'
|
||
let expanded_part = fnameescape(expand(part))
|
||
let expanded_cmdline = substitute(expanded_cmdline, part, expanded_part, '')
|
||
endif
|
||
endfor
|
||
botright new
|
||
setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap
|
||
call setline(1, 'You entered: ' . a:cmdline)
|
||
call setline(2, 'Expanded Form: ' .expanded_cmdline)
|
||
call setline(3,substitute(getline(2),'.','=','g'))
|
||
execute '$read !'. expanded_cmdline
|
||
setlocal nomodifiable
|
||
1
|
||
endfunction
|
||
|
||
|
||
function! MoveToPrevTab()
|
||
"there is only one window
|
||
if tabpagenr('$') == 1 && winnr('$') == 1
|
||
return
|
||
endif
|
||
"preparing new window
|
||
let l:tab_nr = tabpagenr('$')
|
||
let l:cur_buf = bufnr('%')
|
||
if tabpagenr() != 1
|
||
close!
|
||
if l:tab_nr == tabpagenr('$')
|
||
tabprev
|
||
endif
|
||
sp
|
||
else
|
||
close!
|
||
exe "0tabnew"
|
||
endif
|
||
"opening current buffer in new window
|
||
exe "b".l:cur_buf
|
||
endfunc
|
||
|
||
function! MoveToNextTab()
|
||
"there is only one window
|
||
if tabpagenr('$') == 1 && winnr('$') == 1
|
||
return
|
||
endif
|
||
"preparing new window
|
||
let l:tab_nr = tabpagenr('$')
|
||
let l:cur_buf = bufnr('%')
|
||
if tabpagenr() < tab_nr
|
||
close!
|
||
if l:tab_nr == tabpagenr('$')
|
||
tabnext
|
||
endif
|
||
sp
|
||
else
|
||
close!
|
||
tabnew
|
||
endif
|
||
"opening current buffer in new window
|
||
exe "b".l:cur_buf
|
||
endfunc
|
||
|
||
" Local overrides?
|
||
if filereadable($HOME . "/.vimrc.local")
|
||
source ~/.vimrc.local
|
||
endif
|