Skip to content

Instantly share code, notes, and snippets.

@geoffa
Created March 17, 2011 16:38
Show Gist options
  • Save geoffa/874639 to your computer and use it in GitHub Desktop.
Save geoffa/874639 to your computer and use it in GitHub Desktop.
VIM Files
" URL: http://vim.wikia.com/wiki/Example_vimrc
" Authors: http://vim.wikia.com/wiki/Vim_on_Freenode
" Description: A minimal, but feature rich, example .vimrc. If you are a
" newbie, basing your first .vimrc on this file is a good choice.
" If you're a more advanced user, building your own .vimrc based
" on this file is still a good idea.
"------------------------------------------------------------
" Features {{{1
"
" These options and commands enable some very useful features in Vim, that
" no user should have to live without.
" Set 'nocompatible' to ward off unexpected things that your distro might
" have made, as well as sanely reset options when re-sourcing .vimrc
set nocompatible
" Attempt to determine the type of a file based on its name and possibly its
" contents. Use this to allow intelligent auto-indenting for each filetype,
" and for plugins that are filetype specific.
filetype indent plugin on
" Omni completion
set ofu=syntaxcomplete#CompleteCSS
" set omnifunc=csscomplete#CompleteCSS
" Enable syntax highlighting
syntax on
"------------------------------------------------------------
" Must have options {{{1
"
" These are highly recommended options.
" One of the most important options to activate. Allows you to switch from an
" unsaved buffer without saving it first. Also allows you to keep an undo
" history for multiple files. Vim will complain if you try to quit without
" saving, and swap files will keep you safe if your computer crashes.
set hidden
" Better command-line completion
set wildmenu
" Show partial commands in the last line of the screen
set showcmd
" Highlight searches (use <C-L> to temporarily turn off highlighting; see the
" mapping of <C-L> below)
set hlsearch
" Modelines have historically been a source of security vulnerabilities. As
" such, it may be a good idea to disable them and use the securemodelines
" script, <http://www.vim.org/scripts/script.php?script_id=1876>.
" set nomodeline
"------------------------------------------------------------
" Usability options {{{1
"
" These are options that users frequently set in their .vimrc. Some of them
" change Vim's behaviour in ways which deviate from the true Vi way, but
" which are considered to add usability. Which, if any, of these options to
" use is very much a personal preference, but they are harmless.
" Use case insensitive search, except when using capital letters
set ignorecase
set smartcase
" Allow backspacing over autoindent, line breaks and start of insert action
set backspace=indent,eol,start
" When opening a new line and no filetype-specific indenting is enabled, keep
" the same indent as the line you're currently on. Useful for READMEs, etc.
set autoindent
" Stop certain movements from always going to the first character of a line.
" While this behaviour deviates from that of Vi, it does what most users
" coming from other editors would expect.
set nostartofline
" Display the cursor position on the last line of the screen or in the status
" line of a window
set ruler
" Always display the status line, even if only one window is displayed
set laststatus=2
" Instead of failing a command because of unsaved changes, instead raise a
" dialogue asking if you wish to save changed files.
set confirm
" Use visual bell instead of beeping when doing something wrong
set visualbell
" And reset the terminal code for the visual bell. If visualbell is set, and
" this line is also included, vim will neither flash nor beep. If visualbell
" is unset, this does nothing.
set t_vb=
" Enable use of the mouse for all modes
set mouse=a
" Set the command window height to 2 lines, to avoid many cases of having to
" "press <Enter> to continue"
set cmdheight=2
" Display line numbers on the left
set number
" Quickly time out on keycodes, but never time out on mappings
set notimeout ttimeout ttimeoutlen=200
" Use <F11> to toggle between 'paste' and 'nopaste'
set pastetoggle=<F11>
" Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>
" Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:▸\ ,eol:¬
set list
"------------------------------------------------------------
" Indentation options {{{1
"
" Indentation settings according to personal preference.
" Indentation settings for using 2 spaces instead of tabs.
" Do not change 'tabstop' from its default value of 8 with this setup.
set shiftwidth=4
set softtabstop=4
set noexpandtab
" Indentation settings for using hard tabs for indent. Display tabs as
" two characters wide.
"set shiftwidth=2
set tabstop=4
"------------------------------------------------------------
" Folding options {{{1
set foldmethod=manual "fold based on manual
set foldnestmax=10 "deepest fold is 10 levels
set nofoldenable "dont fold by default
set foldlevel=1 "this is just what i use
"------------------------------------------------------------
" Mappings {{{1
"
" Useful mappings
" Map Y to act like D and C, i.e. to yank until EOL, rather than act as yy,
" which is the default
map Y y$
" Map <C-L> (redraw screen) to also turn off search highlighting until the
" next search
nnoremap <C-L> :nohl<CR><C-L>
" Map NERDTreeToggle to <F5>
map <F5> :NERDTreeToggle<CR>
"------------------------------------------------------------
" Colors {{{1
" Set colorscheme to one in ~/.vim/colors
colorscheme wombat
"------------------------------------------------------------
" Cursor {{{1
" Set cursorcolumn and cursorline
set cuc
set cul
"------------------------------------------------------------
" Maintainer: Lars H. Nielsen (dengmao@gmail.com)
" Last Change: January 22 2007
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "wombat"
" Vim >= 7.0 specific colors
if version >= 700
hi CursorLine guibg=#2d2d2d
hi CursorColumn guibg=#2d2d2d
hi MatchParen guifg=#f6f3e8 guibg=#857b6f gui=bold
hi Pmenu guifg=#f6f3e8 guibg=#444444
hi PmenuSel guifg=#000000 guibg=#cae682
endif
" General colors
hi Cursor guifg=NONE guibg=#656565 gui=none
hi Normal guifg=#f6f3e8 guibg=#242424 gui=none
hi NonText guifg=#808080 guibg=#303030 gui=none
hi LineNr guifg=#857b6f guibg=#000000 gui=none
hi StatusLine guifg=#f6f3e8 guibg=#444444 gui=italic
hi StatusLineNC guifg=#857b6f guibg=#444444 gui=none
hi VertSplit guifg=#444444 guibg=#444444 gui=none
hi Folded guibg=#384048 guifg=#a0a8b0 gui=none
hi Title guifg=#f6f3e8 guibg=NONE gui=bold
hi Visual guifg=#f6f3e8 guibg=#444444 gui=none
hi SpecialKey guifg=#808080 guibg=#343434 gui=none
" Syntax highlighting
hi Comment guifg=#99968b gui=italic
hi Todo guifg=#8f8f8f gui=italic
hi Constant guifg=#e5786d gui=none
hi String guifg=#95e454 gui=italic
hi Identifier guifg=#cae682 gui=none
hi Function guifg=#cae682 gui=none
hi Type guifg=#cae682 gui=none
hi Statement guifg=#8ac6f2 gui=none
hi Keyword guifg=#8ac6f2 gui=none
hi PreProc guifg=#e5786d gui=none
hi Number guifg=#e5786d gui=none
hi Special guifg=#e7f6da gui=none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment