virb 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/virb/version.rb +1 -1
  2. data/lib/virb.vim +28 -22
  3. metadata +2 -2
data/lib/virb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Virb
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
data/lib/virb.vim CHANGED
@@ -32,19 +32,6 @@ function! VirbStatusLine()
32
32
  return line
33
33
  endfunc
34
34
 
35
- split! .virb/session
36
- setlocal autoread
37
- let s:virb_output_bufnr = bufnr('%')
38
- setlocal nomodifiable
39
- setlocal nu
40
-
41
- " in interactive buffer
42
- wincmd p
43
- setlocal nu
44
- setlocal statusline=%!VirbStatusLine()
45
- command! -bar -range Virb :<line1>,<line2>call Virb()
46
- set ft=ruby
47
-
48
35
  " main execution function
49
36
  func! Virb() range
50
37
  let s:mtime = getftime(".virb/session")
@@ -71,15 +58,34 @@ func! VirbRefresh()
71
58
  :wincmd p
72
59
  endfunc
73
60
 
74
- if !hasmapto('<Plug>VirbRun')
75
- " this is global
76
- nnoremap <cr> :call Virb()<cr>
77
- vnoremap <cr> :call Virb()<cr>
78
- endif
61
+ func VirbInterrupt()
62
+ " this kill -INT is overbroad, sending INT to all virb processes but we can improve it later
63
+ let cmd = "ps | grep bin\/virb$ | awk '{ print $1}' | xargs kill -INT"
64
+ call system(cmd)
65
+ sleep 400m
66
+ call VirbRefresh()
67
+ endfunc
79
68
 
80
- if !hasmapto('<Plug>VirbRefresh')
81
- " this is global
82
- nnoremap <space> :checkt<CR>
83
- endif
69
+ function! VirbInteractive()
70
+ setlocal nu
71
+ setlocal statusline=%!VirbStatusLine()
72
+ command! -bar -range Virb :<line1>,<line2>call Virb()
73
+ set ft=ruby
74
+ nnoremap <buffer> <cr> :call Virb()<cr>
75
+ vnoremap <buffer> <cr> :call Virb()<cr>
76
+ nnoremap <buffer> <space> :checkt<CR>
77
+ nnoremap <buffer> <c-c> :call VirbInterrupt()<CR>
78
+ nnoremap <buffer> <c-c> :call VirbInterrupt()<CR>
79
+ endfunc
84
80
 
81
+ split! .virb/session
82
+ setlocal autoread
83
+ let s:virb_output_bufnr = bufnr('%')
84
+ setlocal nomodifiable
85
+ setlocal nu
86
+
87
+ " set up interactive buffer
88
+ wincmd p
89
+ call VirbInteractive()
85
90
 
91
+ :au BufNewFile,BufRead *.rb call VirbInteractive()
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-25 00:00:00.000000000 Z
12
+ date: 2012-12-26 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A Vim shell for irb and rails console
15
15
  email: