forked from lanxuezaipiao/vim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhammer.vim
executable file
·50 lines (44 loc) · 1.21 KB
/
hammer.vim
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
if has('ruby')
if !exists('g:HAMMER_SILENCE_WARNINGS')
let g:HAMMER_SILENCE_WARNINGS = 0
endif
if !exists('g:HAMMER_DIRECTORY')
if has('win32') || has('win64')
let g:HAMMER_DIRECTORY = $TEMP
else
let g:HAMMER_DIRECTORY = '/tmp'
end
endif
if !exists('g:HAMMER_BROWSER')
if has('mac')
let g:HAMMER_BROWSER = 'open'
elseif has('win32') || has('win64')
ruby require 'hammer/vim-windows/rubygems'
let g:HAMMER_BROWSER = 'start'
elseif has('unix') && executable('xdg-open')
let g:HAMMER_BROWSER = 'xdg-open'
else
let g:HAMMER_BROWSER = ''
end
endif
if !exists('g:HAMMER_BROWSER_ARGS')
let g:HAMMER_BROWSER_ARGS = ''
endif
if !exists('g:HAMMER_TEMPLATE')
let g:HAMMER_TEMPLATE = 'default'
endif
ruby $: << File.join(Vim.evaluate('g:HAMMER_INSTALL_PATH'), 'lib')
ruby require 'hammer'
ruby Hammer.load_dependencies!
ruby Hammer.load_renderers!
function! hammer#Hammer()
ruby <<RENDER!
buffer = Vim::Buffer.current.extend Vim::ImprovedBuffer
Hammer.render!(buffer)
RENDER!
endfunction
else
function! hammer#Hammer()
echo "Sorry, hammer.vim requires vim to be built with Ruby support."
endfunction
end