Bring some vimrc defaults into user vimrc file

This should result in a notably more consistent experience across
platforms.
master
Jordan Atwood 2 years ago
parent de9d717a9f
commit 4429878704
Signed by: nightfirecat
GPG Key ID: 615A619C2D73A6DF
  1. 55
      src/.vimrc

@ -7,9 +7,26 @@ endif
" Get the defaults that most users want " Get the defaults that most users want
source $VIMRUNTIME/defaults.vim source $VIMRUNTIME/defaults.vim
" Use Vim settings rather than Vi settings
" This is run early to avoid clobbering other options as a side effect.
if &compatible
set nocompatible
endif
" This achieves the same as above iff +eval feature is missing.
silent! while 0
set nocompatible
silent! endwhile
" Don't keep context lines around cursor " Don't keep context lines around cursor
set scrolloff=0 set scrolloff=0
set history=50 " keep 50 lines of command line history
set ruler " show cursor position at all times
set showcmd " display incomplete commands
set wildmenu " display completion matches in a status line
set display=truncate " show @@@ in the last line if it is truncated
" do not keep backup files or undo files (they clutter filesystem) " do not keep backup files or undo files (they clutter filesystem)
set nobackup set nobackup
set noundofile set noundofile
@ -32,6 +49,11 @@ if has('syntax') && has('eval')
packadd! matchit packadd! matchit
endif endif
" Perform incremental searching when it's possible to timeout
if has('reltime')
set incsearch
endif
" Enable re-use of the same window to switch from an unsaved buffer without " Enable re-use of the same window to switch from an unsaved buffer without
" saving it first. Also allows you to keep an undo history for multiple files " saving it first. Also allows you to keep an undo history for multiple files
" when re-using the same window in this way. " when re-using the same window in this way.
@ -83,6 +105,21 @@ set pastetoggle=<F11>
" Use one tab when using Vim shifts " Use one tab when using Vim shifts
set tabstop=4 softtabstop=0 noexpandtab shiftwidth=4 set tabstop=4 softtabstop=0 noexpandtab shiftwidth=4
" Allow backspace to go over everything in insert mode
set backspace=indent,eol,start
" In many terminal emulators the mouse works just fine. By enabling it you can
" position the cursor, Visually select and scroll with the mouse.
" Only xterm can grab the mouse events when using the shift key, for other
" terminals use ":", select text, and press Esc.
if has('mouse')
if &term =~ 'xterm'
set mouse=a
else
set mouse=nvi
endif
endif
" Jump to last position when reopening a file " Jump to last position when reopening a file
if has('autocmd') if has('autocmd')
au BufReadPost * if line ("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif au BufReadPost * if line ("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
@ -92,3 +129,21 @@ endif
" Map <C-L> (redraw screen) to also turn off search highlighting until the " Map <C-L> (redraw screen) to also turn off search highlighting until the
" next search " next search
nnoremap <C-L> :nohl<CR><C-L> nnoremap <C-L> :nohl<CR><C-L>
" Execute only if Vim is compiled with +eval
if 1
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files to automatically do laugnage-dependent indenting.
" Revert with ":filetype off".
filetype plugin indent on
endif
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Revert with ":delcommand DiffOrig".
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
\ | wincmd p | diffthis
endif

Loading…
Cancel
Save