Skip to content

Commit

Permalink
Bug fix for dynamic completion after typing require('
Browse files Browse the repository at this point in the history
(it shouldn't happen inside comments and strings)
  • Loading branch information
xolox committed Nov 15, 2011
1 parent 5cf57e0 commit 3e3d3dc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions autoload/xolox/lua.vim
@@ -1,9 +1,9 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
" Last Change: October 23, 2011
" Last Change: November 15, 2011
" URL: http://peterodding.com/code/vim/lua-ftplugin

let g:xolox#lua#version = '0.6.25'
let g:xolox#lua#version = '0.6.26'
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 Expand Up @@ -410,12 +410,12 @@ function! xolox#lua#getomnivariables(modules) " {{{1
endfunction

function! xolox#lua#completedynamic(type) " {{{1
if xolox#misc#option#get('lua_complete_dynamic', 1)
if xolox#misc#option#get('lua_complete_dynamic', 1) && s:getsynid(1) !~? 'string\|comment\|keyword'
if (a:type == "'" || a:type == '"') && xolox#misc#option#get('lua_complete_omni', 0)
if strpart(getline('.'), 0, col('.') - 1) =~ 'require[^''"]*$'
if strpart(getline('.'), 0, col('.') - 1) =~ 'require\s*(\?\s*$'
return a:type . "\<C-x>\<C-o>"
endif
elseif a:type == '.' && s:getsynid(1) !~? 'string\|comment\|keyword'
elseif a:type == '.'
let column = col('.') - 1
" Gotcha: even though '.' is remapped it counts as a column?
if column && getline('.')[column - 1] =~ '\w'
Expand Down

0 comments on commit 3e3d3dc

Please sign in to comment.