You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
6593dab643 | 8 months ago | |
---|---|---|
.gitignore | 5 years ago | |
README.md | 2 years ago | |
code_select.py | 8 months ago |
README.md
Qute Code Hint
A small qutebrowser userscript for copying code snippets on web pages to the clipboard.
Example
Installation
- Download the script:
wget https://raw.githubusercontent.com/LaurenceWarne/qute-code-hint/master/code_select.py -O ~/.local/share/qutebrowser/userscripts/code_select.py
- In your qutebrowser config file create a new custom group for code:
c.hints.selectors["code"] = [
# Selects all code tags whose direct parent is not a pre tag
":not(pre) > code",
"pre"
]
- Bind the userscript using a keybinding of your choice:
...
'<ctrl-#>': 'hint code userscript code_select.py',
...
- Optionally install the python pyperclip module for better multiline copying:
pip3 install pyperclip --user
Pyperclip doesn't work on wayland so you can use pyclip instead:
pip3 install pyclip
Multiline Copying
Without pyperclip/pyclip the default behaviour for code snippets spanning multiple lines is to join them all on one line, with semicolons separating the previously seperate lines.