From 80e764f70491f6a4229ba225d758fc6266286eaa Mon Sep 17 00:00:00 2001 From: Hari KT Date: Sat, 16 May 2020 11:43:35 +0530 Subject: Copy file location --- plugins/copyfilelocation.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 plugins/copyfilelocation.lua (limited to 'plugins') diff --git a/plugins/copyfilelocation.lua b/plugins/copyfilelocation.lua new file mode 100644 index 0000000..d365240 --- /dev/null +++ b/plugins/copyfilelocation.lua @@ -0,0 +1,17 @@ +local core = require "core" +local command = require "core.command" +local config = require "core.config" + + +command.add("core.docview", { + ["copy-file-location:copy-file-location"] = function() + local doc = core.active_view.doc + if not doc.filename then + core.error "Cannot copy location of unsaved doc" + return + end + local filename = system.absolute_path(doc.filename) + core.log("Copying to clipboard \"%s\"", filename) + system.set_clipboard(filename) + end +}) -- cgit v1.2.3