-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvimrc
144 lines (127 loc) · 4.25 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
" YARTR "
let s:yartr_path=expand('<sfile>:p:h')
map <Leader>t :call YartrRunTestSingle()<CR>
map <Leader>T :call YartrRunTestAll()<CR>
function! YartrRunTestSingle()
normal |y$
let current_line=@"
let first_line_of_test_match=matchstr(current_line, 'def test.*')
if empty(first_line_of_test_match)
execute("?def test") | :normal wyw
let test_name=@"
else
:normal wwyw
let test_name=@"
endif
let file_path=expand('%:p')
let cd_dir=matchstr(file_path, 'engines/[^/]*')
let test_path= matchstr(file_path,'test/.*')
let file_path=substitute(file_path, "/test/.*", "", "")
execute "silent !osascript ".shellescape(s:yartr_path)."/yartr_lib/run_command 'cd '"file_path" ' && ruby -Itest ' "test_path" ' --name=' "test_name""
endfunction
function! YartrRunTestAll()
let file_path=expand('%:p')
let cd_dir=matchstr(file_path, 'engines/[^/]*')
let test_path= matchstr(file_path,'test/.*')
let file_path=substitute(file_path, "/test/.*", "", "")
execute "silent !osascript ".shellescape(s:yartr_path)."/yartr_lib/run_command 'cd '"file_path" ' && ruby -Itest ' "test_path""
endfunction
" Functions "
function! RestoreSession()
if argc() == 0 "vim called without arguments
execute 'source ~/.vim/Session.vim'
end
endfunction
function! OnVimLeave()
execute 'tabdo NERDTreeClose'
mksession! ~/.vim/Session.vim
endfunction
function! SetupVAM()
let c = get(g:, 'vim_addon_manager', {})
let g:vim_addon_manager = c
let c.plugin_root_dir = expand('$HOME', 1) . '/.vim/vim-addons'
let &rtp.=(empty(&rtp)?'':',').c.plugin_root_dir.'/vim-addon-manager'
if !isdirectory(c.plugin_root_dir.'/vim-addon-manager/autoload')
execute '!git clone --depth=1 git://github.com/MarcWeber/vim-addon-manager '
\ shellescape(c.plugin_root_dir.'/vim-addon-manager', 1)
endif
call vam#ActivateAddons([], {'auto_install' : 0})
endfun
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugins!
" Managed with VAM
" https://github.com/MarcWeber/vim-addon-manager
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Startup "
set nocompatible | filetype indent plugin on | syn on
let g:vim_addon_manager = {}
let g:vim_addon_manager.shell_commands_run_method='system'
call SetupVAM()
" use <c-x><c-p> to complete plugin names
" My plugin declarations
VAMActivate ag
VAMActivate ctrlp
VAMActivate delimitMate
VAMActivate EasyMotion
VAMActivate fugitive
VAMActivate github:airblade/vim-gitgutter
VAMActivate github:flazz/vim-colorschemes
VAMActivate github:jelera/vim-javascript-syntax
VAMActivate github:MarcWeber/vim-addon-local-vimrc
VAMActivate github:nathanaelkane/vim-indent-guides
VAMActivate github:pangloss/vim-javascript
VAMActivate github:scrooloose/nerdtree
VAMActivate github:tpope/vim-bundler
VAMActivate html5
VAMActivate molokai
VAMActivate rails
" VAMActivate Rubytest
VAMActivate rust
VAMActivate Syntastic
VAMActivate Tabular
VAMActivate tComment
VAMActivate trailing-whitespace
VAMActivate UltiSnips
VAMActivate vim-coffee-script
VAMActivate vim-snippets
VAMActivate wmgraphviz
" VAMActivate YouCompleteMe
" VAMActivate github:sjl/gundo.vim
" Autocmd "
autocmd VimEnter * nested call RestoreSession()
autocmd VimLeave * call OnVimLeave()
autocmd BufLeave,CursorHold,CursorHoldI,FocusLost * silent! wa " autocmdto save
" Mappings "
" Add keyboard shortcuts
map <C-Tab> gt
map <C-S-Tab> gT
" ctags opens in new tab
:nnoremap <silent><Leader><C-]> <C-w><C-]><C-w>T
nnoremap ; :
map <C-Space> :NERDTreeToggle<CR>
nmap <C-f> :NERDTreeFind<CR>
nmap <C-e> :TagbarToggle<CR>
" Set vars "
set tags=./tags,tags;$HOME
set background=dark
colorscheme solarized
set number
set autochdir
set updatetime=750
set sessionoptions-=options " Don't save options
"Ruby standards
set shiftwidth=2
set tabstop=2
set cursorline
set cursorcolumn
set expandtab
set autoindent " always set autoindenting on
set pastetoggle=<F2>
" Application Specific "
"*** ctrlp ****
let g:ctrlp_max_depth = 50
let g:ctrlp_max_files = 0
let g:ctrlp_follow_symlinks = 1
let g:ctrlp_clear_cache_on_exit = 0
"*** NERDTree ****
let NERDTreeChDirMode=2