dotfiles/.vimrc
2022-09-23 16:21:00 -07:00

81 lines
2.7 KiB
VimL

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 | source $MYVIMRC
endif
call plug#begin()
" Improved Incremental Search
Plug 'haya14busa/incsearch.vim'
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
let g:incsearch#auto_nohlsearch = 1 " Turn off search highlighting after moving
map n <Plug>(incsearch-nohl-n)
map N <Plug>(incsearch-nohl-N)
map * <Plug>(incsearch-nohl-*)
call plug#end()
filetype plugin indent on
" Appearance {{{1
set cursorline " Highlight the current line
set showmatch " Show matching brackets/parenthesis
set hlsearch " Highlight search terms
syntax on " Turn on syntax highlighting
set spell " Turn on spellchecking
set number " Turn on line numbers
set mouse= " Disable mouse support
let g:CSApprox_hook_post = ['hi clear SignColumn']
highlight clear CursorLineNr " Remove highlight color from current line number
highlight clear SignColumn " SignColumn should match background
highlight clear LineNr " Current line number row will have same background color in relative mode
set textwidth=80
set colorcolumn=+1
" Splits {{{1
map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_
map <C-H> <C-W>h<C-W>_
map <C-L> <C-W>l<C-W>_
" Whitespace {{{1
set tabstop=4
set softtabstop=4
set expandtab
set shiftwidth=4
set autoindent " Indent on paste
set smartindent " Indent intelligently
set nojoinspaces " Collapse spaces after sentences
" Search {{{1
set ignorecase
set smartcase
set incsearch
nnoremap <silent> <C-l> :<C-u>nohlsearch<CR> " c-l redraws the screen and clears matches
" Metadata {{{1
set backup
set backupdir=$HOME/.vim/backups
set directory=$HOME/.vim/swaps
set undodir=$HOME/.vim/undo
if has('persistent_undo')
set undofile " So is persistent undo ...
set undolevels=1000 " Maximum number of changes that can be undone
set undoreload=10000 " Maximum number lines to save for undo on a buffer reload
endif
" Other Settings {{{1
set history=1000 " Greatly increase the size of the history (from 20)
set iskeyword-=. " '.' is an end of word designator
set iskeyword-=# " '#' is an end of word designator
set iskeyword-=- " '-' is an end of word designator
nnoremap & :&&<CR> " & repeats the previous substitution, however by default
xnoremap & :&&<CR> " loses the flags, this fixes that.
let g:clang_user_options='|| exit 0'