dotfiles/.vimrc

226 lines
6.7 KiB
VimL
Raw Normal View History

2017-04-22 16:53:37 +03:00
" Vundle setup
set nocompatible " be iMproved
filetype off " required!
" set the runtime path to include Vundle and initialize
"call has('python3')
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" Vundle bundles
" Javascript
Plugin 'pangloss/vim-javascript'
" Plugin 'jelera/vim-javascript-syntax' " Replaced by yajs.vim
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'othree/yajs.vim'
Plugin 'gavocanov/vim-js-indent'
Plugin 'digitaltoad/vim-jade'
Plugin 'othree/es.next.syntax.vim'
Plugin 'othree/jsdoc-syntax.vim'
Plugin 'othree/html5.vim'
Plugin 'heavenshell/vim-jsdoc'
Plugin 'othree/javascript-libraries-syntax.vim'
Plugin 'moll/vim-node'
"Plugin 'ternjs/tern_for_vim'
" Syntax checking
Plugin 'Valloric/YouCompleteMe'
Plugin 'scrooloose/syntastic'
" Useful plugins
Plugin 'Raimondi/delimitMate'
Plugin 'scrooloose/nerdcommenter'
Plugin 'scrooloose/nerdtree'
Plugin 'jlanzarotta/bufexplorer'
Plugin 'ctrlpvim/ctrlp.vim'
" Themes
"Plugin 'Lokaltog/vim-distinguished'
Plugin 'altercation/vim-colors-solarized'
"Plugin 'tomasr/molokai'
"Plugin 'flazz/vim-colorschemes'
Plugin 'morhetz/gruvbox'
Plugin 'chriskempson/base16-vim'
" Airline
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
let g:airline_theme='base16_default'
let g:airline_powerline_fonts = 1
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" Other
set t_Co=256
set background=dark
syntax on
let base16colorspace=256
colorscheme base16-default-dark
"colorscheme solarized
"colorscheme gruvbox
"colorscheme molokai
"let g:molokai_original = 1
"let g:rehash256 = 1
"colorscheme distinguished
"colorscheme ir_black
"colorscheme summerfruit256
set autoindent " Automatically indent
syntax on
set cindent " Indentation for c
set number " Add line numbers
set hlsearch " Highlight search
set sessionoptions=blank,buffers,curdir,folds,globals,help,localoptions,options,resize,tabpages,winsize,winpos
"set autochdir " Change directory automatically
"set backupdir=~/.vim/temp/ " Save temporary backups to temp dir
"set directory=~/.vim/temp/ " Save temporary files to temp dir
set hidden " Allow changing buffers eventhough they're not saved
"set autowrite " Automatically save the buffer when changing to another buffers
"set autowriteall " Automatically save ALL buffers when changing to another buffers
set wildchar=<Tab> wildmenu wildmode=full " Show possible commands by pressing TAB
set wildcharm=<C-Z> " This will allow you to access bufferlist with wildcard by pressing F10
nnoremap <F10> :b <C-Z>
" Indentation
map <F7> mzgg=G`z
map <F3> %s<cr>
" NerdTree
map <F2> :NERDTreeToggle<cr>
imap <F2> <esc>:NERDTreeToggle<cr>i
" NerdCommenter
map <C-c> <leader>ci
au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery
"augroup vimrc
" au BufReadPre * setlocal foldmethod=indent
" au BufWinEnter * if &fdm == 'indent' | setlocal foldmethod=manual | endif
"augroup END
inoremap <F9> <C-O>za
nnoremap <F9> za
onoremap <F9> <C-C>za
vnoremap <F9> zf
set nocp
filetype plugin on
filetype plugin indent on
" configure tags - add additional tags here or comment out not-used ones
"set tags+=~/.vim/tags/cpp
"set tags+=~/.vim/tags/gl
"set tags+=~/.vim/tags/sdl
"set tags+=~/.vim/tags/boost
"set tags+=~/.vim/tags/opencv2
" build tags of your own project with Ctrl-F12
"map <C-F12> :!ctags -R --sort=yes --c++-kinds=+p --fields=+iaS --extra=+q ../src/<CR>
" OmniCppComplete
"let OmniCpp_NamespaceSearch = 1
"let OmniCpp_GlobalScopeSearch = 1
"let OmniCpp_ShowAccess = 1
"let OmniCpp_ShowPrototypeInAbbr = 1 " show function parameters
"let OmniCpp_MayCompleteDot = 1 " autocomplete after .
"let OmniCpp_MayCompleteArrow = 1 " autocomplete after ->
"let OmniCpp_MayCompleteScope = 1 " autocomplete after ::
"let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD", "cv", "boost"]
"au BufNewFile,BufRead,BufEnter *.cpp,*.hpp,*.cc,*.hh set omnifunc=omni#cpp#complete#Main
" automatically open and close the popup menu / preview window
"au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
"set completeopt=menuone,menu,longest,preview
"map <C-TAB> :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR>
"map <C-TAB> :e %:p:s,.hh$,.X123X,:s,.cc$,.hh,:s,.X123X$,.cc,<CR>
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" Indentation
set shiftwidth=8
set softtabstop=8
if has("gui_running")
" GUI is running or is about to start.
" Maximize gvim window.
" set lines=999 columns=999
"set lines=50 columns=100
"set guifont=Source\ Code\ Pro\ 11\ -1\ 5\ 50\ 0\ 0\ 0\ 1\ 0
"set guifont=Source\ Code\ Pro\ Medium\ 11
" GUI options.
set guioptions-=m "remove menu bar
set guioptions-=T "remove toolbar
set guioptions-=r "remove right-hand scroll bar
set guioptions-=L "remove left-hand scroll bar
set guifont=Fira\ Code\ 10
"set guifont=Fira\ Mono\ 10
"set guifont=Source\ Code\ Pro\ 10
"set guifont=Terminus\ 11
set guiheadroom=0
endif
" thesaurus and dictionary stuff
"set dictionary+=/usr/share/dict/words
"set thesaurus+=/home/julankin/.vim/mthes10/mthesaur.txt
" tab navigation like firefox
nnoremap <C-S-tab> :tabprevious<CR>
nnoremap <C-tab> :tabnext<CR>
nnoremap <C-t> :tabnew<CR>
inoremap <C-S-tab> <Esc>:tabprevious<CR>i
inoremap <C-tab> <Esc>:tabnext<CR>i
inoremap <C-t> <Esc>:tabnew<CR>
"set colorcolumn=80
" YouCompleteMe
let g:ycm_add_preview_to_completeopt=0
let g:ycm_confirm_extra_conf=0
"let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
set completeopt-=preview
set ssop-=options " do not store global and local values in a session
set ssop-=folds " do not store folds
" Fix backspace
"set backspace=indent,eol,start
" Syntastic
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
set laststatus=2
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_javascript_checkers = ['eslint']
" Toggle number
:nmap <C-N><C-N> :set invnumber<CR>
" Toggle hlsearch
:nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
autocmd BufRead,BufNewFile *.es6 setfiletype javascript
map <F12> :%!tidy -q --tidy-mark 0 2>/dev/null<CR>
" Configure for jsdoc
let g:jsdoc_enable_es6 = 1
" Remove trailing whitespace automatically
autocmd BufWritePre *.js %s/\s\+$//e
autocmd BufWritePre *.cpp %s/\s\+$//e
set tabstop=4
set softtabstop=0
set expandtab
set shiftwidth=2
set smarttab
autocmd Filetype cpp setlocal ts=4 sw=4 sts=0 expandtab