Mercurial > dotfiles
view vim/vimrc @ 0:9dbf340c7956
Initial commit
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 17 Oct 2011 21:35:00 -0700 |
parents | |
children | f8792d288397 |
line wrap: on
line source
" Ludovic Chabant's ~/.vimrc " " Use Vim settings, rather then Vi settings (much better!). " This must be first, because it changes other options as a side effect. set nocompatible " Load pathogen. call pathogen#infect() " Hide the toolbar in MacVim if has("gui_running") set guioptions=-t endif colorscheme macvim " Various options set hidden set number set autoindent set smartindent set confirm set history=1000 set incsearch set hlsearch set ignorecase set smartcase set laststatus=2 set mouse=a set showcmd set ruler set nobackup set writebackup set backupdir=~/.vim/backup set directory=~/.vim/temp set wildmenu set wildignore+=.DS_Store,Thumbs.db set showtabline=2 set showmatch set ffs=unix,mac,dos set guifont=Monaco:h12 set tabstop=4 set shiftwidth=4 set softtabstop=4 set smarttab set expandtab set clipboard=unnamed set ttyfast set backspace=indent,eol,start " Syntax highlighting syntax on " File types filetype indent plugin on " 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