GermainZ / kitty-weechat-hints

Kitty URL kitten for URLs in WeeChat that tries to take into account line wraps (without having to enter raw mode).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python 3.9 License: GPL v3 Code style: black

Description

A kitty kitten that aims to act like the native URL hints kitten (bound to ctrl+shift+e by default), while supporting WeeChat's line wrapping for URLs. The goal is to be able to use URL hints directly without having to go into WeeChat's raw mode (bound to meta+l by default) first.

Dependencies

… as well as kitty and WeeChat.

Screenshots

Before: using kitty's native URL hints kitten, wrapped URLs are not detected/opened correctly.
Before

After: using this script, wrapped URLs are detected/opened correctly. After

Usage instructions

In WeeChat, weechat.look.prefix_suffix and weechat.look.separator_vertical must be set to the same value. Additionally, the WEECHAT_SEPARATOR variable in the weechat_hints.py script must be updated to reflect that value.

Download and place the script (weechat_hints.py) in the ~/.config/kitty/ directory, for example:

cd ~/.config/kitty/
wget 'https://github.com/GermainZ/kitty-weechat-hints/raw/master/weechat_hints.py'

Once that is done, kitty must be launched as such: kitty -o 'map kitty_mod+e kitten hints --customize-processing weechat_hints.py' weechat.

The shortcut can be customized, for example map f1 can be used instead to keep the original kitten intact as a backup, and make the WeeChat-aware one available by pressing the F1 key.

Notes

The script has to make certain assumptions, and may not work correctly if your WeeChat layout is vastly different or for specific messages. It should, however, provide a starting point that you can adapt.

About

Kitty URL kitten for URLs in WeeChat that tries to take into account line wraps (without having to enter raw mode).

License:GNU General Public License v3.0


Languages

Language:Python 100.0%