forked from hiattp/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc.local
140 lines (117 loc) · 3.76 KB
/
vimrc.local
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
" Enable searching in project with :find
set path=$PWD/**
" Turn off error indications (e.g. the bell sound)
set noerrorbells visualbell t_vb=
autocmd GUIEnter * set visualbell t_vb=
map <Leader>f :e <C-R>=expand("%:p:h") . "/" <CR>
" Auto-indent in a way that makes sense
set autoindent
if executable('ag')
let g:ctrlp_user_command = 'ag %s -l --nocolor --follow -g ""'
endif
" Reload the vimrc file
nmap <silent> <leader>v :so $MYVIMRC<CR>
" Scroll window to optimal spot for work (5 lines below top of screen)
nmap <silent> <leader>TT z<CR>15<C-y>
" Dodge a couple keystrokes on vim commands
nnoremap ; :
nnoremap <leader>f ;
" Put latest yanked text (bypass latest deleted text in default buffer)
noremap YP "0P
nnoremap <expr> Yp getline('.') =~? '\v^\s+$' ? "\"_dd\"0P=`]" : "\"0p=p`]"
" highlight search results
" set hlsearch
" Search settings
set ignorecase
set smartcase
" Line Numbers
set relativenumber
" Full line tab completion using Supertab
imap <C-l> <C-x><C-l>
" Paste from clipboard
map <leader>p :set paste<cr>:r !pbpaste<cr>:set nopaste<cr>
map <leader>bb :Gblame<CR>
" Faster saving
noremap <Leader>w :up<CR>
" Faster quit
noremap <Leader>q :up<CR>:q<CR>
" Faster search access
noremap <Leader>S :Ag<Space>
noremap <Leader>R :%s/
noremap <Leader>RV :%s/\%V
" Break out of insert mode and save
inoremap <Esc> <Esc><Esc>:up<CR>
" Navigate lines
map <leader>l $
map <leader>h ^
" Don't skip over second part of a broken line
nnoremap j gj
nnoremap k gk
" Adjust lines
map <leader>k kJ
map Di ddO
" Adds whitespace above or below with alt j/k
nnoremap <silent>Wj :set paste<CR>m`o<Esc>``:set nopaste<CR>
nnoremap <silent>Wk :set paste<CR>m`O<Esc>``:set nopaste<CR>
nnoremap <silent>WW :Ag <C-r><C-w><CR>
" Paste over lines with whitespace (common when using snipmate)
nnoremap <expr> p getline('.') =~? '\v^\s+$' ? "\"_ddP=`]" : "p=`]"
" Insert last ditch effort in integration tests
nnoremap sos osave_and_open_screenshot<ESC>
" Clear search matches
map <leader>c :nohlsearch<CR>
" RSpec.vim settings and mappings
let g:rspec_command = 'time spring rspec {spec}'
map <Leader>s :call RunNearestSpec()<CR>
" map <Leader>ss :call RunLastSpec()<CR>
map <Leader>a :call RunAllSpecs()<CR>
" Enter Explore faster
map <Leader>e :Explore<CR>
"Ensure focused split is largest in window
set winwidth=84
set winheight=5
set winminheight=5
set winheight=999
"folding settings
set foldmethod=indent "fold based on indent
set foldnestmax=10 "deepest fold is 10 levels
set nofoldenable "dont fold by default
set foldlevel=1 "this is just what i use
" Don't add the comment prefix when I hit enter or o/O on a comment line.
set formatoptions-=or
runtime macros/matchit.vim
" Settings for vim-session
let g:session_autosave='no'
let g:session_autoload='no'
" Settings for syntastic
let g:syntastic_html_checkers=['']
let g:syntastic_mode_map = {
\ "mode": "active",
\ "passive_filetypes": ["haml", "scss", "sass"] }
" Settings for ctrlp
" let g:ctrlp_follow_symlinks = 3
" Navigate windows with auto-create if navigating at edge of windows
function! s:GotoNextWindow( direction )
let l:prevWinNr = winnr()
execute 'wincmd' a:direction
return winnr() != l:prevWinNr
endfunction
function! s:JumpWithCreate( direction )
if ! s:GotoNextWindow(a:direction)
if a:direction == 'h'
vsplit
elseif a:direction == 'j'
split
elseif a:direction == 'k'
split
elseif a:direction == 'l'
vsplit
endif
execute 'wincmd' a:direction
endif
endfunction
au BufNewFile,BufRead *.raml set filetype=yaml
nnoremap <silent> <C-h> :<C-u>call <SID>JumpWithCreate('h')<CR>
nnoremap <silent> <C-j> :<C-u>call <SID>JumpWithCreate('j')<CR>
nnoremap <silent> <C-k> :<C-u>call <SID>JumpWithCreate('k')<CR>
nnoremap <silent> <C-l> :<C-u>call <SID>JumpWithCreate('l')<CR>