summaryrefslogtreecommitdiff
path: root/command.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-01-03 17:29:19 -0500
committerpommicket <pommicket@gmail.com>2023-01-03 17:29:19 -0500
commit87c8bd6eb27edb4bfc539967235c3a1e2f8d77e4 (patch)
tree4dbcb24ce4fca226e5b70bc5f01d71158d891426 /command.c
parent0d92c03f3998fe4d16f3ba928d3a94583755e1ce (diff)
go to declaration
Diffstat (limited to 'command.c')
-rw-r--r--command.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/command.c b/command.c
index fb9a390..bf26b3a 100644
--- a/command.c
+++ b/command.c
@@ -66,6 +66,7 @@ static CommandName const command_names[] = {
{"find-usages", CMD_FIND_USAGES},
{"goto-definition", CMD_GOTO_DEFINITION},
{"goto-definition-at-cursor", CMD_GOTO_DEFINITION_AT_CURSOR},
+ {"goto-declaration-at-cursor", CMD_GOTO_DECLARATION_AT_CURSOR},
{"find", CMD_FIND},
{"find-replace", CMD_FIND_REPLACE},
{"tab-close", CMD_TAB_CLOSE},
@@ -405,10 +406,15 @@ void command_execute(Ted *ted, Command c, i64 argument) {
break;
case CMD_GOTO_DEFINITION:
menu_open(ted, MENU_GOTO_DEFINITION);
- break;
+ break;
case CMD_GOTO_DEFINITION_AT_CURSOR: {
if (buffer && buffer_is_named_file(buffer)) {
- buffer_goto_word_at_cursor(buffer);
+ buffer_goto_word_at_cursor(buffer, GOTO_DEFINITION);
+ }
+ } break;
+ case CMD_GOTO_DECLARATION_AT_CURSOR: {
+ if (buffer && buffer_is_named_file(buffer)) {
+ buffer_goto_word_at_cursor(buffer, GOTO_DECLARATION);
}
} break;
case CMD_FIND_USAGES: