Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Make dofile(), loadfile(), ... trigger filename completion

  • Loading branch information...
commit 8cff1bd82f714c9b058c2b96a882c6f0daabdd48 1 parent 3e3d3dc
Peter Odding authored
1  TODO.md
Source Rendered
@@ -8,7 +8,6 @@
8 8
 Make completion smarter by supporting function arguments:
9 9
 
10 10
  * `collectgarbage()`: stop, restart, collect, count, step, setpause, setstepmul
11  
- * `dofile()`, `loadfile()`: filename completion
12 11
  * `io.open()`, `io.popen()`: r, w, a, r+, w+, a+
13 12
  * `file:read()`: \*n, \*a, \*l
14 13
  * `file:seek()`: set, cur, end
9  autoload/xolox/lua.vim
@@ -3,7 +3,7 @@
3 3
 " Last Change: November 15, 2011
4 4
 " URL: http://peterodding.com/code/vim/lua-ftplugin
5 5
 
6  
-let g:xolox#lua#version = '0.6.26'
  6
+let g:xolox#lua#version = '0.6.27'
7 7
 let s:miscdir = expand('<sfile>:p:h:h:h') . '/misc/lua-ftplugin'
8 8
 let s:omnicomplete_script = s:miscdir . '/omnicomplete.lua'
9 9
 let s:globals_script = s:miscdir . '/globals.lua'
@@ -411,9 +411,12 @@ endfunction
411 411
 
412 412
 function! xolox#lua#completedynamic(type) " {{{1
413 413
   if xolox#misc#option#get('lua_complete_dynamic', 1) && s:getsynid(1) !~? 'string\|comment\|keyword'
414  
-    if (a:type == "'" || a:type == '"') && xolox#misc#option#get('lua_complete_omni', 0)
415  
-      if strpart(getline('.'), 0, col('.') - 1) =~ 'require\s*(\?\s*$'
  414
+    if (a:type == "'" || a:type == '"')
  415
+      let prefix = strpart(getline('.'), 0, col('.') - 1)
  416
+      if xolox#misc#option#get('lua_complete_omni', 0) && prefix =~ '\<require\s*(\?\s*$'
416 417
         return a:type . "\<C-x>\<C-o>"
  418
+      elseif prefix =~ '\<\(dofile\|loadfile\|io\.open\|io\.lines\|os\.remove\)\s*(\?\s*$'
  419
+        return a:type . "\<C-x>\<C-f>"
417 420
       endif
418 421
     elseif a:type == '.'
419 422
       let column = col('.') - 1

0 notes on commit 8cff1bd

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