dotfiles/.vimrc

177 lines
5.0 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')
" Sensible defaults
Plug 'tpope/vim-sensible'
2017-04-22 16:53:37 +03:00
" Javascript
2017-05-23 21:29:06 +03:00
Plug 'heavenshell/vim-jsdoc', {'for': 'javascript'}
Plug 'sheerun/vim-polyglot'
2017-05-23 21:29:06 +03:00
" C/C++
2017-12-22 23:14:27 +02:00
Plug 'vim-scripts/DoxygenToolkit.vim', {'for': 'cpp'}
2018-11-02 01:05:38 +02:00
" Rust
Plug 'rust-lang/rust.vim', {'for': 'rust'}
2018-12-22 11:28:01 +02:00
"Plug 'racer-rust/vim-racer', {'for': 'rust'}
2017-04-22 16:53:37 +03:00
" Syntax checking
"Plug 'Valloric/YouCompleteMe' " alternative #1, full-blown
Plug 'w0rp/ale',
Plug 'neoclide/coc.nvim', {'branch': 'release'}
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'
2018-11-02 01:05:38 +02:00
Plug 'majutsushi/tagbar'
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'
2021-04-27 23:25:21 +03:00
"Plug 'tssm/c64-vim-color-scheme'
2017-05-23 21:29:06 +03:00
"Plug 'morhetz/gruvbox'
2019-03-23 17:28:58 +02:00
"Plug 'chriskempson/base16-vim' " Original but not updated
Plug 'danielwe/base16-vim' " Fork. updated. https://github.com/chriskempson/base16-vim/issues/197
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'
2021-04-27 23:25:21 +03:00
"let g:airline_theme='base16_default'
let g:airline_theme='base16_gruvbox_dark_hard'
2017-04-22 16:53:37 +03:00
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
" Magical color setup
2017-04-22 16:53:37 +03:00
syntax on
2021-04-27 23:25:21 +03:00
"set t_Co=256
set termguicolors
set background=dark
"let base16colorspace=256
"colorscheme base16-solarized-dark
colorscheme base16-gruvbox-dark-hard
"colorscheme base16-default-dark
" Other
2018-11-02 01:05:38 +02:00
set encoding=utf-8
2017-04-22 16:53:37 +03:00
set autoindent " Automatically indent
set cindent " Indentation for c
set number " Add line numbers
set hlsearch " Highlight search
set modeline
set modelines=5
"set sessionoptions=blank,buffers,curdir,folds,globals,help,localoptions,options,resize,tabpages,winsize,winpos
set swapfile
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 dir=~/.vim/temp/ " Save temporary files to temp dir
set hidden " Allow changing buffers eventhough they're not saved
2017-04-22 16:53:37 +03:00
"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=Fira\ Code\ Medium\ 11
"set guifont=Fura\ Code\ Nerd\ Font\ 11
set guiheadroom=0
endif
2017-04-22 16:53:37 +03:00
" Keybindings
" Long list following
2017-04-22 16:53:37 +03:00
" Indentation
map <F7> mzgg=G`z
map <F3> %s<cr>
2017-04-22 16:53:37 +03:00
" NerdTree
map <F2> :NERDTreeToggle<cr>
imap <F2> <esc>:NERDTreeToggle<cr>i
2017-04-22 16:53:37 +03:00
" 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
2017-04-22 16:53:37 +03:00
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
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
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
2018-11-02 01:05:38 +02:00
autocmd Filetype lua setlocal ts=2 sw=2 sts=0 expandtab
autocmd Filetype html setlocal ts=4 sw=4 sts=0 expandtab
2017-05-23 21:29:06 +03:00
" ultisnips
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
2018-02-16 23:18:34 +02:00
2018-11-02 01:05:38 +02:00
let g:ale_linters = {
\'javascript': ['standard'],
\'vue': ['standard --plugin html "**/*.{js,vue}"'],
\'jsx': ['standard --plugin html "**/*.{js,jsx}"'],
\'rust': ['cargo']
\}
let b:ale_fixers = {
\'*': ['remove_trailing_lines', 'trim_whitespace'],
\'rust': ['rustfmt']
\}
let g:ale_fix_on_save = 1
let g:ale_completion_enabled = 1
2018-12-22 11:28:01 +02:00
set completeopt+=preview