From ebcd2420b3fb7d52914b18dd069a5bfe468a9e26 Mon Sep 17 00:00:00 2001 From: Tyler Davis Date: Thu, 30 Jan 2020 20:47:23 +0000 Subject: feat(chore): first commit --- .vimrc | 142 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 .vimrc (limited to '.vimrc') diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..e4d07c0 --- /dev/null +++ b/.vimrc @@ -0,0 +1,142 @@ +call plug#begin('~/.vim/plugged') + +Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } +Plug 'rust-lang/rust.vim' +Plug 'w0rp/ale' + +call plug#end() + +set autoread +set backspace=indent,eol,start +set colorcolumn=250 +set expandtab +set exrc +set encoding=utf-8 +set hidden +set history=1000 +set incsearch +set laststatus=2 +set lazyredraw +set linebreak +set nobackup +set nocompatible +set noswapfile +set nowb +set number +set pastetoggle= +set scrolloff=20 +set secure +set shiftwidth=4 +set shiftround +set shortmess+=I +set showcmd +set showmode +"new splits will be at the bottom or to the right side of the screen +set splitbelow +set splitright +set tabstop=4 +set ttyfast +"time waited for key press(es) to complete. It makes for a faster key response +set ttimeout +set ttimeoutlen=50 +set wildmenu +set wildmode=list:longest,full +set visualbell + +filetype plugin on +syntax on + +"set termguicolors +set background=light +colorscheme peachpuff + +""" Statusline bits +set statusline= +set statusline+=%7*\[%n] "buffernr +set statusline+=%1*\ %<%t\ "File+path +set statusline+=%3*\ %y\ "FileType +set statusline+=%4*\ %{''.(&fenc!=''?&fenc:&enc).''} "Encoding +set statusline+=%5*\ %{(&bomb?\",BOM\":\"\")}\ "Encoding2 +set statusline+=%6*\ %{&ff}\ "FileFormat (dos/unix..) +set statusline+=%7*\ %=\ row:%l/%L\ (%03p%%)\ "Rownumber/total (%) +set statusline+=%9*\ col:%03c\ "Colnr +set statusline+=%0*\ %m%r%w\ "Modified? Readonly? Top/bot. +""" + +""" BEGIN GOLANG + +let g:go_def_mode='gopls' +let g:go_info_mode='gopls' + +" format with goimports instead of gofmt +let g:go_fmt_command = "goimports" " Goimports is slow with modules, when module not found + +" By default syntax-highlighting for Functions, Methods and Structs is disabled +let g:go_highlight_build_constraints = 1 +let g:go_highlight_fields = 1 +let g:go_highlight_functions = 1 +let g:go_highlight_interfaces = 1 +let g:go_highlight_methods = 1 +let g:go_highlight_operators = 1 +let g:go_highlight_structs = 1 + +" Auto-space Go files +autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 + +" vim-go mappings +au FileType go nmap b (go-build) +au FileType go nmap c (go-coverage) +au FileType go nmap r (go-run) +au FileType go nmap t (go-test) +au FileType go nmap d (go-def) + +" Go implements (interfaces under cursor) +au FileType go nmap s (go-implements) +" Go show type info under cursor +au FileType go nmap i (go-info) +" Go rename +au FileType go nmap e (go-rename) +" Go vet +au FileType go nmap v (go-vet) +" Godoc under cursor +au FileType go nmap k (go-doc) + +""" END GOLANG + +""""" Bugfixes and oddities below +" Fix weird JSON quotation issue +let g:vim_json_syntax_conceal = 0 + +" Only do this part when compiled with support for autocommands +if has("autocmd") + " Enable file type detection + filetype on + + " Wrap text in markdown + au BufRead,BufNewFile *.md setlocal textwidth=80 + + " Syntax of these languages is fussy over tabs Vs spaces + autocmd FileType make setlocal ts=8 sts=8 sw=8 noexpandtab + autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab + + " Customisations based on house-style (arbitrary) + 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=4 sts=4 sw=4 noexpandtab + + " Treat .rss files as XML + autocmd BufNewFile,BufRead *.rss setfiletype xml +endif + +" \cd change working directory to current location of file +map cd :cd %:p:h + +" Toggle indent guides for copy/paste +"map :IndentLinesToggle + +" Disable mouse automatic mode +set mouse-=a + +" Enable line numbers toggle +noremap n :set invnumber +"inoremap n :set invnumber -- cgit v1.2.3