Skip to content

Instantly share code, notes, and snippets.

@7ochem
Forked from Rud5G/vimrc.vim
Last active October 13, 2015 02:18
Show Gist options
  • Save 7ochem/4124102 to your computer and use it in GitHub Desktop.
Save 7ochem/4124102 to your computer and use it in GitHub Desktop.
.vimrc
" Vim RC
" Based upon Rud5G .vimrc
" @link https://gist.github.com/Rud5G
" @link https://gist.github.com/2316255
"
" Below some links that could help understand and edit this file
" @link http://vimdoc.sourceforge.net/htmldoc/options.html
" @link http://www.eng.hawaii.edu/Tutor/vi.html [BROKEN!]
" -> {@link http://www.linuxfocus.org/English/May2000/article153.shtml}
"
" @TODO Check this self claimed Ultimate Vim Configuration {@link http://amix.dk/vim/vimrc.html} for more usefull stuff
" @TODO Check this article to find more cool stuff {@link http://www.ibm.com/developerworks/linux/library/l-vim-script-1/index.html}
" @TODO Cehck this for CTRL-S save {@link http://vim.wikia.com/wiki/Saving_a_file}
set autoindent " lines following an indented line will have the same indentation as the previous line.
set backspace=indent,eol,start " Allow backspacing over everything in insert mode
"set expandtab " resplace tabs with actuall spaces -> Disabled, see CheckForCustomConfiguration below
set shiftwidth=4 " softtabs width 4.
set tabstop=4 " tabs are 4 spaces
" those 4 are needed to use :%retab
set background=dark " duh.
set backup " keep a backup file
set backupdir=~/.vim/backup " location backup files
set directory=~/.vim/tmp " location tmp files
" execute: mkdir -p ~/.vim/{backup,tmp}
set foldmethod=manual " manual is default, syntax
set history=350 " keep 350 lines of command line history
set hlsearch
set ignorecase smartcase " case-insensitvice search unless upper-case letters
set laststatus=2
set nocompatible
set number
set showcmd " display incomplete commands
set showmatch
set showmode
set smartcase
set statusline=%<[%n]\ %F\ %m%r%y%=%-14.(%l,%c%V%)\ %P
set timeoutlen=500
"set textwidth=120 " i want 120 chars of text. -> Disabled, see CheckForCustomConfiguration below
set wildmenu
set wildmode=list:longest,full
syntax on
" Check for .vim.custom in the directory containing the newly opened file
" @link http://stackoverflow.com/questions/1889602/multiple-vim-configurations
autocmd BufNewFile,BufRead *.css,*.php,*.phtml,*.xml,*.js call CheckForCustomConfiguration()
function! CheckForCustomConfiguration()
let custom_config_file = expand('%:p:h') . '/.vim.custom'
if filereadable(custom_config_file)
" Read custom file from file dir for custom Vim configuration
exe 'source' custom_config_file
elseif filereadable('.vim.custom')
" Read custom file from current dir for custom Vim configuration
so .vim.custom
else
" If no custom configuration is present, then the settings below will be forced upon
set expandtab " resplace tabs with actuall spaces
set textwidth=120 " i want 120 chars of text.
" @link http://vim.wikia.com/wiki/Remove_unwanted_spaces
autocmd BufWritePre * :%s/\s\+$//e " strip white space of the end of lines
endif
endfunction
"the_END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment