Skip to content

Instantly share code, notes, and snippets.

@chancez
Created July 20, 2012 16:41
Show Gist options
  • Save chancez/3151762 to your computer and use it in GitHub Desktop.
Save chancez/3151762 to your computer and use it in GitHub Desktop.
set nocompatible " be iMproved
" Move around windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" General Settings
filetype on
filetype plugin on
filetype indent on
syntax enable
set hidden
set visualbell " Turn on the visual bell
set title " Adjust title bar accordingly
set scrolloff=5 " Begin scrolling when cursor is at 5 from the edge
set autoread " Read a file if detect to have been changed outside of vim
set browsedir=current " which directory to use for the file browser
" Searching options
set incsearch " Searches as you type.
set ignorecase " Ignore case when searching.
set smartcase " If case seems to matter, use it
set hlsearch " Highlight as you search.
set showmatch " Show all matches.
set magic " " :help magic
set number " Show Line numbers
set ttyfast " Speed option
set spell " Spell checking on.
set showmode " Shows what mode your on at the bottom left
set backspace=eol,start,indent " Allow backspace in insertmode
set whichwrap+=<,>,h,l " Allows you to wrap to a previous line with h and l
set linespace=0 " Number of pixels between chars
autocmd BufEnter * if bufname("") !~ "^\[A-Za-z0-9\]*://" | lcd %:p:h | endif
" always switch to the current file directory.
" Allow undos and history to be persistant
set undofile
set undolevels=1000
set history=1000
" Auto complete stuff
set wildmenu
set wildmode=list:longest,full
set wildignore+=*.pyc
set completeopt=menuone,longest ",preview
set pumheight=6 " Keep a small completion window
" Indentation and wrapping
set autoindent " Auto indentation stuff
set smartindent " Indent based on file type.
set tabstop=4
set shiftwidth=4
set expandtab
set linebreak " Wraps lines instead of inserting an EOL
set textwidth=79 " How many char to allow before inserting a newline
set wrap " Allows wrapping on display.
" Making paste work with indenting"
set pastetoggle=<F2>
set ruler " show the ruler
set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " a ruler on steroids
set showcmd " show partial commands in status line and
" Status Line Options
set statusline=%<%f\ " Filename
set statusline+=%w%h%m%r " Options
set statusline+=%{fugitive#statusline()} " Git Hotness
set statusline+=\ [%{&ff}/%Y] " filetype
set statusline+=\ [%{getcwd()}] " current dir
set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info
" Python
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
au FileType python setlocal expandtab textwidth=79 shiftwidth=4 tabstop=8 softtabstop=4 smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class,with
"au BufRead *.py set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m
" HTML Specifics
au BufRead,BufNewFile *.html setlocal shiftwidth=2 tabstop=2 textwidth=0 wrapmargin=0
au BufRead,BufNewFile *.mkd setlocal shiftwidth=2 tabstop=2 textwidth=0 wrapmargin=0
au FileType html,markdown set omnifunc=htmlcomplete#Complete
" CSS
au BufRead,BufNewFile *.css setlocal shiftwidth=2 tabstop=2 textwidth=0 wrapmargin=0
au FileType css set omnifunc=csscomplete#Complete
"JavaScript
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
" Text files
au BufRead,BufNewFile *.txt setlocal textwidth=0 wrap
" Show trailing whitespace and spaces.
:highlight ExtraWhiteSpace ctermbg=red guibg=red
autocmd Syntax * syn match ExtraWhiteSpace /\s\+$\| \+\ze\t/ containedin=ALL
autocmd BufWinLeave * call clearmatches()
" Removes trailing white spaces
autocmd FileType c,cpp,java,php,javascript,python,twig,xml,yml autocmd BufWritePre <buffer> :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment