diff options
author | Peter Odding <peter@peterodding.com> | 2013-04-28 15:08:19 +0200 |
---|---|---|
committer | Peter Odding <peter@peterodding.com> | 2013-04-28 15:08:19 +0200 |
commit | a7ed49ed589cfe5f84bfeda317d03a874002e1a9 (patch) | |
tree | ad03ea51d3b2d9154e630c19f3dc2d68f1ddfbd7 /escape.vim | |
parent | a744d4c5f0c6086251aab66ec68cb9299869b1e9 (diff) | |
download | vim-easytags-a7ed49ed589cfe5f84bfeda317d03a874002e1a9.tar.gz |
Change the repository layout to that of a proper Vim plug-in
Diffstat (limited to 'escape.vim')
-rw-r--r-- | escape.vim | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/escape.vim b/escape.vim deleted file mode 100644 index 1dd1838..0000000 --- a/escape.vim +++ /dev/null @@ -1,46 +0,0 @@ -" Vim auto-load script -" Author: Peter Odding <peter@peterodding.com> -" Last Change: November 21, 2011 -" URL: http://peterodding.com/code/vim/misc/ - -" Convert a string into a :substitute pattern that matches the string literally. - -function! xolox#misc#escape#pattern(string) - if type(a:string) == type('') - let string = escape(a:string, '^$.*\~[]') - return substitute(string, '\n', '\\n', 'g') - endif - return '' -endfunction - -" Convert a string into a :substitute replacement that inserts the string literally. - -function! xolox#misc#escape#substitute(string) - if type(a:string) == type('') - let string = escape(a:string, '\&~%') - return substitute(string, '\n', '\\r', 'g') - endif - return '' -endfunction - -" Convert a string into a quoted command line argument. I was going to add a -" long rant here about &shellslash, but really, it won't make any difference. -" Let's just suffice to say that I have yet to encounter a single person out -" there who uses this option for its intended purpose (running a UNIX-style -" shell on Windows). - -function! xolox#misc#escape#shell(string) - if xolox#misc#os#is_win() - try - let ssl_save = &shellslash - set noshellslash - return shellescape(a:string) - finally - let &shellslash = ssl_save - endtry - else - return shellescape(a:string) - endif -endfunction - -" vim: ts=2 sw=2 et |