aboutsummaryrefslogtreecommitdiff
path: root/plugins/copyfilelocation.lua
diff options
context:
space:
mode:
authorrxi <rxi@users.noreply.github.com>2020-05-16 08:28:46 +0100
committerGitHub <noreply@github.com>2020-05-16 08:28:46 +0100
commit7e111e7efd7a6f28dca47deb125377bc6f6da053 (patch)
tree2ac36d86a44e949f8046676ac7c7a79593501bd5 /plugins/copyfilelocation.lua
parent6890de6bad7992b37169f9faff028b71892b8b73 (diff)
parent80e764f70491f6a4229ba225d758fc6266286eaa (diff)
downloadlite-xl-plugins-7e111e7efd7a6f28dca47deb125377bc6f6da053.tar.gz
lite-xl-plugins-7e111e7efd7a6f28dca47deb125377bc6f6da053.zip
Merge pull request #32 from harikt/copy-file-location
Plugin :: 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
+})