aboutsummaryrefslogtreecommitdiff
path: root/plugins/copyfilelocation.lua
blob: d3652407c0579240318c2c43cb44ea6486e5e822 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
})