Skip to content

Instantly share code, notes, and snippets.

@snatchev
Created December 16, 2010 15:29
Show Gist options
  • Save snatchev/743523 to your computer and use it in GitHub Desktop.
Save snatchev/743523 to your computer and use it in GitHub Desktop.
set nocompatible
set mouse=a
" lets use ack instead of grep. add default flags if needed
set grepprg=ack
function! Ack(args)
tabnew
execute "silent! grep " . a:args
botright copen
endfunction
" I am not sure what this actually does
command! -nargs=* -complete=file Ack call Ack(<q-args>)
set nu
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set autoindent " always set autoindenting on
set shiftwidth=2
set tabstop=2
set expandtab
set backup " keep a backup file
set backupdir=/tmp
set history=100 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
" Don't use Ex mode, use Q for formatting
map Q gq
map <leader>` :NERDTreeToggle<CR>
" hitting \hl will show the highlighting of that word
map <leader>hl :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
" map <D-left> <C-w>W
" map <D-left> <C-w><left>
" map <D-right> <C-w><right>
" map <D-up> <C-w><up>
" map <D-down> <C-w><down>
map <C-space> :FufFile<CR>
" let ruby_operators = 1
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
highlight WhitespaceError ctermbg=red guibg=red
au ColorScheme * highlight WhitespaceError guibg=red
au BufEnter,InsertLeave * match WhitespaceError /\s\+$/
"au InsertEnter * match WhitespaceError /\s\+\%#\@<!$/
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
" strip trailing whitespaces
" autocmd BufWritePre *.rb :%s/\s\+$//e
" load pathogen bundles before running filetype detection
call pathogen#runtime_append_all_bundles()
" add git info to the statusline
set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
" Enable file type detection.
filetype plugin indent on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment