From ce6be946d024aa55a15d576388d05f90be671cf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Gon=C3=A7alves?= Date: Sat, 8 Oct 2022 12:40:19 +0200 Subject: Sat Oct 8 12:40:19 PM CEST 2022 --- .bin/_music | 70 +++++++ .bin/ag-status | 19 +- .bin/bck-create | 21 ++ .bin/ccurse | 11 -- .bin/ccurse-ical | 8 - .bin/clear-efi-suspend | 10 - .bin/create-local-backup | 24 --- .bin/dot-bootstrap | 30 ++- .bin/dot-sync | 10 +- .bin/get-mailbox-imap | 69 ------- .bin/get-mailbox-local | 11 -- .bin/music | 174 +++++++++------- .bin/nmutt | 8 +- .bin/pipx-sync | 12 -- .bin/poetry-clean-init | 12 ++ .bin/qb | 4 +- .bin/se-plan | 6 + .bin/start-org | 25 --- .bin/synchronize-pub-dots | 1 + .bin/x11-config | 3 +- .bin/x11-screen | 8 +- .bin/yubikey-reset | 20 -- .config/calcurse/keys | 1 + .config/dot/term-color-light | 2 +- .config/gopass/config.yml | 2 +- .config/i3/config | 2 +- .config/neomutt/neomuttrc | 61 +++--- .config/neomutt/neomuttrc.back | 132 ------------- .config/newsboat/config | 8 +- .config/nvim/after/ftplugin/dart.lua | 4 + .config/nvim/after/ftplugin/markdown.lua | 30 +++ .config/nvim/after/ftplugin/python.lua | 4 + .config/nvim/after/ftplugin/yaml.lua | 6 + .config/nvim/after/queries/python/highlights.scm | 3 + .config/nvim/colors/colorscheme.vim | 9 + .config/nvim/init.lua | 1 + .config/nvim/init.old.vim | 218 --------------------- .config/nvim/lua/diagnostic.lua | 45 +++++ .config/nvim/lua/keymaps.lua | 19 +- .config/nvim/lua/lsp.lua | 6 +- .config/nvim/lua/plugins.lua | 164 ---------------- .config/nvim/lua/plugins/aerial.lua | 32 +++ .config/nvim/lua/plugins/bufresize.lua | 1 + .config/nvim/lua/plugins/cmp.lua | 26 +++ .config/nvim/lua/plugins/dap.lua | 21 ++ .config/nvim/lua/plugins/diffview.lua | 4 + .config/nvim/lua/plugins/gitsigns.lua | 14 ++ .config/nvim/lua/plugins/indent-guides.lua | 11 ++ .config/nvim/lua/plugins/indent-o-matic.lua | 14 ++ .config/nvim/lua/plugins/init.lua | 93 +++++++++ .config/nvim/lua/plugins/lspconfig.lua | 82 ++++++++ .config/nvim/lua/plugins/sniprun.lua | 3 + .config/nvim/lua/plugins/telescope.lua | 25 +++ .config/nvim/lua/plugins/treesitter.lua | 18 ++ .config/nvim/lua/plugins/which-key.lua | 13 ++ .config/nvim/lua/plugins/zk.lua | 3 + .config/nvim/lua/settings.lua | 38 +++- .config/pipewire/pipewire-pulse.sh | 16 +- .config/qutebrowser/config.py | 94 ++++++--- .../greasemonkey/fandom-to-breezewiki.js | 21 ++ .../qutebrowser/greasemonkey/gensdeconfiance.js | 8 + .config/qutebrowser/greasemonkey/gitlab.js | 18 ++ .config/qutebrowser/greasemonkey/glassdoor.js | 3 +- .config/qutebrowser/greasemonkey/google.js | 13 ++ .config/qutebrowser/greasemonkey/imgur-to-imgin.js | 2 +- .config/qutebrowser/greasemonkey/imgur-to-rimgo.js | 8 + .../greasemonkey/instagram-to-bibliogram.js | 3 +- .config/qutebrowser/greasemonkey/linkedin.js | 59 ++++++ .config/qutebrowser/greasemonkey/minimal-css.js | 16 -- .config/qutebrowser/greasemonkey/rarbg.js | 12 ++ .config/qutebrowser/greasemonkey/teddit.js | 23 +++ .config/qutebrowser/greasemonkey/yewtube.js | 9 + .config/tmux/tmux.conf | 2 + .config/user-dirs.dirs | 13 +- .mbsyncrc | 4 +- .weechat/buflist.conf | 10 +- .weechat/fset.conf | 2 +- .weechat/logger.conf | 2 +- .weechat/weechat.conf | 28 ++- .xinitrc.dwm | 8 +- .zshrc | 17 +- 81 files changed, 1122 insertions(+), 940 deletions(-) create mode 100755 .bin/_music create mode 100755 .bin/bck-create delete mode 100755 .bin/ccurse delete mode 100755 .bin/ccurse-ical delete mode 100755 .bin/clear-efi-suspend delete mode 100755 .bin/create-local-backup delete mode 100755 .bin/get-mailbox-imap delete mode 100755 .bin/get-mailbox-local delete mode 100755 .bin/pipx-sync create mode 100755 .bin/poetry-clean-init create mode 100755 .bin/se-plan delete mode 100755 .bin/start-org delete mode 100755 .bin/yubikey-reset delete mode 100755 .config/neomutt/neomuttrc.back create mode 100755 .config/nvim/after/ftplugin/dart.lua create mode 100755 .config/nvim/after/queries/python/highlights.scm delete mode 100755 .config/nvim/init.old.vim create mode 100755 .config/nvim/lua/diagnostic.lua delete mode 100755 .config/nvim/lua/plugins.lua create mode 100755 .config/nvim/lua/plugins/aerial.lua create mode 100755 .config/nvim/lua/plugins/bufresize.lua create mode 100755 .config/nvim/lua/plugins/cmp.lua create mode 100755 .config/nvim/lua/plugins/dap.lua create mode 100755 .config/nvim/lua/plugins/diffview.lua create mode 100755 .config/nvim/lua/plugins/gitsigns.lua create mode 100755 .config/nvim/lua/plugins/indent-guides.lua create mode 100755 .config/nvim/lua/plugins/indent-o-matic.lua create mode 100755 .config/nvim/lua/plugins/init.lua create mode 100755 .config/nvim/lua/plugins/lspconfig.lua create mode 100755 .config/nvim/lua/plugins/sniprun.lua create mode 100755 .config/nvim/lua/plugins/telescope.lua create mode 100755 .config/nvim/lua/plugins/treesitter.lua create mode 100755 .config/nvim/lua/plugins/which-key.lua create mode 100755 .config/nvim/lua/plugins/zk.lua create mode 100755 .config/qutebrowser/greasemonkey/fandom-to-breezewiki.js create mode 100755 .config/qutebrowser/greasemonkey/gensdeconfiance.js create mode 100755 .config/qutebrowser/greasemonkey/gitlab.js create mode 100755 .config/qutebrowser/greasemonkey/google.js create mode 100755 .config/qutebrowser/greasemonkey/imgur-to-rimgo.js create mode 100755 .config/qutebrowser/greasemonkey/linkedin.js delete mode 100755 .config/qutebrowser/greasemonkey/minimal-css.js create mode 100755 .config/qutebrowser/greasemonkey/rarbg.js create mode 100755 .config/qutebrowser/greasemonkey/teddit.js create mode 100755 .config/qutebrowser/greasemonkey/yewtube.js diff --git a/.bin/_music b/.bin/_music new file mode 100755 index 0000000..6ef5ef8 --- /dev/null +++ b/.bin/_music @@ -0,0 +1,70 @@ +#!/bin/sh + + +MUSIC_DIR="${HOME}/music" +MUSIC_LIST= +MUSIC_FILE= +MUSIC_YT_OPTIONS= + +log() { + echo "[${0} ] ${@}" +} + +main() { + # arguments + while getopts "c:" arg; do + case "${arg}" in + c) + MUSIC_FILE="${OPTARG}" + ;; + h) + exit 0 + ;; + esac + done + + # ensure parameters are correct + [ ! -f "${MUSIC_FILE}" ] && exit 1 + + + while read -r line; do + + # skip comments + line=$(echo ${line} | grep -v -e "^$" -e "^#") + [ -z "${line}" ] && continue + + # retrieve playlist params + url=$(echo "${line}" | cut -d " " -f 1) + dir=$(echo "${line}" | cut -d " " -f 2) + + dir="${MUSIC_DIR}/${dir}" + + [ -d "${dir}" ] && + log "${dir}: directory already exists" && + continue + + mkdir "${dir}" + log "${dir} ${url}: download" + + yt-dlp --rm-cache-dir >/dev/null + yt-dlp \ + --extract-audio \ + --audio-format mp3 \ + --prefer-ffmpeg \ + --audio-quality 0 \ + --embed-thumbnail \ + --metadata-from-title "%(artist)s - %(title)s" \ + --no-warnings \ + --ignore-errors \ + --no-overwrites \ + --continue \ + --add-metadata \ + --user-agent "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" \ + --output "${dir}/'%(title)s.%(ext)s'" \ + "${url}" + + + done < "${MUSIC_FILE}" +} + +main ${@} diff --git a/.bin/ag-status b/.bin/ag-status index 3970e54..abd2fff 100755 --- a/.bin/ag-status +++ b/.bin/ag-status @@ -6,10 +6,13 @@ __cleanup_value() { uname=$(uname) +status="" + battery="" battery_status="" time="" volume="" +vpn="" while true; do case "${uname}" in @@ -24,8 +27,9 @@ while true; do ;; Linux) battery=$(acpi -b | - cut -d " " -f 4 | - cut -d "%" -f 1) + tr -s " " "\n" | + grep "%" | + sed 's/[%,]//g') battery_status=$(acpi -a | tr -s " " | cut -d " " -f 3) @@ -33,18 +37,25 @@ while true; do __cleanup_value) if $(pamixer --get-mute); then - volume_status="__mute__" + volume="%mute" fi ;; esac - time=$(date +%Y-%m-%dT%H:%M:%S) status="VOL: ${volume}%" + vpn="" + ! wg && vpn="wireguard" + pgrep openvpn && vpn="openvpn" + if [ -n "${vpn}" ]; then + status="${status} | VPN: ${vpn}" + fi + if [ -n "${battery}" ]; then status="${status} | BATTERY ${battery}%" fi + time=$(date +%Y-%m-%dT%H:%M:%S) status="${status} | DATE: ${time}" echo "${status}" diff --git a/.bin/bck-create b/.bin/bck-create new file mode 100755 index 0000000..9714af6 --- /dev/null +++ b/.bin/bck-create @@ -0,0 +1,21 @@ +#!/bin/sh + +set -xe + +directories="${HOME}/docs + ${HOME}/git.rgoncalves.se + ${HOME}/.local/share/gopass + ${HOME}/.local/share/mail + ${HOME}/.local/share/yadm + ${HOME}/.local/share/zk" + +pgp_id=$(gpg --list-secret-keys | grep -A 1 sec | tail -n 1 | tr -d " ") +output_name="$(date -u +"%Y-%m-%dT%H_%M_%S%Z").tar.pgp" + +if [ -d "${1}" ]; then + output_name="${1}/${output_name}" +elif [ -f "${1}" ] || [ "${1}" ]; then + output_name="${1}" +fi + +tar cvf - ${directories} | lz4 | gpg -e -z 0 -r "${pgp_id}" > "${output_name}" diff --git a/.bin/ccurse b/.bin/ccurse deleted file mode 100755 index 6377bb0..0000000 --- a/.bin/ccurse +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -default_calendar="personal" -data_dir="${HOME}/docs/calendar" - -for calendar; do true; done -args=$(echo ${@} | rev | cut -d " " -f 2- | rev) - -exec calcurse -C "${HOME}/.config/calcurse" \ - -D "${data_dir}/${last:-${default_calendar}}" \ - ${args} diff --git a/.bin/ccurse-ical b/.bin/ccurse-ical deleted file mode 100755 index d5c6e90..0000000 --- a/.bin/ccurse-ical +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -set -xe - -[ "${1}" ] -[ "${2}" ] - -ccurse diff --git a/.bin/clear-efi-suspend b/.bin/clear-efi-suspend deleted file mode 100755 index 9086ef3..0000000 --- a/.bin/clear-efi-suspend +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -set -xe - -mkdir -p /dev/pstore -mount -t pstore pstore /dev/pstore -ls /dev/pstore -rm -f /dev/pstore/* - -rm /sys/firmware/efi/efivars/dump-type0-* diff --git a/.bin/create-local-backup b/.bin/create-local-backup deleted file mode 100755 index 4e4cb1b..0000000 --- a/.bin/create-local-backup +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -set -xe - -source_directories="./git.rgoncalves.se/ - ./ - " - -out_dir=$(readlink -f "${1}") - -[ -d "${out_dir}" ] - -exit -rsync -hvrPt \ - --delete-after \ - --fuzzy \ - --prune-empty-dirs \ - --include "*.pdf" \ - --include "*.epub" \ - --include "*.png" \ - --include "*.jpg" \ - --include "*/" \ - --exclude "*" \ - "${src_dir}/" "${out_dir}/" diff --git a/.bin/dot-bootstrap b/.bin/dot-bootstrap index 766eaf1..0da52d0 100755 --- a/.bin/dot-bootstrap +++ b/.bin/dot-bootstrap @@ -2,17 +2,27 @@ set -x -e -directories="git \ - downloads \ - .cache/dot \ - .cache/neomutt \ - .local/bin \ - .local/share/dot \ - .mail" - +# dotfiles setup remote=$(yadm remote | head -n 1) yadm branch --set-upstream-to="${remote}/trunk" trunk -for directory in ${directories}; do mkdir -p "${HOME}/${directory}"; done +# directory structure +for directory in "${HOME}/.cache/dot \ + ${HOME}/.cache/neomutt \ + ${HOME}/.local/bin \ + ${HOME}/.local/share/dot \ + ${HOME}/.mail + ${HOME}/downloads \ + ${HOME}/git \ + ${HOME}/mnt \ + ${HOME}/tmp \ + ${ZK_NOTEBOOK_DIR}"; do + mkdir -p "${directory}" +done + +# default venvs +venv_root_dir="${HOME}/.local/venv" +mkdir -p "${venv_root_dir}" -notmuch new +python -m venv "${venv_root_dir}/weechat" +"${venv_root_dir}/weechat/bin/pip" install websocket-client diff --git a/.bin/dot-sync b/.bin/dot-sync index 7f4d490..0643086 100755 --- a/.bin/dot-sync +++ b/.bin/dot-sync @@ -13,13 +13,21 @@ yadm add \ $HOME/.config/neomutt \ $HOME/.config/newsboat \ $HOME/.config/nvim \ - $HOME/.config/qutebrowser/{*.py,greasemonkey} \ + $HOME/.config/qutebrowser/*.py \ + $HOME/.config/qutebrowser/bookmarks \ + $HOME/.config/qutebrowser/greasemonkey \ + $HOME/.config/qutebrowser/quickmarks \ + $HOME/.config/qutebrowser/userscripts/*.py \ $HOME/.config/sway \ + $HOME/.config/task \ $HOME/.config/yadm \ $HOME/.config/waybar \ + $HOME/.config/zk \ $HOME/.public-keys yadm push +nvim --headless -c "PaqSync" -c "TSInstall all" -c "TSUpdate" -c "qa" + yadm commit -m "$(date +%Y-%m-%dT%H:%M:%S)" yadm push diff --git a/.bin/get-mailbox-imap b/.bin/get-mailbox-imap deleted file mode 100755 index b78752d..0000000 --- a/.bin/get-mailbox-imap +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env python3 - -import imaplib -import sys - - -def get_boxes(list): - """ Retrieve and decode all mailboxes. """ - return [box.decode('utf-8').rsplit(' ')[-1] for box in list] - - -def flatten_output(list): - """ Print all boxes with a flattened output. """ - return ''.join([f"+'{box}' " for box in list]) - - -def sort_mailboxes(mailboxes): - """ Sort boxes list according to a predefined order. """ - - order = [ - "INBOX", - "Unread", - "Drafts", - "Sent", - "Spam", - "Trash", - "Junk", - "Archive" - ] - - mailboxes = sorted(mailboxes) - - # sort based on predefined order - output = [] - for exp in order: - matching = [s for s in mailboxes if exp in s] - output.extend(matching) - - # ensure all retrieved boxes are present - for box in mailboxes: - if box not in output: - output.append(box) - - return output - - -def main(): - """ - Retrieve, sort, and pretty print for neomutt - """ - - # user information - remote = sys.argv[1] - username = sys.argv[2] - password = sys.argv[3] - - # connection - mail = imaplib.IMAP4_SSL(remote) - mail.login(username, password) - - # parse folders output - bxs = sort_mailboxes(get_boxes(mail.list()[1])) - - # oneline pretty-print for neomutt - print(flatten_output(bxs), end=' ') - - -if __name__ == "__main__": - main() diff --git a/.bin/get-mailbox-local b/.bin/get-mailbox-local deleted file mode 100755 index b579016..0000000 --- a/.bin/get-mailbox-local +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -root_dir=$(readlink -f ${1}) - -mailboxes=$(find "${1}" -name "cur" | - xargs dirname | - sed "s@$root_dir/@+@g" | - grep "${2:-.*}" | - sort) - -echo ${mailboxes} diff --git a/.bin/music b/.bin/music index 6ef5ef8..a14aae9 100755 --- a/.bin/music +++ b/.bin/music @@ -1,70 +1,104 @@ -#!/bin/sh - - -MUSIC_DIR="${HOME}/music" -MUSIC_LIST= -MUSIC_FILE= -MUSIC_YT_OPTIONS= - -log() { - echo "[${0} ] ${@}" -} - -main() { - # arguments - while getopts "c:" arg; do - case "${arg}" in - c) - MUSIC_FILE="${OPTARG}" - ;; - h) - exit 0 - ;; - esac - done - - # ensure parameters are correct - [ ! -f "${MUSIC_FILE}" ] && exit 1 - - - while read -r line; do - - # skip comments - line=$(echo ${line} | grep -v -e "^$" -e "^#") - [ -z "${line}" ] && continue - - # retrieve playlist params - url=$(echo "${line}" | cut -d " " -f 1) - dir=$(echo "${line}" | cut -d " " -f 2) - - dir="${MUSIC_DIR}/${dir}" - - [ -d "${dir}" ] && - log "${dir}: directory already exists" && - continue - - mkdir "${dir}" - log "${dir} ${url}: download" - - yt-dlp --rm-cache-dir >/dev/null - yt-dlp \ - --extract-audio \ - --audio-format mp3 \ - --prefer-ffmpeg \ - --audio-quality 0 \ - --embed-thumbnail \ - --metadata-from-title "%(artist)s - %(title)s" \ - --no-warnings \ - --ignore-errors \ - --no-overwrites \ - --continue \ - --add-metadata \ - --user-agent "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" \ - --output "${dir}/'%(title)s.%(ext)s'" \ - "${url}" - - - done < "${MUSIC_FILE}" -} - -main ${@} +#!/usr/bin/python3 + +import os +import sys +import yt_dlp +from dataclasses import dataclass + + +def _match_filter(info: dict, *, incomplete) -> str | None: + _duration = info.get("duration") + _duration_min = 60 + + if _duration and int(_duration) < _duration_min: + return "Duration too short: < _duration_min" + + return None + + +@dataclass(frozen=True) +class Collection: + """A music collection.""" + + title: str + links: frozenset[str] + + def __eq__(self, other) -> bool: + if isinstance(other, Collection): + return self.title == other.title + raise NotImplementedError + + +def parse_raw_to_collections(raw_data: list[str]) -> frozenset[Collection]: + collections: set[Collection] = set() + _collection_data: list[str] = [] + + for index, line in enumerate(raw_data): + if line.startswith("#"): + continue + elif line == "" or index + 1 == len(raw_data): + if len(_collection_data) == 0: + continue + + collections.add( + Collection(_collection_data[0], frozenset(_collection_data[1:])) + ) + _collection_data.clear() + else: + _collection_data.append(line) + + return frozenset(collections) + + +def get_ytdlp_options(output_dir: str) -> dict: + return { + "format": "bestaudio/best", + "match_filter": _match_filter, + "postprocessors": [ + { + "key": "FFmpegExtractAudio", + #"preferredcodec": "m4a", + }, + { + "key": "FFmpegMetadata", + "add_metadata": True, + }, + { + "key": "EmbedThumbnail", + "already_have_thumbnail": False, + }, + ], + "outtmpl": f"{output_dir}/%(title)s.%(ext)s", + "restrictfilenames": True, + "ignoreerrors": True, + } + + +def download_collection(collection: Collection, parent_dir: str) -> None: + output_dir = os.path.join(parent_dir, collection.title) + + if os.path.isdir(output_dir): + return + + os.makedirs(output_dir, exist_ok=True) + + with yt_dlp.YoutubeDL(get_ytdlp_options(output_dir)) as downloader: + downloader.download(collection.links) + + +def main() -> int: + # input handling + if len(sys.argv) != 2: + return 1 + + with open(sys.argv[1], "r") as file: + filedata = file.read().splitlines() + + for collection in parse_raw_to_collections(filedata): + download_collection(collection, os.getcwd()) + + return 0 + + +if __name__ == "__main__": + exit(main()) diff --git a/.bin/nmutt b/.bin/nmutt index 0ee2822..a45d33f 100755 --- a/.bin/nmutt +++ b/.bin/nmutt @@ -1,6 +1,6 @@ #!/bin/sh -NMUTT_CONFIGURATION_FILE="${HOME}/.config/neomutt/personal" +NMUTT_CONFIGURATION_FILE="${HOME}/.config/neomutt/credentials-personal" get_param() { grep "${2}" "${1}" | @@ -15,5 +15,7 @@ export MAIL_SERVER=$(get_param "${NMUTT_CONFIGURATION_FILE}" "my_server") export MAIL_USERNAME=$(get_param "${NMUTT_CONFIGURATION_FILE}" "my_user") export MAIL_PASSWORD=$(get-pass "mailbox") -#notmuch new -exec neomutt ${@} +notmuch new >/dev/null 2>&1 & +neomutt ${@} + +notmuch new >/dev/null 2>&1 & diff --git a/.bin/pipx-sync b/.bin/pipx-sync deleted file mode 100755 index 181768e..0000000 --- a/.bin/pipx-sync +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -set -x -e - -packages="pywal - ipython" - -pipx upgrade-all - -for package in ${packages}; do - pipx install "${package}" || true -done diff --git a/.bin/poetry-clean-init b/.bin/poetry-clean-init new file mode 100755 index 0000000..ad7da81 --- /dev/null +++ b/.bin/poetry-clean-init @@ -0,0 +1,12 @@ +#!/bin/sh + +set -xe + + +poetry env info -p +test -x "${1}" + +rm -r $(poetry env info -p) poetry.lock +poetry env use "${1}" +poetry update --dry-run +poetry install diff --git a/.bin/qb b/.bin/qb index 3caf57e..dd30091 100755 --- a/.bin/qb +++ b/.bin/qb @@ -109,11 +109,11 @@ def main(): QB_PROFILE_TAG = QB_PROFILE[0].lower() # Ensure directory existence - for dir in [QB_PROFILES_DIR, QB_PROFILE_DIR, QB_PROFILE_DIR_CONFIG]: + for dir in (QB_PROFILES_DIR, QB_PROFILE_DIR, QB_PROFILE_DIR_CONFIG): bypass_file_exists(os.mkdir, dir) # Ensure common files are shared with other profiles - for file in ['config.py', 'bookmarks', 'greasemonkey']: + for file in ('config.py', 'bookmarks', 'greasemonkey', 'userscripts'): bypass_file_exists(os.symlink, f'{QB_DIR}/{file}', f'{QB_PROFILE_DIR_CONFIG}/{file}') diff --git a/.bin/se-plan b/.bin/se-plan new file mode 100755 index 0000000..f16a2f7 --- /dev/null +++ b/.bin/se-plan @@ -0,0 +1,6 @@ +#!/bin/sh + +T=$(mktemp) +curl -so $T https://plan.cat/~rgoncalves +$EDITOR $T +curl -su "rgoncalves:$(get-pass plan.cat)" -F "plan=<$T" https://plan.cat/stdin diff --git a/.bin/start-org b/.bin/start-org deleted file mode 100755 index c32b99e..0000000 --- a/.bin/start-org +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -set -xe - -session_name="org" -windows="wchat:weechat - nmutt:neomutt - calcurse:calcurse" - -if [ "${1}" = "-f" ]; then - tmux kill-session -t "${session_name}" -fi - -tmux new-session -s "${session_name}" -d - -for window in ${windows}; do - window_cmd=$(echo "${window}" | cut -d ":" -f 1) - window_name=$(echo "${window}" | cut -d ":" -f 2) - - tmux new-window -n "${window_name}" - tmux send-keys -t "${session_name}:${window_name}" \ - "${window_cmd} " -done - -tmux a -t "${session_name}" diff --git a/.bin/synchronize-pub-dots b/.bin/synchronize-pub-dots index ae018b2..b1f2e7b 100755 --- a/.bin/synchronize-pub-dots +++ b/.bin/synchronize-pub-dots @@ -3,6 +3,7 @@ set -e command -v yadm git +git rev-parse --is-inside-work-tree allowed_patterns="-e ^.bin -e ^.config/alacritty/ diff --git a/.bin/x11-config b/.bin/x11-config index 5230c13..efd47d7 100755 --- a/.bin/x11-config +++ b/.bin/x11-config @@ -11,7 +11,8 @@ synclient_options="TapButton1=1 \ # synaptic if command -v syndaemon; then - pkill syndaemon && syndaemon -RKd -i 0.2 + pkill syndaemon && true + syndaemon -RKd -i 0.1 synclient ${synclient_options} fi diff --git a/.bin/x11-screen b/.bin/x11-screen index ccccda7..ea9e08d 100755 --- a/.bin/x11-screen +++ b/.bin/x11-screen @@ -22,6 +22,12 @@ fi if [ "${hostname}" = "ws-xps01" ]; then xrandr --output eDP1 --mode 3200x1800 - echo a __hidpi fi + +if [ "${hostname}" = "work-01" ]; then + xrandr --output eDP1 --mode 1920x1080 + xrandr --output DP3 --off + xrandr --addmode DP3 1920x1080 + xrandr --output DP3 --mode 1920x1080 --same-as eDP1 +fi diff --git a/.bin/yubikey-reset b/.bin/yubikey-reset deleted file mode 100755 index 4824bc8..0000000 --- a/.bin/yubikey-reset +++ /dev/null @@ -1,20 +0,0 @@ -echo "DESTRUCTIVE !!!" - -sleep 60 - -gpg-connect-agent < noop bind editor "> " quote-char -bind pager c imap-fetch-mail +bind editor ^T complete-query +bind editor complete bind index G last-entry bind index \CR imap-fetch-mail bind index g noop bind index gg first-entry bind index - collapse-thread bind index _ collapse-all +bind pager c imap-fetch-mail bind pager,attach h exit bind attach view-mailcap bind attach l view-mailcap @@ -120,11 +102,20 @@ bind index \CL limit bind pager,browser gg top-page bind pager,browser G bottom-page bind index,pager R group-reply +bind index,pager g group-chat-reply bind index,pager K sidebar-prev bind index,pager J sidebar-next bind index,pager O sidebar-open bind index,pager,browser d half-down bind index,pager,browser u half-up +bind index,pager @ compose-to-sender + +# macro +macro index S "notmuch new" "sync email" # colors color hdrdefault color07 default + +# hooks +account-hook . 'echo `notmuch new >/dev/null 2>&1`' +timeout-hook 'echo "`notmuch new >/dev/null 2>&1`"' diff --git a/.config/neomutt/neomuttrc.back b/.config/neomutt/neomuttrc.back deleted file mode 100755 index 1f85eb8..0000000 --- a/.config/neomutt/neomuttrc.back +++ /dev/null @@ -1,132 +0,0 @@ - -# rgoncalves.se - -# personal informations -set my_password = "" -set my_server = "" -set my_user = "" -source "~/.config/neomutt/personal" - -# IMAP -set imap_user = "$my_user@$my_server" -set imap_pass = "$my_password" -set hostname = "imap.$my_server" -set folder = "imaps://imap.$my_server:993" -#set folder = "~/.mail/personal" - -# SMTP -set smtp_pass = "$my_password" -set smtp_url = "smtps://$my_user@$my_server:$my_password@smtp.$my_server" - -# force tls -set ssl_verify_host = yes -set ssl_force_tls = yes - -# mailboxes -set spoolfile = "+INBOX" -set mbox = "+INBOX" -set postponed = "+Drafts" -set record = "+Sent" -set trash = "+Trash" -set mail_check_stats = yes -set imap_delim_chars = "aa" - -mailboxes `python3 ~/.bin/get-mailbox-imap \ -imap.$MAIL_SERVER \ -$MAIL_USERNAME@$MAIL_SERVER \ -$MAIL_PASSWORD` - -# dl -set mail_check = 90 -set sleep_time = 0 -set timeout = 15 -set beep = no -set edit_headers = yes -set fast_reply = yes -set forward_quote = yes -set include = yes -set pipe_decode = yes -set postpone = no -set recall = no -set reflow_space_quotes = yes -set reply_to = yes -set reverse_name = yes -set reverse_name = yes -set sig_dashes = no -set sort_re = yes - -set charset = "utf-8" -set date_format = "%d.%m.%Y-%H:%M" -set index_format = "%4C %Z %{$date_format} %-15.15L (%?l?%4l&%4c?) %s" -set quote_regex = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+" -set reply_regex = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*" -set send_charset = "utf-8:iso-8859-1:us-ascii" - -set signature = "~/.signature" -set header_cache = "~/.cache/neomutt" -set message_cachedir = "$header_cache" - -# auto_view text/html -# alternative_order text/plain text/html - -# headers -ignore * -unignore from date subject to cc -unignore organization organisation x-mailer: x-newsreader: x-mailing-list: -unignore posted-to: list-id: - -# threads -set sort ="threads" -set sort_aux = "reverse-last-date-received" -set strict_threads ="yes" -set collapse_unread = no - -# sidebar -set sidebar_visible = yes -set sidebar_short_path = yes -set sidebar_sort_method = "unsorted" -set sidebar_delim_chars = "/" -set sidebar_format = "%D %?F?[%F]?%* %4N|%4S" -set sidebar_folder_indent = yes -set sidebar_indent_string = "> " - -# keybinds -bind editor noop -bind editor "> " quote-char -bind pager c imap-fetch-mail -bind index G last-entry -bind index \CR imap-fetch-mail -bind index g noop -bind index gg first-entry -bind index - collapse-thread -bind index _ collapse-all -bind pager,attach h exit -bind attach view-mailcap -bind attach l view-mailcap -bind pager j next-line -bind pager k previous-line -bind pager l view-attachments -bind index D delete-message -bind index U undelete-message -bind index h noop -bind index l display-message -bind browser h goto-parent -bind browser l select-entry -bind index \CL limit -bind pager,browser gg top-page -bind pager,browser G bottom-page -bind index,pager R group-reply -bind index,pager K sidebar-prev -bind index,pager J sidebar-next -bind index,pager O sidebar-open -bind index,pager,browser d half-down -bind index,pager,browser u half-up - -# colors -color hdrdefault color07 default -#color quoted color08 default - -# notmuch -#set virtual_spoolfile = yes -#set nm_query_type = threads -#virtual-mailboxes "INBOX" "notmuch://?query=tag:inbox" diff --git a/.config/newsboat/config b/.config/newsboat/config index c9d9fcd..2766562 100755 --- a/.config/newsboat/config +++ b/.config/newsboat/config @@ -28,8 +28,14 @@ color info color0 color15 color article color15 color0 # multimedia +player "mpv" browser "qutebrowser %u" -macro y set browser "mpv %u" ; open-in-browser ; set browser "qutebrowser %u" +macro m set browser "mpv %u" ; open-in-browser ; set browser "qutebrowser %u" # format feedlist-format "%4i %n %8u %24T | %t" +datetime-format "%b %d" + +# killfile +ignore-mode "display" +ignore-article "*" "( feedlink =~ \"yewtu.be\" and ( title =~ \"#shorts\" or content =~ \"#shorts\" ) )" diff --git a/.config/nvim/after/ftplugin/dart.lua b/.config/nvim/after/ftplugin/dart.lua new file mode 100755 index 0000000..777faa6 --- /dev/null +++ b/.config/nvim/after/ftplugin/dart.lua @@ -0,0 +1,4 @@ +o.colorcolumn = '80' +bo.expandtab = true +bo.shiftwidth = 2 +bo.tabstop = 2 diff --git a/.config/nvim/after/ftplugin/markdown.lua b/.config/nvim/after/ftplugin/markdown.lua index bfcca96..3c7e009 100755 --- a/.config/nvim/after/ftplugin/markdown.lua +++ b/.config/nvim/after/ftplugin/markdown.lua @@ -6,3 +6,33 @@ bo.shiftwidth = 2 bo.formatoptions = 'qc' bo.textwidth = 80 o.colorcolumn = '80' + +if require("zk.util").notebook_root(vim.fn.expand('%:p')) ~= nil then + local function map(...) vim.api.nvim_buf_set_keymap(0, ...) end + local opts = { noremap=true, silent=false } + + map("n", "", "lua vim.lsp.buf.definition()", opts) + map("n", "K", "lua vim.lsp.buf.hover()", opts) + + vim.api.nvim_exec([[ + syn region markdownWikiLink matchgroup=markdownLinkDelimiter + \ start="\[\[" end="\]\]" contains=markdownUrl keepend oneline concealends + syn region markdownLink matchgroup=markdownLinkDelimiter + \ start="\[" end="\]" contains=markdownUrl keepend oneline concealends + syn region markdownLink matchgroup=markdownLinkDelimiter + \ start="(" end=")" contains=markdownUrl keepend contained conceal + syn region markdownLinkText matchgroup=markdownLinkTextDelimiter + \ start="!\=\[\%(\%(\_[^][]\|\[\_[^][]*\]\)*]\%( \=[[(]\)\)\@=" + \ end="\]\%( \=[[(]\)\@=" nextgroup=markdownLink,markdownId + \ skipwhite contains=@markdownInline,markdownLineStart concealends + + " unlet b:current_syntax + syntax include @Yaml syntax/yaml.vim + syntax include @Toml syntax/toml.vim + syntax region yamlFrontmatter start=/\%^---$/ end=/^---$/ + \ keepend contains=@Yaml + syntax region tomlFrontmatter start=/\%^+++$/ end=/^+++$/ + \ keepend contains=@Toml + + ]], true) +end diff --git a/.config/nvim/after/ftplugin/python.lua b/.config/nvim/after/ftplugin/python.lua index b6c54ff..64eb9f0 100755 --- a/.config/nvim/after/ftplugin/python.lua +++ b/.config/nvim/after/ftplugin/python.lua @@ -1 +1,5 @@ o.colorcolumn = '80' + +require"nvim-treesitter.highlight".set_custom_captures { + ["docstring"] = "Comment", +} diff --git a/.config/nvim/after/ftplugin/yaml.lua b/.config/nvim/after/ftplugin/yaml.lua index b89af72..4f9234b 100755 --- a/.config/nvim/after/ftplugin/yaml.lua +++ b/.config/nvim/after/ftplugin/yaml.lua @@ -4,3 +4,9 @@ o.colorcolumn = '80' bo.tabstop = 2 bo.softtabstop = 2 bo.shiftwidth = 2 + + +vim.api.nvim_exec([[ + set is hlsearch ai ic scs + nnoremap :nohls +]], true) diff --git a/.config/nvim/after/queries/python/highlights.scm b/.config/nvim/after/queries/python/highlights.scm new file mode 100755 index 0000000..4b664d4 --- /dev/null +++ b/.config/nvim/after/queries/python/highlights.scm @@ -0,0 +1,3 @@ +(block (expression_statement (string)) @docstring) + +(type) @type diff --git a/.config/nvim/colors/colorscheme.vim b/.config/nvim/colors/colorscheme.vim index 48df51c..e401231 100755 --- a/.config/nvim/colors/colorscheme.vim +++ b/.config/nvim/colors/colorscheme.vim @@ -209,3 +209,12 @@ sign define semshiError text=E> texthl=semshiErrorSign hi VirtColumn cterm=NONE ctermbg=0 ctermfg=2 hi IndentBlankLineChar cterm=NONE ctermbg=0 ctermfg=15 + + + + +" Highlight docstrings as comments, not string. +syn region pythonDocstring start=+^\s*[uU]\?[rR]\?"""+ end=+"""+ keepend excludenl contains=pythonEscape,@Spell,pythonDoctest,pythonDocTest2,pythonSpaceError +syn region pythonDocstring start=+^\s*[uU]\?[rR]\?'''+ end=+'''+ keepend excludenl contains=pythonEscape,@Spell,pythonDoctest,pythonDocTest2,pythonSpaceError + +hi def link pythonDocstring pythonComment diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index eda0497..5abff38 100755 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -5,6 +5,7 @@ cmd = vim.cmd require('settings') require('plugins') +require('diagnostic') require('lsp') require('statusline') require('keymaps') diff --git a/.config/nvim/init.old.vim b/.config/nvim/init.old.vim deleted file mode 100755 index 35630e8..0000000 --- a/.config/nvim/init.old.vim +++ /dev/null @@ -1,218 +0,0 @@ -" nvim configuration ~~ rgoncalves.se - -" vim-plug autoinstall -if empty(glob('~/.local/share/nvim/site/autoload/plug.vim')) - silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs - \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - autocmd VimEnter * PlugInstall --sync | source $MYVIMRC -endif - -" system agnostic detection -let uname = system('uname')[:-2] - -" global configuration -set encoding=utf-8 -set laststatus=2 -set scrolloff=3 -set viminfo= -set mouse=a -set title -set number -set noswapfile -set shell=/bin/sh -set updatetime=2500 -set synmaxcol=300 -set lazyredraw -set ttyfast -set wildoptions= -set autochdir -let sh_minlines=100 -let sh_maxlines=600 - -" filetypes and colorschemes -syntax on -filetype on -filetype plugin on -filetype indent on -colorscheme base - -" keybindings -noremap =j :%!python -m json.tool -noremap =k :%s/-\|-/-+-/g -noremap =l :%s/-+-/-\|-/g -noremap :NERDTreeToggle -noremap :GitGutterCustomToggle -inoremap -inoremap -inoremap -inoremap -" keybindings - omnifunc -inoremap pumvisible() ? "\" : "\" -inoremap pumvisible() ? "\" : "\" -inoremap pumvisible() ? '' : - \ '=pumvisible() ? "\Down>" : ""' -inoremap pumvisible() ? '' : - \ '=pumvisible() ? "\Down>" : ""' -inoremap (pumvisible() ? (col('.') > 1 ? 'i' : 'i') : '') . - \ '=pumvisible() ? "\C-n>\C-p>\Down>" : ""' -inoremap (pumvisible() ? (col('.') > 1 ? 'i' : 'i') : '') . - \ '=pumvisible() ? "\C-n>\C-p>\Down>" : ""' - -let g:polyglot_disabled = ['autoindent', 'sensible'] - -" PLUGINS list -if !empty(glob('~/.local/share/nvim/site/autoload/plug.vim')) - call plug#begin('~/.nvim/plugged/') - " core - Plug 'scrooloose/nerdtree' - " completion - Plug 'w0rp/ale' - " Plug 'davidhalter/jedi-vim' - Plug 'maralla/completor.vim' - " fzf - Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } - Plug 'junegunn/fzf.vim' - " indent - Plug 'nathanaelkane/vim-indent-guides' - Plug 'editorconfig/editorconfig-vim' - Plug 'pangloss/vim-javascript' - Plug 'pearofducks/ansible-vim' - Plug 'sheerun/vim-polyglot' - Plug 'dbeniamine/vim-mail' - Plug 'ap/vim-css-color' - " notes - Plug 'dhruvasagar/vim-table-mode' - Plug 'jceb/vim-orgmode' - " headers and source - Plug 'vim-scripts/a.vim' - Plug 'majutsushi/tagbar' - " git - Plug 'airblade/vim-gitgutter' - Plug 'tpope/vim-fugitive' - Plug 'jreybert/vimagit' - Plug 'junegunn/gv.vim' - " python - Plug 'petobens/poet-v' - call plug#end() -endif - -" indentation -set smarttab -set autoindent -set nocompatible -set tabstop=8 -set shiftwidth=8 -set softtabstop=8 -set noexpandtab -set list lcs=tab:\|\ ". -set fillchars+=vert:\ ". -set ve+=onemore -set list -set shortmess=atToOF - -" plugins settings -let g:ale_sign_error = '' -let g:ale_sign_warning = '' -let g:ale_c_clang_options='-std=gnu99 -Wall' -let g:ale_c_gcc_options='-std=gnu99 -Wall' -let g:ale_sh_shellcheck_options = '-e SC1090 SC2181 -e SC2155' -let g:ale_python_flake8_options = '--ignore=E501' -let g:ale_linters = { 'python': ['bandit', 'flake8'], } - -let g:gitgutter_max_signs = 500 -let g:gitgutter_sign_added = '+' -let g:gitgutter_sign_modified = '~' -let g:gitgutter_sign_removed = '-' -let g:gitgutter_sign_modified_removed = '-' - -let g:indent_guides_enable_on_vim_startup = 0 -let g:indent_guides_auto_colors = 0 -let g:indent_cuides_exclude_filetypes = [ - \'help', - \'terminal' - \] -let g:poetv_executables = ['poetry'] -let g:poetv_auto_activate = 1 - -let g:python_host_prog = system('which python2')[:-2] -let g:python3_host_prog = system('which python3')[:-2] -let g:jedi#auto_initialization = 1 -let g:jedi#popup_on_dot = 0 - -let g:NERDTreeAutoDeleteBuffer = 1 -let g:NERDTreeMinimalUI = 1 -let g:NERDTreeDirArrowExpandable = '+' -let g:NERDTreeDirArrowCollapsible = '-' - -let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*'] -let g:fzf_layout = { 'down': '40%'} -let g:magit_default_fold_level = 2 -let g:sql_type_default = 'pgsql' -let g:table_mode_always_active = 0 - -if uname == 'OpenBSD' - let g:ncm2_pyclang#library_path = '/usr/local/lib/libclang.so.8.1' - let g:completor_python_binary = '/usr/bin/python3' -endif - -" netrw -let g:netrw_banner = 0 -let g:netrw_browse_split = 4 -let g:netrw_liststyle = 3 -let g:netrw_altv = 1 -let g:netrw_winsize = 25 -let g:netrw_list_hide = '\(^\|\s\s\)\zs\.\S\+' - -autocmd BufNewFile,BufReadPost *.{yaml,yml} set filetype=yaml -autocmd BufNewFile,BufReadPost */*ssh/config.d/* set syntax=sshconfig -autocmd BufNewFile,BufReadPost */*ansible*/**/*.yml set filetype=yaml.ansible -autocmd BufNewFile,BufRead ~/.config/i3/config set filetype=i3config -autocmd BufNewFile,BufRead ~/.config/sway/config set filetype=i3config -autocmd BufNewFile,BufRead ~/.config/polybar/config set filetype=dosini -autocmd FileType conf let b:EditorConfig_disable = 1 -autocmd FileType gitcommit let b:EditorConfig_disable = 1 -autocmd FileType java setlocal omnifunc=javacomplete#Complete -autocmd FileType yaml let b:EditorConfig_disable = 1 - -" statusline -set statusline= -set statusline+=\ %f -set statusline+=%m -set statusline+=%= -set statusline+=\ %y -set statusline+=\ %{&fileencoding?&fileencoding:&encoding} -set statusline+=\ [%{&fileformat}\] -set statusline+=\ %p%% -set statusline+=\ %l:%c -set statusline+=\ - -" completion -set omnifunc=syntaxcomplete#Complete -set completeopt=longest,menuone - -" commands -command! PlugSync PlugClean | - \ PlugInstall | - \ UpdateRemotePlugins -command! GitGutterCustomToggle GitGutterLineHighlightsToggle | - \ GitGutterLineNrHighlightsToggle -command! Gblame Git blame - -" cnoremap :call CommandCallback() - -function! s:SyncColorcolumnColorscheme() - let l:length = '/\%' . string(&colorcolumn + 1) . 'v.\+/' - execute 'match' 'OverLength' l:length -endfunction - -function! s:CommandCallback() - let l:last_command = @: - - if l:last_command =~ 'set colorcolumn' - call s:SyncColorcolumnColorscheme() - endif -endfunction - -function! s:Init() - call s:SyncColorcolumnColorscheme() -endfunction diff --git a/.config/nvim/lua/diagnostic.lua b/.config/nvim/lua/diagnostic.lua new file mode 100755 index 0000000..0eb4e91 --- /dev/null +++ b/.config/nvim/lua/diagnostic.lua @@ -0,0 +1,45 @@ +local original_diagnostic_set = vim.diagnostic.set +local disabled_diagnostics_patterns = { + -- { 'mypy', 'Library stubs not installed' }, + -- { 'mypy', 'Cannot find implementation or library stub' }, + -- { 'mypy', 'Skipping analyzing' } +} + +local function is_diagnostic_disabled(diagnostic, disabled_diagnostic_patterns) + return string.find(diagnostic.source, disabled_diagnostic_patterns[1]) and + string.find(diagnostic.message, disabled_diagnostic_patterns[2]) +end + +local function is_diagnostic_enabled(diagnostic, disabled_diagnostic_patterns) + local found_diagnostic = true + for _, disabled_diagnostic_patterns in pairs(disabled_diagnostics_patterns) do + if is_diagnostic_disabled(diagnostic, disabled_diagnostic_patterns) then + found_diagnostic = false + end + end + return found_diagnostic +end + +vim.diagnostic.set = function(namespace, bufnr, diagnostics, opts) + local filtered_diagnostics = {} + for _, diagnostic in pairs(diagnostics) do + if is_diagnostic_enabled(diagnostic, disabled_diagnostics_patterns) then + table.insert(filtered_diagnostics, diagnostic) + end + end + original_diagnostic_set(namespace, bufnr, filtered_diagnostics, opts) +end + +vim.diagnostic.config{ + underline = false, + signs = true, + severity_sort = true, + update_in_insert = false, + float = { + source = 'always', + }, + virtual_text = { + prefix = '▒ ', + spacing = 8, + }, +} diff --git a/.config/nvim/lua/keymaps.lua b/.config/nvim/lua/keymaps.lua index 070ddc9..5243d8b 100755 --- a/.config/nvim/lua/keymaps.lua +++ b/.config/nvim/lua/keymaps.lua @@ -1,24 +1,9 @@ ---[[ --- Keymaps ---]] - local map = vim.api.nvim_set_keymap local cmd = vim.cmd - -options = {noremap=true} +local options = { noremap=true } map('i', '', '', options) map('i', '', '', options) map('i', '', '', options) map('i', '', '', options) -map('i', '', '', options) - -map('', '', ':NvimTreeToggle', options) - ---[[ -map('n', '', '', 'compe#complete()', options) -map('n', '', '', 'compe#confirm(\'\'', options) -map('n', '', '', 'compe#close(\'\'', options) -map('n', '', '', 'compe#scroll({\'delta\': +4}', options) -map('n', '', '', 'compe#scroll({\'delta\': -4}', options) ---]] +map('i', '', ' :noh', options) diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua index 95d9409..4e0624c 100755 --- a/.config/nvim/lua/lsp.lua +++ b/.config/nvim/lua/lsp.lua @@ -1,9 +1,6 @@ ---[[ --- lsp ---]] - local lsp = vim.lsp +--[[ lsp.handlers["textDocument/publishDiagnostics"] = lsp.with( lsp.diagnostic.on_publish_diagnostics, { @@ -15,3 +12,4 @@ lsp.handlers["textDocument/publishDiagnostics"] = lsp.with( signs = true, } ) +--]] diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua deleted file mode 100755 index bb7a7b4..0000000 --- a/.config/nvim/lua/plugins.lua +++ /dev/null @@ -1,164 +0,0 @@ --- bootstrap paq -local install_path = vim.fn.stdpath('data')..'/site/pack/paqs/start/paq-nvim' -if vim.fn.empty(vim.fn.glob(install_path)) > 0 then - vim.fn.system({ - 'git', 'clone', '--depth=1', - 'https://github.com/savq/paq-nvim.git', - install_path - }) - vim.cmd 'packadd paq-nvim' -end - --- enable paq -vim.cmd 'packadd paq-nvim' - --- plugins -require('paq') { - {'savq/paq-nvim'}; - - -- treesiter / lsp - {'nvim-treesitter/playground'}; - {'nvim-treesitter/nvim-treesitter-textobjects'}; - { - 'nvim-treesitter/nvim-treesitter', - run=vim.api.nvim_command(':silent! TSUpdate') - }; - { - 'neovim/nvim-lspconfig', - run='python3 -m pipx install python-lsp-server[all]' - }; - - -- utils - {'folke/trouble.nvim'}; - {'hrsh7th/nvim-compe'}; - - {'hrsh7th/cmp-nvim-lsp'}; - {'hrsh7th/cmp-cmdline'}; - {'hrsh7th/cmp-buffer'}; - {'hrsh7th/cmp-path'}; - {'hrsh7th/cmp-calc'}; - {'hrsh7th/nvim-cmp'}; - - -- indent - {'lewis6991/gitsigns.nvim'}; - {'glepnir/indent-guides.nvim'}; - {'darazaki/indent-o-matic'}; - - -- dep - {'nvim-lua/plenary.nvim'}; -} - --- treesitter - -local parser_configs = require('nvim-treesitter.parsers').get_parser_configs() - -require('nvim-treesitter.configs').setup { - ensure_installed = 'maintained', - ignore_install = { - 'verilog', - 'kotlin' - }, - highlight = { enable = true }, - incremental_selection = { enable = true }, - textobjects = { enable = true } -} - --- completion - -local cmp = require('cmp') - -cmp.setup({ - mapping = { - [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), - [''] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c' }), - [''] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c' }), - [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), - }, - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'cmdline' }, - { name = 'path' }, - { name = 'calc' } - }, - { - { name = 'buffer' } - }) -}) - -cmp.setup.cmdline('/', { - sources = { - { name = 'buffer' } - } -}) - --- lsp configuration - -local lsputil = require('lspconfig/util') -local python_venv = require('utils').get_python_venv() -require('lspconfig').pylsp.setup{ - cmd = {'pylsp', '-v'}, - cmd_env = { - VIRTUAL_ENV = python_venv, - PATH = lsputil.path.join(python_venv, 'bin') .. ':' .. vim.env.PATH - }, -} - -require('lspconfig').clangd.setup{} -require('lspconfig').elixirls.setup{ cmd = {'elixir-ls'} } -require('lspconfig').eslint.setup{} -require('lspconfig').terraformls.setup{} - --- org - -require('trouble').setup{} - --- syntactic sugar - -require('indent_guides').setup{ - indent_enable=true; - exclude_filetypes={ - 'calendar', - 'gitcommit', - 'help', - 'NvimTree', - }; -} - -require('indent-o-matic').setup { - max_lines = 0, - standard_widths = { 2, 4, 8 }, - - filetype_ = { - standard_widths = { 2, 4 }, - }, - - filetype_css = { - max_lines = 4096, - }, - - filetype_scss = { - max_lines = 4096, - }, - - filetype_javascript = { - max_lines = 4096, - }, - - filetype_json = { - max_lines = 4096, - }, - - filetype_typescript = { - max_lines = 4096, - }, -} - -require('gitsigns').setup{ - signs = { - add = {hl = 'GitSignsAdd', text = '▍', numhl='GitSignsAddNr', linehl='GitSignsAddLn'}, - change = {hl = 'GitSignsChange', text = '▍', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - delete = {hl = 'GitSignsDelete', text = '▍', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - topdelete = {hl = 'GitSignsDelete', text = '▍', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - changedelete = {hl = 'GitSignsChange', text = '▍', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - } -} diff --git a/.config/nvim/lua/plugins/aerial.lua b/.config/nvim/lua/plugins/aerial.lua new file mode 100755 index 0000000..7b915db --- /dev/null +++ b/.config/nvim/lua/plugins/aerial.lua @@ -0,0 +1,32 @@ +require("aerial").setup{ + highlight_on_jump = 800, + min_width = 10, + filter_kind = { + "Array", + "Boolean", + "Class", + "Constant", + "Constructor", + "Enum", + "EnumMember", + "Event", + "Field", + "File", + "Function", + "Interface", + "Key", + "Method", + "Module", + "Namespace", + "Null", + "Number", + "Object", + "Operator", + "Package", + "Property", + "String", + "Struct", + "TypeParameter", + "Variable" + }, +} diff --git a/.config/nvim/lua/plugins/bufresize.lua b/.config/nvim/lua/plugins/bufresize.lua new file mode 100755 index 0000000..c4212f8 --- /dev/null +++ b/.config/nvim/lua/plugins/bufresize.lua @@ -0,0 +1 @@ +require('bufresize').setup{} diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua new file mode 100755 index 0000000..503440f --- /dev/null +++ b/.config/nvim/lua/plugins/cmp.lua @@ -0,0 +1,26 @@ +local cmp = require('cmp') + +cmp.setup({ + mapping = { + [''] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c' }), + [''] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c' }), + [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), + -- [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), + -- [''] = cmp.mapping.confirm({ select = true }) + }, + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'cmdline' }, + { name = 'path' }, + { name = 'calc' } + }, + { + { name = 'buffer' } + }) +}) + +cmp.setup.cmdline('/', { + sources = { + { name = 'buffer' } + } +}) diff --git a/.config/nvim/lua/plugins/dap.lua b/.config/nvim/lua/plugins/dap.lua new file mode 100755 index 0000000..b927ca6 --- /dev/null +++ b/.config/nvim/lua/plugins/dap.lua @@ -0,0 +1,21 @@ +local dap = require('dap') +local python_venv = require('utils').get_python_venv() + +dap.adapters.python = { + type = 'executable'; + command = 'python'; + args = { '-m', 'debugpy.adapter' }; +} + +dap.configurations.python = { + { + type = 'python'; + request = 'launch'; + name = "Launch file"; + + program = "${file}"; + pythonPath = python_venv .. '/bin/python'; + }, +} + +-- require("dapui").setup{} diff --git a/.config/nvim/lua/plugins/diffview.lua b/.config/nvim/lua/plugins/diffview.lua new file mode 100755 index 0000000..857b041 --- /dev/null +++ b/.config/nvim/lua/plugins/diffview.lua @@ -0,0 +1,4 @@ +require('diffview').setup{ + diff_binaries = false, + enhanced_diff_hl = false, +} diff --git a/.config/nvim/lua/plugins/gitsigns.lua b/.config/nvim/lua/plugins/gitsigns.lua new file mode 100755 index 0000000..7c4a92b --- /dev/null +++ b/.config/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,14 @@ +require('gitsigns').setup{ + signs = { + add = {hl = 'GitSignsAdd', text = '▍', + numhl='GitSignsAddNr', linehl='GitSignsAddLn'}, + change = {hl = 'GitSignsChange', text = '▍', + numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + delete = {hl = 'GitSignsDelete', text = '▍', + numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + topdelete = {hl = 'GitSignsDelete', text = '▍', + numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + changedelete = {hl = 'GitSignsChange', text = '▍', + numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + } +} diff --git a/.config/nvim/lua/plugins/indent-guides.lua b/.config/nvim/lua/plugins/indent-guides.lua new file mode 100755 index 0000000..c50f74d --- /dev/null +++ b/.config/nvim/lua/plugins/indent-guides.lua @@ -0,0 +1,11 @@ +require('indent_guides').setup{ + indent_enable=true; + exclude_filetypes={ + 'calendar', + 'gitcommit', + 'help', + 'lsp-installer', + 'man', + 'NvimTree', + }; +} diff --git a/.config/nvim/lua/plugins/indent-o-matic.lua b/.config/nvim/lua/plugins/indent-o-matic.lua new file mode 100755 index 0000000..4b2abb5 --- /dev/null +++ b/.config/nvim/lua/plugins/indent-o-matic.lua @@ -0,0 +1,14 @@ +require('indent-o-matic').setup { + max_lines = 0, + standard_widths = { 2, 4, 8 }, + + filetype_ = { standard_widths = { 2, 4 } }, + + filetype_css = { max_lines = 4096 }, + filetype_scss = { max_lines = 4096 }, + filetype_json = { max_lines = 4096 }, + filetype_javascript = { max_lines = 4096 }, + filetype_typescript = { max_lines = 4096 }, + filetype_xml = { max_lines = 4096 }, + filetype_django = { max_lines = 4096 }, +} diff --git a/.config/nvim/lua/plugins/init.lua b/.config/nvim/lua/plugins/init.lua new file mode 100755 index 0000000..cd325d2 --- /dev/null +++ b/.config/nvim/lua/plugins/init.lua @@ -0,0 +1,93 @@ +-- bootstrap +local install_path = vim.fn.stdpath('data')..'/site/pack/paqs/start/paq-nvim' +if vim.fn.empty(vim.fn.glob(install_path)) > 0 then + vim.fn.system({ + 'git', 'clone', '--depth=1', + 'https://github.com/savq/paq-nvim.git', + install_path + }) +end + +vim.cmd 'packadd paq-nvim' + +require('paq') { + {'savq/paq-nvim'}; + + -- treesiter + {'nvim-treesitter/playground'}; + {'nvim-treesitter/nvim-treesitter-textobjects'}; + { + 'nvim-treesitter/nvim-treesitter', + run=vim.api.nvim_command(':silent! TSUpdate') + }; + + -- lsp + { + 'neovim/nvim-lspconfig', + run = function() + vim.fn.system({'npm', 'install', '-g', '@ansible/ansible-language-server'}) + vim.fn.system({'npm', 'install', '-g', 'vscode-langservers-extracted'}) + vim.fn.system({'python3', '-m', 'pipx', 'install', '--force', 'python-lsp-server[all]'}) + vim.fn.system({'python3', '-m', 'pipx', 'inject', 'python-lsp-server', 'git+https://github.com/python/mypy'}) + vim.fn.system({'python3', '-m', 'pipx', 'inject', 'python-lsp-server', 'pylsp-mypy'}) + vim.fn.system({'python3', '-m', 'pipx', 'inject', 'python-lsp-server', 'types-all'}) + vim.fn.system({'python3', '-m', 'pipx', 'upgrade', '--include-injected', 'python-lsp-server'}) + -- vim.fn.system({'python3', '-m', 'pip', 'install', '--force', 'debugpy'}) + end + }; + {'mickael-menu/zk-nvim'}; + + {'nvim-telescope/telescope.nvim'}; + {'stevearc/aerial.nvim'}; + {'sindrets/diffview.nvim'}; + {'folke/which-key.nvim'}; + { + 'michaelb/sniprun', + run = 'bash install.sh' + }; + + -- dap + {'mfussenegger/nvim-dap'}; + {'rcarriga/nvim-dap-ui'}; + + -- completion + {'hrsh7th/cmp-nvim-lsp'}; + {'hrsh7th/cmp-cmdline'}; + {'hrsh7th/cmp-buffer'}; + {'hrsh7th/cmp-path'}; + {'hrsh7th/cmp-calc'}; + {'hrsh7th/nvim-cmp'}; + + -- indentation + {'lewis6991/gitsigns.nvim'}; + {'glepnir/indent-guides.nvim'}; + {'darazaki/indent-o-matic'}; + { + 'stsewd/sphinx.nvim', + run=function() + vim.fn.system({'python3', '-m', 'pip', 'install', 'sphinx'}) + vim.api.nvim_command(':silent! UpdateRemotePlugins') + end + }; + + -- qol + {'kwkarlwang/bufresize.nvim'}; + + -- dependencies + {'nvim-lua/plenary.nvim'}; +} + +require('plugins.aerial') +require('plugins.bufresize') +require('plugins.cmp') +-- require('plugins.dap') +require('plugins.diffview') +require('plugins.gitsigns') +require('plugins.indent-guides') +require('plugins.indent-o-matic') +require('plugins.sniprun') +require('plugins.lspconfig') +require('plugins.telescope') +require('plugins.treesitter') +require('plugins.which-key') +require('plugins.zk') diff --git a/.config/nvim/lua/plugins/lspconfig.lua b/.config/nvim/lua/plugins/lspconfig.lua new file mode 100755 index 0000000..9ef6a1d --- /dev/null +++ b/.config/nvim/lua/plugins/lspconfig.lua @@ -0,0 +1,82 @@ +local opts = { noremap=true, silent=true } + +local lsputil = require('lspconfig/util') +local python_venv = require('utils').get_python_venv() + +local on_attach = function(client, bufnr) + -- Enable completion triggered by + vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + + -- Mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', 'lua vim.lsp.buf.declaration()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'lua vim.lsp.buf.definition()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', 'lua vim.lsp.buf.hover()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', 'lua vim.lsp.buf.implementation()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'lua vim.lsp.buf.references()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'D', 'lua vim.lsp.buf.type_definition()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'rn', 'lua vim.lsp.buf.rename()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ca', 'lua vim.lsp.buf.code_action()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'f', 'lua vim.lsp.buf.formatting()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', '', 'lua vim.lsp.buf.signature_help()', opts) + + require("aerial").on_attach(client, bufnr) +end + +vim.api.nvim_set_keymap('n', 'd', 'lua vim.diagnostic.open_float()', opts) +vim.api.nvim_set_keymap('n', '[d', 'lua vim.diagnostic.goto_prev()', opts) +vim.api.nvim_set_keymap('n', ']d', 'lua vim.diagnostic.goto_next()', opts) +vim.api.nvim_set_keymap('n', 'q', 'lua vim.diagnostic.setloclist()', opts) + +require('lspconfig').ansiblels.setup{ on_attach = on_attach } +require('lspconfig').clangd.setup{ on_attach = on_attach } +require('lspconfig').eslint.setup{ on_attach = on_attach } +require('lspconfig').gopls.setup{ on_attach = on_attach } +require('lspconfig').terraformls.setup{ on_attach = on_attach } + +require('lspconfig').dartls.setup{ + on_attach = on_attach, + settings = { + dart = { + analysisExcludedFolders = { '.git' }, + completeFunctionCalls = true, + enableSdkFormatter = true, + showTodos = true + } + } +} + +require('lspconfig').pylsp.setup{ + cmd_env = { + VIRTUAL_ENV = python_venv, + PATH = lsputil.path.join(python_venv, 'bin') .. ':' .. vim.env.PATH, + MYPYPATH = lsputil.path.join(python_venv, 'bin') .. ':' .. (vim.env.MYPYPATH or "") + }, + on_attach = on_attach, + settings = { + pylsp = { + configurationSources = {'flake8', 'pycodestyle'}, + plugins = { + flake8 = { + enabled = true, + ignore = {}, + maxLineLength = 160 + }, + rope_completion = { + enabled = true, + }, + pyflakes = { + enabled = true + }, + } + } + } +} + +require('lspconfig').elixirls.setup{ + cmd = {'elixir-ls'}, + on_attach = on_attach +} diff --git a/.config/nvim/lua/plugins/sniprun.lua b/.config/nvim/lua/plugins/sniprun.lua new file mode 100755 index 0000000..d6d1265 --- /dev/null +++ b/.config/nvim/lua/plugins/sniprun.lua @@ -0,0 +1,3 @@ +require('sniprun').setup{ + display = { 'Terminal' }, +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100755 index 0000000..6a5f8c6 --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,25 @@ +require('telescope').setup{ + defaults = { + borderchars = { '─', '│', '─', '│', '┌', '┐', '┘', '└'} + } +} + +require('telescope').load_extension('aerial') + +local opt = { noremap=true } +local keybinds = { + {'fa', 'aerial'}, + {'fb', 'buffers'}, + {'ff', 'find_files'}, + {'fg', 'git_files'}, + {'fl', 'live_grep'}, + {'fh', 'help_tags'}, + {'fm', 'man_pages'}, + {'fo', 'oldfiles'}, + {'fr', 'resume'}, + {'f/', 'current_buffer_fuzzy_find'}, +} + +for _, keybind in pairs(keybinds) do + vim.api.nvim_set_keymap('n', keybind[1], 'Telescope ' .. keybind[2] .. '', opt) +end diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100755 index 0000000..7fb6d45 --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,18 @@ +require('nvim-treesitter.configs').setup { + ensure_installed = 'all', + ignore_install = { + 'verilog', + 'kotlin' + }, + highlight = { + enable = true, + -- additional_vim_regex_highlighting = { "markdown" } + additional_vim_regex_highlighting = true, + set_custom_captures = { + ["type.string"] = "pythonFunction", + } + }, + incremental_selection = { enable = true }, + textobjects = { enable = true } +} + diff --git a/.config/nvim/lua/plugins/which-key.lua b/.config/nvim/lua/plugins/which-key.lua new file mode 100755 index 0000000..93e19f9 --- /dev/null +++ b/.config/nvim/lua/plugins/which-key.lua @@ -0,0 +1,13 @@ +require("which-key").setup{ + window = { + position = "bottom", -- bottom, top + margin = { 1, 40, 1, 0 }, -- extra window margin [top, right, bottom, left] + padding = { 0, 0, 0, 0 }, -- extra window padding [top, right, bottom, left] + winblend = 0 + }, + icons = { + breadcrumb = ">", -- symbol used in the command line area that shows your active key combo + separator = ":", -- symbol used between a key and it's label + group = "+", -- symbol prepended to a group + }, +} diff --git a/.config/nvim/lua/plugins/zk.lua b/.config/nvim/lua/plugins/zk.lua new file mode 100755 index 0000000..1a091b9 --- /dev/null +++ b/.config/nvim/lua/plugins/zk.lua @@ -0,0 +1,3 @@ +require('zk').setup{ + picker = 'telescope' +} diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua index aa04dce..ef8fb95 100755 --- a/.config/nvim/lua/settings.lua +++ b/.config/nvim/lua/settings.lua @@ -11,12 +11,21 @@ o.autochdir = false o.smarttab = true o.number = true o.list = true +o.mouse = '' o.swapfile = false -- o.foldmethod = 'expr' -- o.foldexpr = 'nvim_treesitter#foldexpr()' +local format = function(diagnostic) + if diagnostic.severity == vim.diagnostic.severity.ERROR then + -- return string.format("E: %s", diagnostic.message) + return diagnostic.message .. diagnostic.source + end + return diagnostic.message +end + cmd 'syntax enable' cmd 'filetype on' cmd 'filetype plugin on' @@ -24,7 +33,30 @@ cmd 'filetype indent on' cmd 'colorscheme colorscheme' vim.cmd([[ -au BufNewFile,BufRead *.Dockerfile,Dockerfile.* setlocal filetype=dockerfile -au BufNewFile,BufRead *.j2*,*.jinja* setlocal filetype=django -au BufNewFile,BufRead *.env* setlocal filetype=sh + au BufNewFile,BufRead *.Dockerfile,Dockerfile.* setlocal filetype=dockerfile + au BufNewFile,BufRead *.j2*,*.jinja* setlocal filetype=django + au BufNewFile,BufRead */task/config setlocal filetype=taskrc + au BufNewFile,BufRead *.env* setlocal filetype=sh + + au BufNewFile,BufRead */playbooks/*.yml set filetype=yaml.ansible + + au BufNewFile,BufRead */.config/neomutt/* + \ if &filetype == "" | + \ setlocal filetype=neomuttrc | + \ endif ]]) + +--[[ +require'nvim-treesitter.configs'.setup { + textobjects = { + lsp_interop = { + enable = true, + border = 'none', + peek_definition_code = { + ["k"] = "@function.outer", + ["K"] = "@class.outer", + }, + }, + }, +} +]]-- diff --git a/.config/pipewire/pipewire-pulse.sh b/.config/pipewire/pipewire-pulse.sh index 4abff58..bbcfa48 100755 --- a/.config/pipewire/pipewire-pulse.sh +++ b/.config/pipewire/pipewire-pulse.sh @@ -3,27 +3,25 @@ sleep 3 source_name="master-mono" +source_position=1 + +if [ "$(cat /etc/hostname)" = "work-01" ]; then + source_position=2 +fi source_index=$(pactl list short sources | grep "input.*pci-" | head -n 1 | + head -n "${source_position}" | awk '{print $1;}') echo "${source_index}" -#pactl load-module module-remap-source \ -# "source_name=${source_name}" \ -# "master=${source_index}" \ -# use_master_format=1 \ -# master_channel_map=front-left \ -# channel_map=mono \ -# channels=1 - pactl load-module module-echo-cancel \ "source_name=${source_name}" \ "master=${source_index}" \ use_master_format=1 \ aec_method="webrtc" \ - aec_args='"beamforming=1 mic_geometry=-1,0,0,1,0,0"' + aec_args='"beamforming=1 mic_geometry=-0.04,0,0,0.04,0,0"' pactl set-default-source "${source_name}" diff --git a/.config/qutebrowser/config.py b/.config/qutebrowser/config.py index cd3695d..d9aaa8f 100755 --- a/.config/qutebrowser/config.py +++ b/.config/qutebrowser/config.py @@ -2,38 +2,75 @@ # ~/.config/qutebrowser/config.py # rgoncalves.se +import html import logging import os import re -import subprocess -import platform +import socket + +from PyQt5.QtCore import QUrl + +from qutebrowser.api import cmdutils +from qutebrowser.browser.urlmarks import ( + AlreadyExistsError as UrlAlreadyExistsError +) +from qutebrowser.browser.urlmarks import UrlMarkManager +from qutebrowser.config.config import ConfigContainer +from qutebrowser.config.configfiles import ConfigAPI +from qutebrowser.utils import message, objreg +from qutebrowser.utils.usertypes import PromptMode +from userscripts.urlmarks import urlmarkmanager_save + +config: ConfigAPI = config # noqa: F821 pylint: disable=E0602,C0103 +c: ConfigContainer = c # noqa: F821 pylint: disable=E0602,C0103 logging.basicConfig(level=logging.DEBUG) -""" -Bypass flake8 warnings. -""" -try: - config -except NameError: - config = None +UrlMarkManager.save = ( + lambda manager: urlmarkmanager_save(manager, config.configdir) +) -def is_musl_system(): - return bool(re.search('musl', os.popen("ldd /bin/ls").read())) +def is_musl_system() -> bool: + return bool(re.search('musl', os.popen('ldd /bin/ls').read())) -def select_qt_arguments(): + +def get_qt_arguments() -> list: """ Select best arguments for launching qutebrowser. Empty by default, it picks lag free options for musl systems. """ - args = [] - - if is_musl_system(): - args.append('disable-seccomp-filter-sandbox') - - return args + filters = { + 'disable-seccomp-filter-sandbox': is_musl_system() + } + + return list( + filter(lambda x: x, map(lambda x: x[1], list(filters.items()))) + ) + + +@cmdutils.register() +def bookmark_save(url: QUrl): + """Save the current page as a bookmark.""" + manager = objreg.get('bookmark-manager') + tags = message.ask( + title="Add bookmark:", + mode=PromptMode.text, + url=url.toString(QUrl.RemovePassword | QUrl.FullyEncoded), + text=( + "Please enter bookmark tags for
" + f"{html.escape(url.toDisplayString())}" + ), + ) + + if not tags: + return + + try: + manager.add(url, tags) + except UrlAlreadyExistsError: + message.warning("Bookmark already exists.") config.load_autoconfig(False) @@ -41,10 +78,8 @@ config.set('auto_save.session', True) config.set('scrolling.smooth', False) config.set('qt.highdpi', False) config.set('qt.force_software_rendering', 'none') -config.set('qt.args', select_qt_arguments()) -config.set('messages.timeout', 1000) - -config.bind(',m', 'spawn mpv {url}') +config.set('qt.args', get_qt_arguments()) +config.set('messages.timeout', 2500) config.set('content.images', True, 'chrome-devtools://*') config.set('content.images', True, 'devtools://*') @@ -57,6 +92,8 @@ config.set('content.notifications.enabled', False) config.set('content.notifications.enabled', True, '*://*.zoho.eu/*') config.set('content.notifications.enabled', True, '*://*.viperdev.io/*') config.set('content.notifications.enabled', True, '*://*.rgoncalves.se/*') +config.set('content.notifications.enabled', True, '*://app.slack.com/*') +config.set('content.notifications.enabled', True, '*://mail.google.com/*') config.set('content.register_protocol_handler', False) config.set('content.geolocation', False) @@ -93,13 +130,22 @@ config.set('content.prefers_reduced_motion', True) config.set('content.headers.referer', 'same-domain') config.set('url.default_page', 'https://lite.duckduckgo.com/lite/') config.set('url.start_pages', 'https://lite.duckduckgo.com/lite/') -config.set('url.searchengines', - {'DEFAULT': 'https://lite.duckduckgo.com/lite/?q={}'}) +config.set( + 'url.searchengines', {'DEFAULT': 'https://lite.duckduckgo.com/lite/?q={}'} +) config.set('downloads.location.directory', f'{os.environ["HOME"]}/downloads') +config.set('downloads.prevent_mixed_content', False) config.set('content.autoplay', False) config.set('content.cookies.accept', 'no-3rdparty') +config.set('content.javascript.alert', False) config.set('content.headers.do_not_track', False, '*://*.thetrainline.com/*') config.set('content.blocking.enabled', False, '*://*.thetrainline.com/*') config.set('content.cookies.accept', 'all', '*://*.thetrainline.com/*') + +config.bind(',m', 'spawn mpv {url}') +config.bind('M', 'bookmark-save {url}') + +if socket.gethostname() == 'work-01': + config.set('fonts.default_size', '14pt') diff --git a/.config/qutebrowser/greasemonkey/fandom-to-breezewiki.js b/.config/qutebrowser/greasemonkey/fandom-to-breezewiki.js new file mode 100755 index 0000000..59369f5 --- /dev/null +++ b/.config/qutebrowser/greasemonkey/fandom-to-breezewiki.js @@ -0,0 +1,21 @@ +// ==UserScript== +// @name fandom to breezewiki +// @match *://*.fandom.com/* +// @grant none +// @run-at document-start +// ==/UserScript== + +BREEZEWIKI_INSTANCE = "breezewiki.pussthecat.org" + +url = location.href +url = url.replace(/\bwww\.\b/, "") +host = location.hostname +path = location.pathname +if (url.includes("/wiki/")) { + // this is bad + location.href = "https://" + BREEZEWIKI_INSTANCE + "/" + host.split(".")[0] + path +} +else { + url = url.replace("fandom.com", BREEZEWIKI_ISNTANCE) + location.href = url +} diff --git a/.config/qutebrowser/greasemonkey/gensdeconfiance.js b/.config/qutebrowser/greasemonkey/gensdeconfiance.js new file mode 100755 index 0000000..8e62a30 --- /dev/null +++ b/.config/qutebrowser/greasemonkey/gensdeconfiance.js @@ -0,0 +1,8 @@ +// ==UserScript== +// @name gensdeconfiance +// @match https://gensdeconfiance.com/* +// @run-at document-end +// @grant none +// ==/UserScript== + +document.getElementById('react-paywall').remove() diff --git a/.config/qutebrowser/greasemonkey/gitlab.js b/.config/qutebrowser/greasemonkey/gitlab.js new file mode 100755 index 0000000..5ebb8a3 --- /dev/null +++ b/.config/qutebrowser/greasemonkey/gitlab.js @@ -0,0 +1,18 @@ +// ==UserScript== +// @name gitlab +// @match *://*/* +// @run-at document-end +// @grant none +// ==/UserScript== + +(async function unwrap(subgroups) { + await new Promise(resolve => setTimeout(resolve, 600)); + for (subgroup of subgroups) { + if (! subgroup.classList.contains("has-children")) { + continue; + } + subgroup.click() + unwrap(subgroup.getElementsByClassName("group-row has-children")); + } + return +})(document.getElementsByClassName("group-row has-children")); diff --git a/.config/qutebrowser/greasemonkey/glassdoor.js b/.config/qutebrowser/greasemonkey/glassdoor.js index e6e44fc..664448c 100755 --- a/.config/qutebrowser/greasemonkey/glassdoor.js +++ b/.config/qutebrowser/greasemonkey/glassdoor.js @@ -1,6 +1,7 @@ // ==UserScript== // @name glassdoor // @match https://*.glassdoor.com/* +// @match https://*.glassdoor.ch/* // @match https://*.glassdoor.fr/* // @run-at document-end // @grant none @@ -20,5 +21,3 @@ window.addEventListener('load', function() { ]; functions.forEach(f => f()); }); - -console.log('aaaaaaaaaaaaa'); diff --git a/.config/qutebrowser/greasemonkey/google.js b/.config/qutebrowser/greasemonkey/google.js new file mode 100755 index 0000000..b410eff --- /dev/null +++ b/.config/qutebrowser/greasemonkey/google.js @@ -0,0 +1,13 @@ +// ==UserScript== +// @name custom google +// @match https://www.google.com/* +// @grant none +// ==/UserScript== + +(function() { + 'use strict'; + + document.querySelectorAll('.ads-ad').forEach(function(e){ + e.remove(); + }); +})(); diff --git a/.config/qutebrowser/greasemonkey/imgur-to-imgin.js b/.config/qutebrowser/greasemonkey/imgur-to-imgin.js index d4ac434..1263eb5 100755 --- a/.config/qutebrowser/greasemonkey/imgur-to-imgin.js +++ b/.config/qutebrowser/greasemonkey/imgur-to-imgin.js @@ -5,4 +5,4 @@ // @run-at document-start // ==/UserScript== -top.location.hostname = "imgin.voidnet.tech"; +// top.location.hostname = "imgin.voidnet.tech"; diff --git a/.config/qutebrowser/greasemonkey/imgur-to-rimgo.js b/.config/qutebrowser/greasemonkey/imgur-to-rimgo.js new file mode 100755 index 0000000..d0735cb --- /dev/null +++ b/.config/qutebrowser/greasemonkey/imgur-to-rimgo.js @@ -0,0 +1,8 @@ +// ==UserScript== +// @name imgur to rimgo +// @match *://imgur.com/* +// @grant none +// @run-at document-start +// ==/UserScript== + +top.location.hostname = "rimgo.pussthecat.org"; diff --git a/.config/qutebrowser/greasemonkey/instagram-to-bibliogram.js b/.config/qutebrowser/greasemonkey/instagram-to-bibliogram.js index a608059..53f11ee 100755 --- a/.config/qutebrowser/greasemonkey/instagram-to-bibliogram.js +++ b/.config/qutebrowser/greasemonkey/instagram-to-bibliogram.js @@ -5,4 +5,5 @@ // @run-at document-start // ==/UserScript== -top.location.hostname = "bibliogram.art"; +top.location.hostname = "bibliogram.pussthecat.org"; +// document.getElementsByClassName('explanation')[0].getElementsByTagName('a')[0].click() diff --git a/.config/qutebrowser/greasemonkey/linkedin.js b/.config/qutebrowser/greasemonkey/linkedin.js new file mode 100755 index 0000000..b8468ec --- /dev/null +++ b/.config/qutebrowser/greasemonkey/linkedin.js @@ -0,0 +1,59 @@ +// ==UserScript== +// @name linkedin css +// @match *://*.linkedin.com/* +// @grant none +// @inject-into content +// ==/UserScript== + +(function() { + 'use strict'; + + // Selectors + const storySelector = '.feed-shared-update-v2'; + const descriptionSelector = '.feed-shared-actor__description, .feed-shared-actor__sub-description'; + + // Search strings + const searchStrings = { + 'da': ['Promoveret'], + 'en': ['Promoted'], + 'es': ['Promocionado'], + 'fr': ['Post sponsorisé'] + }; + + const language = searchStrings.hasOwnProperty(document.documentElement.lang) ? document.documentElement.lang : 'en'; + + function blockSponsoredPosts() { + const stories = document.querySelectorAll(storySelector); + for (const story of stories) { + if (story.style.display == 'none') { + continue; + } + + const descriptions = story.querySelectorAll(descriptionSelector); + for (const description of descriptions) { + + const descriptionContent = description.innerText.trim(); + if (searchStrings[language].find(searchString => searchString == descriptionContent)) { + + console.debug('Blocked sponsored story', story); + story.style.display = 'none'; + } + } + } + } + + const observer = new MutationObserver(blockSponsoredPosts); + observer.observe(document.body, { + 'childList': true, + 'subtree': true + }); + + blockSponsoredPosts(); + + GM_addStyle(` + .scaffold-layout__aside { + visibility: hidden; + } + `) + +})(); diff --git a/.config/qutebrowser/greasemonkey/minimal-css.js b/.config/qutebrowser/greasemonkey/minimal-css.js deleted file mode 100755 index 1fe1414..0000000 --- a/.config/qutebrowser/greasemonkey/minimal-css.js +++ /dev/null @@ -1,16 +0,0 @@ -// ==UserScript== -// @name minimal css -// @match *://www.google.com -// @match *://www.google.com/search* -// @match *://cliq.zoho.eu/chats/* -// @match *://www.pinterest.com/* -// @grant none -// ==/UserScript== - -GM_addStyle(` - * { - border-radius: 0px !important; - transition: none !important; - animation: none !important; - } -`) diff --git a/.config/qutebrowser/greasemonkey/rarbg.js b/.config/qutebrowser/greasemonkey/rarbg.js new file mode 100755 index 0000000..cb99969 --- /dev/null +++ b/.config/qutebrowser/greasemonkey/rarbg.js @@ -0,0 +1,12 @@ +// ==UserScript== +// @name rarbg css +// @match *://rarbg.to/* +// @match *://rarbgaccessed.org/* +// @grant none +// ==/UserScript== + +GM_addStyle(` + div:last-of-type { + z-index: -1 !important; + } +`) diff --git a/.config/qutebrowser/greasemonkey/teddit.js b/.config/qutebrowser/greasemonkey/teddit.js new file mode 100755 index 0000000..2e9c829 --- /dev/null +++ b/.config/qutebrowser/greasemonkey/teddit.js @@ -0,0 +1,23 @@ +// ==UserScript== +// @name yewtube +// @match *://*.teddit.net/* +// @match *://teddit.net/* +// @grant none +// @run-at document-start +// ==/UserScript== + +document.cookie = "post_media_max_height=medium"; +document.cookie = "flairs=true"; +document.cookie = "highlight_controversial=true"; +document.cookie = "show_upvotes=true"; +document.cookie = "collapse_child_comments=false"; +document.cookie = "nsfw_enabled=false"; +document.cookie = "show_upvoted_percentage=false"; +document.cookie = "videos_muted=true"; +document.cookie = "show_large_gallery_images=true"; +document.cookie = "domain_twitter="; +document.cookie = "domain_youtube="; +document.cookie = "domain_instagram="; +document.cookie = "prefer_frontpage=true"; +document.cookie = "default_comment_sort=best"; +document.cookie = "theme=white"; diff --git a/.config/qutebrowser/greasemonkey/yewtube.js b/.config/qutebrowser/greasemonkey/yewtube.js new file mode 100755 index 0000000..0362a7b --- /dev/null +++ b/.config/qutebrowser/greasemonkey/yewtube.js @@ -0,0 +1,9 @@ +// ==UserScript== +// @name yewtube +// @match *://*.yewtu.be/* +// @match *://yewtu.be/* +// @grant none +// @run-at document-start +// ==/UserScript== + +document.cookie = "PREFS=%7B%22annotations%22%3Afalse%2C%22annotations_subscribed%22%3Afalse%2C%22autoplay%22%3Atrue%2C%22automatic_instance_redirect%22%3Afalse%2C%22captions%22%3A%5B%22%22%2C%22%22%2C%22%22%5D%2C%22comments%22%3A%5B%22youtube%22%2C%22reddit%22%5D%2C%22continue%22%3Afalse%2C%22continue_autoplay%22%3Atrue%2C%22dark_mode%22%3A%22%22%2C%22latest_only%22%3Afalse%2C%22listen%22%3Afalse%2C%22local%22%3Atrue%2C%22watch_history%22%3Afalse%2C%22vr_mode%22%3Atrue%2C%22show_nick%22%3Afalse%2C%22locale%22%3A%22en-US%22%2C%22region%22%3A%22US%22%2C%22max_results%22%3A40%2C%22notifications_only%22%3Afalse%2C%22player_style%22%3A%22invidious%22%2C%22quality%22%3A%22dash%22%2C%22quality_dash%22%3A%221080p%22%2C%22default_home%22%3A%22Popular%22%2C%22feed_menu%22%3A%5B%22Popular%22%2C%22Trending%22%5D%2C%22related_videos%22%3Atrue%2C%22sort%22%3A%22published%22%2C%22speed%22%3A1%2C%22thin_mode%22%3Afalse%2C%22unseen_only%22%3Afalse%2C%22video_loop%22%3Afalse%2C%22extend_desc%22%3Afalse%2C%22volume%22%3A50%2C%22save_player_pos%22%3Afalse%7D"; diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index 9e77b7c..b54721e 100755 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -4,7 +4,9 @@ set-option -g mouse off set-option -g mode-keys vi set-option -g escape-time 0 set-option -g default-terminal "screen-256color" +set-option -g renumber-windows on set-option -g history-limit 5000 +set-option -g xterm-keys on set -s escape-time 0 # keybindings diff --git a/.config/user-dirs.dirs b/.config/user-dirs.dirs index 0e54d8c..a529fd4 100755 --- a/.config/user-dirs.dirs +++ b/.config/user-dirs.dirs @@ -1,15 +1,8 @@ -# This file is written by xdg-user-dirs-update -# If you want to change or add directories, just edit the line you're -# interested in. All local changes will be retained on the next run. -# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped -# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an -# absolute path. No other format is supported. -# XDG_DOWNLOAD_DIR="$HOME/downloads" -XDG_DOCUMENTS_DIR="$HOME/" -XDG_MUSIC_DIR="$HOME/" +XDG_DOCUMENTS_DIR="$HOME/docs" +XDG_MUSIC_DIR="$HOME/music" XDG_PICTURES_DIR="$HOME/pictures" XDG_DESKTOP_DIR="$HOME/" XDG_TEMPLATES_DIR="$HOME/" -XDG_PUBLICSHARE_DIR="$HOME/" +XDG_PUBLICSHARE_DIR="$HOME/mnt" XDG_VIDEOS_DIR="$HOME/" diff --git a/.mbsyncrc b/.mbsyncrc index 1023795..943fe7c 100755 --- a/.mbsyncrc +++ b/.mbsyncrc @@ -9,8 +9,8 @@ Account personal MaildirStore personal-local SubFolders Verbatim -Path ~/.mail/ -Inbox ~/.mail/INBOX +Path ~/.local/share/mail/personal/ +Inbox ~/.local/share/mail/personal/INBOX Channel personal Far :personal-remote: diff --git a/.weechat/buflist.conf b/.weechat/buflist.conf index 99bd851..b56726d 100755 --- a/.weechat/buflist.conf +++ b/.weechat/buflist.conf @@ -6,25 +6,25 @@ # # Use commands like /set or /fset to change settings in WeeChat. # -# For more info, see: https://weechat.org/doc/quickstart +# For more info, see: https://weechat.org/doc/quickstart/ # [look] add_newline = on auto_scroll = 50 -display_conditions = "${buffer.hidden}==0" +display_conditions = "${bar_item.name} == buflist && (${buffer.hidden} == || ${plugins.var.buflist.look.show_hidden_buffers} !=) && (${type} !~ ^(channel|private)$ || ${type} =~ ^(channel|private)$ && ${buffer[${if:${plugin}==irc?${info:irc_buffer,${irc_server.name}}:${info:slack_matrix_server_search,${buffer}}}].local_variables.fold}==) || ${bar_item.name} == buflist2 && ${buffer.local_variables.control_buffer} != || ${bar_item.name} == buflist3 && ${buffer.local_variables.control_buffer2} !=" enabled = on mouse_jump_visited_buffer = off mouse_move_buffer = on mouse_wheel = on nick_prefix = off nick_prefix_empty = on -signals_refresh = "" +signals_refresh = "irc_server_connected,relay_client_connected,relay_client_disconnected" sort = "number,-active" -use_items = 1 +use_items = 3 [format] -buffer = "${format_number}${indent}${format_nick_prefix}${color_hotlist}${name}${buffer.nick}" +buffer = "${format_number}${indent}${format_nick_prefix}${color_hotlist}${format_name}" buffer_current = "${color:,blue}${format_buffer}" hotlist = " ${color:green}(${hotlist}${color:green})" hotlist_highlight = "${color:magenta}" diff --git a/.weechat/fset.conf b/.weechat/fset.conf index 3d7a814..1b52d85 100755 --- a/.weechat/fset.conf +++ b/.weechat/fset.conf @@ -6,7 +6,7 @@ # # Use commands like /set or /fset to change settings in WeeChat. # -# For more info, see: https://weechat.org/doc/quickstart +# For more info, see: https://weechat.org/doc/quickstart/ # [look] diff --git a/.weechat/logger.conf b/.weechat/logger.conf index 37c02b4..9bd4719 100755 --- a/.weechat/logger.conf +++ b/.weechat/logger.conf @@ -6,7 +6,7 @@ # # Use commands like /set or /fset to change settings in WeeChat. # -# For more info, see: https://weechat.org/doc/quickstart +# For more info, see: https://weechat.org/doc/quickstart/ # [look] diff --git a/.weechat/weechat.conf b/.weechat/weechat.conf index 53e2776..e79493e 100755 --- a/.weechat/weechat.conf +++ b/.weechat/weechat.conf @@ -6,7 +6,7 @@ # # Use commands like /set or /fset to change settings in WeeChat. # -# For more info, see: https://weechat.org/doc/quickstart +# For more info, see: https://weechat.org/doc/quickstart/ # [debug] @@ -212,7 +212,7 @@ status_time = default [completion] base_word_until_cursor = on command_inline = on -default_template = "%(nicks)|%(irc_channels)" +default_template = "%(nicks)|%(irc_channels)|%(usergroups)" nick_add_space = on nick_case_sensitive = off nick_completer = ": " @@ -243,7 +243,6 @@ proxy_curl = "" [plugin] autoload = "*" -debug = off extension = ".so,.dll" path = "%h/plugins" save_config_on_unload = on @@ -324,7 +323,7 @@ status.conditions = "" status.filling_left_right = vertical status.filling_top_bottom = horizontal status.hidden = off -status.items = "[time],[buffer_last_number],[buffer_plugin],buffer_number+:+buffer_name+(buffer_modes)+{buffer_nicklist_count}+buffer_zoom+buffer_filter,scroll,[lag],[hotlist],[matrix_typing_notice],completion" +status.items = "[time],[buffer_last_number],[buffer_plugin],buffer_number+:+buffer_name+(buffer_modes)+{buffer_nicklist_count}+buffer_zoom+buffer_filter,scroll,[lag],[hotlist],[matrix_typing_notice],[slack_typing_notice],completion,cmd_completion" status.position = bottom status.priority = 500 status.separator = off @@ -362,9 +361,24 @@ vi_line_numbers.size = 0 vi_line_numbers.size_max = 0 vi_line_numbers.type = window +[custom_bar_item] + [layout] [notify] +python.slack.scaleway.#briq = highlight +python.slack.scaleway.#datacenter = highlight +python.slack.scaleway.#fivefoot5x5urban = highlight +python.slack.scaleway.#foodporn = highlight +python.slack.scaleway.#it-internal-services = highlight +python.slack.scaleway.#production-incidents = highlight +python.slack.scaleway.#production-ops = highlight +python.slack.scaleway.#protobuf = highlight +python.slack.scaleway.#social-media = highlight +python.slack.scaleway.#sport-paris = highlight +python.slack.scaleway.#squad-managed-databases = highlight +python.slack.scaleway.#squad-redis = highlight +python.slack.scaleway.#squad-website = highlight [filter] topic = on;*;irc_topic;* @@ -653,6 +667,11 @@ meta2-A = "/cursor move up" meta2-B = "/cursor move down" meta2-C = "/cursor move right" meta2-D = "/cursor move left" +@chat(python.*):D = "hsignal:slack_cursor_delete" +@chat(python.*):L = "hsignal:slack_cursor_linkarchive" +@chat(python.*):M = "hsignal:slack_cursor_message" +@chat(python.*):R = "hsignal:slack_cursor_reply" +@chat(python.*):T = "hsignal:slack_cursor_thread" @chat(python.matrix.*):r = "hsignal:matrix_cursor_reply" @item(buffer_nicklist):K = "/window ${_window_number};/kickban ${nick}" @item(buffer_nicklist):b = "/window ${_window_number};/ban ${nick}" @@ -675,6 +694,7 @@ meta2-D = "/cursor move left" @chat(fset.fset):button2* = "hsignal:fset_mouse" @chat(fset.fset):wheeldown = "/fset -down 5" @chat(fset.fset):wheelup = "/fset -up 5" +@chat(python.*):button2 = "hsignal:slack_mouse" @chat(script.scripts):button1 = "/window ${_window_number};/script go ${_chat_line_y}" @chat(script.scripts):button2 = "/window ${_window_number};/script go ${_chat_line_y};/script installremove -q ${script_name_with_extension}" @chat(script.scripts):wheeldown = "/script down 5" diff --git a/.xinitrc.dwm b/.xinitrc.dwm index 04ea96f..d1edaee 100755 --- a/.xinitrc.dwm +++ b/.xinitrc.dwm @@ -1,2 +1,8 @@ +eval $(gnome-keyring-daemon --start) +export SSH_AUTH_SOCK +dbus-update-activation-environment --systemd DISPLAY + xrdb -merge ~/.Xresources -exec dbus-run-session -- ~/.bin/dwm-start +exec ~/.bin/dwm-start +# exec dbus-run-session -- ~/.bin/dwm-start +# exec dbus-launch ~/.bin/dwm-start diff --git a/.zshrc b/.zshrc index 0a3a6d2..7ff854a 100755 --- a/.zshrc +++ b/.zshrc @@ -1,9 +1,12 @@ # ~/.zshrc configuration ~~ rgoncalves.se -. ~/.cprofile set -o vi +for cprofile in $HOME/.cprofile*; do + . "${cprofile}" +done + precmd() { vcs_info } @@ -12,13 +15,14 @@ precmd() { autoload -U history-search-end zle -N history-beginning-search-backward-end history-search-end zle -N history-beginning-search-forward-end history-search-end +bindkey '^R' history-incremental-search-backward bindkey "^[[A" history-beginning-search-backward-end bindkey "^[[B" history-beginning-search-forward-end bindkey "^[[1;5C" forward-word bindkey "^[[1;5D" backward-word bindkey "\[[H" beginning-of-line bindkey "\[[F" end-of-line -bindkey "\e[3~" delete-char +bindkey "\e[3~" delete-char bindkey '^[[Z' reverse-menu-complete zstyle ':completion:*' completer _complete zstyle ':completion:*' matcher-list '' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' '+l:|=* r:|=*' @@ -43,7 +47,7 @@ _dir="%~" _color=002 autoload -Uz vcs_info -zstyle ':vcs_info:*' enable git svn +zstyle ':vcs_info:*' enable svn zstyle ':vcs_info:*' enable git zstyle ':vcs_info:*' get-revision true zstyle ':vcs_info:*' check-for-changes true @@ -60,8 +64,13 @@ RPROMPT='${vcs_info_msg_0_}' # pyenv # export PYENV_ROOT="$HOME/.pyenv" -eval "$(pyenv init --path)" eval "$(pyenv init -)" +eval "$(pyenv virtualenv-init - 2>/dev/null &)" (cat ~/.cache/dot/sequences 2>/dev/null &) # clear + +if [ -z "${SSH_AUTH_SOCK}" ]; then + eval $(ssh-agent) >/dev/null 2>&1 + ssh-add -k >/dev/null 2>&1 +fi -- cgit v1.2.3