Skip to content

Instantly share code, notes, and snippets.

@ptwobrussell
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ptwobrussell/05600f8d955be3423ba1 to your computer and use it in GitHub Desktop.
Save ptwobrussell/05600f8d955be3423ba1 to your computer and use it in GitHub Desktop.
vimrc
" Place this file in ~/.vimrc
" Get it with:
" wget --no-check-certificate https://gist.githubusercontent.com/ptwobrussell/05600f8d955be3423ba1/raw/374b960cea9c3cf28cb0757db6136ba4fce3b196/gistfile1.txt -O .vimrc
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set backup " keep a backup file
endif
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")
" Don't use Ex mode, use Q for formatting
map Q gq
" This is an alternative that also works in block mode, but the deleted
" text is lost and it only works for putting the current register.
"vnoremap p "_dp
" 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
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" 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 language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" 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
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
" Some python specifics
set tabstop=4
set shiftwidth=4
set smarttab
set expandtab
set softtabstop=4
set autoindent
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
" Clears search highlighting by just hitting a return.
" " The <BS> clears the command line.
" " (From Zdenek Sekera [zs@sgi.com] on the vim list.)
" " I added the final <cr> to restore the standard behaviour of
" " <cr> to go to the next line
:nnoremap <CR> :nohlsearch<CR>/<BS><CR>
" tab navigation like firefox from vim tip 1221
"map th :tabprev<cr>
"map tl :tabnext<cr>
map <D-1> : tabprev<cr>
map <D-2> : tabnext<cr>
map tn :tabnew<cr>
map tc :tabclose<cr>
"not on by default
syntax on
"strafe
map <C-j> <C-y>
map <C-k> <C-e>
"",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>
"set line numbers
set nu
"keep pertinent info showing at the bottom of the screen
set laststatus=2
set ruler
"make sure syntax highlighting is on
syntax on
"save macros between sessions
set viminfo=%,'50,\"100,n~/.viminfo
"Dont store backups in the current directory
set backupdir=/tmp
"Use ack instead of grep
set grepprg=ack\ −a
colo murphy
"Override some murphy settings that are a PITA to read
hi NonText term=bold ctermfg=Yellow gui=bold guifg=Yellow
hi PreProc term=underline ctermfg=Magenta guifg=Wheat
"Treat symbols with dots in them as one token for purposes of ctags (and a
"bunch of other things
"set iskeyword+=.
let php_folding = 3
map f zc
set vb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment