Created
March 22, 2012 17:53
-
-
Save carljparker/2160992 to your computer and use it in GitHub Desktop.
Carl's _vimrc (Windows 7)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" | |
" Never commit this file until you have had a chance to at least run vim with | |
" your changes, and preferably actually had a chance to test the changes | |
" themselves. There have been multiple time (at least three) when vim wouldn't | |
" even start correctly because of changes to my _vimrc configuration. | |
" | |
set nocompatible | |
source $VIMRUNTIME/vimrc_example.vim | |
source $VIMRUNTIME/mswin.vim | |
behave mswin | |
" | |
" | |
let mapleader = ',' | |
set ic | |
set smartcase | |
set autowrite | |
set nu | |
set wrap linebreak nolist | |
set autoindent | |
set expandtab | |
set shiftwidth=2 | |
set tabstop=2 | |
set virtualedit=all | |
set visualbell | |
set winheight=20 | |
set winwidth=100 | |
set textwidth=80 | |
set shell=C:\Windows\system32\cmd.exe\ /d | |
set cursorline | |
" | |
" | |
" Requires that the Berkely par program be installed. Available on Windows | |
" from Cygwin. | |
" | |
" temporarily comment out using par for formatting | |
" vim's own formatter works pretty well, and par | |
" does strange things like not produce any indent. | |
" | |
" set formatprg=par\ -w60 | |
highlight cursorline ctermfg=yellow | |
highlight cursorline ctermbg=blue | |
highlight colorcolumn ctermbg=darkgreen | |
" | |
" set column column to 75 to ensure formatting for narrow | |
" console windows and 110 to alert myself to when | |
" programlisting text will wrap in the PDF. It wraps at | |
" the 114 column. | |
" | |
set colorcolumn=75,110 | |
" | |
" | |
" Automatically change the cursoline color in insert mode. See the following | |
" URL for more detail. | |
" | |
" http://stackoverflow.com/questions/7614546/vim-cursorline-color-change-in-insert-mode | |
" | |
" | |
" Change Color when entering Insert Mode | |
autocmd InsertEnter * highlight CursorLine ctermbg=darkred | |
" Revert Color to default when leaving Insert Mode | |
autocmd InsertLeave * highlight CursorLine ctermbg=blue | |
" | |
" | |
" For some reason, in my current install, C-Y is mapped to C-R (redo) | |
" unmap it, so that C-Y will scroll the screen to show a single line | |
" at the top, which is its purpose in standard vim | |
" | |
unmap <C-Y> | |
" | |
" map alt-} to search forward to the end of the next open tag | |
" or the beginning of the next close tag. | |
" Note that I need to *double* backslash the alternation | |
" character "|". | |
" | |
" To get the alt-}, use the following sequence <C-q><A-}> | |
" | |
map Ý />[[:alpha:]<]\\|<\/<CR> | |
" | |
" | |
" map alt-w to ctrl-w (for easier access to windowing commands) | |
" | |
map ÷ | |
" | |
" | |
" map alt-v to ctrl-v (for easier access to visual block mode) | |
" | |
map ö | |
" | |
" | |
" map shift-w (i.e. W) save the current buffer | |
" | |
map W :w | |
" | |
" | |
" go to alternate buffer with ^^, presumably built-in, but not in my | |
" installation ... | |
map ^^ :e# | |
" | |
" | |
" make the navigation keys work more intuitively | |
" | |
map j gj | |
map k gk | |
" | |
" | |
" make shift-y work consistently with shift-d and shift-c, rather than just | |
" duplicate the functionality of yy, as it does by default | |
" | |
map Y v$y | |
" | |
" | |
" make shift-U the same as redo (ctrl-r) because otherwise shift-U isn't as | |
" helpful | |
" | |
map U | |
" | |
" | |
" Maps that Use the Leader Character | |
" | |
" make the double tap (@@) easier | |
" | |
" mapping using the leader key | |
map <leader>. @@ | |
" | |
" map to the F8 key ala SlickEdit | |
" | |
map ÎB @@ | |
" | |
" select different linenumbering | |
" | |
map <leader>r :set relativenumber | |
map <leader>n :set number | |
" | |
" | |
" make Perforce commit comments easier | |
map <leader>c :24 | |
C[docs, carlp, | |
" | |
" | |
" turn off residual highlighting from a search | |
" | |
nnoremap <leader><space> :noh<CR> | |
" | |
" | |
" enable easy changing of cwd to current file's directory | |
" | |
nnoremap <leader>cd :cd %:p:h<CR>:pwd<CR> | |
" | |
" | |
" break an html paragraph into two | |
" | |
map <leader>s i | |
</para>^M^M<para>^M | |
" | |
" | |
" fold sections, assumes that cursor is on the first line of the section | |
" | |
map <leader>zs zf/<\/section> | |
map <leader>zh zf/^h= | |
map <leader>zl zf/^--- | |
" | |
" save my state, write everything out to disk, and exit all windows/tabs. | |
" | |
map <leader>q :mks!<CR>:wqall<CR> | |
" | |
" | |
" easier escapes to command mode | |
" | |
" | |
" The double-tap on i is a little dangerous because | |
" if I'm in normal mode but think I'm in insert mode, | |
" I can accidentally put myself in insert by taking an | |
" action which I think will escape me . . . :-P | |
" Recommend that, after I get facile with the other escapes, | |
" I turn this one off . . . and turning it off. | |
" | |
"imap ii | |
" | |
" | |
" I like doing the "double-tap" on k | |
imap kk | |
" | |
" . . . and J as well; we must do J. | |
imap jj | |
" | |
" | |
" this is shift-<enter>, make it equal <ESC> | |
imap <s- | |
> | |
" | |
" | |
" map ctrl-<backspace> to ctrl-w so that I can erase entire words | |
" | |
imap <c-> | |
" | |
" | |
" make word completion easier | |
" | |
imap <tab> | |
" | |
" | |
" Abbreviations | |
" | |
" My first abbreviation | |
" S3 cannot be used without the 'Amazon' in front | |
abbr s3 Amazon S3 | |
abbr aeb AWS Elastic Beanstalk | |
abbr ddb Amazon DynamoDB | |
abbr awx AWS Explorer | |
" | |
" | |
set diffexpr=MyDiff() | |
function MyDiff() | |
let opt = '-a --binary ' | |
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif | |
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif | |
let arg1 = v:fname_in | |
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif | |
let arg2 = v:fname_new | |
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif | |
let arg3 = v:fname_out | |
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif | |
let eq = '' | |
if $VIMRUNTIME =~ ' ' | |
if &sh =~ '\<cmd' | |
let cmd = '""' . $VIMRUNTIME . '\diff"' | |
let eq = '"' | |
else | |
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"' | |
endif | |
else | |
let cmd = $VIMRUNTIME . '\diff' | |
endif | |
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq | |
endfunction | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment