summaryrefslogtreecommitdiffstats
path: root/.vimrc
diff options
context:
space:
mode:
authorTyler Davis <tydavis@gmail.com>2020-01-30 20:47:23 +0000
committerTyler Davis <tydavis@gmail.com>2020-01-30 20:47:23 +0000
commitebcd2420b3fb7d52914b18dd069a5bfe468a9e26 (patch)
tree8900b21909bd05b3ef4ea45c0b9fe4d3c58a123f /.vimrc
downloaddotfiles-ebcd2420b3fb7d52914b18dd069a5bfe468a9e26.tar.gz
dotfiles-ebcd2420b3fb7d52914b18dd069a5bfe468a9e26.zip
feat(chore): first commit
Diffstat (limited to '.vimrc')
-rw-r--r--.vimrc142
1 files changed, 142 insertions, 0 deletions
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=<F2>
+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 <leader>b <Plug>(go-build)
+au FileType go nmap <leader>c <Plug>(go-coverage)
+au FileType go nmap <leader>r <Plug>(go-run)
+au FileType go nmap <leader>t <Plug>(go-test)
+au FileType go nmap <leader>d <Plug>(go-def)
+
+" Go implements (interfaces under cursor)
+au FileType go nmap <Leader>s <Plug>(go-implements)
+" Go show type info under cursor
+au FileType go nmap <Leader>i <Plug>(go-info)
+" Go rename
+au FileType go nmap <Leader>e <Plug>(go-rename)
+" Go vet
+au FileType go nmap <Leader>v <Plug>(go-vet)
+" Godoc under cursor
+au FileType go nmap <Leader>k <Plug>(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 <leader>cd :cd %:p:h<CR>
+
+" Toggle indent guides for copy/paste
+"map <silent> <F8> :IndentLinesToggle<CR>
+
+" Disable mouse automatic mode
+set mouse-=a
+
+" Enable line numbers toggle
+noremap <leader>n :set invnumber<CR>
+"inoremap <leader>n <C-O>:set invnumber<CR>