diff options
| author | Jacob McDonnell <jacob@simplelittledream.com> | 2022-07-16 18:13:16 -0400 |
|---|---|---|
| committer | Jacob McDonnell <jacob@simplelittledream.com> | 2022-07-16 18:13:16 -0400 |
| commit | 8fad9a5ecddc88d57a531e4b0084544984f23d25 (patch) | |
| tree | 84954bc8219942aa56bc899330ccd0007bbe0ef0 /.config/micro/plug/fzf | |
| parent | 2887af7fcfb4d618dd13cf66ec2fbdbd84c7527c (diff) | |
Added profile and other missing configs
Diffstat (limited to '.config/micro/plug/fzf')
| -rw-r--r-- | .config/micro/plug/fzf/README.md | 1 | ||||
| -rw-r--r-- | .config/micro/plug/fzf/main.lua | 38 | ||||
| -rw-r--r-- | .config/micro/plug/fzf/repo.json | 32 |
3 files changed, 71 insertions, 0 deletions
diff --git a/.config/micro/plug/fzf/README.md b/.config/micro/plug/fzf/README.md new file mode 100644 index 0000000..2f03afd --- /dev/null +++ b/.config/micro/plug/fzf/README.md @@ -0,0 +1 @@ +Provides a `fzf` command in micro to open a file in the current pane using fzf. diff --git a/.config/micro/plug/fzf/main.lua b/.config/micro/plug/fzf/main.lua new file mode 100644 index 0000000..fbdcd97 --- /dev/null +++ b/.config/micro/plug/fzf/main.lua @@ -0,0 +1,38 @@ +VERSION = "1.1.1" + +local micro = import("micro") +local shell = import("micro/shell") +local config = import("micro/config") +local buffer = import("micro/buffer") + +function fzf(bp) + if shell.TermEmuSupported then + local err = shell.RunTermEmulator(bp, "fzf", false, true, fzfOutput, {bp}) + if err ~= nil then + micro.InfoBar():Error(err) + end + else + local output, err = shell.RunInteractiveShell("fzf", false, true) + if err ~= nil then + micro.InfoBar():Error(err) + else + fzfOutput(output, {bp}) + end + end +end + +function fzfOutput(output, args) + local bp = args[1] + local strings = import("strings") + output = strings.TrimSpace(output) + if output ~= "" then + local buf, err = buffer.NewBufferFromFile(output) + if err == nil then + bp:OpenBuffer(buf) + end + end +end + +function init() + config.MakeCommand("fzf", fzf, config.NoComplete) +end diff --git a/.config/micro/plug/fzf/repo.json b/.config/micro/plug/fzf/repo.json new file mode 100644 index 0000000..592bab8 --- /dev/null +++ b/.config/micro/plug/fzf/repo.json @@ -0,0 +1,32 @@ +[ + { + "Name": "fzf", + "Description": "adds support to opening files via fzf", + "Website": "https://github.com/samdmarshall/micro-fzf-plugin", + "Tags": ["fzf"], + "Versions": [ + { + "Version": "1.1.1", + "Url": "https://github.com/micro-editor/updated-plugins/releases/download/v1.0.0/fzf-1.1.1.zip", + "Require": { + "micro": ">=2.0.0-1" + } + }, + { + "Version": "1.1.0", + "Url": "https://github.com/micro-editor/updated-plugins/releases/download/v1.0.0/fzf-1.1.0.zip", + "Require": { + "micro": ">=2.0.0-1" + } + }, + { + "Version": "1.0.5", + "Url": "https://github.com/samdmarshall/micro-fzf-plugin/archive/v1.0.5.zip", + "Require": { + "micro": ">=1.1.2" + } + } + ] + } +] + |
