aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBence Ferdinandy <bence@ferdinandy.com>2023-09-19 08:51:50 +0200
committerRobin Jarry <robin@jarry.cc>2023-09-19 11:09:16 +0200
commit4400b08a95b4f4548388e34858516df33d80b2d3 (patch)
tree6b52c8acd8d5fda566d22efa326886468c7e7c8f
parent194d263bbe2bd685b192ddcebbc64c099e3a8dc1 (diff)
downloadaerc-4400b08a95b4f4548388e34858516df33d80b2d3.tar.gz
aerc-4400b08a95b4f4548388e34858516df33d80b2d3.zip
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 <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--main.go2
1 files changed, 1 insertions, 1 deletions
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 {