summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-07-14 11:24:02 -0400
committerpommicket <pommicket@gmail.com>2023-07-14 11:24:02 -0400
commitfc847c8996363a3abf349b66d379403aecd71472 (patch)
tree52c6422bc5231d2c8ed8a80053316307e189c18f
parent34ef28ec01a2475d9629dcc3f1e7891b5c92acfe (diff)
copy-path command
-rw-r--r--command.c8
-rw-r--r--command.h3
2 files changed, 11 insertions, 0 deletions
diff --git a/command.c b/command.c
index fd75189..96c04b6 100644
--- a/command.c
+++ b/command.c
@@ -70,6 +70,7 @@ static CommandName command_names[] = {
{"autocomplete", CMD_AUTOCOMPLETE},
{"autocomplete-back", CMD_AUTOCOMPLETE_BACK},
{"find-usages", CMD_FIND_USAGES},
+ {"copy-path", CMD_COPY_PATH},
{"goto-definition", CMD_GOTO_DEFINITION},
{"goto-definition-at-cursor", CMD_GOTO_DEFINITION_AT_CURSOR},
{"goto-declaration-at-cursor", CMD_GOTO_DECLARATION_AT_CURSOR},
@@ -304,6 +305,13 @@ void command_execute_ex(Ted *ted, Command c, CommandArgument full_argument, Comm
}
}
break;
+ case CMD_COPY_PATH:
+ if (buffer) {
+ SDL_SetClipboardText(buffer->path);
+ } else {
+ SDL_SetClipboardText(ted->cwd);
+ }
+ break;
case CMD_TAB:
if (ted->replace && buffer == &ted->find_buffer) {
ted_switch_to_buffer(ted, &ted->replace_buffer);
diff --git a/command.h b/command.h
index 97a7c43..72dfb7c 100644
--- a/command.h
+++ b/command.h
@@ -116,6 +116,9 @@ typedef enum {
CMD_PASTE,
CMD_FIND,
CMD_FIND_REPLACE,
+
+ /// copy path to current file
+ CMD_COPY_PATH,
CMD_TAB_CLOSE,
/// argument = index of tab (starting at 0)