From 9336f9788ae063c2aa089018ff9de2fed481c280 Mon Sep 17 00:00:00 2001 From: delthas Date: Sun, 31 Oct 2021 17:21:12 +0100 Subject: /mode: default channel to the current channel --- commands.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'commands.go') diff --git a/commands.go b/commands.go index 08b7187..1dd5cd0 100644 --- a/commands.go +++ b/commands.go @@ -76,9 +76,9 @@ func init() { }, "MODE": { AllowHome: true, - MinArgs: 2, + MinArgs: 1, MaxArgs: 5, // - Usage: " [args]", + Usage: "[] [args]", Desc: "change channel or user modes", Handle: commandDoMode, }, @@ -359,6 +359,11 @@ func commandDoNick(app *App, args []string) (err error) { } func commandDoMode(app *App, args []string) (err error) { + if strings.HasPrefix(args[0], "+") || strings.HasPrefix(args[0], "-") { + // if we do eg /MODE +P, automatically insert the current channel: /MODE # +P + _, channel := app.win.CurrentBuffer() + args = append([]string{channel}, args...) + } channel := args[0] flags := args[1] modeArgs := args[2:] -- cgit v1.2.3