Skip to content

Instantly share code, notes, and snippets.

@FilipDeVos
Created December 17, 2009 11:19
Show Gist options
  • Save FilipDeVos/258688 to your computer and use it in GitHub Desktop.
Save FilipDeVos/258688 to your computer and use it in GitHub Desktop.
vim config files
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" options for gvim on Windows 7
"
" Author: Filip De Vos
" Last updated: 1st April 2010
"
" To use this conveniently I work like this:
" - check out the gist in my Git working folder with:
" cd ~/Documents/WorkingGit/
" git clone git://gist.github.com/258688.git vimconfig
" - Then create a symbolic link in my home directory to the conf files
" ln ~/Documents/WorkingGit/vimconfig/_gvimrc _gvimrc
"
" This config uses the zenburn theme which can be downloaded at:
" http://www.vim.org/scripts/script.php?script_id=415
" Once downloaded, move the file to the
" C:\Program Files\vim\vim72\colors\zenburn.vim
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Set the default register to the windows clipboard
set clipboard=unnamed
" shortcuts to get here and reload
nmap ,g :e $HOME\_gvimrc<CR>
" set the font of graphical vim
set guifont=Consolas:h10
" use the zenburn color scheme
colorscheme zenburn
" let window size be remembered
set sessionoptions+=resize,winpos
" To enable the saving and restoring of screen positions.
let g:screen_size_restore_pos = 1
" To save and restore screen for each Vim instance.
" This is useful if you routinely run more than one Vim instance.
" For all Vim to use the same settings, change this to 0.
let g:screen_size_by_vim_instance = 1
" Map new tab to Ctrl+n
map <C-n> <ESC><ESC>:tabnew<CR>
" Map Ctrl-A to "Select All" (ripped from mswin.vim)
noremap <C-A> gggH<C-O>G
inoremap <C-A> <C-O>gg<C-O>gH<C-O>G
cnoremap <C-A> <C-C>gggH<C-O>G
onoremap <C-A> <C-C>gggH<C-O>G
snoremap <C-A> <C-C>gggH<C-O>G
xnoremap <C-A> <C-C>ggVG
" Open file dialog in a new tab
map <F10> :browse tabnew ~\Documents\<CR>
" since I need to retab soo often, a shortkey is handy.
map <F8> :retab<CR>
" Map Ctrl+Up to enlarge font and Ctrl+Down to shrink font.
nnoremap <C-Up> :silent! let &guifont = substitute(&guifont,':h\zs\d\+','\=eval(submatch(0)+1)','')<CR>
nnoremap <C-Down> :silent! let &guifont = substitute(&guifont,':h\zs\d\+','\=eval(submatch(0)-1)','')<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim options on Windows 7
"
" Author: Filip De Vos
" Last updated: 1st April 2010
"
" To use this conveniently I work like this:
" - check out the gist in my Git working folder with:
" cd ~/Documents/WorkingGit/
" git clone git://gist.github.com/258688.git vimconfig
" - Then create a symbolic link in my home directory to the conf files
" ln ~/Documents/WorkingGit/vimconfig/_vimrc _vimrc
" - then start vim to check out your new settings.
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" shortcuts to open config and reload
nmap ,s :so $HOME\_vimrc<CR>
nmap ,v :e $HOME\_vimrc<CR>
" don't be compatible with vi
set nocompatible
" Switch to the current file directory
set autochdir
" Set line numbers on and remap F2 to toggle
set number
nmap <silent> <F2> :set nonumber!<CR>
" show the line where the cursor is
set cursorline
hi clear CursorLine
" custom status line
set statusline=%<%y\ b%n\ %h%m%r%=%-14.(%l,%c%V%)\ %P
" Remove menu bar and toolbar
set guioptions-=m
set guioptions-=T
" disable backup files.
set nobackup
set nowritebackup
" make tabstop 4 spaces wide
set tabstop=4
set shiftwidth=4
set expandtab
set cindent
set smartindent
" Show end of line marker
set list!
"don't wrap long lines
set nowrap
"make backspace not such a pain
set backspace=eol,start,indent
" show matching brace
set showmatch
" prevent vim from beeping when a command doesn't work
set vb t_vb=
" make the screen a bit bigger.
set lines=40
set columns=120
set mousehide
" Switch on syntax highlighting if it wasn't on yet.
if !exists("syntax_on")
syntax on
endif
filetype plugin indent on
" switch on search pattern highlighting
set hlsearch
" enable incremental searching
set incsearch
" enable case insensitive search unless there are uppercase letters in the pattern
set ignorecase
set smartcase
" resize window splits
map <F11> :resize -2<CR>
map <F12> :resize +2<CR>
" set highlighting for SQL files to use the SQL Server TSQL syntax
let g:sql_type_default = "sqlserver"
" let the file searcher look recursive through the path to open a file.
set wildignore=.svn,.git
:nnoremap gf <C-W>gf
set path+=./**
set path+=$HOME/Documents/WorkingSvn/**
set path+=$HOME/Documents/WorkingGit/**
set suffixesadd=.cs,.sql
" Detect if the file is unicode encoded and switch the editor encoding to
" unicode if needed.
" Taken from: http://www.mail-archive.com/[email protected]/msg09732.html
if has("multi_byte")
if &enc !~? '^u' " if the locale 'encoding' starts with u or U
" then Unicode is already set
if &tenc == ''
let &tenc = &enc " save the keyboard charset
endif
set enc=utf-8 " to support Unicode fully, we need to be able
" to represent all Unicode codepoints in memory
endif
set fencs=ucs-bom,utf-8,latin1
setg bomb " default for new Unicode files
setg fenc=latin1 " default for files created from scratch
else
echomsg 'Warning: Multibyte support is not supported.'
endif
" Fix my common typos
ia teh the
ia htis this
ia tihs this
ia eariler earlier
ia funciton function
ia funtion function
ia fucntion function
ia retunr return
ia reutrn return
ia foreahc foreach
ia eariler earlier
ia Craeting Creating
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment