invim 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,14 @@
1
+ Invim
2
+ =====
3
+
4
+ Description
5
+ -----------
6
+
7
+ Invim is a gem that provides you with a quick and easy way to open current terminal tab (shell/irb) in Vim for easy searching & copying. Terminal.app only.
8
+
9
+ Installation
10
+ ------------
11
+
12
+ gem install invim
13
+
14
+
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
+
5
+ require 'invim'
6
+
7
+ Object.invim
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.files = `git ls-files`.split("\n")
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ puts s.executables
19
20
  s.require_paths = ["lib"]
20
21
 
21
22
  # specify any dependencies here; for example:
@@ -1,7 +1,44 @@
1
1
  require "invim/version"
2
2
 
3
3
  module Invim
4
- def invim; system 'invim'; end
4
+
5
+ FILE = '/tmp/invim.tmp'
6
+
7
+ def invim
8
+ system empty_file
9
+ system capture_terminal_text
10
+ system open_file
11
+ end
12
+
13
+ private
14
+
15
+ def empty_file
16
+ "> #{FILE}"
17
+ end
18
+
19
+ def open_file
20
+ "/Applications/MacVim.app/Contents/MacOS/Vim + #{FILE}"
21
+ end
22
+
23
+ def capture_terminal_text
24
+ # figure out how to suppress spaces in shell heredoc
25
+ <<-COMMAND
26
+ osascript <<END
27
+ set the_filepath to "#{FILE}"
28
+ set the_file to POSIX file the_filepath
29
+ tell application "Terminal"
30
+ tell front window
31
+ set the_text to history of selected tab as text
32
+ end
33
+ end
34
+
35
+ open for access the_file with write permission
36
+ write the_text to the_file
37
+ close access the_file
38
+ END
39
+ COMMAND
40
+ end
41
+
5
42
  end
6
43
 
7
44
  Object.send(:include, Invim)
@@ -1,3 +1,3 @@
1
1
  module Invim
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: invim
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Milan Dobrota
@@ -21,8 +21,8 @@ dependencies: []
21
21
  description: Open current terminal tab (shell, irb) in vim text editor.
22
22
  email:
23
23
  - milan@milandobrota.com
24
- executables: []
25
-
24
+ executables:
25
+ - invim
26
26
  extensions: []
27
27
 
28
28
  extra_rdoc_files: []
@@ -30,7 +30,9 @@ extra_rdoc_files: []
30
30
  files:
31
31
  - .gitignore
32
32
  - Gemfile
33
+ - README.md
33
34
  - Rakefile
35
+ - bin/invim
34
36
  - invim.gemspec
35
37
  - lib/invim.rb
36
38
  - lib/invim/version.rb