Skip to content

Instantly share code, notes, and snippets.

@bentsai
Created March 22, 2010 16:50
Show Gist options
  • Save bentsai/340259 to your computer and use it in GitHub Desktop.
Save bentsai/340259 to your computer and use it in GitHub Desktop.
set nocompatible
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => General
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Sets how many lines of history vim has to remember
set history=700
" Enable filetype plugin
filetype plugin on
filetype indent on
" Set to auto read when a file is changed externally
set autoread
" Assign comma to be map leader character (instead of backslash)
let mapleader = ","
let g:mapleader = ","
" Fast editing of .vimrc
map <leader>e :e! $MYVIMRC<cr>
" Automatically reload when vimrc is edited
autocmd! bufwritepost *vimrc source $MYVIMRC
" backspace and cursor keys wrap to previous/next line
set backspace=indent,eol,start whichwrap+=<,>,[,]
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Things from mswin.vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CTRL-V is paste
map <C-V> "+gP
cmap <C-V> <C-R>+
" Pasting blockwise and linewise selections is not possible in Insert and
" Visual mode without the +virtualedit feature. They are pasted as if they
" were characterwise instead.
" Uses the paste.vim autoload script.
exe 'inoremap <script> <C-V>' paste#paste_cmd['i']
exe 'vnoremap <script> <C-V>' paste#paste_cmd['v']
" Use CTRL-Q to do what CTRL-V used to do
noremap <C-Q> <C-V>
" backspace in Visual mode deletes selection
vnoremap <BS> d
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => UI
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set scrolloff=7
set wildmenu
set ruler
" Allow hidden buffers
set hidden
set ignorecase
set smartcase
set gdefault
set incsearch
set showmatch
set hlsearch
set magic "Set magic on for regular expressions
set showmatch "Show matching braces when text indicator is over them
set mat=2 "How many tenths of a second to blink
set guioptions-=T
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Colors and fonts
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set guifont=ProggyCleanSZBP:h9:cANSI,Consolas:h9,Lucida\ Console:h9:cDEFAULT
syntax enable "Enable syntax h1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set tabstop=3
set shiftwidth=3
set softtabstop=3
set smarttab
set expandtab
set lines=48
set laststatus=2
set viminfo='100,\"50
set wildignore=*.o,*.obj,*.bak,*.exe
set encoding=utf-8
set modelines=0
set relativenumber
set wrap
set formatoptions=qrn1
" Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:▸\ ,eol:¬
nmap <leader>l :set list!<CR>
"statusline
set statusline=%t\ "tail of the filename
set statusline+=[%{strlen(&fenc)?&fenc:'none'}, "file encoding
set statusline+=%{&ff}] "file format
set statusline+=%h "help file flag
set statusline+=%m "modified flag
set statusline+=%r "read only flag
set statusline+=%y "filetype
set statusline+=%= "left/right separator
set statusline+=%c, "cursor column
set statusline+=%l/%L "cursor line/total lines
set statusline+=\ %P "percent through file
" Pressing F5 lists all buffers, just type number
map <F5> :ls<CR>:e #
" I always accidentally hit F1
map <F1> <ESC>
cnoremap <c-n> <down>
cnoremap <c-p> <up>
nnoremap <esc> :noh<cr><esc>
nnoremap j gj
nnoremap k gk
nnoremap <tab> %
vnoremap <tab> %
" Timestamp
nmap <F3> a<C-R>=strftime("%Y-%m-%d %H:%M")<CR><Esc>
imap <F3> <C-R>=strftime("%Y-%m-%d %H:%M")<CR>
colorscheme rubyblue
behave mswin
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Files, backups and undo
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Turn backup off, since most stuff is in SVN, git anyway...
set nobackup
set nowb
set noswapfile
"Persistent undo
try
set undodir=$VIMRUNTIME\undodir
set undofile
catch
endtry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment