Created
September 19, 2013 11:03
-
-
Save omnikron/6621906 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Oli new stuff | |
" ==================================== | |
" Press space in normal mode to enter a command | |
nnoremap <Space> : | |
" Pretty lines | |
set fillchars=vert:\ | |
" make backspace work like most other apps | |
set backspace=2 | |
" Open NERDTree to the current file LIKE MAGIC | |
:command NF NERDTreeFind | |
" Recognize Gemfile as ruby | |
autocmd BufNewFile,BufRead Gemfile set filetype=ruby | |
" Using javascript-libraries-syntax.vim, specifying angular and jQuery only | |
autocmd BufReadPre *.js let b:javascript_lib_use_jquery = 1 | |
autocmd BufReadPre *.js let b:javascript_lib_use_underscore = 0 | |
autocmd BufReadPre *.js let b:javascript_lib_use_backbone = 0 | |
autocmd BufReadPre *.js let b:javascript_lib_use_prelude = 0 | |
autocmd BufReadPre *.js let b:javascript_lib_use_angularjs = 1 | |
" Map CtrlP plugin | |
map <Leader>t :CtrlP<CR> | |
" Highlight trailing whitespace and allow automatic removal thereof. | |
highlight ExtraWhitespace ctermfg=15 ctermbg=4 guifg=#CF6A4C guibg=#420E09 | |
match ExtraWhitespace /\s\+$\| \+\ze\t/ | |
" automatically remove trailing whitespace | |
autocmd FileType c,ruby,r,cpp autocmd BufWritePre <buffer> :%s/\s\+$\| | |
\+\ze\t//e | |
" ==================================== | |
" Stuff originally from Bryan | |
" ==================================== | |
" Using Pathogen to bundle plugins, etc | |
runtime bundle/pathogen/autoload/pathogen.vim | |
call pathogen#infect() | |
" Make my shell take commands (-c) as if I'm logged in (-l) | |
set shellcmdflag=-cl | |
" Long lines are (often) hard to read | |
set textwidth=80 | |
" The usual shiftwidth things | |
set shiftwidth=2 | |
set tabstop=2 | |
set expandtab | |
" Incremental search | |
set incsearch | |
" Useful grep | |
set grepprg=grep\ -rinsE | |
" Always cd to the directory of the current file - NO! | |
" set noautochdir | |
" Ignore white-space changes in diffs, and use filler lines to keep split-diffs | |
" symmetrical. | |
set diffopt=filler,iwhite | |
" Shell-like completion | |
set wildmenu | |
set wildmode=list:longest | |
" Set the title in shells | |
set title | |
" Show more lines around the cursor when scrolling | |
set scrolloff=3 | |
" File position info | |
set ruler | |
" Disable beep (flash screen instead), to annoy fewer co-workers | |
set visualbell t_vb= | |
" Status line | |
set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P | |
set laststatus=2 | |
" Show line numbers | |
set number | |
" Allow hiding of modified buffers | |
set hidden | |
" Sensible invisibile characters (hit \l to see) | |
map <Leader>l :set list!<CR> | |
set listchars=tab:→·,eol:¶,trail:· | |
" Open a file browser in the current buffer's directory | |
map <F11> :browse e %:h<CR> | |
" Hypersearch for word (prompt) - filled in with current file's dir and | |
" extension, and the cursor is left on the word (prefilled to <cword>). | |
map <F5> :vimgrep /\<<C-R>=expand("<cword>")<CR>\>/j **/*<C-R>=expand("%:e")<CR><C-Left><Left><Left><Left><Left><Left> | |
if has("gui_running") | |
" No toolbar, no menu (in GUI mode) | |
set guioptions-=T " no toolbar | |
set guioptions-=m " no menu | |
set guioptions-=r " no constant right-hand scrollbar | |
try | |
if has("gui_macvim") | |
set guifont=monaco:h18 " My Mac is on a TV, so big fonts, please. | |
elseif has("gui_gtk2") | |
set guifont=Monaco\ 10 " You need to download this, most likely. | |
set guifont=Monospace\ 11 " Sensible fallback | |
colorscheme solarized | |
endif | |
catch /.*/ | |
set guifont=Monospace\ 11 " Sensible fallback | |
endtry | |
else | |
"Console is (probably) dark if we're not in the GUI | |
set background=light | |
end | |
" Quick text wrapping | |
command! -nargs=* Wrap set wrap linebreak nolist | |
" Automatically re-read modified files | |
set autoread | |
" If the terminal has more than one colour, or the GUI's running | |
if &t_Co > 1 || has("gui_running") | |
syntax enable " What editor worth its salt doesn't show your syntax? | |
colorscheme solarized | |
let g:solarized_termtrans=1 | |
let g:solarized_bold=0 | |
"let g:solarized_termcolors= 256 | |
endif | |
if has("autocmd") | |
" File-type detection | |
filetype plugin indent on | |
" Autocompletion for Ruby (and Rails) | |
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1 | |
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1 | |
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1 | |
autocmd User Rails let g:rails_ctags_arguments = '--extra=+f --exclude=.git --exclude=log `rvm gemdir`/gems/*' | |
autocmd FileType eruby set textwidth=0 | |
" Always apply $MYVIMRC after writing. Disabled for now, because it gets | |
" pretty memory-hungry. | |
" autocmd BufWritePost .vimrc source $MYVIMRC | |
" Wipeout fugitive buffers | |
autocmd BufReadPost fugitive://* set bufhidden=delete | |
endif | |
" Alt right/left/home/previous for buffer jumping | |
map <M-Right> :bnext<CR> | |
map <M-Left> :bprevious<CR> | |
map <M-Home> :bfirst<CR> | |
map <M-End> :blast<CR> | |
" Enable tags in the user help files | |
if isdirectory('~/.vim/doc') | |
helptags ~/.vim/doc | |
endif | |
" Folding | |
set foldmethod=manual |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment