-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvimrc
145 lines (120 loc) · 4.68 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
set nocompatible "Use Vim defaults instead of Vi compatibility
execute pathogen#infect()
execute pathogen#helptags()
syntax on
" This makes vim act like all other editors, buffers can
" exist in the background without being in a window.
" http://items.sjbach.com/319/configuring-vim-right
set hidden
set background=dark "Use `dark` or `light` as your background
set number "Display numbers
set nowrap "Do not wrap lines
set guioptions-=T "Remove top toolbar
set guioptions-=r "Remove right hand scroll bar
set go-=L "Remove left hand scroll bar
set cursorline "Highlight current line
set gcr=a:blinkon0 "Disable cursor blink
set visualbell "No sounds
set autoread "Reload files changed outside vim
set expandtab "Use spaces for tab at insert mode
set shiftwidth=2 "How many columns text is indented with the reindent operations
set softtabstop=2 "Duh?
set tabstop=2 "How many columns a tab counts for
set history=10000 "Keep 10K lines of command line history
set ruler "Show the cursor position all the time
set showcmd "Display incomplete commands
set incsearch "Do incremental searching
set ignorecase "Make searches case-insensitive.
set smartcase "Unless there is a capital letter
set clipboard=unnamed "All operations work with the OS clipboard. No need for \"+, \"*
set hlsearch
" System specific settings
if has("unix")
let s:uname = system("uname -s")
if s:uname == "Darwin\n"
set guifont=Monaco:h12 " Set font family and size
colorscheme netstudio " Set colorscheme for terminal
else
set guifont=Droid\ Sans\ Mono\ 9 " Set font family and size
colorscheme codeschool
endif
endif
let mapleader=","
" Display tabs and trailing spaces visually
set list listchars=tab:\ \ ,trail:·
set colorcolumn=0 " Disable max chars column
filetype on " Enable filetype detection
filetype indent on " Enable filetype-specific indenting
filetype plugin on " Enable filetype-specific plugins
filetype indent plugin on
set omnifunc=syntaxcomplete#Complete
" Keep undo history across sessions by storing in file.
if has('persistent_undo')
silent !mkdir ~/.vim/tmp/backups > /dev/null 2>&1
set undodir=~/.vim/tmp/backups//
set undofile
endif
" Every time you open a git object using fugitive it creates a new buffer.
" This means that your buffer listing can quickly become swamped with
" fugitive buffers. This prevents this from becomming an issue:
autocmd BufReadPost fugitive://* set bufhidden=delete
map <Leader>gb :Gblame<CR>
" Grep navigation
map <F7> :cp<CR>
map <F8> :cn<CR>
" save swaps in fixed directories
set directory=~/.vim/tmp/swap//,/var/tmp//,/tmp//
" autocmd vimenter * NERDTree "Autostarts NERDTree
autocmd VimEnter * wincmd p "Focus on current window
let g:NERDTreeWinSize=30 "Set size
let g:NERDTreeWinPos="left" "Set position
let NERDTreeMinimalUI=1
let NERDTreeDirArrows=1
map <Leader>cd :NERDTreeFind<CR>
" Toggle NERDTree with F2
map <F2> :NERDTreeToggle<CR>
" Set autocomplete colors
":highlight Pmenu guibg=black guifg=lightmagenta
" auto-source .vimrc upon save
if has("autocmd")
autocmd! bufwritepost .vimrc source $MYVIMRC
endif
" autoclose ruby blocks with end
imap <S-CR> <CR><CR>end<Esc>-cc
set statusline=%t
set statusline+=%{fugitive#statusline()}\
set statusline+=%=
set statusline+=[%{strlen(&fenc)?&fenc:&enc}]
set statusline+=\ [line\ %l\/%L]
"mark syntax errors with :signs
let g:syntastic_enable_signs=1
"automatically jump to the error when saving the file
let g:syntastic_auto_jump=0
"show the error list automatically
let g:syntastic_auto_loc_list=0
"don't care about warnings
"let g:syntastic_quiet_warnings=0
"let g:syntastic_html_tidy_ignore_errors=[]
runtime macros/matchit.vim
let g:RspecKeymap=0
map <Leader>t :call RunSpec()<CR>
map <Leader>s :call RunSpecLine()<CR>
map <Leader>a :call RunSpecs()<CR>
" Do not lose cursor position when splitting
nnoremap <C-W>s Hmx`` \|:split<CR>`xzt``
" Little hack to fix the split/scroll problem
tabnew
bwipeout
" Start ctrlp
set runtimepath^=~/.vim/bundle/ctrlp.vim
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*node_modules*
let g:ctrlp_custom_ignore = {
\ "dir": "\v[\/]\.(git|hg|svn)$",
\ "file": "\v\.(exe|so|dll)$"
\ }
" Visual sugar for when focusing window
augroup BgHighlight
autocmd!
autocmd BufEnter * set cul
autocmd BufLeave * set nocul
augroup END