aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-06-23 11:59:03 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2023-06-23 12:25:55 +0200
commit072d828d763940d3f12e1fa621eef1bcbf9bd288 (patch)
tree22cc04d83f82adcb433fe6c129f947622cb9358c
parent290eecac062db139dd17ebce5cd6b19ac53f5c18 (diff)
downloadwee-slack-072d828d763940d3f12e1fa621eef1bcbf9bd288.tar.gz
Automatically enable emoji/usergroups completion
Automatically set completion_default_template on wee-slack buffers, so emojis and usergroups can be tab completed without having to set weechat.completion.default_template manually.
-rw-r--r--README.md21
-rw-r--r--wee_slack.py15
2 files changed, 16 insertions, 20 deletions
diff --git a/README.md b/README.md
index f1e870e..65e4acd 100644
--- a/README.md
+++ b/README.md
@@ -324,30 +324,11 @@ or symlink the
[`weemoji.json`](https://github.com/wee-slack/wee-slack/blob/master/weemoji.json)
file to your WeeChat config directory (e.g. `~/.local/share/weechat` or
`~/.weechat`). If doing this after starting wee-slack, you will have to reload
-it by running `/python reload slack`. Then append `|%(emoji)` to the
-`weechat.completion.default_template` config option, e.g. like this:
-
-```
-/set weechat.completion.default_template "%(nicks)|%(irc_channels)|%(emoji)"
-```
+it by running `/python reload slack`.
Emoji names can be completed by typing colon and the start of the emoji name
and pressing tab.
-### User group tab completions
-
-To enable tab completions for usergroups append `|%(usergroups)` to the
-`weechat.completion.default_template` config option, e.g. like this:
-
-```
-/set weechat.completion.default_template "%(nicks)|%(irc_channels)|%(usergroups)"
-```
-
-If you already added `%(emoji)` to this config option, like described in the
-last section, make sure not to overwrite that. The usergroup will appear in the
-same format as nicks, like the following: `@marketing`, where marketing is the
-usergroup handle.
-
### Cursor and mouse mode
The cursor mode and mouse mode can be used to interact with older messages, for editing, deleting, reacting and replying to a message. Mouse mode can be toggled by pressing `Alt`+`m` and cursor mode can be entered by running `/cursor` (see `/help cursor`).
diff --git a/wee_slack.py b/wee_slack.py
index 6dae8af..1d18126 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -1694,6 +1694,11 @@ class SlackTeam(object):
w.buffer_set(self.channel_buffer, "localvar_set_slack_type", self.type)
w.buffer_set(self.channel_buffer, "localvar_set_nick", self.nick)
w.buffer_set(self.channel_buffer, "localvar_set_server", self.name)
+ w.buffer_set(
+ self.channel_buffer,
+ "localvar_set_completion_default_template",
+ "${weechat.completion.default_template}|%(usergroups)|%(emoji)",
+ )
self.buffer_merge()
def buffer_merge(self, config_value=None):
@@ -2421,6 +2426,11 @@ class SlackChannel(SlackChannelCommon):
self.channel_buffer, "localvar_set_channel", self.formatted_name()
)
w.buffer_set(self.channel_buffer, "localvar_set_nick", self.team.nick)
+ w.buffer_set(
+ self.channel_buffer,
+ "localvar_set_completion_default_template",
+ "${weechat.completion.default_template}|%(usergroups)|%(emoji)",
+ )
self.buffer_rename_in_progress = True
w.buffer_set(
self.channel_buffer, "short_name", self.formatted_name(style="sidebar")
@@ -3212,6 +3222,11 @@ class SlackThreadChannel(SlackChannelCommon):
self.channel_buffer, "localvar_set_channel", self.formatted_name()
)
w.buffer_set(self.channel_buffer, "localvar_set_server", self.team.name)
+ w.buffer_set(
+ self.channel_buffer,
+ "localvar_set_completion_default_template",
+ "${weechat.completion.default_template}|%(usergroups)|%(emoji)",
+ )
self.buffer_rename_in_progress = True
w.buffer_set(
self.channel_buffer, "short_name", self.formatted_name(style="sidebar")