-
Notifications
You must be signed in to change notification settings - Fork 1
/
nvimrc
225 lines (203 loc) · 7.04 KB
/
nvimrc
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
" 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 ~/.nvim/Session.vim'
end
endfunction
function! OnVimLeave()
execute 'tabdo NERDTreeClose'
mksession! ~/.nvim/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) . '/.nvim/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:altercation/vim-colors-solarized
VAMActivate github:benekastah/neomake
VAMActivate github:jelera/vim-javascript-syntax
VAMActivate github:junegunn/fzf
VAMActivate github:majutsushi/tagbar
VAMActivate github:leafgarland/typescript-vim
VAMActivate github:mxw/vim-jsx
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-airline
VAMActivate github:vim-airline/vim-airline-themes
VAMActivate vim-coffee-script
VAMActivate vim-ruby
VAMActivate vim-snippets
" 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
:map <NUL> :NERDTreeToggle<CR>
:map <C-c> :.!pbcopy<cr>u
:map <C-f> :NERDTreeFind<CR>
:map <C-p> :FZF -m<cr>
:map <C-e> :TagbarToggle<CR>
:nnoremap <silent><Leader><C-]> <C-w><C-]><C-w>T
:nnoremap ; :
" windows navigation
:nnoremap ∑ <C-w><C-w>
:nnoremap ˙ <C-w>h
:nnoremap ∆ <C-w>j
:nnoremap ˚ <C-w>k
:nnoremap ¬ <C-w>l
" Set vars "
set rtp+=~/.fzf
set backspace=indent,eol,start
" set tags=./tags,tags;$HOME
set background=light
colorscheme solarized
set number
set updatetime=750
set sessionoptions-=options " Don't save options
set mouse=a
" Persistent undo
set undofile
set undodir=$HOME/.vim/undo
set undolevels=1000
set undoreload=10000
"Ruby standards
set shiftwidth=2
set tabstop=2
" set cursorline
" set cursorcolumn
set nosmarttab
set expandtab
set autoindent " always set autoindenting on
set pastetoggle=<F2>
set clipboard=unnamed
set ignorecase " smartcase MUST BE used with ignorecase
set smartcase
" Application Specific "
"*** ctrlp ****
let g:ctrlp_max_depth = 30
let g:ctrlp_max_files = 0
let g:ctrlp_follow_symlinks = 1
let g:ctrlp_clear_cache_on_exit = 0
"*** NERDTree ****
let NERDTreeShowHidden=1
let NERDTreeChDirMode=2
let NERDTreeQuitOnOpen=1
let NERDTreeMinimalUI=1
"*** airline ****
let g:airline#extensions#default#layout = [
\ [ 'a', 'b', 'c' ],
\ [ 'x', 'y', 'z', 'warning' ]
\ ]
let g:airline_left_sep = ''
let g:airline_right_sep = ''
let g:airline_section_b = ''
let g:airline_section_c = '%f'
let g:airline_section_x = airline#section#create(['tagbar'])
let g:airline_section_y = '%p%%'
let g:airline_section_z = ''
let g:airline_skip_empty_sections = 1
let g:airline#extensions#tabline#enabled = 1
"" Just show the filename (no path) in the tab
" let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
let g:airline#extensions#tabline#fnametruncate = 10
" let g:airline#extensions#tabline#left_sep = ''
" let g:airline#extensions#tabline#left_alt_sep = ''
" let g:airline#extensions#tabline#right_sep = ''
" let g:airline#extensions#tabline#right_alt_sep = ''
let g:airline#extensions#tabline#show_buffers = 0
let g:airline#extensions#tabline#show_splits = 0
let g:airline#extensions#tabline#show_tabs = 1
let g:airline#extensions#tabline#show_tab_nr = 1
let g:airline#extensions#tabline#show_tab_type = 0
let g:airline#extensions#tabline#tab_nr_type = 1 "tab number type is tab number
let g:solarized_base16 = 1
let g:neomake_ruby_enabled_makers = ['rubocop']
let g:neomake_javascript_enabled_makers = ['eslint']
let g:neomake_javascript_eslint_exe = system('PATH=$(npm bin):$PATH && which eslint | tr -d "\n"')
let g_neomake_typescript_tslint_maker = {
\ 'exe': 'tslint',
\ 'args': ['-r', '/usr/local/lib/node_modules/tslint-jsdoc-rules/lib', '--experimentalDecorators']
\ }
let g:neomake_typescript_enabled_makers = ['tslint']
let g:jsx_ext_required = 0
" Neovim ONLY
" Windows navigation for terminal mode
:tnoremap <Leader><Esc> <C-\><C-n>
:tnoremap ∑ <C-\><C-n><C-w><C-w>
:tnoremap ˙ <C-\><C-n><C-w>h
:tnoremap ∆ <C-\><C-n><C-w>j
:tnoremap ˚ <C-\><C-n><C-w>k
:tnoremap ¬ <C-\><C-n><C-w>l
autocmd BufWritePost * Neomake