2014-07-10 21:05:51 -07:00
|
|
|
" An example for a vimrc file.
|
|
|
|
"
|
|
|
|
" To use it, copy it to
|
2014-11-17 23:44:47 -07:00
|
|
|
" for Unix: ~/.vimrc
|
2015-06-29 14:00:16 -07:00
|
|
|
" for Windows: $VIM\_vimrc
|
2014-07-10 21:05:51 -07:00
|
|
|
|
2014-12-09 20:48:34 -07:00
|
|
|
set backup " keep a backup file (restore to previous version)
|
|
|
|
set undofile " keep an undo file (undo changes after closing)
|
|
|
|
set ruler " show the cursor position all the time
|
|
|
|
set showcmd " display incomplete commands
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
" Don't use Ex mode, use Q for formatting
|
2015-06-29 14:00:16 -07:00
|
|
|
noremap Q gq
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
|
|
|
|
" so that you can undo CTRL-U after inserting a line break.
|
|
|
|
inoremap <C-U> <C-G>u<C-U>
|
|
|
|
|
2015-06-29 14:00:16 -07:00
|
|
|
" Switch syntax highlighting on
|
|
|
|
syntax on
|
2014-07-10 21:05:51 -07:00
|
|
|
|
2015-06-29 14:00:16 -07:00
|
|
|
" Enable file type detection.
|
|
|
|
" Use the default filetype settings, so that mail gets 'textwidth' set to 72,
|
|
|
|
" 'cindent' is on in C files, etc.
|
|
|
|
" Also load indent files, to automatically do language-dependent indenting.
|
|
|
|
filetype plugin indent on
|
2014-07-10 21:05:51 -07:00
|
|
|
|
2015-06-29 14:00:16 -07:00
|
|
|
" Put these in an autocmd group, so that we can delete them easily.
|
|
|
|
augroup vimrcEx
|
|
|
|
autocmd!
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
" For all text files set 'textwidth' to 78 characters.
|
|
|
|
autocmd FileType text setlocal textwidth=78
|
|
|
|
|
|
|
|
" When editing a file, always jump to the last known cursor position.
|
|
|
|
" Don't do it when the position is invalid or when inside an event handler
|
|
|
|
autocmd BufReadPost *
|
2016-01-27 06:17:19 -07:00
|
|
|
\ if line("'\"") >= 1 && line("'\"") <= line("$") |
|
2015-06-29 14:00:16 -07:00
|
|
|
\ execute "normal! g`\"" |
|
2014-07-10 21:05:51 -07:00
|
|
|
\ endif
|
|
|
|
|
2015-06-29 14:00:16 -07:00
|
|
|
augroup END
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
" Convenient command to see the difference between the current buffer and the
|
|
|
|
" file it was loaded from, thus the changes you made.
|
|
|
|
" Only define it when not defined already.
|
|
|
|
if !exists(":DiffOrig")
|
2015-06-29 14:00:16 -07:00
|
|
|
command DiffOrig vert new | set buftype=nofile | read ++edit # | 0d_ | diffthis
|
2014-12-09 20:48:34 -07:00
|
|
|
\ | wincmd p | diffthis
|
2014-07-10 21:05:51 -07:00
|
|
|
endif
|