From fe662bc168633f5604770e09605353823253b9e3 Mon Sep 17 00:00:00 2001 From: Hiroshi Muraoka Date: Wed, 27 Aug 2025 21:16:24 +0900 Subject: [PATCH] refactor: define commands first --- plugin/cfp.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/plugin/cfp.lua b/plugin/cfp.lua index aa75a24..2a6871b 100644 --- a/plugin/cfp.lua +++ b/plugin/cfp.lua @@ -1,25 +1,27 @@ -- Create user commands for cfp.nvim -vim.api.nvim_create_user_command("CopyPath", function() require("cfp").copy_path() end, { +local commands = require("cfp.commands") + +vim.api.nvim_create_user_command("CopyPath", function() commands.copy_path() end, { desc = "Copy current file relative path to clipboard", }) -vim.api.nvim_create_user_command("CopyPathLine", function() require("cfp").copy_path_line() end, { +vim.api.nvim_create_user_command("CopyPathLine", function() commands.copy_path_line() end, { desc = "Copy current file relative path with line number to clipboard", }) -vim.api.nvim_create_user_command("CopyBranchURL", function() require("cfp").copy_path_url() end, { +vim.api.nvim_create_user_command("CopyBranchURL", function() commands.copy_branch_url() end, { desc = "Copy current file relative path as GitHub URL with branch name to clipboard", }) -vim.api.nvim_create_user_command("CopyBranchURLLine", function() require("cfp").copy_path_url() end, { +vim.api.nvim_create_user_command("CopyBranchURLLine", function() commands.copy_branch_url_line() end, { desc = "Copy current file relative path with line number as GitHub URL with branch name to clipboard", }) -vim.api.nvim_create_user_command("CopyHashURL", function() require("cfp").copy_path_hash() end, { +vim.api.nvim_create_user_command("CopyHashURL", function() commands.copy_hash_url() end, { desc = "Copy current file relative path as GitHub URL with commit hash to clipboard", }) -vim.api.nvim_create_user_command("CopyHashURLLine", function() require("cfp").copy_path_with_hash() end, { +vim.api.nvim_create_user_command("CopyHashURLLine", function() commands.copy_hash_url_line() end, { desc = "Copy current file relative path with line number as GitHub URL with commit hash to clipboard", })