dotfiles/.vimrc

149 lines
4.0 KiB
VimL

" set the runtime path to include Vundle and initialize
"call has('python3')
" Start plugins
call plug#begin('~/.vim/plugged')
" Sensible defaults
Plug 'tpope/vim-sensible'
" Javascript
Plug 'heavenshell/vim-jsdoc', {'for': 'javascript'}
Plug 'sheerun/vim-polyglot'
" C/C++
Plug 'vim-scripts/DoxygenToolkit.vim', {'for': 'cpp'}
" Syntax checking
"Plug 'Valloric/YouCompleteMe' " alternative #1, full-blown
Plug 'w0rp/ale',
" Useful plugins
Plug 'Raimondi/delimitMate'
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree'
Plug 'jlanzarotta/bufexplorer'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'ervandew/supertab'
Plug 'reedes/vim-lexical'
" Snippets
Plug 'sirver/ultisnips'
Plug 'honza/vim-snippets'
" Themes
"Plug 'Lokaltog/vim-distinguished'
"Plug 'altercation/vim-colors-solarized'
"Plug 'tomasr/molokai'
"Plug 'flazz/vim-colorschemes'
"Plug 'morhetz/gruvbox'
Plug 'chriskempson/base16-vim'
" Airline
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
let g:airline_theme='base16_default'
let g:airline_powerline_fonts = 1
" Initialize plugin system
call plug#end()
filetype plugin indent on
" Magical color setup
set t_Co=256
set background=dark
syntax on
let base16colorspace=256
colorscheme base16-default-dark
" Other
set autoindent " Automatically indent
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
set colorcolumn=80
" Set GUI parameters
if has("gui_running")
" 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=Fura\ Code\ Nerd\ Font\ 10
set guiheadroom=0
endif
" Keybindings
" Long list following
" 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
inoremap <F9> <C-O>za
nnoremap <F9> za
onoremap <F9> <C-C>za
vnoremap <F9> zf
" 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>
" Session parameters
set ssop-=options " do not store global and local values in a session
set ssop-=folds " do not store folds
" Toggle number
:nmap <C-N><C-N> :set invnumber<CR>
" Toggle hlsearch
:nnoremap <silent> <Space> :nohlsearch<Bar>:echo<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 sane defaults for tabs
autocmd Filetype python setlocal ts=4 sw=4 sts=0 expandtab
autocmd Filetype cpp setlocal ts=4 sw=4 sts=0 expandtab
autocmd Filetype javascript setlocal ts=2 sw=2 sts=0 expandtab
autocmd Filetype vue setlocal ts=2 sw=2 sts=0 expandtab
autocmd Filetype json setlocal ts=2 sw=2 sts=0 expandtab
autocmd Filetype html setlocal ts=4 sw=4 sts=0 expandtab
" ultisnips
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
"let g:ale_linters = {
""\ 'cpp': ['cppcheck'],
""\}