-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
189 lines (149 loc) · 4.43 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
runtime! autoload/pathogen.vim
set nocompatible
syntax on
filetype on
filetype plugin indent on
set visualbell
set wildmenu
set wildmode=list:longest,full
set splitright
set splitbelow
set hidden
set guifont=Monaco:h16
set guioptions-=T guioptions-=e guioptions-=L guioptions-=r
set shell=bash
augroup vimrc
autocmd!
autocmd GuiEnter * set columns=120 lines=70 number
augroup END
" Add comma as leader
:nmap , \
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" vim tab navigation
nnoremap th :tabfirst<CR>
nnoremap tj :tabprev<CR>
nnoremap tk :tabnext<CR>
nnoremap tl :tablast<CR>
nnoremap tc :tabclose<CR>
nnoremap tn :tabnew<CR>
" disable arrow navigation keys
inoremap <Up> <NOP>
inoremap <Down> <NOP>
inoremap <Left> <NOP>
inoremap <Right> <NOP>
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
" show line numbers
set number
" Save with leader + w
nnoremap <Leader>w :w<CR>
" format JSON with jq
nnoremap <Leader>j :%!cat % <bar> jq '.'<CR>
" ignore ruby warnings in Syntastic
let g:syntastic_ruby_mri_args="-T1 -c"
" syntax highlighting for .ejs and .hamlc
au BufNewFile,BufRead *.ejs set filetype=html
au BufNewFile,BufRead *.hamlc set filetype=html
" Better search behavior
set hlsearch
set incsearch
set ignorecase
set smartcase
" Unhighlight search results
map <Leader><space> :nohl<cr>
" Don't scroll off the edge of the page
set scrolloff=5
" This uses Ack.vim to search for the word under the cursor
nnoremap <leader><bs> :Ag! '\b<c-r><c-w>\b'<cr>
" NERDTree configuration
let NERDTreeIgnore=['\~$', 'tmp', '\.git', '\.bundle', '.DS_Store', 'tags', '.swp']
let NERDTreeShowHidden=1
let g:NERDTreeDirArrows=0
map <Leader>n :NERDTreeToggle<CR>
map <Leader>fnt :NERDTreeFind<CR>
" BufExplorer
noremap <leader>bb :BufExplorer<CR>
" split windows
nnoremap <C-w>- :spl<cr>
nnoremap <C-w><bar> :vsp<cr>
" Rspec and Cucumber container compatibility
let g:turbux_command_rspec="RAILS_ENV=test bin/fig run worker bundle exec rspec"
let g:turbux_command_cucumber="RAILS_ENV=test bin/fig run worker bundle exec cucumber"
set softtabstop=2 shiftwidth=2 expandtab
if getcwd() != $HOME && getcwd() != $DOTFILES_DIR && getcwd() != expand("$HOME/src/dotfiles")
if filereadable(expand('.vimbundle'))
let g:pathogen_disabled = []
let installed_plugins= split(system("ls -1 ~/.vimbundles/ | awk -F'/' '{print $NF}'"), '\n')
let project_plugins= split(system("cat '.vimbundle' | awk -F'/' '{print $NF}'"), '\n')
" reconcile the differences and disable those not contained in the project
for plugin in installed_plugins
if index(project_plugins, plugin) == -1
call add(g:pathogen_disabled, plugin)
endif
endfor
endif
endif
colorscheme Tomorrow-Night-Eighties
if filereadable(expand('~/.vimrc.local'))
source ~/.vimrc.local
endif
if getcwd() != $HOME && getcwd() != $DOTFILES_DIR && getcwd() != expand("$HOME/src/dotfiles")
if filereadable(expand('.vimrc'))
source .vimrc
endif
endif
" vp doesn't replace paste buffer
function! RestoreRegister()
let @" = s:restore_reg
return ''
endfunction
function! s:Repl()
let s:restore_reg = @"
return "p@=RestoreRegister()\<cr>"
endfunction
vmap <silent> <expr> p <sid>Repl()
if exists('g:loaded_pathogen')
execute pathogen#infect('~/.vimbundles/{}')
endif
" toggle quickfix with <Leader> c
let g:toggle_list_no_mappings=1
nmap <script> <silent> <Leader>c :call ToggleQuickfixList()<CR>
" close windows with leader + q
nnoremap <Leader>q :q<CR>
" force close with leader + Q
nnoremap <Leader>Q :q!<CR>
" ctrlp.vim config
let g:ctrlp_max_files=0
let g:ctrlp_max_depth=30
let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:30,results:30'
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/](node_modules|tags|vendor|public|tmp|git-bin|enterprise|bin)',
\ 'file': '\vtags',
\ }
command! -nargs=0 -bar Qargs execute 'args' QuickfixFilenames()
function! QuickfixFilenames()
" Building a hash ensures we get each buffer only once
let buffer_numbers = {}
for quickfix_item in getqflist()
let buffer_numbers[quickfix_item['bufnr']] = bufname(quickfix_item['bufnr'])
endfor
return join(map(values(buffer_numbers), 'fnameescape(v:val)'))
endfunction
" Disable vim backups
set nobackup
set nowritebackup
" Disable swapfile
set noswapfile
" vim gocode
filetype plugin on
" airline
let g:airline_powerline_fonts=1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_symbols.space = "\ua0"