" 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 let g:solarized_hitrail=1 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 hlsearch "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 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// set splitright set cursorline " 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 gohtmltmpl 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 autocmd FileType html.handlebars setlocal ts=2 sts=2 sw=2 expandtab 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 autocmd FileType md setlocal tw=80 ts=2 sts=2 sw=2 expandtab autocmd FileType vimwiki setlocal tw=80 ts=2 sts=2 sw=2 expandtab 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 " Vim-go options let g:go_fmt_command = "goimports" let g:go_fmt_autosave = 1 let g:go_metalinter_enabled = ['govet', 'golint', 'errcheck', 'staticcheck', 'gosimple', 'structcheck', 'varcheck', 'ineffassign', 'deadcode', 'gosec', 'unconvert', 'dupl', 'goconst', 'gocyclo', 'misspell', 'unparam', 'lll', 'interfacer', 'nakedret', 'scopelint'] let g:go_metalinter_autosave = 1 "let g:go_metalinter_autosave_enabled = ['govet', 'golint', 'errcheck'] let g:go_metalinter_autosave_enabled = ['govet', 'golint', 'errcheck', 'staticcheck', 'gosimple', 'structcheck', 'varcheck', 'ineffassign', 'deadcode', 'gosec', 'unconvert', 'dupl', 'goconst', 'gocyclo', 'misspell', 'unparam', 'lll', 'interfacer', 'nakedret', 'scopelint'] let g:go_list_type = "quickfix" let g:go_highlight_functions = 1 let g:go_highlight_function_parameters = 1 let g:go_highlight_function_calls = 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 let g:go_highlight_generate_tags = 1 let g:go_highlight_extra_types = 1 let g:go_highlight_array_whitespace_error = 1 let g:go_highlight_chan_whitespace_error = 1 let g:go_highlight_space_tab_error = 1 let g:go_highlight_trailing_whitespace_error = 1 let g:go_highlight_variable_declarations = 1 let g:go_doc_popup_window=1 let g:go_def_mapping_enabled = 0 let g:go_doc_keywordprg_enabled = 0 let g:go_code_completion_enabled = 0 let g:go_gopls_use_placeholders = 1 let g:go_gopls_complete_unimported = 1 let g:go_test_show_name = 1 let g:go_test_timeout= '60s' let g:go_auto_type_info = 1 let g:go_jump_to_error = 0 let g:go_auto_sameids = 0 " vimwiki options let g:vimwiki_list = [{'path': '~/Notebook/work', \ 'auto_toc': 1, \ 'index': 'main', \ 'ext': '.md', \ 'syntax': 'markdown'}, \{'path': '~/Notebook/perso', \ 'auto_toc': 1, \ 'index': 'main', \ 'ext': '.md', \ 'syntax': 'markdown'}] let g:vimwiki_ext2syntax = {'.md': 'markdown'} " Grammalecte options let g:grammalecte_cli_py='/usr/bin/grammalecte' " IndentGuide options let g:indent_guides_auto_colors = 0 autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd ctermbg=none autocmd VimEnter,Colorscheme * :hi IndentGuidesEven ctermbg=black " CoC options " ALE options let g:ale_completion_enabled = 0 let g:ale_fix_on_save = 0 call plug#begin('~/.vim/plugged') Plug 'scrooloose/nerdtree' Plug 'xuyuanp/nerdtree-git-plugin' Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' Plug 'airblade/vim-gitgutter' Plug 'tpope/vim-fugitive' Plug 'jreybert/vimagit' Plug 'fatih/vim-go' Plug 'joukevandermaas/vim-ember-hbs' Plug 'dag/vim-fish' Plug 'glench/vim-jinja2-syntax' Plug 'mattn/emmet-vim' Plug 'ollykel/v-vim' Plug 'liuchengxu/vim-clap' Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'dense-analysis/ale' Plug 'joereynolds/vim-minisnip' Plug 'aklt/plantuml-syntax' Plug 'scrooloose/vim-slumlord' Plug 'vimwiki/vimwiki' Plug 'dpelle/vim-Grammalecte' Plug 'nathanaelkane/vim-indent-guides' Plug 'altercation/vim-colors-solarized' call plug#end() " Other key mappings map :NERDTreeToggle map n :cnext map p :cprevious nmap N :NERDTreeFocus nnoremap h :cclose " Removes trailing whitespaces nnoremap s :keeppattern %s/\s\+$// autocmd BufNewFile,BufRead *.tmpl set syntax=gohtmltmpl nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) nmap go (coc-list-outline) nnoremap K :call show_documentation() nmap rn (coc-rename) function! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) execute 'h '.expand('') else call CocAction('doHover') endif endfunction nmap :Clap files nmap b :Clap buffers if has("autocmd") autocmd FileType go nmap b (go-build) autocmd FileType go nmap r (go-run) autocmd FileType go nmap t (go-test) autocmd FileType go nmap T (go-test-func) autocmd FileType go nmap c (go-coverage) autocmd FileType go nmap cc (go-coverage-clean) autocmd FileType go nmap a (go-alternate-edit) autocmd FileType go nmap f (go-fmt) autocmd FileType go nmap d (go-def) autocmd FileType go nmap m (go-metalinter) endif