-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.vimrc
165 lines (137 loc) · 3.65 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
call pathogen#infect()
" Disable arrow keys
noremap <Up> ""
noremap! <Up> <Esc>
noremap <Down> ""
noremap! <Down> <Esc>
noremap <Left> ""
noremap! <Left> <Esc>
noremap <Right> ""
noremap! <Right> <Esc>
" enable syntax highlighting
syntax on
filetype plugin indent on
" disable syntax highlighting for vim-gitgutter
highlight clear SignColumn
"I give up - sometimes I need NERDTree
nmap <C-n> <Esc>:NERDTreeToggle<CR>
" Solarized dark color scheme
let hour = strftime("%H")
" if 6 <= hour && hour <= 18
" set background=dark
" else
set background=light
" endif
colorscheme solarized
set t_Co=256
set term=screen-256color-bce
let g:solarized_termcolors=256
set t_ut=
set hidden
set backspace=indent,eol,start
set nu
set ignorecase
set smartcase
set wildmenu
set scrolloff=3
set autoindent
set expandtab
" set cursorline
let mapleader = ","
let g:session_autoload = 'no'
let g:go_disable_autoinstall = 1
" Always keep 3 lines in view
set scrolloff=2
" Always show the tab line
set showtabline=2
" Ruby tab stop
set tabstop=2
set softtabstop=2
set shiftwidth=2
" Don't use backup or swap files. I save frequently.
set nobackup
set nowb
set noswapfile
set cmdheight=2
set switchbuf=useopen
set numberwidth=5
set winwidth=79
set winheight=25
" Set ignore for wildmenu and ctrlq
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/cache/*,*/node_modules/* " for Linux/MacOSX
let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$|cache'
let g:ctrlp_max_files=0
" Use system clipboard
set clipboard=unnamedplus
" Easier switching between windows
noremap <C-h> <C-w>h
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
noremap <C-l> <C-w>l
function! RunTests(filename)
:w
if match(a:filename, '\.feature$') != -1
exec ":!script/features " . a:filename
else
if filereadable("script/test")
exec ":!script/test " . a:filename
elseif filereadable("Gemfile")
exec ":!bundle exec rspec --color " . a:filename
else
exec ":!rspec --color " . a:filename
end
end
endfunction
function SetTestFile()
let t:grb_test_file=@%
endfunction
function! RunTestFile(...)
if a:0
let command_suffix = a:1
else
let command_suffix = ""
endif
"Run test in previously marked test file
let in_test_file = match(expand("%"), '\(.feature\|._spec.rb\)$') != -1
if in_test_file
call SetTestFile()
elseif !exists("t:grb_test_file")
return
end
call RunTests(t:grb_test_file . command_suffix)
endfunction
map <leader>t :call RunTestFile()<cr>
au FileType go nmap <leader>t <Plug>(go-test)
" map <C-t> :CommandT<cr>
" reselect visual block after indent/outdent
vnoremap < <gv
vnoremap > >gv
" Really annoying things that should work but don't due to capitalization
command W w
command Q q
command Tabnew tabnew
command TAbnew tabnew
command Tabn tabn
command TAbn tabn
command Tabp tabp
command TAbp tabp
command Tablas tablast
command TAblas tablast
command Tabfir tabfirst
command TAbfir tabfirst
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0
let g:syntastic_ruby_checkers = ['mri', 'rubocop']
let g:syntastic_javascript_checkers=['eslint']
let g:syntastic_javascript_eslint_exe='$(npm bin)/eslint'
set foldmethod=indent
set foldnestmax=10
set nofoldenable
set foldlevel=1
autocmd BufEnter * :syntax sync fromstart
let g:ackprg = 'ag --vimgrep'