view vim/vimrc @ 13:287b91d2898f

Some mapping changes.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 21 Nov 2011 00:10:49 -0800
parents 00cac5ebf546
children cec2213f938c
line wrap: on
line source

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" 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/gVIM, and set a nice window size.
if has("gui_running")
    set guioptions=-t
    set lines=50
    set columns=135
endif

" Don't unload abandoned buffers.
set hidden

" 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=~/$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

" Show matching braces.
set showmatch

" Set the file-formats.
set ffs=unix,mac,dos

" 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

" Default color scheme
colorscheme peaksea
set background=dark

" Enable file type detection.
filetype indent plugin on

" MiniBufExplorer
" Navigate with CTRL+Tab/CTRL+Shift+Tab
"let g:miniBufExplMapCTabSwitchBufs = 1

" Custom mappings.
let mapleader="\\"
" MiniBufExplorer mappings
map <leader>e :MiniBufExplorer<cr>
map <leader>c :CMiniBufExplorer<cr>
map <leader>u :UMiniBufExplorer<cr>
map <leader>t :TMiniBufExplorer<cr>
" Close buffer with CTRL+W
"map <C-w> :bdelete<cr>

" Open NERDtree
map <leader>n :NERDTreeToggle<cr>

" Temporary stuff
"let mapleader=","                                               " Use , as Leader
"let gmapleader=","
"map Y y$                                                        " Yank to the end of the line w/ Y
"map <leader>nt :tabnew<CR>                                      " New tab w/ ,nt
"map <leader>f :FufFile<CR>                                      " Find files with ,f
"nmap <leader>w :w!<cr>
"map <F3> :r !pbpaste<CR>
"map <F4> :setlocal spell spelllang=en_gb<CR>                    " Turn on spellcheck with <F4>
"map <F5> :set nospell<CR>
"set pastetoggle=<F6>
"map <F7> :set complete+=k<CR>
"map <S-F7> :set complete=-k<CR>                                 
"map <F8> :YRShow<CR>                                            " Show the YankRing w/ <F8>
"nnoremap <F3> :GundoToggle<CR>                                  " Show the undo tree w/ <F3>
"nnoremap ; :
"autocmd BufRead,BufNewfile ~/notes/* set filetype=markdown      " All files in ~/notes are Markdown
"au BufWinLeave *.html,*.css mkview	
"au BufWinEnter *.html,*.css silent loadview	
"au FileType mail set tw=65                                      " Thin width when writing mail in mutt 
"au FocusLost * :wa                                              " Saves file when vim loses focus
"if has('statusline')                                            " Status line with git repo info
"  set statusline=%<%f\ 
"  set statusline+=%w%h%m%r 
"  set statusline+=%{fugitive#statusline()}
"  set statusline+=\ [%{&ff}/%Y]  
"  set statusline+=\ [%{getcwd()}]
"  set statusline+=%=%-14.(Line:\ %l\ of\ %L\ [%p%%]\ -\ Col:\ %c%V%)
"endif

" When started as "evim", evim.vim will already have done these settings.
"if v:progname =~? "evim"
"  finish
"endif

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

"set fileformats=dos,unix	" set fileformat to DOS by default