Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #7 from caio/master

Add support for calling custom functions during escape
  • Loading branch information...
commit c029aec736ade7143bfe9b009f344af4bdf49c1d 2 parents 0c111d3 + ffb3c4e
@jpalardy jpalardy authored
View
3  ftplugin/python/slime.vim
@@ -0,0 +1,3 @@
+function! _EscapeText_python(text)
+ return substitute(a:text, "\n", "
+", "g")
View
3  ftplugin/scala/slime.vim
@@ -0,0 +1,3 @@
+function! _EscapeText_scala(text)
+ return ":paste\n" . a:text . ""
+endfunction
View
11 plugin/slime.vim
@@ -73,7 +73,16 @@ endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! s:_EscapeText(text)
- return substitute(shellescape(a:text), "\\\\\\n", "\n", "g")
+ let transformed_text = a:text
+
+ if exists("&filetype")
+ let custom_escape = "_EscapeText_" . &filetype
+ if exists("*" . custom_escape)
+ let transformed_text = call(custom_escape, [a:text])
+ end
+ end
+
+ return substitute(shellescape(transformed_text), "\\\\\\n", "\n", "g")
endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Please sign in to comment.
Something went wrong with that request. Please try again.