-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyvimrc
208 lines (154 loc) · 4.2 KB
/
myvimrc
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
let mapleader="\t"
source ~/.vim/vimrc
set clipboard=unnamed
nnoremap <C-F> :CommandT<cr>
nnoremap <f4> :CommandTMRU<cr>
colorscheme monokai
let g:CommandTFileScanner="find"
nmap <F1> :call dev_notes#toggle_note()<cr>
let g:EasyMotion_do_mapping = 0 " Disable default mappings
" Bi-directional find motion
" Jump to anywhere you want with minimal keystrokes, with just one key binding.
" `s{char}{label}`
nmap S <Plug>(easymotion-s)
" Turn on case sensitive feature
let g:EasyMotion_smartcase = 1
" JK motions: Line motions
map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k)
set tabstop=2
set shiftwidth=2
set expandtab
set nobackup
set noswapfile
" better atomic save
autocmd BufWriteCmd * call AtomicSave()
set colorcolumn=100
" highlight line and column under cursor
set cursorline cursorcolumn
set wildignore+=tmp/cache/assets/*
" noremap <Up> <nop>
" noremap <Down> <nop>
" noremap <Left> <nop>
" noremap <Right> <nop>
" nnoremap ; :
cabbrev gst Gstatus
cabbrev gd Gdiff
set keymap=russian-jcukenwin
set iminsert=0
set imsearch=0
highlight lCursor guifg=Red guibg=NONE
" folding
set foldmethod=expr
set foldexpr=TestFolding(v:lnum)
set foldcolumn=1
set foldlevel=1
set foldnestmax=1
function! IndentLevel(lnum)
let level = indent(a:lnum) / &shiftwidth
if level > 2
return 2
endif
return level
endfunction
function! PrevNonBlankLine(lnum)
let current = a:lnum - 1
while current > 0
if getline(current) =~? '\v\S'
return current
endif
let current -= 1
endwhile
return -2
endfunction
function! NextNonBlankLine(lnum)
let numlines = line('$')
let current = a:lnum + 1
while current <= numlines
if getline(current) =~? '\v\S'
return current
endif
let current += 1
endwhile
return -2
endfunction
function! TestFolding(lnum)
let prev_indent = IndentLevel(PrevNonBlankLine(a:lnum))
let this_indent = IndentLevel(a:lnum)
let next_indent = IndentLevel(NextNonBlankLine(a:lnum))
if getline(a:lnum) =~? '\v^\s*$'
return TestFolding(PrevNonBlankLine(a:lnum))
endif
if prev_indent > this_indent
return prev_indent
elseif next_indent == this_indent
return this_indent
elseif next_indent < this_indent
return this_indent
elseif next_indent > this_indent
return '>' . next_indent
endif
endfunction
function RunTest(text)
let name = substitute(a:text, "['\"]", "", "g")
let name = substitute(name, "[^a-zA-Z0-9]", "_", "g")
let cmd = substitute("echo {name} | time bin/one_test {file}\n", "{name}", name, "")
let cmd = substitute(cmd, "{file}", @%, "")
call Send_to_Tmux(cmd)
endfunction
" running test file, one test, or all suite
noremap <F7> :!time testdrb %<CR>
noremap <F9> $?test ['"][^'"]\+['"] do<CR>:.w !sed "s/^\ \+//" \| sed "s/\ do$//" \| sed "s/['\"]//g" \| sed "s/\ /_/g" \| time bin/one_test %<CR>
noremap <F5> :!time testdrb test/**/*_test.rb<CR>
noremap <F12> :A<CR>
noremap <S-F12> :R<CR>
noremap <F11> :R<CR>
noremap <F5> :call Send_to_Tmux("time bin/tests\n")<CR>
noremap <F7> :call Send_to_Tmux(substitute("time testdrb {file}\n", "{file}", @%, ""))<CR>
noremap <F9> $?test ['"][^'"]\+['"] do<CR>^v/' do<CR>"ry :call RunTest(@r)<CR>
" fastest search
set grepprg=ag\ --nogroup\ --nocolor
" switchers to change how word-wise ops working
noremap _ :set iskeyword-=_ <CR>
noremap + :set iskeyword+=_ <CR>
" Turns on HARD MODE
inoremap <up> <nop>
nnoremap <up> <nop>
vnoremap <up> <nop>
inoremap <down> <nop>
nnoremap <down> <nop>
vnoremap <down> <nop>
inoremap <left> <nop>
nnoremap <left> <nop>
vnoremap <left> <nop>
inoremap <right> <nop>
nnoremap <right> <nop>
vnoremap <right> <nop>
inoremap <PageUp> <nop>
nnoremap <PageUp> <nop>
vnoremap <PageUp> <nop>
inoremap <PageDown> <nop>
nnoremap <PageDown> <nop>
vnoremap <PageDown> <nop>
nnoremap k <nop>
vnoremap k <nop>
nnoremap gk <nop>
vnoremap gk <nop>
nnoremap j <nop>
vnoremap j <nop>
nnoremap gj <nop>
vnoremap gj <nop>
nnoremap h <nop>
vnoremap h <nop>
nnoremap l <nop>
vnoremap l <nop>
set backspace=0
" Quickfix navigation with arrows
nnoremap <right> :cn<cr>
nnoremap <left> :cp<cr>
" Arglist navigation with arrows
nnoremap <down> :n<cr>
nnoremap <up> :prev<cr>
" Bufferlist navigation with jk
nnoremap j :bprevious<cr>
nnoremap k :bnext<cr>