dotfiles/.vimrc

244 lines
7.3 KiB
VimL
Raw Normal View History

2017-04-22 16:53:37 +03:00
" set the runtime path to include Vundle and initialize
"call has('python3')
2017-05-23 21:29:06 +03:00
" Start plugins
call plug#begin('~/.vim/plugged')
2017-04-22 16:53:37 +03:00
" Javascript
2017-05-23 21:29:06 +03:00
" Plug 'jelera/vim-javascript-syntax' " Replaced by yajs.vim
Plug 'pangloss/vim-javascript', {'for': 'javascript'}
Plug 'nathanaelkane/vim-indent-guides', {'for': 'javascript'}
Plug 'othree/yajs.vim', {'for': 'javascript'}
Plug 'gavocanov/vim-js-indent', {'for': 'javascript'}
Plug 'digitaltoad/vim-jade', {'for': 'javascript'}
Plug 'othree/es.next.syntax.vim', {'for': 'javascript'}
Plug 'othree/jsdoc-syntax.vim', {'for': 'javascript'}
Plug 'othree/html5.vim',
2017-05-23 21:29:06 +03:00
Plug 'heavenshell/vim-jsdoc', {'for': 'javascript'}
Plug 'othree/javascript-libraries-syntax.vim', {'for': 'javascript'}
Plug 'moll/vim-node', {'for': 'javascript'}
"Plug 'ternjs/tern_for_vim', {'for': 'javascript'}
2017-05-23 21:29:06 +03:00
" C/C++
"Plug 'majutsushi/tagbar'
2017-04-22 16:53:37 +03:00
" Syntax checking
"Plug 'Valloric/YouCompleteMe'
Plug 'w0rp/ale',
"Plug 'scrooloose/syntastic'
2017-04-22 16:53:37 +03:00
" Useful plugins
2017-05-23 21:29:06 +03:00
Plug 'Raimondi/delimitMate'
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree'
Plug 'jlanzarotta/bufexplorer'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'ervandew/supertab'
Plug 'reedes/vim-lexical'
2017-05-23 21:29:06 +03:00
" Snippets
Plug 'sirver/ultisnips'
Plug 'honza/vim-snippets'
2017-04-22 16:53:37 +03:00
" Themes
2017-05-23 21:29:06 +03:00
"Plug 'Lokaltog/vim-distinguished'
"Plug 'altercation/vim-colors-solarized'
"Plug 'tomasr/molokai'
"Plug 'flazz/vim-colorschemes'
"Plug 'morhetz/gruvbox'
Plug 'chriskempson/base16-vim'
2017-04-22 16:53:37 +03:00
" Airline
2017-05-23 21:29:06 +03:00
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
2017-04-22 16:53:37 +03:00
let g:airline_theme='base16_default'
let g:airline_powerline_fonts = 1
2017-05-23 21:29:06 +03:00
" Initialize plugin system
call plug#end()
filetype plugin indent on
2017-04-22 16:53:37 +03:00
" 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
2017-05-23 21:29:06 +03:00
let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
2017-04-22 16:53:37 +03:00
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
2017-04-22 16:53:37 +03:00
"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']
2017-04-22 16:53:37 +03:00
2017-05-23 21:29:06 +03:00
map <F12> :GoTo<CR>
2017-04-22 16:53:37 +03:00
" 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
2017-05-23 21:29:06 +03:00
"map <F12> :%!tidy -q --tidy-mark 0 2>/dev/null<CR>
2017-04-22 16:53:37 +03:00
" 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
2017-05-23 21:29:06 +03:00
autocmd Filetype python setlocal ts=4 sw=4 sts=0 expandtab
2017-04-22 16:53:37 +03:00
autocmd Filetype cpp setlocal ts=4 sw=4 sts=0 expandtab
2017-05-23 21:29:06 +03:00
let g:UltiSnipsExpandTrigger="<c-tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
augroup lexical
autocmd!
autocmd FileType markdown,mkd call lexical#init()
autocmd FileType textile call lexical#init()
autocmd FileType text call lexical#init({ 'spell': 0 })
augroup END