Skip to content

Instantly share code, notes, and snippets.

@rgieseke
Created August 19, 2010 12:08
Show Gist options
  • Save rgieseke/537711 to your computer and use it in GitHub Desktop.
Save rgieseke/537711 to your computer and use it in GitHub Desktop.
module('_m.common.filename', package.seeall)
function insert_filename()
local current_dir = (buffer.filename or ''):match('.+[/\\]')
if not current_dir then
current_dir = _HOME
end
filename =
gui.dialog('fileselect',
'--title', "Insert filename",
'--select-multiple',
'--with-directory', current_dir)
if filename then
filename = filename:gsub('\n', '')
filename = filename:gsub(current_dir, '')
buffer:add_text(filename)
end
end
keys.caO = {insert_filename}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment