karottenreibe-vim-syntax 0.0.0
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.
- data/HISTORY.markdown +11 -0
- data/LICENSE.txt +22 -0
- data/README.markdown +21 -0
- data/Rakefile +16 -0
- data/VERSION +1 -0
- data/lib/vim-syntax.rb +39 -0
- metadata +69 -0
data/HISTORY.markdown
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
/*---- DON'T PANIC License 1.1 -----------
|
2
|
+
|
3
|
+
Don't panic, this piece of software is
|
4
|
+
free, i.e. you can do with it whatever
|
5
|
+
you like, including, but not limited to:
|
6
|
+
|
7
|
+
* using it
|
8
|
+
* copying it
|
9
|
+
* (re)distributing it
|
10
|
+
* burning/burying/shredding it
|
11
|
+
* eating it
|
12
|
+
* using it to obtain world domination
|
13
|
+
* and ignoring it
|
14
|
+
|
15
|
+
Under the sole condition that you
|
16
|
+
|
17
|
+
* CONSIDER buying the author a strong
|
18
|
+
brownian motion producer, say a nice
|
19
|
+
hot cup of tea, should you ever meet
|
20
|
+
him in person.
|
21
|
+
|
22
|
+
----------------------------------------*/
|
data/README.markdown
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
What is this?
|
2
|
+
=============
|
3
|
+
|
4
|
+
A simple (!) extension to the syntax gem, that allows you to
|
5
|
+
highlight vim syntax.
|
6
|
+
|
7
|
+
How do I use it?
|
8
|
+
================
|
9
|
+
|
10
|
+
First:
|
11
|
+
|
12
|
+
gem install karottenreibe-vim-syntax --source http://gems.github.com
|
13
|
+
|
14
|
+
Then:
|
15
|
+
|
16
|
+
require 'vim-syntax'
|
17
|
+
require 'syntax/convertors/html'
|
18
|
+
|
19
|
+
convertor = Syntax::Convertors::HTML.for_syntax "vim"
|
20
|
+
puts convertor.convert( "let mapleader=','" )
|
21
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'jeweler'
|
2
|
+
|
3
|
+
task :release do
|
4
|
+
sh "vim HISTORY.markdown"
|
5
|
+
sh "vim README.markdown"
|
6
|
+
end
|
7
|
+
|
8
|
+
Jeweler::Tasks.new do |gem|
|
9
|
+
gem.name = "vim-syntax"
|
10
|
+
gem.summary = gem.description = "A simple (!) extension to the syntax gem, that allows you to highlight vim syntax."
|
11
|
+
gem.email = "karottenreibe@gmail.com"
|
12
|
+
gem.homepage = "http://github.com/karottenreibe/vim-syntax"
|
13
|
+
gem.authors = ["Fabian Streitel"]
|
14
|
+
gem.add_dependency('syntax')
|
15
|
+
end
|
16
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.2
|
data/lib/vim-syntax.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
require 'syntax'
|
3
|
+
|
4
|
+
class VimTokenizer < Syntax::Tokenizer
|
5
|
+
|
6
|
+
def step
|
7
|
+
@got_command ||= false
|
8
|
+
|
9
|
+
if comment = scan(%r{"[^"]*$|^".*$})
|
10
|
+
start_group(:comment, comment)
|
11
|
+
elsif string = scan(%r{"[^"]*"|'[^']*'})
|
12
|
+
start_group(:string, string)
|
13
|
+
elsif scan(%r{function (\w+)\(\)(.*?)endfunction}m)
|
14
|
+
start_group(:command, 'function')
|
15
|
+
start_group(:functionname, subgroup(1))
|
16
|
+
start_group(:functionbody, subgroup(2))
|
17
|
+
elsif number = scan(%r{\d+})
|
18
|
+
start_group(:number, number)
|
19
|
+
elsif key = scan(%r{<[^<]+>})
|
20
|
+
start_group(:key, key)
|
21
|
+
|
22
|
+
elsif punct = scan(%r{[^\w\s]})
|
23
|
+
start_group(:punct, punct)
|
24
|
+
elsif space = scan(%r{\s})
|
25
|
+
@got_command = false if space == "\n"
|
26
|
+
start_group(:whitespace, space)
|
27
|
+
|
28
|
+
elsif not @got_command and command = scan(%r{\w+})
|
29
|
+
@got_command = true
|
30
|
+
start_group(:command, command)
|
31
|
+
else
|
32
|
+
start_group(:param, scan(%r{.}))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
Syntax::SYNTAX['vim'] = VimTokenizer
|
39
|
+
|
metadata
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: karottenreibe-vim-syntax
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Fabian Streitel
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-08-05 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: syntax
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
description: A simple (!) extension to the syntax gem, that allows you to highlight vim syntax.
|
26
|
+
email: karottenreibe@gmail.com
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- LICENSE.txt
|
33
|
+
- README.markdown
|
34
|
+
files:
|
35
|
+
- HISTORY.markdown
|
36
|
+
- LICENSE.txt
|
37
|
+
- README.markdown
|
38
|
+
- Rakefile
|
39
|
+
- VERSION
|
40
|
+
- lib/vim-syntax.rb
|
41
|
+
has_rdoc: false
|
42
|
+
homepage: http://github.com/karottenreibe/vim-syntax
|
43
|
+
licenses:
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options:
|
46
|
+
- --charset=UTF-8
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: "0"
|
54
|
+
version:
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: "0"
|
60
|
+
version:
|
61
|
+
requirements: []
|
62
|
+
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 1.3.5
|
65
|
+
signing_key:
|
66
|
+
specification_version: 3
|
67
|
+
summary: A simple (!) extension to the syntax gem, that allows you to highlight vim syntax.
|
68
|
+
test_files: []
|
69
|
+
|