Permalink
Browse files

Initial coffeescript support -- Functions

  • Loading branch information...
1 parent e8f45ea commit 4d3a147d2097d1d9e82355fcdb2c917339864a91 @AndrewRadev committed Mar 3, 2012
Showing with 34 additions and 0 deletions.
  1. +22 −0 autoload/sj/coffee.vim
  2. +1 −0 examples/test.coffee
  3. +11 −0 ftplugin/coffee/splitjoin.vim
View
@@ -0,0 +1,22 @@
+function! sj#coffee#SplitFunction()
+ let line = getline('.')
+
+ if line !~ '->'
+ return 0
+ else
+ s/->\s*/->\r/
+ normal! ==
+ return 1
+ endif
+endfunction
+
+function! sj#coffee#JoinFunction()
+ let line = getline('.')
+
+ if line !~ '->'
+ return 0
+ else
+ s/->\_s\+/-> /
+ return 1
+ endif
+endfunction
View
@@ -0,0 +1 @@
+(foo, bar) -> console.log foo
@@ -0,0 +1,11 @@
+if !exists('b:splitjoin_split_callbacks')
+ let b:splitjoin_split_callbacks = [
+ \ 'sj#coffee#SplitFunction',
+ \ ]
+endif
+
+if !exists('b:splitjoin_join_callbacks')
+ let b:splitjoin_join_callbacks = [
+ \ 'sj#coffee#JoinFunction',
+ \ ]
+endif

0 comments on commit 4d3a147

Please sign in to comment.