summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/util.vim7
1 files changed, 7 insertions, 0 deletions
diff --git a/autoload/ale/util.vim b/autoload/ale/util.vim
index 1f590adc..b94a11b7 100644
--- a/autoload/ale/util.vim
+++ b/autoload/ale/util.vim
@@ -236,6 +236,13 @@ function! ale#util#EscapePCRE(unsafe_string) abort
return substitute(a:unsafe_string, '\([\-\[\]{}()*+?.^$|]\)', '\\\1', 'g')
endfunction
+" Escape a string so that it can be used as a literal string inside an evaled
+" vim command.
+function! ale#util#EscapeVim(unsafe_string) abort
+ return "'" . substitute(a:unsafe_string, "'", "''", 'g') . "'"
+endfunction
+
+
" Given a String or a List of String values, try and decode the string(s)
" as a JSON value which can be decoded with json_decode. If the JSON string
" is invalid, the default argument value will be returned instead.