mirror of
https://github.com/gryf/weechat-replacer.git
synced 2025-12-18 20:10:19 +01:00
Fix for crash regarding version checking.
This commit is contained in:
45
README.rst
45
README.rst
@@ -7,13 +7,14 @@ Installation and configuration
|
|||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
In order to use it, you have to have WeeChat with Python plugin support
|
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
|
compiled in. Than, copy ``replacer.py`` to ``~/.local/share/weechat/python/``.
|
||||||
any of the Python version - both Python2 and Python3 are supported. You can
|
It should run on any version of the Python3.
|
||||||
optionally create symbolic link to this script:
|
|
||||||
|
You can optionally create symbolic link to this script:
|
||||||
|
|
||||||
.. code:: shell-session
|
.. code:: shell-session
|
||||||
|
|
||||||
ln -s ~/.weechat/python/replacer.py ~/.weechat/python/autoload/replacer.py
|
ln -s ~/.local/share/weechat/python/replacer.py ~/.local/share/weechat/python/autoload/replacer.py
|
||||||
|
|
||||||
Next, you need to add this *replacer_plugin* to Weechat completion template, so
|
Next, you need to add this *replacer_plugin* to Weechat completion template, so
|
||||||
it'll looks similar to:
|
it'll looks similar to:
|
||||||
@@ -30,13 +31,19 @@ Next, load the plugin (if you choose to not load it automatically):
|
|||||||
|
|
||||||
Now you all set.
|
Now you all set.
|
||||||
|
|
||||||
|
Note, that even though there is possibility for keeping all files in different
|
||||||
|
place than XDG paths, this case is not tested anymore, and all the issues
|
||||||
|
regarding old files placement will be ignored.
|
||||||
|
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Abbreviations will be stored as json file ``~/.weechat/replacement_map.json``,
|
Abbreviations will be stored as json file
|
||||||
which role is to simply persist dictionary object on the filesystem. To add
|
``$XDG_DATA_HOME/weechat/replacement_map.json``, which usually be
|
||||||
some replacement words, and text which would those words replaced with:
|
``~/.local/share/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::
|
.. code::
|
||||||
|
|
||||||
@@ -46,30 +53,6 @@ and than, when you type ``foo`` word and press ``tab`` key, you should get
|
|||||||
``bar`` word instead.
|
``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
|
License
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class Replacer(object):
|
|||||||
|
|
||||||
# nothing found. so there is no replacement file. let's assume the
|
# nothing found. so there is no replacement file. let's assume the
|
||||||
# right file path.
|
# right file path.
|
||||||
version = weechat.info_get("version_number", "") or 0
|
version = int(weechat.info_get("version_number", "")) or 0
|
||||||
if version < 0x3020000: # < 3.2.0
|
if version < 0x3020000: # < 3.2.0
|
||||||
path = '%h/' + map_file
|
path = '%h/' + map_file
|
||||||
return weechat.string_eval_path_home(path, {}, {}, {})
|
return weechat.string_eval_path_home(path, {}, {}, {})
|
||||||
|
|||||||
Reference in New Issue
Block a user