Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Option lua_define_completion_mappings (issue #13)

Issue #13 on GitHub:
  #13
  • Loading branch information...
commit 0544e6fb52344a989c0a7320636ccee03487f175 1 parent 6e0c4b7
@xolox authored
View
5 README.md
@@ -97,6 +97,11 @@ 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_completion_mappings` option
+
+By default the Lua file type plug-in defines insert mode mappings so that the plug-in is called whenever you type a single quote, double quote or a dot inside a Lua buffer. This enables context sensitive completion. If you don't like these mappings you can set this option to zero (false). In that case the mappings will not be defined.
+
## Contact
If you have questions, bug reports, suggestions, etc. the author can be contacted at <peter@peterodding.com>. The latest version is available at <http://peterodding.com/code/vim/lua-ftplugin> and <http://github.com/xolox/vim-lua-ftplugin>. If you like this plug-in please vote for it on [Vim Online][script].
View
4 autoload/xolox/lua.vim
@@ -1,9 +1,9 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: May 13, 2013
+" Last Change: May 15, 2013
" URL: http://peterodding.com/code/vim/lua-ftplugin
-let g:xolox#lua#version = '0.7.5'
+let g:xolox#lua#version = '0.7.6'
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
10 doc/ft_lua.txt
@@ -18,6 +18,7 @@ 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
4. Contact |ft_lua-contact|
5. License |ft_lua-license|
@@ -190,6 +191,15 @@ following command:
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_completion_mappings* option
+
+By default the Lua file type plug-in defines insert mode mappings so that the
+plug-in is called whenever you type a single quote, double quote or a dot
+inside a Lua buffer. This enables context sensitive completion. If you don't
+like these mappings you can set this option to zero (false). In that case the
+mappings will not be defined.
+
===============================================================================
*ft_lua-contact*
Contact ~
View
16 ftplugin/lua.vim
@@ -1,7 +1,7 @@
" Vim file type plug-in
" Language: Lua 5.1
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: June 18, 2011
+" Last Change: May 15, 2013
" URL: http://peterodding.com/code/vim/lua-ftplugin
if exists('b:did_ftplugin')
@@ -73,12 +73,14 @@ if exists('loaded_matchit')
endif
" Enable dynamic completion on typing "require('" or "variable."? {{{1
-inoremap <buffer> <silent> <expr> . xolox#lua#completedynamic('.')
-call add(s:undo_ftplugin, 'iunmap <buffer> .')
-inoremap <buffer> <silent> <expr> ' xolox#lua#completedynamic("'")
-call add(s:undo_ftplugin, "iunmap <buffer> '")
-inoremap <buffer> <silent> <expr> " xolox#lua#completedynamic('"')
-call add(s:undo_ftplugin, 'iunmap <buffer> "')
+if xolox#misc#option#get('lua_define_completion_mappings', 1)
+ inoremap <buffer> <silent> <expr> . xolox#lua#completedynamic('.')
+ call add(s:undo_ftplugin, 'iunmap <buffer> .')
+ inoremap <buffer> <silent> <expr> ' xolox#lua#completedynamic("'")
+ call add(s:undo_ftplugin, "iunmap <buffer> '")
+ inoremap <buffer> <silent> <expr> " xolox#lua#completedynamic('"')
+ call add(s:undo_ftplugin, 'iunmap <buffer> "')
+endif
" Enable tool tips with function signatures? {{{1
if has('balloon_eval')
Please sign in to comment.
Something went wrong with that request. Please try again.