systems/home/vimrc
2024-03-20 11:16:48 -05:00

90 lines
3.2 KiB
VimL

" ~/.vimrc
" This must be first - it changes other options as a side effect
set nocompatible " use Vim settings, rather then Vi settings
set shortmess+=I " get rid of the intro screen on blank file
set background=dark " this works better for text mode white-on-black terms
set backspace=2 " allow backspacing over everything in insert mode
set esckeys " allow cursor keys in insert mode
set noautoindent " always set autoindenting off
set shiftwidth=4 " number of spaces used for autoindent insertions
set tabstop=4 " tabstop positions
set nobackup " backups are for wimps
set history=250 " keep 250 lines of command line history
set noerrorbells " damn that beep to hell
set visualbell " enable terminal visual bell, but...
set t_vb= " ...unset the code to do it. (MacVim needs this)
set magic " use 'magic' patterns (extended regexp) in search
set ignorecase " ignore case during searches
set smartcase " all lower/upper = case insensitive, \c \C overrides
set laststatus=2 " show status line, even if only one buffer
set report=0 " show report on all (0) changes
set lazyredraw " do not update screen while executing macros
set ruler " show the cursor position all the time
set showcmd " show current uncompleted command
set showmode " show current mode
set showmatch " show matching brackets
" tone down that dang bold highlighting, folks
" highlight=8b,db,es,hs,mb,Mn,nu,rs,sr,tb,vr,ws
set highlight=8r,db,es,hs,mb,Mr,nu,rs,sr,tb,vr,ws
" highlight extra/unwanted whitespace
autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
highlight ExtraWhitespace ctermbg=red guibg=red guifg=red
match ExtraWhitespace /\s\+$\| \+\ze\t/
" do not jump to first character with page commands, ie keep the cursor
" in the current column.
set nostartofline
" what info to store from an editing session in the viminfo file
set viminfo='50,\"100,:100,n~/.viminfo
" allow the last line to be a modeline - useful when
" the last line gives the preferred textwidth
set modeline
set modelines=1
" add the dash ('-'), the dot ('.'), and the '@' as "letters" to "words".
" this makes it possible to expand email addresses, eg: joe-www@foo.org
set iskeyword=@,48-57,_,192-255,-,.,@-@
" which chars/keys to allow eol wrapping (:help whichwrap)
set whichwrap=<,>,[,]
" enable wrapping but without linebreaks
set wrap
set linebreak
set nolist " list disables linebreak
set textwidth=0
set wrapmargin=0
set formatoptions+=l
" When you forgot to sudo before editing a file
cmap w!! w !sudo tee > /dev/null %
" When the backspace key sends a "delete" character
" then you simply map the "delete" to a "backspace" (CTRL-H):
map <Del> <C-H>
" Don't use Ex mode, use Q for formatting
map Q gq
" Make shift-insert work like in Xterm
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>
" Make p in Visual mode replace the selected text with the "" register.
vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc>
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif