/
explorer.vim
75 lines (57 loc) · 2.16 KB
/
explorer.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
" Vim-to-ruby function calls.
function! lustyexplorer#LustyFilesystemExplorerStart(path)
ruby LustyE::profile() {
\ $lusty_filesystem_explorer.run_from_path(VIM::evaluate("a:path"))
\}
endfunction
function! lustyexplorer#LustyBufferExplorerStart()
ruby LustyE::profile() { $lusty_buffer_explorer.run }
endfunction
function! lustyexplorer#LustyBufferGrepStart()
ruby LustyE::profile() { $lusty_buffer_grep.run }
endfunction
function! s:LustyFilesystemExplorerCancel()
ruby LustyE::profile() { $lusty_filesystem_explorer.cancel }
endfunction
function! s:LustyBufferExplorerCancel()
ruby LustyE::profile() { $lusty_buffer_explorer.cancel }
endfunction
function! s:LustyBufferGrepCancel()
ruby LustyE::profile() { $lusty_buffer_grep.cancel }
endfunction
function! s:LustyFilesystemExplorerKeyPressed(code_arg)
ruby LustyE::profile() { $lusty_filesystem_explorer.key_pressed }
endfunction
function! s:LustyBufferExplorerKeyPressed(code_arg)
ruby LustyE::profile() { $lusty_buffer_explorer.key_pressed }
endfunction
function! s:LustyBufferGrepKeyPressed(code_arg)
ruby LustyE::profile() { $lusty_buffer_grep.key_pressed }
endfunction
" Setup the autocommands that handle buffer MRU ordering.
augroup LustyExplorer
autocmd!
autocmd BufAdd,BufEnter * ruby LustyE::profile() { $le_buffer_stack.push }
autocmd BufDelete * ruby LustyE::profile() { $le_buffer_stack.pop }
autocmd BufWipeout * ruby LustyE::profile() { $le_buffer_stack.pop }
augroup End
ruby << EOF
require 'pathname'
# For IO#ready -- but Cygwin doesn't have io/wait.
require 'io/wait' unless RUBY_PLATFORM =~ /cygwin/
# Needed for String#each_char in Ruby 1.8 on some platforms.
require 'jcode' unless "".respond_to? :each_char
# Needed for Array#each_slice in Ruby 1.8 on some platforms.
require 'enumerator' unless [].respond_to? :each_slice
$LUSTY_PROFILING = false
if $LUSTY_PROFILING
require 'rubygems'
require 'ruby-prof'
end
{{RUBY_CODE_INSERTION_POINT}}
$lusty_buffer_explorer = LustyE::BufferExplorer.new
$lusty_filesystem_explorer = LustyE::FilesystemExplorer.new
$lusty_buffer_grep = LustyE::BufferGrep.new
$le_buffer_stack = LustyE::BufferStack.new
EOF
" vim: set sts=2 sw=2: