spacify 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.rdoc +12 -0
  2. data/VERSION +1 -1
  3. data/lib/spacify.rb +2 -2
  4. data/spacify.vim +10 -5
  5. metadata +2 -2
data/README.rdoc CHANGED
@@ -45,6 +45,18 @@ Give unformatted code<br />
45
45
  Order by most common attributes,<br />
46
46
  and format the code with spaces.
47
47
 
48
+ ** Yes I know there are those who would say that this kind of columned output is bad (Uncle Bob), however,
49
+ I like it I think it helps me find things faster. I figure to each their own.
50
+
51
+ == Installation
52
+
53
+ gem install spacify
54
+
55
+ cp GEM_DIR/spacify.vim ~/.vim/plugin
56
+ " add
57
+ source ~/.vim/plugin/spacify.vim
58
+ " to your .vimrc file
59
+
48
60
  == Note on Patches/Pull Requests
49
61
 
50
62
  * Fork the project.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/lib/spacify.rb CHANGED
@@ -47,7 +47,7 @@ class SpacerLine < BaseLine
47
47
 
48
48
  def to_s
49
49
  s = ''
50
- s << @leading
50
+ s << "#@leading"
51
51
  s << '<'
52
52
  s << @parsed.node_name
53
53
  s << ' '
@@ -56,7 +56,7 @@ class SpacerLine < BaseLine
56
56
  end
57
57
  s << '/' if @parsed.empty?
58
58
  s << '>'
59
- s << @trailing
59
+ s << "#@trailing"
60
60
  s << "\n"
61
61
  s
62
62
  end
data/spacify.vim CHANGED
@@ -1,12 +1,17 @@
1
- function! Spacify(html) range
2
- " let input = shellescape( join( getline(a:firstline, a:lastline), "\n") )
1
+ function! Spacify() range
2
+ let saved_line = getpos("v")
3
+ let l:html = "<" . expand("<cword>") . "[^>]+>"
3
4
  let input = join( getline(a:firstline, a:lastline), "\n")
4
- let regex = shellescape( a:html )
5
+ let regex = shellescape( l:html )
5
6
  let res = system( "spacify " . regex, input )
6
- echo type(res)
7
+
7
8
  let current_line = a:firstline
8
9
  for line in split(res, '\n')
9
- execute setline(current_line, line)
10
+ call setline(current_line, line)
10
11
  let current_line += 1
11
12
  endfor
13
+
14
+ call setpos(".", saved_line)
12
15
  endfunction
16
+
17
+ map <LocalLeader>s :call Spacify()<CR>
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Scott Noel-Hemming