From 26833f2fa995ae28c15052781fb90ac30ddc914d Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Thu, 28 Apr 2022 16:21:59 -0400 Subject: [PATCH] Making a whole mess with vim things egad --- vimrc | 56 ++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/vimrc b/vimrc index 88c7982..52b8c34 100644 --- a/vimrc +++ b/vimrc @@ -7,6 +7,9 @@ filetype on filetype indent on filetype plugin on +let mapleader = "," + +set autowrite set backspace=indent,eol,start set backupdir^=~/.vim/_backup// set cursorline @@ -25,6 +28,7 @@ set smartcase set statusline+=%#warningmsg# set statusline+=%* set tabstop=4 +set updatetime=100 set textwidth=67 if has("persistent_undo") @@ -32,24 +36,51 @@ if has("persistent_undo") set undofile endif -au BufRead,BufNewFile Pipfile setfiletype toml au BufRead,BufNewFile *.gcfg setfiletype gitconfig -au BufRead,BufNewFile Pipfile setfiletype toml -au BufRead,BufNewFile Dockerfile* setfiletype dockerfile au BufRead,BufNewFile *.service setfiletype systemd au BufRead,BufNewFile .Rprofile setfiletype r -au QuickFixCmdPost *grep* cwindow +au BufRead,BufNewFile .envrc setfiletype sh +au BufRead,BufNewFile Dockerfile* setfiletype dockerfile +au BufRead,BufNewFile Pipfile setfiletype toml +au BufRead,BufNewFile Pipfile setfiletype toml au BufWritePre *.py execute ':Black' +au BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 +au FileType go nmap r (go-run) +au FileType go nmap c (go-coverage-toggle) +au QuickFixCmdPost *grep* cwindow + +" run :GoBuild or :GoTestCompile based on the go file +function! s:build_go_files() + let l:file = expand('%') + if l:file =~# '^\f\+_test\.go$' + call go#test#Test(0, 1) + elseif l:file =~# '^\f\+\.go$' + call go#cmd#Build(0) + endif +endfunction + +au FileType go nmap b :call build_go_files() +au FileType go nmap d :GoDef -map ,t :w -map ,- :nohl -map ,w :%s/ *$// +map t :w +map - :nohl +map w :%s/ *$// let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*'] let g:airline_powerline_fonts = 1 let g:coc_global_extensions = ['coc-tsserver'] let g:coc_node_path = "/home/dan/.nvm/versions/node/v16.9.1/bin/node" +let g:go_auto_sameids = 1 +let g:go_auto_type_info = 1 +let g:go_def_mode='gopls' let g:go_fmt_command = "goimports" +let g:go_highlight_build_constraints = 1 +let g:go_highlight_extra_types = 1 +let g:go_highlight_fields = 1 +let g:go_highlight_function_calls = 1 +let g:go_highlight_functions = 1 +let g:go_highlight_operators = 1 +let g:go_info_mode='gopls' let g:python_highlight_all = 1 let g:rustfmt_autosave = 1 let g:shfmt_extra_args = '-i 2' @@ -61,9 +92,14 @@ let g:vim_markdown_frontmatter = 1 let g:yapf_style = "pep8" if has("python3") - python3 from powerline.vim import setup as powerline_setup - python3 powerline_setup() - python3 del powerline_setup + python3 << eopython +try: + from powerline.vim import setup as powerline_setup + powerline_setup() + del powerline_setup +except ImportError: + pass +eopython endif packadd! dracula