Skip to content

Instantly share code, notes, and snippets.

@arowla
Created March 3, 2010 23:27
Show Gist options
  • Save arowla/321189 to your computer and use it in GitHub Desktop.
Save arowla/321189 to your computer and use it in GitHub Desktop.
My .vimrc file
set ai
set backspace=2 " (bs) allow backspacing over everything in insert mode
set expandtab
set foldmethod=indent
set hidden
set history=50 " (hi) keep 50 lines of command line history
set ignorecase
set incsearch
set laststatus=2
set list listchars=tab:>-,trail:.,extends:>,precedes:<
"set mouse=a
set nocompatible
set noeb
set nofen
set nohls
set nowrap
set pastetoggle=<F11>
set ruler " (ru) show the cursor position all the time
set smarttab
set statusline=[%n]\ %.200F\ %(\ %M%R%H)%)\ \@(%l\,%c%V)\ %P
set sw=4
set ts=4
set viminfo='20,\"50 " (vi) read/write a .viminfo file, don't store more than 50 lines of registers
set virtualedit=block
colorscheme blackbeauty
if exists('+autochdir')
set autochdir
else
autocmd BufEnter * silent! lcd %:p:h:gs/ /\\ /
endif
filetype on
filetype plugin on
map caps-lock <Nop>
" Don't use Ex mode, use Q for formatting
map Q gq
map ,p <Esc>:set paste!<cr>
map ,x :!transpose.pl \| table-ize.pl<cr>
map ,b :BufExplorer<cr>
"map ,h :perldo s/^(\s*)(\w+)\s*$/$1-$2 => \\my \$$2,/<cr>
"map ,f :perldo s/^(\s*)(\w+)\s*$/$1->$2(\$$2)/<cr>
"map ,H :perldo s/^(\s*)(\w+)\s*$/$1$2 => \$$2 \|\| '',/<cr>
map ,W :s/\([a-z][a-z_]*\)/'\1'/g<cr>
map ,WC :s/\([a-z][a-z_]*\)/'\1', /g<cr>
"map ,i :set nofen!<cr>
map ,o o
map ,O O
map! gcr <ESC>
map gcr <ESC>
map! ,gcr ,<ESC>
map ,rt :! ./% --test<CR>
map ,c <ESC>:set ignorecase!<CR>
map ,ec :e `edit_clean %:p`<CR>
highlight StatusLine ctermfg=darkblue ctermbg=grey
" 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>
"set bg=light
" Switch syntax highlighting on, when the terminal has colors
" Also switch off highlighting the last used search pattern.
if has("syntax") && &t_Co > 2 || has("gui_running")
set bg=dark
augroup filetype
au! BufRead,BufNewFile *.t set filetype=perl
au! BufRead,BufNewFile autohandler set filetype=html
au! BufRead,BufNewFile ldc.afiedt.*.buf set filetype=sql
augroup END
syntax on
hi PreProc ctermfg=Green
set nohlsearch
endif
au BufRead,BufNewFile *.html set filetype=mason
au BufRead,BufNewFile *.fo set filetype=mason
au BufRead,BufNewFile *.fo set ts=2
au BufRead,BufNewFile *.fo set sw=2
au BufRead,BufNewFile *.t set filetype=perl
au BufRead,BufNewFile autohandler set filetype=mason
au BufRead,BufNewFile *.html set filetype=mason
" Only do this part when compiled with support for autocommands.
if has("autocmd")
autocmd BufReadPost * if line("'\"") | exe "'\"" | endif
" In text files, always limit the width of text to 72 characters
"autocmd BufRead *.txt set tw=72
augroup cprog
" Remove all cprog autocommands
au!
" When starting to edit a file:
" For C and C++ files set formatting of comments and set C-indenting on.
" For other files switch it off.
" Don't change the order, it's important that the line with * comes first.
autocmd FileType * set formatoptions=tcql nocindent comments&
autocmd FileType c,cpp set formatoptions=croql nocindent comments=sr:/*,mb:*,el:*/,://
autocmd FileType perl set autoindent smartindent
augroup END
" This is disabled, because it changes the jumplist. Can't use CTRL-O to go
" back to positions in previous files more than once.
if 0
" When editing a file, always jump to the last cursor position.
" This must be after the uncompress commands.
autocmd BufReadPost * if line("'\"") && line("'\"") <= line("$") | exe "normal `\"" | endif
endif
endif " has("autocmd")
highlight Normal guibg=Black guifg=White
"highlight Comment ctermbg=DarkBlue ctermfg=Red
set diffopt=iwhite
syn match MyBraces /[{}]/ containedin=ALL
" Pick whatever highlighting you want...
hi MyBraces guibg=Green
let CVSCommandDiffOpt='ubBpN'
set ch=2 " Make command line two lines high
"surround visual selection with paired characters of your choice
vnoremap _( <ESC>`>a)<ESC>`<i(<ESC>
vnoremap _" <ESC>`>a"<ESC>`<i"<ESC>
vnoremap _' <ESC>`>a'<ESC>`<i'<ESC>
vnoremap _{ <ESC>`>a}<ESC>`<i{<ESC>
vnoremap _[ <ESC>`>a]<ESC>`<i[<ESC>
",v brings up my .vimrc
",V reloads it -- making all changes active (have to save first)
map ,v :sp ~/.vimrc<CR><C-W>_
map <silent> ,V :source ~/.vimrc<CR>:filetype detect<CR>:exe ":echo 'vimrc reloaded'"<CR>
map ,dl cc<ESC>
map <F8> :TlistToggle<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment