-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvimcity.vim
81 lines (70 loc) · 1.75 KB
/
vimcity.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
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
" vimcity.vim : something something'
" Version : 0.1
" Maintainer : jackie kircher <kircher.jackie@gmail.com>
" License : WTFPL
" ** JUMP SHIP ** "
if v:version < 600 || !has("ruby")
echomsg 'Your version of vim must be compiled with ruby support'
finish
end
if !exists('loaded_genutils')
runtime plugin/genutils.vim
endif
if !exists('loaded_genutils') || loaded_genutils < 200
echomsg 'You need the latest version of genutils.vim plugin'
finish
endif
" ** LOAD FILE? ** "
if exists("loaded_vimcity")
finish "too many vimcity"
" unload görillas here instead?
endif
let loaded_vimcity = 1
let s:user_cpo = &cpo " store current compatible-mode
set cpo&vim " go into noncompatible-mode
" ## CONFIGURATION ## "
" variable script path
if !exists("vimcity_path")
let s:vim_path = split(&runtimepath, ',')
let s:vimcity_path = s:vim_path[0]."/plugin/vimcity.vim"
else
let s:vimcity_path = vimcity_path
unlet vimcity_path
end
" ## new command: VimCity ## "
command! -nargs=0 VimCity :call <SID>vimcity(<args>)
function! s:vimcity(...)
call vimcity#vimcity()
endfunction
function! vimcity#vimcity()
try
call s:play()
catch /^Vim:Interrupt$/
" Do nothing?
finally
" Still nothing?
endtry
endfunction
function! s:play()
exec "tabnew VimCity"
setlocal noreadonly
setlocal nonumber
setlocal noswapfile
setlocal buftype=nofile
setlocal nowrap
setlocal so=999
setlocal nolist
exec "sp Welcome_to_VimCity"
exec "resize 3"
setlocal noreadonly
setlocal nonumber
setlocal noswapfile
setlocal buftype=nofile
setlocal nowrap
setlocal nolist
" load the game!
ruby load "lib/vimcity.rb"
ruby VimCityGame.new
endfunction
let &cpo = s:user_cpo " restore user's compatible-mode
unlet s:user_cpo