1
0
mirror of https://github.com/gryf/weechat-replacer.git synced 2026-03-17 07:23:33 +01:00
Files
weechat-replacer/README.rst
gryf 9c406727e3 Adapt to the upcoming way for WeeChat store configuration.
In version of 3.2 of WeeChat, the default way of storing the
configuration and data, will be the XDG one. Let's adopt to this. Map
file will be stored on different location depending of the version of
weechat, but also, if mapping file would be spotted on one of the
defined locations, it would be used. Whatever version of the weechat you
have preferences are:

$XDG_DATA_HOME/weechat/replacement_map.json
$XDG_CONFIG_HOME/weechat/replacement_map.json
~/.weechat/weechat/replacement_map.json

whatever $XDG_somethinig is pointed to, or where
weechat_config_dir/weechat_data_dir are pointing. Those values are
retrieved from WeeChat, so you should know, where the replacement_map
should go.
2021-05-13 21:56:57 +02:00

77 lines
2.3 KiB
ReStructuredText
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
weechat-replacer
================
WeeChat plugin for replacing user defined keywords with specified text.
Installation and configuration
------------------------------
In order to use it, you have to have WeeChat with Python plugin support
compiled in. Than, copy ``replacer.py`` to ``~/.weechat/python/``. You can use
any of the Python version - both Python2 and Python3 are supported. You can
optionally create symbolic link to this script:
.. code:: shell-session
ln -s ~/.weechat/python/replacer.py ~/.weechat/python/autoload/replacer.py
Next, you need to add this *replacer_plugin* to Weechat completion template, so
it'll looks similar to:
.. code::
/set weechat.completion.default_template "%(nicks)|%(irc_channels)|%(replacer_plugin)"
Next, load the plugin (if you choose to not load it automatically):
.. code::
/python load replacer.py
Now you all set.
Usage
-----
Abbreviations will be stored as json file ``~/.weechat/replacement_map.json``,
which role is to simply persist dictionary object on the filesystem. To add
some replacement words, and text which would those words replaced with:
.. code::
/replacer add foo bar
and than, when you type ``foo`` word and press ``tab`` key, you should get
``bar`` word instead.
Upgrade to WeeChat 3.2
----------------------
Starting from WeeChat 3.2 full XDG paths were implemented, so that there
potentially will be a need to move your replacement definition file to move to
the new location.
For now, you can do nothing, replacer data file will be still looked in old
location, or you can move it to the new location.
If you decide to the migration, default location for the replacement map
file will be the ``$weechat_data_dir`` which in most of the cases would be
``~/.local/share/weechat``, unless you;re using ``--dir`` or ``--temp-dir``
weechats params.
Anyway, if you plan to do the full migration to XDG, and you had your
replacement definition file in ``~/.weechat/replacement_map.json``, and want to
move to the XDG location, than you'll want to move your configuration to
``$XDG_DATA_HOME/weechat``, which usually is ``~/.local/share/weechat`` before
removing old location. Note, that migrating instructions only applies to the
replacer plugin. For WeeChat itself, you'll need to consult WeeChat
documentation.
License
-------
This plugin is on Apache 2 license. See LICENSE for details.