diff --git a/dotfiles/.vimrc b/dotfiles/.vimrc new file mode 100644 index 0000000..6f945fb --- /dev/null +++ b/dotfiles/.vimrc @@ -0,0 +1,31 @@ +set mouse= +execute pathogen#infect() +syntax on +filetype plugin indent on +let g:ycm_global_ycm_extra_conf = "/home/micke/.vim/bundle/YouCompleteMe/.ycm_extra_conf.py" +set autoread +map :py3f /usr/share/vim/addons/syntax/clang-format.py +imap :py3f /usr/share/vim/addons/syntax/clang-format.py +function! Formatonsave() + let l:formatdiff = 1 + py3f /usr/share/vim/addons/syntax/clang-format.py +endfunction +autocmd BufWritePre *.h,*.cc,*.cpp call Formatonsave() +" Uncomment the following to have Vim jump to the last position when +" reopening a file +if has("autocmd") + au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif +endif + + +let g:ale_python_pylint_options = '--extension-pkg-allow-list=wx' +" Check Python files with flake8 and pylint. +let g:ale_linters = {'python': ['mypy', 'flake8']} +" Fix Python files with black and isort. +let g:ale_fixers = {'python': ['yapf', 'isort']} +let g:ale_sign_error = '❌' +let g:ale_sign_warning = '⚠️' +" Start NERDTree and put the cursor back in the other window. +autocmd VimEnter * NERDTree | wincmd p +autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif +nnoremap :ALEFix