summaryrefslogtreecommitdiffstats
path: root/vim/.vim/ftplugin/ruby.vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim/.vim/ftplugin/ruby.vim')
-rw-r--r--vim/.vim/ftplugin/ruby.vim25
1 files changed, 25 insertions, 0 deletions
diff --git a/vim/.vim/ftplugin/ruby.vim b/vim/.vim/ftplugin/ruby.vim
new file mode 100644
index 0000000..035f432
--- /dev/null
+++ b/vim/.vim/ftplugin/ruby.vim
@@ -0,0 +1,25 @@
+function! s:rubocop_in_bundler()
+ let l:gemfiles = glob("*.gemspec", 1, 1)
+ if filereadable("Gemfile")
+ let l:gemfiles += ["Gemfile"]
+ endif
+ for l:file in l:gemfiles
+ for l:line in readfile(l:file)
+ if l:line =~ 'gem.*rubocop'
+ return 1
+ endif
+ endfor
+ endfor
+ return 0
+endfunction
+if s:rubocop_in_bundler()
+ let b:ale_ruby_rubocop_executable = 'bundle'
+endif
+
+" look up words in ri rather than man for K
+function! s:ri(word)
+ exe 'silent read! ri -T -f rdoc "' . a:word . '" 2>/dev/null'
+ setlocal ft=
+endfunction
+nnoremap <buffer> <silent>K :call Help(0, [':', '.'], '<SID>ri')<CR>
+vnoremap <buffer> <silent>K :call Help(1, [':', '.'], '<SID>ri')<CR>