Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug fix: Properly escape Vim script strings in omnicomplete.lua
  • Loading branch information
xolox committed May 12, 2013
1 parent 2f29afe commit b4f29a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions autoload/xolox/lua.vim
@@ -1,9 +1,9 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
" Last Change: April 30, 2013
" Last Change: May 12, 2013
" URL: http://peterodding.com/code/vim/lua-ftplugin

let g:xolox#lua#version = '0.7.3'
let g:xolox#lua#version = '0.7.4'
let s:miscdir = expand('<sfile>:p:h:h:h') . '/misc/lua-ftplugin'
let s:omnicomplete_script = s:miscdir . '/omnicomplete.lua'
let s:globals_script = s:miscdir . '/globals.lua'
Expand Down
7 changes: 6 additions & 1 deletion misc/lua-ftplugin/omnicomplete.lua
Expand Up @@ -29,7 +29,12 @@ local function addmatch(word, kind, desc)
if not desc then
print(string.format("{'word':'%s','kind':'%s'}", word, kind))
else
print(string.format("{'word':'%s','kind':'%s','menu':'%s'}", word, kind, (desc:gsub('\n', ' '))))
-- Make sure we generate valid Vim script expressions (this is probably
-- still not right).
desc = desc:gsub('\n', '\\n')
:gsub('\r', '\\r')
:gsub("'", "''")
print(string.format("{'word':'%s','kind':'%s','menu':'%s'}", word, kind, desc))
end
end

Expand Down

0 comments on commit b4f29a5

Please sign in to comment.