diff vim/vimrc @ 6:f8792d288397

Big vimrc update.
author ludovicchabant
date Tue, 18 Oct 2011 12:05:04 -0700
parents 9dbf340c7956
children 00cac5ebf546
line wrap: on
line diff
--- a/vim/vimrc	Tue Oct 18 12:04:56 2011 -0700
+++ b/vim/vimrc	Tue Oct 18 12:05:04 2011 -0700
@@ -1,60 +1,132 @@
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"
 " Ludovic Chabant's ~/.vimrc
 "
+" http://ludovic.chabant.com
+"
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 
 " Use Vim settings, rather then Vi settings (much better!).
 " This must be first, because it changes other options as a side effect.
 set nocompatible
 
+" Set some important system-dependent variables.
+if has("win32") || has("win64") || has("dos32")
+    let $HOMEVIM = "vimfiles"
+    let $PLATFORM = "windows"
+else
+    let $HOMEVIM = ".vim"
+    let $PLATFORM = "unix"
+endif
+
 " Load pathogen.
 call pathogen#infect()
 
-" Hide the toolbar in MacVim
+" Hide the toolbar in MacVim/gVIM
 if has("gui_running")
     set guioptions=-t
 endif
 
-colorscheme macvim
+" Don't unload abandoned buffers.
+set hidden
 
-" Various options
-set hidden 
-set number                                                     
+" Show line numbers.
+set number
+
+" Smart auto-indenting.
 set autoindent
 set smartindent
+
+" Use confirmation dialog.
 set confirm
+
+" Remember lots of commands.
 set history=1000
+
+" Use incremental search, with highlighting,
+" case-insensitive unless we actually type some
+" mixed-case stuff.
 set incsearch
 set hlsearch
 set ignorecase
 set smartcase
+
+" Always show window status lines.
 set laststatus=2
+
+" Enable using the mouse like some everyday guy.
 set mouse=a
+
+" Show interesting stuff at the bottom of the window.
 set showcmd
 set ruler
+
+" Don't pollute the hard-drive with *~ files. Only
+" create them in hidden backup/temp directories while
+" we edit the file, and then get rid of it.
 set nobackup
 set writebackup
-set backupdir=~/.vim/backup
-set directory=~/.vim/temp
+set backupdir=~/$HOMEVIM/backup
+set directory=~/$HOMEVIM/temp
+
+" Better command-line completion, but don't show some
+" stuff we don't care about.
 set wildmenu
 set wildignore+=.DS_Store,Thumbs.db
+
+" Always display the tab-page line.
 set showtabline=2
-set showmatch	
+
+" Show matching braces.
+set showmatch
+
+" Set the file-formats.
 set ffs=unix,mac,dos
-set guifont=Monaco:h12
+
+" Tabs and indenting are 4 characters, and tabs behave like
+" spaces during editing. They're smart, too, and when you
+" press <TAB> it actually inserts a soft-tab so everything's
+" indented the same.
 set tabstop=4
 set shiftwidth=4
 set softtabstop=4
 set smarttab
 set expandtab
+
+" Clipboard buffer.
 set clipboard=unnamed
+
+" Smoot terminal experience.
 set ttyfast
+
+" Allow backspacing over anything.
 set backspace=indent,eol,start
 
+" Going left and right let you go to other lines.
+set whichwrap+=<,>,h,l
+
+" And now, for some system-dependent settings:
+" - font to use
+if $PLATFORM == "windows"
+    set guifont=Consolas:h12
+else
+    set guifont=Monaco:h12
+endif
+
+
 " Syntax highlighting
 syntax on
 
-" File types
+" Default color scheme
+colorscheme peaksea
+set background=dark
+
+" Enable file type detection.
 filetype indent plugin on
 
+" Custom mappings.
+let mapleader=","
+map <leader>nt :tabnew<CR> " New tab = ,nt
 
 " Temporary stuff
 "let mapleader=","                                               " Use , as Leader