From 4400b08a95b4f4548388e34858516df33d80b2d3 Mon Sep 17 00:00:00 2001 From: Bence Ferdinandy Date: Tue, 19 Sep 2023 08:51:50 +0200 Subject: commands: strip leading colons from commands When giving advice on commands to run the colon is often included to signify that the snippet is needs to be run as an aerc command. Unfortunately, copying this into the command prompt of aerc leads to an error. Copy the behaviour of vim and strip any number of leading colons from command names. Signed-off-by: Bence Ferdinandy Acked-by: Robin Jarry --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main.go') diff --git a/main.go b/main.go index 4e0e4a4d..0f897bd0 100644 --- a/main.go +++ b/main.go @@ -71,7 +71,7 @@ func expandAbbreviations(cmd []string, sets []*commands.Commands) []string { if len(cmd) == 0 { return cmd } - name := cmd[0] + name := strings.TrimLeft(cmd[0], ":") candidate := "" for _, set := range sets { if set.ByName(name) != nil { -- cgit