Source

dotfiles / vimrc

set formatoptions=crqn
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set smartcase
syntax enable 		" Turn on syntax hilighting
filetype on           " Enable filetype detection
set autoindent
filetype indent on    " Enable filetype-specific indenting
filetype plugin on    " Enable filetype-specific plugins
set nocompatible 	" Keep vim from trying to be 100% vi compatible
set backspace=indent,eol,start " Better backspacing
set ruler		" Vim will always tell me where she is
set lz          " Don't re-draw while running macros
set hid         " Can hide buffers without closing them
set shortmess=atI " shortens messages to avoid 'press a key' prompt 
set matchtime=1

set wildmenu    " Pretty command-line option matching
set wildignore=*.bak,*.o,*.e,*~,*.pyc
" Suffixes that get lower priority when doing tab completion for filenames.
" These are files we are not likely to want to edit or read.
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc,.class,.pyc

set statusline=%f%m%r%h%w\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]%=Y=%04l,\ X=%04v\ %p%%\ of\ %L\ (buf\ %n)
set laststatus=2 " Always show status line

set foldmethod=marker

if has("autocmd")
	" Change to the directory the file in your current buffer is in
	autocmd BufEnter * :lcd %:p:h

	" map " to \" to make it nice 'n eazy when I have to use a "

	autocmd BufRead,BufNewFile *.php,*.c 	map!  I// | map  I// | map! � :s/\/\///
 | map � :s/\/\///
  | set cin

	autocmd BufRead,BufNewFile *.py,*.pl  	map!  I# |  map  I# | map! � :s/#//
 | map � :s/#//
	autocmd BufRead,BufNewFile * map <C-A> :!%:p
	autocmd BufRead,BufNewFile *.c map <C-X> :make
	autocmd BufRead,BufNewFile *.c map <C-A> :make run
	autocmd BufRead,BufNewFile *.c map <C-B> :!make debug
    autocmd BufRead,BufNewFile *.py map <C-A> :!py %

endif " has("autocmd")

" 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>

noremap 0 ^
noremap ^ 0

set showcmd             " Show (partial) command in status line.
set showmatch           " Show matching brackets.
set incsearch           " Incremental search
set hlsearch		    " Hilight searches

nmap j gj
nmap k gk

" map c-o to new line below, then go back to normal, c-s-o to new line above and normal
map <C-O> ok
map � Oj

" NetRW stuff
let g:netrw_sort_sequence='[\/]$,*,\.bak$,\.o$,\.h$,\.info$,\.swp$,\.obj$,\.pyc$'
let g:netrw_keepdir=0
let g:netrw_browse_split=1

" map \ to nohlsearch
map \ :noh

imap <c-h> <c-w>h
imap <c-j> <c-w>j
imap <c-k> <c-w>k
imap <c-l> <c-w>l
map <c-h> <c-w>h
map <c-j> <c-w>j
map <c-k> <c-w>k
map <c-l> <c-w>l
map <c-@> <c-w>_
map <c-space> <c-w>_

map <right> :bn<return>
map <left> :bp<return>
map <c-e> :Sex<return>

map <F7> :setlocal spell spelllang=en_ca
map <F8> :setlocal spell spelllang=NONE

map  :!gnome-terminal &<Enter><Enter>

map <F9> Oimport rpdb2; rpdb2.start_embedded_debugger("asdf") #BREAK
map <F8> Oimport pdb; pdb.set_trace() #BREAK
map <F7> Oimport traceback, sys; traceback.print_exception(*sys.exc_info()) #TRACEBACK
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.