aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrxi <rxi@users.noreply.github.com>2020-05-16 10:03:26 +0100
committerrxi <rxi@users.noreply.github.com>2020-05-16 10:03:26 +0100
commit60903899991293d0eb8f5b30086a55ba4d9707fa (patch)
tree60cf6f1cabe5cbc5ce6f0534548444dff4946b18
parent0d7fa4b63c8448a2939b4fb5172e01c149c41b24 (diff)
parent7e111e7efd7a6f28dca47deb125377bc6f6da053 (diff)
downloadlite-xl-plugins-60903899991293d0eb8f5b30086a55ba4d9707fa.tar.gz
lite-xl-plugins-60903899991293d0eb8f5b30086a55ba4d9707fa.zip
Merge branch 'master' of https://github.com/rxi/lite-plugins
-rw-r--r--README.md1
-rw-r--r--plugins/copyfilelocation.lua17
2 files changed, 18 insertions, 0 deletions
diff --git a/README.md b/README.md
index 3942342..d718706 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,7 @@ Plugin | Description
[`bracketmatch`](plugins/bracketmatch.lua?raw=1) | Underlines matching right-bracket of left-bracket under caret *([screenshot](https://user-images.githubusercontent.com/3920290/80132745-0c863f00-8594-11ea-8875-c455c6fd7eae.png))*
[`colorpreview`](plugins/colorpreview.lua?raw=1) | Underlays color values (eg. `#ff00ff` or `rgb(255, 0, 255)`) with their resultant color. *([screenshot](https://user-images.githubusercontent.com/3920290/80743752-731bd780-8b15-11ea-97d3-847db927c5dc.png))*
[`console`](https://github.com/rxi/console)* | A console for running external commands and capturing their output *([gif](https://user-images.githubusercontent.com/3920290/81343656-49325a00-90ad-11ea-8647-ff39d8f1d730.gif))*
+[`copyfilelocation`](plugins/copyfilelocation.lua?raw=1) | Copy file location to clipboard
[`detectindent`](plugins/detectindent.lua?raw=1) | Automatically detects and uses the indentation size and tab type of a loaded file
[`drawwhitespace`](plugins/drawwhitespace.lua?raw=1) | Draws tabs and spaces *([screenshot](https://user-images.githubusercontent.com/3920290/80573013-22ae5800-89f7-11ea-9895-6362a1c0abc7.png))*
[`eval`](plugins/eval.lua?raw=1) | Replaces selected Lua code with its evaluated result
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
+})