commit 74b9df3018e8c990d2a2f5e96f37f83f14bc72d5 Author: Alek Ratzloff Date: Fri Oct 7 17:58:54 2022 -0700 Initial commit, vimrc Signed-off-by: Alek Ratzloff diff --git a/vimrc b/vimrc new file mode 100644 index 0000000..158c5f9 --- /dev/null +++ b/vimrc @@ -0,0 +1,202 @@ +filetype off +set nocompatible + +call plug#begin('~/.vim/plugged') +" General vim stuff +Plug 'wincent/terminus' +Plug 'godlygeek/tabular' + +" F# +Plug 'fsharp/vim-fsharp' + +" Perl6/Raku +Plug 'vim-perl/vim-perl6', { 'for': 'perl6' } + +" Rust +Plug 'rust-lang/rust.vim', { 'for': 'rust' } + +" Fish shell +Plug 'dag/vim-fish' + +" Rusty Object Notation +Plug 'ron-rs/ron.vim' + +" HJSON +Plug 'hjson/vim-hjson' + +" Dhall +Plug 'vmchale/dhall-vim' + +" Vimwiki +Plug 'vimwiki/vimwiki' + +" Godotscript v3 +Plug 'clktmr/vim-gdscript3' + +" Python +Plug 'ambv/black' +Plug 'vim-scripts/indentpython.vim' + +" TOML +Plug 'cespare/vim-toml' + +" Elixir +Plug 'elixir-editors/vim-elixir' + +" Jinja + HTML templating +Plug 'lepture/vim-jinja' + +" Haskell +Plug 'neovimhaskell/haskell-vim' +Plug 'alx741/vim-hindent' + +call plug#end() + +filetype plugin indent on +let python_highlight_all=1 +"let g:rustfmt_options = '--edition 2018' +"let c_no_curly_error=1 +syntax enable " syntax highlighting +colorscheme badwolf2 + +"let g:cargo_makeprg_params = '--color=never' +let g:hindent_on_save = 0 + +"set statusline+=%#warningmsg# +"set statusline+=%{SyntasticStatuslineFlag()} +"set statusline+=%* + +au BufRead,BufNewFile *.hj setlocal filetype=hjson +au BufRead,BufNewFile *.md setlocal textwidth=100 +au BufRead,BufNewFile *.yaml,*.yml setlocal shiftwidth=2 tabstop=2 +"au BufRead,BufNewFile *.rs setlocal textwidth=100 colorcolumn=100 +au BufRead,BufNewFile /tmp/jrnl*.txt setlocal textwidth=100 colorcolumn=100 formatoptions-=t columns=100 wrap +au BufRead,BufNewFile *.py setlocal colorcolumn=100 textwidth=100 +au BufRead,BufNewFile *.adoc setlocal colorcolumn=100 textwidth=100 +au FileType make setlocal noexpandtab shiftwidth=4 tabstop=4 +au FileType haskell setlocal shiftwidth=2 tabstop=2 + +au FileType rust compiler cargo +au FileType rust nnoremap cc :make check +au FileType rust nnoremap cn :cn +au FileType rust nnoremap cp :cp +au FileType rust nnoremap co :copen +au FileType rust nnoremap cq :cclose +au BufRead,BufNewFile *.lalrpop setlocal ft=rust +au BufRead,BufNewFile *html,*.j2 setlocal ft=jinja + +" Help navigation +" Enter to go to the topic under cursor +au Filetype help nnoremap +" Backspace to go to the previous topic +au Filetype help nnoremap +" S for the next subject +au Filetype help nnoremap s /\|\zs\S\+\ze\| +au Filetype help nnoremap S ?\|\zs\S\+\ze\| +" Doesn't cause statements after `case: {` to be crazy-indented +au Filetype cpp setlocal cinoptions=l1g0 + +" Store swapfiles in ~/.vim/swap/ +set directory=$HOME/.vim/swap/ +" Store wiki in ~/.vim/wiki +let g:vimwiki_list = [{'path': '~/.vim/wiki', 'syntax': 'markdown'}] + +" Tabbing/indenting +set nu " line numbers +set relativenumber +set shiftwidth=4 " 4 space tabs +set tabstop=4 " tabs print as 4 spaces +set ruler +set expandtab " spaces > tabs +set smarttab +set autoindent +set smartindent +set nowrap +set cursorline +set wildmenu " tab menu for files +set lazyredraw " redraw only when we need to - useful for macros +highlight clear CursorLineNr " For some reason, the line number column(s) of the current line sometimes get underlined and it's distracting +"set showmatch " jumps to matching [({})] +set incsearch " search as characters are entered +set hlsearch " highlight matches +set mouse=a +set scrolloff=10 +set timeoutlen=175 ttimeoutlen=175 +set modeline modelines=5 + +set linebreak " If the line goes off the screen, break the line at the `breakat` characters +set showbreak=+++ " Use this string to show that the line was broken at the end of the line + +" Move vertically by visual line +nnoremap j gj +nnoremap k gk +" Hack to fix the # character insert +inoremap # X# +nnoremap 4i i + +" Color stuff +set t_Co=256 " 256 colors support +set colorcolumn=100,120 " 100, and 120 character markers +" This sets up 24-bit true color support - don't fuck these up +set t_8f=[38;2;%lu;%lu;%lum +set t_8b=[48;2;%lu;%lu;%lum +set termguicolors + +" +" Keymappings +" +let mapleader = "-" +inoremap ddi +" Upper/lower case keymaps +inoremap wbvwUi +inoremap wbvwui +nnoremap wbvwU +nnoremap wbvwu +vnoremap k +" Set up paste-replacement to yank into the blackhole register +vnoremap p "_dP + +"=====[ Correct common mistypings in-the-fly ]======================= + +iab retrun return +iab pritn print +iab teh the +iab liek like +iab liekwise likewise +iab Pelr Perl +iab pelr perl +iab ;t 't +iab moer more +iab previosu previous +iab virutal virtual +iab unwarp unwrap +iab unrwap unwrap +iab compilie compile +iab compilier compiler + +" Clear a line +nnoremap c ddO +" Edit vimrc file +nnoremap ev :tabnew $HOME/.vimrc +" Source vimrc file +nnoremap sv :source $HOME/.vimrc +" Tabular extension +nnoremap t :Tab /=getline('.')[col('.')-1] + +" Tab control +nnoremap tt :tabnew +nnoremap :tabp +nnoremap :tabn + +nnoremap Q @@ + +" Quicksave +nnoremap w :update +nnoremap s :update + +" +" Code folding +" +set foldlevelstart=4 +set foldmethod=manual +nnoremap f za