diff options
author | Adam T. Carpenter <atc@53hor.net> | 2020-11-24 08:11:46 -0500 |
---|---|---|
committer | Adam T. Carpenter <atc@53hor.net> | 2020-11-24 08:11:46 -0500 |
commit | 208ecf206edaa6426128d9999563af5c3e18fadd (patch) | |
tree | a2cbb6d09a5a6a5caa0f6a7ac99826f30283b775 /.vimrc | |
download | dotfiles-208ecf206edaa6426128d9999563af5c3e18fadd.tar.xz dotfiles-208ecf206edaa6426128d9999563af5c3e18fadd.zip |
Init
Diffstat (limited to '.vimrc')
-rw-r--r-- | .vimrc | 92 |
1 files changed, 92 insertions, 0 deletions
@@ -0,0 +1,92 @@ +" General options +set ruler " show the cursor position all the time +set showcmd " display incomplete commands +set ttimeout " time out for key codes +set ttimeoutlen=100 " wait up to 100ms after Esc for special key +set display=truncate " show @@@ in the last line if it is truncated +set scrolloff=5 " show a few lines around the cursor +set relativenumber " relative line numbering +set tabstop=4 " 4-space tabs +set softtabstop=4 " 4-space tabs +set shiftwidth=4 " 4-space shiftwidth +set backspace=indent,eol,start " backspace over everything in insert +set directory=$HOME/.vim/swapfiles// " common swap directory +set fillchars+=vert:\ +syntax on " switch syntax highlighting on + +" Matching and key mappings +:match ErrorMsg '\%>80v.\+' " right-hand drift warning +"" automatically finish closing tags +:inoremap <lt>/ </<C-x><C-o><Esc>==gi + +" only do this if autocommands enabled +if has("autocmd") + " enable file type detection and load indent files + filetype plugin indent on + + augroup vimStartup + au! + + "at startup, jump to last cursor position if valid + autocmd BufReadPost * + \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit' + \ | exe "normal! g`\"" + \ | endif + augroup END +endif + + + +if empty(glob('~/.vim/autoload/plug.vim')) + silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs + \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + autocmd VimEnter * PlugInstall --sync | source $MYVIMRC +endif + +call plug#begin('~/.vim/plugged') +"Plug 'dense-analysis/ale' +Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'} +call plug#end() + +"" ALE +"let g:ale_linter_aliases = { +"\ 'vue': ['vue', 'javascript'], +"\ 'liquid': ['liquid', 'html'], +"\} +"let g:ale_linters = { +"\ 'vue': ['eslint', 'vls'], +"\ 'javascript': ['eslint'], +"\ 'html': ['htmlhint'], +"\ 'rust': [] +"\} +"let g:ale_fixers = { +"\ 'css': ['prettier'], +"\ 'html': ['prettier'], +"\ 'javascript': ['eslint'], +"\ 'json': ['prettier'], +"\ 'liquid': ['prettier'], +"\ 'markdown': ['prettier'], +"\ 'vue': ['eslint'], +"\ 'scss': ['prettier'], +"\ '*': ['remove_trailing_lines', 'trim_whitespace'], +"\ 'rust': [] +"\} +"let g:ale_fix_on_save = 1 + +" COC.VIM +inoremap <silent><expr> <TAB> +\ pumvisible() ? "\<C-n>" : +\ <SID>check_back_space() ? "\<TAB>" : +\ coc#refresh() +inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +highlight CocFloating ctermbg=black + +" Auto-reloading scripts +autocmd BufWritePost i3.base !themer.sh -r +autocmd BufWritePost */i3blocks/config !i3-msg reload |