Commits

David Wolever committed 41ddc32

Cleaning up vimrc, adding lots of comments.

Comments (0)

Files changed (2)

 export SWC="swc@swc.scipy.org"
 export TB="thirdbit@third-bit.com"
 export NFS="wolever_wolever@ssh.phx.nearlyfreespeech.net"
+export BASIE="-p42 wolever@basieproject.org"
 
 export NAME="David Wolever"
 export EDITOR="vim"
-set formatoptions=crqn
-set tabstop=4
-set softtabstop=4
-set shiftwidth=4
-set expandtab
-set ignorecase
-set smartcase
+" Tab options
+set tabstop=4       " When reading a file, show a tab ('\t') as 4 spaces
+set softtabstop=4   " When inserting a tab (eg, pressing 'tab'), insert 4 spaces
+set shiftwidth=4    " Number of spaces to indent when using '>>'
+set expandtab       " Never insert an actual tab character -- always use spaces
+set autoindent      " Copy indent from current line to next when enter is pressed
+" See also: :help retab
+
+" Formatting options
+set formatoptions=cqn
+" c: auto-wrap comments to textwidth
+" q: Allow formatting comments with 'gq'
+" n: Recognized numbered lists (eg: '1. ...\n 2. ... \n')
+" See also: :help fo-table
+
+" Searching options
+set ignorecase   " Ignore case when searching
+set smartcase    " See :help smartcase (trust me, it's useful)
+set incsearch    " Incremental search
+set hlsearch	 " Hilight searches
+" Turn off highlighting when \ is pressed
+map \ :noh
+
+" File type things
 syntax enable 		" Turn on syntax hilighting
 filetype on         " Enable filetype detection
 filetype indent on  " Enable filetype-specific indenting
 filetype plugin on  " Enable filetype-specific plugins
-set autoindent
-set nocompatible 	" Keep vim from trying to be 100% vi compatible
+
+" Use <C-A> to execute the current file (equivilent to ./$FILE)
+autocmd BufEnter * map <C-A> :!%:p
+
+" XML, HTML and Javascript have very bad indent settings... Don't use them.
+autocmd BufEnter *.xml,*.js setlocal indentexpr= " Stop auto-indenting
+autocmd BufEnter *.js setlocal nocin
+autocmd BufEnter *.js setlocal smartindent
+autocmd BufEnter *.js setlocal autoindent
+
+" When switching to a file, enter its directory
+autocmd BufEnter * :lcd %:p:h
+
+" Miscalanious stuff...
 set backspace=indent,eol,start " Better backspacing
-"set t_kb=         " Fix backspace problems on some machines
-"fixdel              " But this creates backspace problems on others... :(
-set ruler			" Vim will always tell me where she is
+set ruler			" Show a ruler along the bottom of the screen
 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 scrolloff=3     " Always keep three lines above or below the cursor
-
-set wildmenu    " Pretty command-line option matching
+set nocompatible 	" Keep vim from trying to be 100% vi compatible
+set showcmd         " Show (partial) command in status line.
+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 statusline=%f%m%r%h%w\ [%Y]\ [HEX=\%02.2B]%=Y=%04l,\ X=%04v\ %p%%\ of\ %L\ (buf\ %n)
 set laststatus=2 " Always show status line
 
+" Folding opttions
 set foldmethod=marker
 
-if has("autocmd")
-	" Change to the directory the file in your current buffer is in
-	autocmd BufEnter * :lcd %:p:h
-	autocmd BufEnter * map <C-A> :!%:p
-	autocmd BufEnter *.c map <C-X> :make
-	autocmd BufEnter *.c map <C-A> :make run
-	autocmd BufEnter *.c map <C-B> :!make debug
-    autocmd BufEnter *.py map <C-A> :!python %
-    autocmd BufEnter *.py set foldmethod=indent
-    autocmd BufEnter *.xml,*.js setlocal indentexpr= " Stop auto-indenting
-    autocmd BufEnter *.js setlocal nocin
-    autocmd BufEnter *.js setlocal si
-    autocmd BufEnter *.js setlocal ai
-endif " has("autocmd")
+" Python-specific things
+" Use <C-A> to run .python files and fold them too!
+autocmd BufEnter *.py map <C-A> :!python %
+autocmd BufEnter *.py set foldmethod=indent
+" Use F7, F8 and F9 to insert useful Python statements
+map <F9> Oimport rpdb2; rpdb2.start_embedded_debugger("asdf") #BREAK
+map <F8> Ofrom nose.tools import set_trace; set_trace() #BREAK
+map <F7> Oimport traceback, sys; traceback.print_exception(*sys.exc_info()) #TRACEBACK
 
+" When editing CPython source, run their provided vimrc (setting certain useful
+" things like their coding standards)
 let py_source = '\(Py3k-svn\|Python-trunk\)'
 let path = expand('%:p:h')
 if path =~ py_source
 " 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>
 
+" Move to the first non-whitespace character when 0 is pressed and the first
+" character on the line when ^ is pressed (instead of vice-versa)
 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
-
+" Use j and k to move down and up _logical_ lines instead of line-break lines
 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
+" Use <C-O> to insert a blank line below the current line
 map <C-O> ok
-map � Oj
 
-" NetRW stuff
+" NetRW (the file browser) stuff... Safe to ignore :)
 let g:netrw_sort_sequence='[\/]$,*,\.bak$,\.o$,\.h$,\.info$,\.swp$,\.obj$,\.pyc$'
 let g:netrw_keepdir=0
 let g:netrw_browse_split=0
 
-" map \ to nohlsearch
-map \ :noh
-
 " Some windowing convinience methods
 map <c-h> <c-w>h
 map <c-j> <c-w>j
 map + <c-w>+
 map - <c-w>-
 
+" Who needs arrow keys anyway?
 map <right> :bn<return>
 map <left> :bp<return>
-
-map  :!gnome-terminal &<Enter><Enter>
-
-map <F9> Oimport rpdb2; rpdb2.start_embedded_debugger("asdf") #BREAK
-map <F8> Ofrom nose.tools import set_trace; set_trace() #BREAK
-map <F7> Oimport traceback, sys; traceback.print_exception(*sys.exc_info()) #TRACEBACK
+map <up> :cp<return>
+map <down> :cn<return>
 
 " Match braces just by white-bolding them, not making them cyan
 hi MatchParen ctermbg=none ctermfg=white
+set showmatch    " Show matching brackets.
+set matchtime=1
+
+"set t_kb=         " Fix backspace problems on some machines
+"fixdel              " But this creates backspace problems on others... :(
+
+" Uncomment this line to use <C-N> to open a terminal
+" map  :!gnome-terminal &<Enter><Enter>
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.