Permalink
Browse files

Make setting of completefunc/omnifunc optional (issue #15)

See issue #15 on GitHub:
  #15
  • Loading branch information...
1 parent 73736ad commit 17e900399ff6d670c2fb1bcab7125d65f2765366 @xolox committed Aug 31, 2013
Showing with 48 additions and 8 deletions.
  1. +14 −0 README.md
  2. +2 −2 autoload/xolox/lua.vim
  3. +23 −1 doc/ft_lua.txt
  4. +9 −5 ftplugin/lua.vim
View
@@ -103,6 +103,17 @@ If you want to use the omni completion despite the warnings above, execute the f
Now when you type Control-X Control-O Vim will hang for a moment, after which you should be presented with an enormous list of completion candidates :-)
+### The `lua_define_completefunc` option
+
+By default the Lua file type plug-in sets the ['completefunc'] [] option so that Vim can complete Lua keywords, global variables and library members using Control-X Control-U. If you don't want the 'completefunc' option to be changed by the plug-in, you can set this option to zero (false) in your [vimrc script] [vimrc]:
+
+ :let g:lua_define_completefunc = 0
+
+### The `lua_define_omnifunc` option
+
+By default the Lua file type plug-in sets the ['omnifunc'] [] option so that Vim can complete the names of all Lua modules installed on the local system. If you don't want the 'omnifunc' option to be changed by the plug-in, you can set this option to zero (false) in your [vimrc script] [vimrc]:
+
+ :let g:lua_define_omnifunc = 0
### The `lua_define_completion_mappings` option
@@ -118,6 +129,8 @@ This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/M
© 2013 Peter Odding &lt;<peter@peterodding.com>&gt;.
+['completefunc']: http://vimdoc.sourceforge.net/htmldoc/options.html#'completefunc'
+['omnifunc']: http://vimdoc.sourceforge.net/htmldoc/options.html#'omnifunc'
[cfu]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27completefunc%27
[dll]: http://en.wikipedia.org/wiki/Dynamic-link_library
[dof]: http://www.lua.org/manual/5.1/manual.html#pdf-dofile
@@ -141,4 +154,5 @@ This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/M
[shell]: http://peterodding.com/code/vim/shell/
[tob]: http://vimdoc.sourceforge.net/htmldoc/motion.html#text-objects
[vim]: http://www.vim.org/
+[vimrc]: http://vimdoc.sourceforge.net/htmldoc/starting.html#vimrc
[vundle]: https://github.com/gmarik/vundle
View
@@ -1,9 +1,9 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: August 19, 2013
+" Last Change: August 31, 2013
" URL: http://peterodding.com/code/vim/lua-ftplugin
-let g:xolox#lua#version = '0.7.12'
+let g:xolox#lua#version = '0.7.13'
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'
View
@@ -17,7 +17,9 @@ Contents ~
9. The |lua_complete_library| option
10. The |lua_complete_dynamic| option
11. The |lua_complete_omni| option
- 12. The |lua_define_completion_mappings| option
+ 12. The |lua_define_completefunc| option
+ 13. The |lua_define_omnifunc| option
+ 14. The |lua_define_completion_mappings| option
4. Contact |ft_lua-contact|
5. License |ft_lua-license|
6. References |ft_lua-references|
@@ -199,6 +201,26 @@ Now when you type Control-X Control-O Vim will hang for a moment, after which
you should be presented with an enormous list of completion candidates :-)
-------------------------------------------------------------------------------
+The *lua_define_completefunc* option
+
+By default the Lua file type plug-in sets the |'completefunc'| option so that
+Vim can complete Lua keywords, global variables and library members using
+Control-X Control-U. If you don't want the 'completefunc' option to be changed
+by the plug-in, you can set this option to zero (false) in your |vimrc| script:
+>
+ :let g:lua_define_completefunc = 0
+<
+-------------------------------------------------------------------------------
+The *lua_define_omnifunc* option
+
+By default the Lua file type plug-in sets the |'omnifunc'| option so that Vim
+can complete the names of all Lua modules installed on the local system. If you
+don't want the 'omnifunc' option to be changed by the plug-in, you can set this
+option to zero (false) in your |vimrc| script:
+>
+ :let g:lua_define_omnifunc = 0
+<
+-------------------------------------------------------------------------------
The *lua_define_completion_mappings* option
By default the Lua file type plug-in defines insert mode mappings so that the
View
@@ -1,7 +1,7 @@
" Vim file type plug-in
" Language: Lua 5.1
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: May 15, 2013
+" Last Change: August 31, 2013
" URL: http://peterodding.com/code/vim/lua-ftplugin
if exists('b:did_ftplugin')
@@ -24,12 +24,16 @@ let &l:includeexpr = 'xolox#lua#includeexpr(v:fname)'
call add(s:undo_ftplugin, 'setlocal inc< inex<')
" Enable completion of Lua keywords, globals and library members. {{{1
-setlocal completefunc=xolox#lua#completefunc
-call add(s:undo_ftplugin, 'setlocal completefunc<')
+if xolox#misc#option#get('lua_define_completefunc', 1)
+ setlocal completefunc=xolox#lua#completefunc
+ call add(s:undo_ftplugin, 'setlocal completefunc<')
+endif
" Enable dynamic completion by searching "package.path" and "package.cpath". {{{1
-setlocal omnifunc=xolox#lua#omnifunc
-call add(s:undo_ftplugin, 'setlocal omnifunc<')
+if xolox#misc#option#get('lua_define_omnifunc', 1)
+ setlocal omnifunc=xolox#lua#omnifunc
+ call add(s:undo_ftplugin, 'setlocal omnifunc<')
+endif
" Set a filename filter for the Windows file open/save dialogs. {{{1
if has('gui_win32') && !exists('b:browsefilter')

0 comments on commit 17e9003

Please sign in to comment.