Skip to content

Commit

Permalink
feat: use copy_cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroSuero committed Jul 7, 2024
1 parent ff4943d commit 373aaca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lua/freeze-code/commands.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local M = {}

local utils = require("freeze-code.utils")
local config = require("freeze-code.config")
local logger = utils.logger
local os_utils = utils.os
local is_win = os_utils.is_win
Expand Down Expand Up @@ -92,6 +93,11 @@ end
local copy_by_os = function(opts)
local cmd = {}
local filename = vim.fn.expand(opts.output)
if config.config.copy_cmd ~= "" then
local command = string.gsub(config.config.copy_cmd, "filename", filename)
cmd = { command }
return vim.fn.system(cmd)
end
if vim.fn.executable("gclip") ~= 0 then
cmd = { "gclip", "-copy", "-f", filename }
return vim.fn.system(cmd)
Expand Down
2 changes: 1 addition & 1 deletion lua/freeze-code/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ local default_config = {
_installed = vim.fn.exepath("freeze") ~= "",
install_path = vim.env.HOME .. "/.local/bin",
freeze_path = vim.fn.exepath("freeze"),
copy_cmd = vim.env.HOME .. "/dev/nvim_plugins/freeze-code.nvim/bin/pngcopy-macos",
copy_cmd = "",
copy = false,
open = false,
dir = vim.env.PWD,
Expand Down

0 comments on commit 373aaca

Please sign in to comment.