aboutsummaryrefslogtreecommitdiff
path: root/plugins/copyfilelocation.lua
diff options
context:
space:
mode:
authorHari KT <me@harikt.com>2020-05-16 11:43:35 +0530
committerHari KT <me@harikt.com>2020-05-16 11:43:35 +0530
commit80e764f70491f6a4229ba225d758fc6266286eaa (patch)
tree2ac36d86a44e949f8046676ac7c7a79593501bd5 /plugins/copyfilelocation.lua
parent6890de6bad7992b37169f9faff028b71892b8b73 (diff)
downloadlite-xl-plugins-80e764f70491f6a4229ba225d758fc6266286eaa.tar.gz
lite-xl-plugins-80e764f70491f6a4229ba225d758fc6266286eaa.zip
Copy file location
Diffstat (limited to 'plugins/copyfilelocation.lua')
-rw-r--r--plugins/copyfilelocation.lua17
1 files changed, 17 insertions, 0 deletions
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
+})