diff options
author | Guillaume Chérel <guillaume.cherel@iscpif.fr> | 2017-11-23 10:32:12 +0100 |
---|---|---|
committer | Guillaume Chérel <guillaume.cherel@iscpif.fr> | 2017-11-23 10:43:16 +0100 |
commit | 90da494323c8947abfcd654bbbb251afba7144d6 (patch) | |
tree | 67215072938ef91ca13be6a558efe24060eb91f1 /fzf-open.lua | |
parent | 88b745b07ea383078a67b3c09c8c59f067f94b10 (diff) | |
download | vis-fzf-open-90da494323c8947abfcd654bbbb251afba7144d6.tar.gz |
Added configuration for path and defauld args.
Diffstat (limited to 'fzf-open.lua')
-rw-r--r-- | fzf-open.lua | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/fzf-open.lua b/fzf-open.lua index 8e3e4ca..7a20b0c 100644 --- a/fzf-open.lua +++ b/fzf-open.lua @@ -13,8 +13,12 @@ -- You should have received a copy of the GNU Affero General Public License -- along with this program. If not, see <https://www.gnu.org/licenses/>. +module = {} +module.fzf_path = "fzf" +module.fzf_args = "" + vis:command_register("fzf", function(argv, force, win, selection, range) - local command = "fzf " .. table.concat(argv, " ") + local command = module.fzf_path .. " " .. module.fzf_args .. " " .. table.concat(argv, " ") local file = io.popen(command) local output = file:read() @@ -23,16 +27,18 @@ vis:command_register("fzf", function(argv, force, win, selection, range) if status == 0 then vis:command(string.format("e '%s'", output)) elseif status == 1 then - vis:info(string.format("fzf: No match. Command %s exited with return value %i." , command, status)) + vis:info(string.format("fzf-open: No match. Command %s exited with return value %i." , command, status)) elseif status == 2 then - vis:info(string.format("fzf: Error. Command %s exited with return value %i." , command, status)) + vis:info(string.format("fzf-open: Error. Command %s exited with return value %i." , command, status)) elseif status == 130 then - vis:info(string.format("fzf: Interrupted. Command %s exited with return value %i" , command, status)) + vis:info(string.format("fzf-open: Interrupted. Command %s exited with return value %i" , command, status)) else - vis:info(string.format("fzf: Unknown exit status %i. command %s exited with return value %i" , command, status, status)) + vis:info(string.format("fzf-open: Unknown exit status %i. command %s exited with return value %i" , status, command, status, status)) end vis:feedkeys("<vis-redraw>") return true; end) + +return module |