dotfiles/vim/.vimrc

160 lines
5.4 KiB
VimL
Raw Normal View History

2017-04-14 18:39:44 +02:00
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages.
runtime! archlinux.vim
" If you prefer the old-style vim functionalty, add 'runtime! vimrc_example.vim'
" Or better yet, read /usr/share/vim/vim80/vimrc_example.vim or the vim manual
" and configure vim to your own liking!
" Syntax highlighting
syntax on
set background=dark
let g:solarized_termcolors = 16
colorscheme solarized
" have Vim load indentation rules and plugins
" according to the detected filetype.
if has("autocmd")
filetype plugin indent on
endif
set shell=sh
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
"set ignorecase " Do case insensitive matching
"set smartcase " Do smart case matching
"set incsearch " Incremental search
"set autowrite " Automatically save before commands like :next and :make
set hidden " Hide buffers when they are abandoned
set mouse=a
set number
set expandtab "Use softtabstop spaces instead of tab characters for indentation
set shiftwidth=4 "Indent by 4 spaces when using >>, <<, == etc.
set softtabstop=4 "Indent by 4 spaces when pressing <TAB>
set tabstop=4
set autoindent "Keep indentation from previous line
set smartindent "Automatically inserts indentation in some cases
set nowrap
set laststatus=2
let mapleader = ","
set backupdir=~/.vim/backup//
set directory=~/.vim/swap//
set undodir=~/.vim/undo//
2017-09-18 15:01:14 +02:00
set splitright
2017-04-14 18:39:44 +02:00
" flag lines wider than 80 char
highlight ColorColumn ctermbg=magenta
call matchadd('ColorColumn', '\%81v', 100)
if has("autocmd")
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType html setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType css setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType javascript setlocal ts=2 sts=2 sw=2 expandtab
2017-10-01 20:29:24 +02:00
autocmd FileType handlebars setlocal ts=2 sts=2 sw=2 expandtab
2017-04-14 18:39:44 +02:00
autocmd FileType xml setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType go setlocal ts=4 sts=4 sw=4 noexpandtab
autocmd FileType rst setlocal tw=80 ts=3 sts=3 sw=3 expandtab
autocmd FileType gitcommit setlocal tw=80 ts=2 sts=2 sw=2 expandtab
2017-09-18 15:01:14 +02:00
autocmd FileType md setlocal tw=80 ts=2 sts=2 sw=2 expandtab
2017-04-14 18:39:44 +02:00
endif
" Airline options
let g:airline_powerline_fonts = 1
let g:airline_theme='solarized'
let g:airline#extensions#tabline#enabled = 1
" NERDTree options
" Automatically opens NERDTree
" autocmd vimenter * NERDTree
" Close NERDTree if it is the last window
" autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Syntastic options
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 1
let g:syntastic_aggregate_errors = 1
2017-09-18 15:01:14 +02:00
" let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
" let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_java_javac_config_file_enabled = 1
2017-04-14 18:39:44 +02:00
" Vim-go options
let g:go_fmt_command = "goimports"
let g:go_metalinter_autosave = 1
let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck', 'structcheck', 'deadcode', 'gocyclo', 'ineffassign', 'dupl', 'gotype', 'varcheck', 'interfacer', 'gosimple', 'staticcheck', 'misspell', 'gas']
let g:go_get_update = 0
let g:go_list_type = "quickfix"
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_fields = 1
let g:go_highlight_types = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
if has("autocmd")
autocmd FileType go nmap <leader>b <Plug>(go-build)
autocmd FileType go nmap <leader>r <Plug>(go-run)
autocmd FileType go nmap <leader>t <Plug>(go-test)
autocmd FileType go nmap <leader>T <Plug>(go-test-func)
autocmd FileType go nmap <leader>c <Plug>(go-cover)
autocmd FileType go nmap <leader>C <Plug>(go-cover-clear)
autocmd FileType go nmap <leader>a <Plug>(go-alternate)
autocmd FileType go nmap <leader>f <Plug>(go-fmt)
endif
2017-09-18 15:01:14 +02:00
" vimwiki options
2017-10-01 20:29:24 +02:00
let g:vimwiki_list = [{'path': '~/Notebook/work',
\ 'auto_toc': 1,
\ 'index': 'main',
\ 'ext': '.md',
\ 'syntax': 'markdown'},
\{'path': '~/Notebook/perso',
2017-09-18 15:01:14 +02:00
\ 'auto_toc': 1,
\ 'index': 'main',
\ 'ext': '.md',
\ 'syntax': 'markdown'}]
2017-04-14 18:39:44 +02:00
2017-09-18 15:01:14 +02:00
" Grammalecte options
let g:grammalecte_cli_py='/usr/share/grammalecte-fr/cli.py'
2017-04-14 18:39:44 +02:00
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree'
Plug 'xuyuanp/nerdtree-git-plugin'
Plug 'airblade/vim-gitgutter'
Plug 'bling/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tpope/vim-fugitive'
2017-10-01 20:29:24 +02:00
Plug 'jreybert/vimagit'
2017-04-14 18:39:44 +02:00
Plug 'kien/ctrlp.vim'
Plug 'valloric/youcompleteme'
Plug 'altercation/vim-colors-solarized'
Plug 'fatih/vim-go'
Plug 'joukevandermaas/vim-ember-hbs'
Plug 'scrooloose/syntastic'
Plug 'mtscout6/syntastic-local-eslint.vim'
2017-09-18 15:01:14 +02:00
Plug 'aklt/plantuml-syntax'
Plug 'scrooloose/vim-slumlord'
Plug 'vimwiki/vimwiki'
Plug 'dpelle/vim-Grammalecte'
2017-04-14 18:39:44 +02:00
call plug#end()
" Other key mappings
map <C-n> :NERDTreeToggle<CR>
2017-09-18 15:01:14 +02:00
map <leader>n :cnext<CR>
map <leader>p :cprevious<CR>
2017-10-01 20:29:24 +02:00
nmap <leader>N :NERDTreeFocus<CR>
2017-09-18 15:01:14 +02:00
nnoremap <leader>h :cclose<CR>