Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Bug fix: Use xolox#misc#option#get() instead of xolox#lua#getopt()

  • Loading branch information...
commit dc8a93799aab5467f290f2aedf13dd1eaf540ded 1 parent f9ba581
Peter Odding authored August 27, 2011
28  autoload/xolox/lua.vim
... ...
@@ -1,13 +1,13 @@
1 1
 " Vim auto-load script
2 2
 " Author: Peter Odding <peter@peterodding.com>
3  
-" Last Change: June 18, 2011
  3
+" Last Change: August 27, 2011
4 4
 " URL: http://peterodding.com/code/vim/lua-ftplugin
5 5
 
6 6
 let s:miscdir = expand('<sfile>:p:h:h:h') . '/misc/lua-ftplugin'
7 7
 let s:omnicomplete_script = s:miscdir . '/omnicomplete.lua'
8 8
 let s:globals_script = s:miscdir . '/globals.lua'
9 9
 
10  
-function! xolox#lua#getopt(name, default) " {{{1
  10
+function! xolox#misc#option#get(name, default) " {{{1
11 11
   if exists('g:' . a:name)
12 12
     return eval('g:' . a:name)
13 13
   elseif exists('b:' . a:name)
@@ -63,19 +63,19 @@ endfunction
63 63
 
64 64
 function! xolox#lua#autocheck() " {{{1
65 65
   if &filetype == 'lua'
66  
-    if xolox#lua#getopt('lua_check_syntax', 1)
  66
+    if xolox#misc#option#get('lua_check_syntax', 1)
67 67
       call xolox#lua#checksyntax()
68 68
     endif
69  
-    if xolox#lua#getopt('lua_check_globals', 0) && empty(getqflist())
  69
+    if xolox#misc#option#get('lua_check_globals', 0) && empty(getqflist())
70 70
       call xolox#lua#checkglobals(0)
71 71
     endif
72 72
   endif
73 73
 endfunction
74 74
 
75 75
 function! xolox#lua#checksyntax() " {{{1
76  
-  let compiler_name = xolox#lua#getopt('lua_compiler_name', 'luac')
77  
-  let compiler_args = xolox#lua#getopt('lua_compiler_args', '-p')
78  
-  let error_format = xolox#lua#getopt('lua_error_format', 'luac: %f:%l: %m')
  76
+  let compiler_name = xolox#misc#option#get('lua_compiler_name', 'luac')
  77
+  let compiler_args = xolox#misc#option#get('lua_compiler_args', '-p')
  78
+  let error_format = xolox#misc#option#get('lua_error_format', 'luac: %f:%l: %m')
79 79
   if !executable(compiler_name)
80 80
     let message = "lua.vim %s: The configured Lua compiler"
81 81
     let message .= " doesn't seem to be available! I'm disabling"
@@ -291,13 +291,13 @@ function! xolox#lua#completefunc(init, base) " {{{1
291 291
     return s:getcompletionprefix()
292 292
   endif
293 293
   let items = []
294  
-  if xolox#lua#getopt('lua_complete_keywords', 1)
  294
+  if xolox#misc#option#get('lua_complete_keywords', 1)
295 295
     call extend(items, g:xolox#lua_data#keywords)
296 296
   endif
297  
-  if xolox#lua#getopt('lua_complete_globals', 1)
  297
+  if xolox#misc#option#get('lua_complete_globals', 1)
298 298
     call extend(items, g:xolox#lua_data#globals)
299 299
   endif
300  
-  if xolox#lua#getopt('lua_complete_library', 1)
  300
+  if xolox#misc#option#get('lua_complete_library', 1)
301 301
     call extend(items, g:xolox#lua_data#library)
302 302
   endif
303 303
   let pattern = '^' . xolox#misc#escape#pattern(a:base)
@@ -334,7 +334,7 @@ endfunction
334 334
 function! xolox#lua#omnifunc(init, base) " {{{1
335 335
   if a:init
336 336
     return s:getcompletionprefix()
337  
-  elseif !xolox#lua#getopt('lua_complete_omni', 0)
  337
+  elseif !xolox#misc#option#get('lua_complete_omni', 0)
338 338
     throw printf("lua.vim %s: omni completion needs to be explicitly enabled, see the readme!", g:lua_ftplugin_version)
339 339
   endif
340 340
   if !exists('s:omnifunc_modules')
@@ -419,8 +419,8 @@ function! xolox#lua#getomnivariables(modules) " {{{1
419 419
 endfunction
420 420
 
421 421
 function! xolox#lua#completedynamic(type) " {{{1
422  
-  if xolox#lua#getopt('lua_complete_dynamic', 1)
423  
-    if (a:type == "'" || a:type == '"') && xolox#lua#getopt('lua_complete_omni', 0)
  422
+  if xolox#misc#option#get('lua_complete_dynamic', 1)
  423
+    if (a:type == "'" || a:type == '"') && xolox#misc#option#get('lua_complete_omni', 0)
424 424
       if strpart(getline('.'), 0, col('.') - 1) =~ 'require[^''"]*$'
425 425
         return a:type . "\<C-x>\<C-o>"
426 426
       endif
@@ -432,7 +432,7 @@ function! xolox#lua#completedynamic(type) " {{{1
432 432
         " are available, which is kind of annoying. But I don't know of an
433 433
         " alternative to :silent that can be used inside of <expr>
434 434
         " mappings?!
435  
-        if xolox#lua#getopt('lua_complete_omni', 0)
  435
+        if xolox#misc#option#get('lua_complete_omni', 0)
436 436
           return a:type . "\<C-x>\<C-o>"
437 437
         else
438 438
           return a:type . "\<C-x>\<C-u>"
2  plugin/lua-ftplugin.vim
@@ -12,7 +12,7 @@ if &cp || exists('g:loaded_lua_ftplugin')
12 12
   finish
13 13
 endif
14 14
 
15  
-let g:lua_ftplugin_version = '0.6.18'
  15
+let g:lua_ftplugin_version = '0.6.19'
16 16
 
17 17
 " Commands to manually check for syntax errors and undefined globals.
18 18
 command! -bar LuaCheckSyntax call xolox#lua#checksyntax()

0 notes on commit dc8a937

Please sign in to comment.
Something went wrong with that request. Please try again.