From: Samir Benmendil Date: Sun, 17 Dec 2023 17:36:48 +0000 (+0000) Subject: Merge branch 'lazyvim' X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/84e2deef3e6453881262f3cc49e2f38187383bc4?hp=d3882af27e038c41f7abfe6ee623f07a82e3e357 Merge branch 'lazyvim' --- diff --git a/Makefile b/Makefile index c5a8d99..a245778 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ DOTFILES := goobookrc profile Xresources CONFIGFILES := mpv offlineimap ranger retroarch xbindkeys xkb .PHONY: core_files -core_files: dircolors git ranger ssh systemd tmux vim zsh +core_files: dircolors git nvim ranger ssh systemd tmux zsh .PHONY: desktop desktop: core_files awesome kitty picom qutebrowser rofi xkb @@ -127,7 +127,7 @@ systemd: $(XDG_CONFIG_HOME) $(systemd_system_units) .PHONY: systemd task: $(XDG_CONFIG_HOME) - ln -sfT $(APATH)/taskrc $(XDG_CONFIG_HOME)/taskrc + ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@ .PHONY: task tmux: $(XDG_CONFIG_HOME) @@ -150,6 +150,10 @@ vim: $(XDG_CONFIG_HOME) ln -sfT $(APATH)/vim $(XDG_CONFIG_HOME)/vim mkdir -p $(XDG_DATA_HOME)/vim .PHONY: vim + +nvim: $(XDG_CONFIG_HOME) vim + ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@ +.PHONY: nvim yay: $(XDG_CONFIG_HOME) ln -sfT $(APATH)/yay $(XDG_CONFIG_HOME)/yay diff --git a/aliases b/aliases index 721a3da..e7b0a12 100644 --- a/aliases +++ b/aliases @@ -32,7 +32,7 @@ if [[ -n "${VIM_TERMINAL}" ]]; then done } fi -alias vi='vim' +alias vi=nvim alias svi='sudo -e' #alias vp='vim PKGBUILD' # I have a script for that in ~/bin alias vs='vim SPLITBUILD' diff --git a/awesome/bindings.lua b/awesome/bindings.lua index ae2ebaf..be64d76 100644 --- a/awesome/bindings.lua +++ b/awesome/bindings.lua @@ -49,6 +49,25 @@ globalkeys = gears.table.join(globalkeys, {description = "focus the next screen", group = "screen"}), awful.key({ modkey, }, "=", function () awful.screen.focus_relative( 1) end, -- that's the key left of 1 (kinesis) {description = "focus the next screen", group = "screen"}), + awful.key({ modkey, "Control" }, "=", + function () + -- swap tags in screens + local c = client.focus + local this_screen = awful.screen.focused(); + -- TODO: only works with two screens + local next_screen = this_screen:get_next_in_direction("right") or this_screen:get_next_in_direction("left") + local this_screen_tag = this_screen.selected_tag; + local next_screen_tag = next_screen.selected_tag; + + this_screen_tag:swap(next_screen_tag) + + this_screen_tag:view_only() + next_screen_tag:view_only() + + awful.screen.focus(this_screen) + c:jump_to(true) + end, + {description = "swap screens", group = "screen"}), awful.key({ modkey, "Control" }, "Right", function () awful.screen.focus_relative(-1) end, {description = "focus the next screen", group = "screen"}), awful.key({ modkey, "Control" }, "Left", function () awful.screen.focus_relative(-1) end, @@ -149,7 +168,11 @@ globalkeys = gears.table.join(globalkeys, -- requires a little sleep before simulating shift+Insert, otherwise I -- believe the focus is still on awful and not the current window awful.key({ modkey }, "\\", function () awful.spawn('xdotool sleep 0.2 key --clearmodifiers shift+Insert') end, - {description = "paste primary selection", group = "awesome"}) + {description = "paste primary selection", group = "awesome"}), + -- utf8 picker + -- TODO: the mapping is similar to kitty's , but worth changing maybe? + awful.key({ modkey, "Shift"}, "u", function () awful.spawn('rofimoji') end, + { description = "select utf8 character", group = "awesome"}) ) -- Client keys {{{1 diff --git a/awesome/signals.lua b/awesome/signals.lua index 204ca2b..62a56a6 100644 --- a/awesome/signals.lua +++ b/awesome/signals.lua @@ -19,13 +19,17 @@ end) -- open steam games on tag 9 and switch to it awesome.register_xproperty("STEAM_GAME", "number") client.connect_signal("manage", function (c) - if c:get_xproperty("STEAM_GAME") then + local steam_game = c:get_xproperty("STEAM_GAME") + if steam_game then local tag = tags[1][9] c:move_to_screen(1) c:move_to_tag(tag) - tag:view_only() - c.fullscreen = true - awful.placement.centered(mouse, {parent = c}) + if steam_game ~= 769 then + -- 769 seems to be the value for the steam client itself + tag:view_only() + c.fullscreen = true + awful.placement.centered(mouse, {parent = c}) + end end end) diff --git a/awesome/themes/nord/background.svg b/awesome/themes/nord/background.svg index c476dab..fc3167c 100644 --- a/awesome/themes/nord/background.svg +++ b/awesome/themes/nord/background.svg @@ -9,10 +9,9 @@ viewBox="0 0 1920 1080" sodipodi:docname="background.svg" xml:space="preserve" - inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)" + inkscape:version="1.2.2 (b0a8486541, 2022-12-01)" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"> + style="display:inline;fill:#5e81ac;fill-opacity:1;stroke:none" /> diff --git a/bin/aur-sync-devel b/bin/aur-sync-devel new file mode 100755 index 0000000..f699fed --- /dev/null +++ b/bin/aur-sync-devel @@ -0,0 +1,66 @@ +#!/bin/bash +# Example taken from /usr/share/doc/aurutils/examples/sync-devel + +set -e +argv0=sync-devel +XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache} + +# For the purposes of this example, we assume AURDEST contains both AUR and +# non-AUR git repositories (e.g. from github or archweb), with corresponding +# packages in the local repository. +AURDEST=${AURDEST:-$XDG_CACHE_HOME/aurutils/sync} +AURVCS=".*-(cvs|svn|git|hg|bzr|darcs)$" + +# Pattern the defines VCS packages. The AUR has no formal definition of a VCS +# package - here we include the most common version control systems. +filter_vcs() { + awk -v "mask=$AURVCS" '$1 ~ mask {print $1}' "$@" +} + +# Scratch space for intermediary results. +mkdir -pm 0700 "${TMPDIR:-/tmp}/aurutils-$UID" +tmp=$(mktemp -d --tmpdir "aurutils-$UID/$argv0.XXXXXXXX") +trap 'rm -rf "$tmp"' EXIT + +# Retrieve a list of the local repository contents. The repository +# can be specified with the usual aur-repo arguments. +aur repo --list "$@" | tee "$tmp"/db | filter_vcs - >"$tmp"/vcs + +# Only AUR repositories can be cloned anew, as the source of non-AUR packages +# is unknown beforehand. Their existence is checked with `git-ls-remote` (`-e`) +# Running makepkg locally on a PKGBUILD with pkgver() results in local changes, +# so these are removed with `--discard`. New upstream commits are then merged +# with `git-merge` or `git-rebase` (`--sync=auto`). The final PKGBUILD is shown +# in `aur-view` later on. +cd "$AURDEST" +aur fetch -e --discard --sync=auto --results="$tmp"/fetch_results - <"$tmp"/vcs + +# Make sure empty repositories are not considered for inspection. +targets=() +while IFS=: read -r mode rev_old rev path; do + path=${path#file://} name=${path##*/} + + case $mode in + clone|merge|fetch|rebase|reset) + [[ $rev != "0" ]] && targets+=("$name") ;; + esac +done <"$tmp"/fetch_results + +# Inspect new AUR (downstream) commits with aur-view(1). This is done +# before running aur-srcver, which runs makepkg and sources the +# PKGBUILD. +aur view "${targets[@]}" + +# Update `epoch:pkgver-pkgrel` for each target with `aur-srcver`. +# This runs `makepkg`, cloning upstream to the latest revision. The +# output is then compared with the contents of the local repository. +cat "$tmp"/db | aur vercmp -p <(aur srcver "${targets[@]}") | \ + awk '{print $1}' >"$tmp"/ood + +# Build the packages. Arguments are shared between aur-repo and +# aur-build to specify the local repository. +if [[ -s $tmp/ood ]]; then + aur build "$@" -a "$tmp"/ood --syncdeps --rmdeps --noconfirm +else + printf >&2 '%s: all packages up-to-date\n' "$argv0" +fi diff --git a/bin/find_duplicate b/bin/find_duplicate index b7ce1ba..4844611 100755 --- a/bin/find_duplicate +++ b/bin/find_duplicate @@ -1,5 +1,3 @@ #!/bin/bash -dirs=(/home/ramsi/Movies /mnt/Skaro/Movies) - -find "${dirs[@]}" -type f -printf '%H %P\n' | sed -r 's/\{[^}]+\}.*//' | sort -k1 | uniq -Df1 +find "$@" -type f -printf '%H %P\n' | sed -r 's/\{[^}]+\}.*//' | sort -k1 | uniq -Df1 diff --git a/bin/maic b/bin/maic index bdbb82f..1385b54 100755 --- a/bin/maic +++ b/bin/maic @@ -1,3 +1,5 @@ #!/usr/bin/env bash +set -o pipefail + maim -q --select --hidecursor "$@" | xclip -selection clipboard -t image/png diff --git a/bin/maif b/bin/maif index e4e1d2a..63de4c9 100755 --- a/bin/maif +++ b/bin/maif @@ -25,14 +25,10 @@ while [[ $# -gt 0 ]]; do case $opt in -h|--help) usage; exit 0 ;; - -* ) - echo -e "\n Option does not exist : $opt\n" - usage; exit 1 ;; - *) args+=("$opt"); shift ;; esac done geometry="$(slop)" file="$(date "+%FT%T_${geometry%%+*}_maif.png")" -maim --geometry="${geometry}" $file +maim "${args[@]}" --geometry="${geometry}" $file diff --git a/bin/monzo.py b/bin/monzo.py index 722cc5f..6980487 100755 --- a/bin/monzo.py +++ b/bin/monzo.py @@ -7,9 +7,11 @@ import sys outformat = "qif" # outformat = "csv" + class UnknownAccountError(Exception): pass + def get_account(data): account_id = data["transactions"][0]["account_id"] if account_id == "": @@ -19,6 +21,7 @@ def get_account(data): raise UnknownAccountError(account_id) + if __name__ == "__main__": with open(sys.argv[1], 'r') if len(sys.argv) > 1 else sys.stdin as fp: data = json.load(fp) @@ -46,6 +49,11 @@ if __name__ == "__main__": else: payee = t["merchant"]["name"] memo = t["description"] + try: + memo = "Tab: {}".format(t["tab"]["name"]) + except KeyError: + pass + memo += "\n{local_amount} {local_currency}".format(**t) notes = t["notes"] if outformat == "csv": diff --git a/bin/org-agenda b/bin/org-agenda new file mode 100755 index 0000000..a39a449 --- /dev/null +++ b/bin/org-agenda @@ -0,0 +1,91 @@ +#!/bin/python + +from glob import glob +from os import path, get_terminal_size +import orgparse +from datetime import date + +# TODO: read org location from config +org_glob = '~/org/**.org' +org_todos = ['TODO', 'WAITING', 'NEXT'] +org_dones = ['DONE', 'CANCELLED'] + + +def org_is_archived(root): + return "ARCHIVE" in root.tags + + +def org_is_overdue(node, end=None): + if not node.scheduled: + return False + + if node.todo in org_dones: + return False + + if node.closed: + return False + + if end is None: + end = orgparse.date.OrgDate(date.today()) + + r = orgparse.date.OrgDate(0, end) + return node.scheduled.has_overlap(r) + + +def org_is_scheduled(node: orgparse.node, start=None, end=None): + if not node.scheduled: + return False + + if node.todo in org_dones: + return False + + if start is None and end is None: + return True + + if start is None: + start = orgparse.date.OrgDate(0) + + if end is None: + end = start + + r = orgparse.date.OrgDate(start, end) + return node.scheduled.has_overlap(r) + + +def format_tags(tags): + if not tags: + return "" + return "".join([":{}:".format(t) for t in tags]) + + +def print_node(node): + [f, _] = path.splitext(path.basename(n.env.filename)) + [cols, rows] = get_terminal_size() + wf = 12 + wh = min(50, cols - wf) + wt = cols - wf - wh + print("{:<{wf}}{:<{wh}}{:>{wt}}".format(f+":", "{} {}".format(n.todo, n.heading)[:wh], format_tags(n.tags), + wf=wf, wh=wh, wt=wt)) + + +nodes_today = [] +nodes_overdue = [] +nodes_done_today = [] +#TODO nodes_deadline +for org_file in glob(path.expanduser(org_glob)): + with open(org_file) as f: + env = orgparse.node.OrgEnv(todos=org_todos, dones=org_dones, filename=org_file) + root = orgparse.load(f, env=env) + # print(root.env.all_todo_keys) + for node in root[1:]: + if org_is_archived(node): + continue + if org_is_overdue(node, date.today()): + nodes_overdue.append(node) + elif org_is_scheduled(node, date.today()): + nodes_today.append(node) + +for n in nodes_overdue: + print_node(n) +for n in nodes_today: + print_node(n) diff --git a/bin/shorten b/bin/shorten new file mode 100755 index 0000000..33f41f2 --- /dev/null +++ b/bin/shorten @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# https://brettterpstra.com/2016/04/27/shell-tricks-shorten-every-line-of-output/ + +#TODO allow different width to be set +c=$(tput cols) +w=$((c - 1)) +cat | sed -E "s/(.{$w}).*$/\1…/" diff --git a/bin/xkbload b/bin/xkbload new file mode 100755 index 0000000..607385b --- /dev/null +++ b/bin/xkbload @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +# This script is meant to be called by inputplug when a new input device event happened. + +xkb_config=$XDG_CONFIG_HOME/xkb +xkb_file=$xkb_config/default.xkb +[[ -f $xkb_config/$(hostname).xkb ]] && xkb_file=$(hostname) + +XIDeviceEnabled() +{ + kinadv2="Kinesis Advantage2 Keyboard" + if [[ "$device_name" == "$kinadv2" ]]; then + # HACK: if I don't sleep, capslock is enabled on reconnect + sleep 0.1 + echo "xkbcomp default.xkb" + xkbcomp -w0 -I$xkb_config $xkb_file $DISPLAY -i $device_id + fi +} + +call_event_handler() +{ + case $(type -t $event_type) in + function) $event_type ;; + *) echo "No handler for event '$event_type'" ;; + esac +} + +if [[ $# -eq 4 ]]; then + # See inputplug(1) + event_type=$1 + device_id=$2 + device_type=$3 + device_name=$4 + call_event_handler +else + # if not called with four args, loop over all devices + event_type=XIDeviceEnabled + for device_id in $(xinput list --id-only); do + device_name="$(xinput list --name-only $device_id)" + device_type="UnknownTODO" # don't know how to get this easily + call_event_handler + done +fi diff --git a/git/config b/git/config index a759c2e..8f78436 100644 --- a/git/config +++ b/git/config @@ -56,3 +56,5 @@ [includeIf "gitdir:~/src/fpp/**"] path = ~/.config/git/fpp.config +[credential] + helper = cache diff --git a/kitty/kitty.conf b/kitty/kitty.conf index 2a4ea8e..7388341 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -243,9 +243,13 @@ allow_hyperlinks yes #: Process hyperlink (OSC 8) escape sequences. If disabled OSC 8 #: escape sequences are ignored. Otherwise they become clickable -#: links, that you can click by holding down ctrl+shift and clicking -#: with the mouse. The special value of ``ask`` means that kitty will -#: ask before opening the link. +#: links, that you can click with the mouse or by using the hints +#: kitten . The +#: special value of ask means that kitty will ask before opening the +#: link when clicked. + +shell_integration no-sudo + term xterm-kitty diff --git a/mbsync/config b/mbsync/config index 11aa5d7..6f705ab 100644 --- a/mbsync/config +++ b/mbsync/config @@ -42,10 +42,9 @@ Channel mailfence/bin Far :mailfence-remote:"Trash" Near :mailfence-local:"trash" -Channel mailfence/youtube -Far :mailfence-remote: -Near :mailfence-local: -Patterns youtube* +Channel mailfence/important +Far :mailfence-remote:important +Near :mailfence-local:important Channel mailfence/archive Far :mailfence-remote: @@ -56,9 +55,9 @@ Group mailfence Channel mailfence/inbox Channel mailfence/drafts Channel mailfence/sent +Channel mailfence/important Channel mailfence/spam Channel mailfence/bin -Channel mailfence/youtube Channel mailfence/archive IMAPAccount fpp diff --git a/mpv/config b/mpv/config index 0392e66..2f3b644 100644 --- a/mpv/config +++ b/mpv/config @@ -1,5 +1,6 @@ # default ytdl -ytdl-format=bestvideo*[height<=720][vcodec!=?vp9]+bestaudio/best[height<=720] +ytdl-format=bestvideo*[height<=720]+bestaudio/best[height<=720] cache=auto +sub-auto=fuzzy no-sub diff --git a/mutt/accounts/mailfence b/mutt/accounts/mailfence index 3bc608b..620ea28 100644 --- a/mutt/accounts/mailfence +++ b/mutt/accounts/mailfence @@ -18,6 +18,7 @@ macro index,pager a "khard add-email" "add the sender addr mailboxes +mailfence/inbox mailboxes +mailfence/sent +mailboxes +mailfence/important mailboxes +mailfence/youtube mailboxes +mailfence/archive mailboxes +mailfence/drafts @@ -25,6 +26,7 @@ mailboxes +mailfence/spam mailboxes +mailfence/trash macro index,pager gi "+mailfence/inbox" "go to inbox" +macro index,pager gI "+mailfence/important" "go to important" macro index,pager gy "+mailfence/youtube" "go to youtube" macro index,pager ga "+mailfence/archive" "go to archive" macro index,pager gs "+mailfence/spam" "go to spam" diff --git a/mutt/bindings b/mutt/bindings index 469977b..649b0f2 100644 --- a/mutt/bindings +++ b/mutt/bindings @@ -36,6 +36,13 @@ macro pager F "\ set resolve=\$my_resolve" \ "Flag message without resolving" +#FIXME: doesn't work because is interactive +# macro index,pager f "\ +# set my_mime_forward=\$mime_forward mime_forward=yes\ +# \ +# set mime_forward=\$my_mime_forward" \ +# "Forward message as attachement" + # Remap bounce-message function to “B” bind index,pager B bounce-message bind index,pager R group-reply diff --git a/mutt/colors/nord b/mutt/colors/nord index ece1443..83346d8 100644 --- a/mutt/colors/nord +++ b/mutt/colors/nord @@ -6,7 +6,7 @@ color normal color15 default color status brightblue default color indicator color15 color235 color tree color8 default -color error brightcolor15 color196 +color error bold color15 color196 color markers color142 default uncolor index * @@ -15,11 +15,11 @@ color index color8 default ~P # threads containing new messages color index color4 default "~(~N)" # new messages + sidebar -color index brightcolor3 default ~N +color index bold color3 default ~N # tagged -color index brightcolor12 default ~T +color index bold color12 default ~T # deleted -color index brightcolor1 default ~D +color index bold color1 default ~D uncolor header * # set up the headers @@ -31,14 +31,14 @@ color header blue default "^date:" color header brightyellow default "^subject: " # message bodies -color attachment brightcolor211 default -color search brightcolor16 color221 +color attachment bold color211 default +color search bold color16 color221 color signature color243 default color tilde color240 default uncolor body * color body color137 default "[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+" -color bold brightcolor15 default +color bold bold color15 default # gpg color body brightgreen default "^gpg: Good signature.*" color body brightred default "^gpg: BAD signature.*" diff --git a/mutt/mailcap b/mutt/mailcap index e7ddad0..e64064d 100644 --- a/mutt/mailcap +++ b/mutt/mailcap @@ -1,4 +1,4 @@ -text/html; $XDG_CONFIG_HOME/mutt/mutt_bgrun qutebrowser %s; test=test -n "$DISPLAY"; nametemplate=%s.html +text/html; $XDG_CONFIG_HOME/mutt/mutt_bgrun qutebrowser --temp-basedir %s; test=test -n "$DISPLAY"; nametemplate=%s.html text/html; w3m -I %{charset} -dump %s -T text/html -cols "$COLUMNS" -o display_link_number=1; copiousoutput; nametemplate=%s.html text/calendar; $XDG_CONFIG_HOME/mutt/ical2txt; copiousoutput # generate html from dmarc report, testing against *rmz.io* because all other tests were too difficult diff --git a/ncmpcpp/config b/ncmpcpp/config index 5407875..ddd4c45 100644 --- a/ncmpcpp/config +++ b/ncmpcpp/config @@ -20,8 +20,7 @@ autocenter_mode = "yes" user_interface = "alternative" media_library_primary_tag = "album_artist" -visualizer_fifo_path = "/tmp/mpd.fifo" +visualizer_data_source = "/tmp/mpd.fifo" visualizer_output_name = "fifo" -visualizer_sync_interval = "30" visualizer_in_stereo = "yes" visualizer_type = "spectrum" (spectrum/wave) diff --git a/nvim/.gitignore b/nvim/.gitignore new file mode 100644 index 0000000..cc5457a --- /dev/null +++ b/nvim/.gitignore @@ -0,0 +1,8 @@ +tt.* +.tests +doc/tags +debug +.repro +foo.* +*.log +data diff --git a/nvim/.neoconf.json b/nvim/.neoconf.json new file mode 100644 index 0000000..7c48087 --- /dev/null +++ b/nvim/.neoconf.json @@ -0,0 +1,15 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + } +} diff --git a/nvim/LICENSE b/nvim/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/nvim/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/nvim/README.md b/nvim/README.md new file mode 100644 index 0000000..185280b --- /dev/null +++ b/nvim/README.md @@ -0,0 +1,4 @@ +# 💤 LazyVim + +A starter template for [LazyVim](https://github.com/LazyVim/LazyVim). +Refer to the [documentation](https://lazyvim.github.io/installation) to get started. diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 0000000..ffbd395 --- /dev/null +++ b/nvim/init.lua @@ -0,0 +1,9 @@ +-- load original vimrc file +vim.cmd([[ source $XDG_CONFIG_HOME/vim/vimrc ]]) + +-- TODO: review if I want this for some buffers +vim.g.autoformat = false + +-- bootstrap lazy.nvim, LazyVim and your plugins +package.loaded["lazyvim.config.options"] = true +require("config.lazy") diff --git a/nvim/lua/config/autocmds.lua b/nvim/lua/config/autocmds.lua new file mode 100644 index 0000000..2e26068 --- /dev/null +++ b/nvim/lua/config/autocmds.lua @@ -0,0 +1,33 @@ +-- Autocmds are automatically loaded on the VeryLazy event + +local function augroup(name) + return vim.api.nvim_create_augroup("lazyvim_" .. name, { clear = true }) +end + +-- Highlight on yank +vim.api.nvim_create_autocmd("TextYankPost", { + group = augroup("highlight_yank"), + callback = function() + vim.highlight.on_yank() + end, +}) + +-- close some filetypes with +vim.api.nvim_create_autocmd("FileType", { + group = augroup("close_with_q"), + pattern = { + "PlenaryTestPopup", + "help", + "lspinfo", + "man", + "notify", + "qf", + "spectre_panel", + "startuptime", + "tsplayground", + }, + callback = function(event) + vim.bo[event.buf].buflisted = false + vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true }) + end, +}) diff --git a/nvim/lua/config/keymaps.lua b/nvim/lua/config/keymaps.lua new file mode 100644 index 0000000..e8b8287 --- /dev/null +++ b/nvim/lua/config/keymaps.lua @@ -0,0 +1,93 @@ +-- Keymaps are automatically loaded on the VeryLazy event + +local Util = require("lazyvim.util") + +local function map(mode, lhs, rhs, opts) + local keys = require("lazy.core.handler").handlers.keys + ---@cast keys LazyKeysHandler + -- do not create the keymap if a lazy keys handler exists + if not keys.active[keys.parse({ lhs, mode = mode }).id] then + opts = opts or {} + opts.silent = opts.silent ~= false + vim.keymap.set(mode, lhs, rhs, opts) + end +end + +-- Resize window using arrow keys +-- TODO: this is cool, but should also support a number +map("n", "", "resize +2", { desc = "Increase window height" }) +map("n", "", "resize -2", { desc = "Decrease window height" }) +map("n", "", "vertical resize -2", { desc = "Decrease window width" }) +map("n", "", "vertical resize +2", { desc = "Increase window width" }) + +-- Move Lines +map("n", "", "m .+1==", { desc = "Move down" }) +map("n", "", "m .-2==", { desc = "Move up" }) +map("i", "", "m .+1==gi", { desc = "Move down" }) +map("i", "", "m .-2==gi", { desc = "Move up" }) +map("v", "", ":m '>+1gv=gv", { desc = "Move down" }) +map("v", "", ":m '<-2gv=gv", { desc = "Move up" }) + +-- buffers +if Util.has("bufferline.nvim") then + map("n", "", "BufferLineCyclePrev", { desc = "Prev buffer" }) + map("n", "", "BufferLineCycleNext", { desc = "Next buffer" }) + map("n", "[b", "BufferLineCyclePrev", { desc = "Prev buffer" }) + map("n", "]b", "BufferLineCycleNext", { desc = "Next buffer" }) +else + map("n", "", "bprevious", { desc = "Prev buffer" }) + map("n", "", "bnext", { desc = "Next buffer" }) + map("n", "[b", "bprevious", { desc = "Prev buffer" }) + map("n", "]b", "bnext", { desc = "Next buffer" }) +end +map("n", "bb", "e #", { desc = "Switch to Other Buffer" }) +map("n", "`", "e #", { desc = "Switch to Other Buffer" }) + +-- Clear search with +map({ "i", "n" }, "", "noh", { desc = "Escape and clear hlsearch" }) + +-- Clear search, diff update and redraw +-- taken from runtime/lua/_editor.lua +map( + "n", + "ur", + "nohlsearchdiffupdatenormal! ", + { desc = "Redraw / clear hlsearch / diff update" } +) + +map({ "n", "x" }, "gw", "*N", { desc = "Search word under cursor" }) + +-- Add undo break-points +map("i", ",", ",u") +map("i", ".", ".u") +map("i", ";", ";u") + +-- lazy +map("n", "l", ":Lazy", { desc = "Lazy" }) + +-- new file +map("n", "fn", "enew", { desc = "New File" }) + +if not Util.has("trouble.nvim") then + map("n", "[q", vim.cmd.cprev, { desc = "Previous quickfix" }) + map("n", "]q", vim.cmd.cnext, { desc = "Next quickfix" }) +end + +-- stylua: ignore start + +-- toggle options +map("n", "uf", Util.format.toggle, { desc = "Toggle format on Save" }) +map("n", "ud", Util.toggle.diagnostics, { desc = "Toggle Diagnostics" }) +local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3 +map("n", "uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" }) + +-- highlights under cursor +if vim.fn.has("nvim-0.9.0") == 1 then + map("n", "ui", vim.show_pos, { desc = "Inspect Pos" }) +end + +-- floating terminal +-- TODO: I prefer a split buffer for terminal, need to review how to make this more vim-like +map("n", "ft", function() Util.float_term(nil, { cwd = Util.get_root() }) end, { desc = "Terminal (root dir)" }) +map("n", "fT", function() Util.float_term() end, { desc = "Terminal (cwd)" }) +map("t", "", "", {desc = "Enter Normal Mode"}) diff --git a/nvim/lua/config/lazy.lua b/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..bad9b58 --- /dev/null +++ b/nvim/lua/config/lazy.lua @@ -0,0 +1,52 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + -- bootstrap lazy.nvim + -- stylua: ignore + vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) +end +vim.opt.rtp:prepend(vim.env.LAZY or lazypath) + +require("lazy").setup({ + spec = { + -- add LazyVim and import its plugins + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- import any extras modules here + -- { import = "lazyvim.plugins.extras.lang.typescript" }, + -- { import = "lazyvim.plugins.extras.lang.json" }, + -- { import = "lazyvim.plugins.extras.ui.mini-animate" }, + -- import/override with your plugins + { import = "plugins" }, + }, + defaults = { + -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. + -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. + lazy = false, + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = false, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + }, + install = { colorscheme = { "tokyonight", "habamax" } }, + checker = { + -- automatically check for plugin updates + enabled = true, + notify = false, + }, + performance = { + rtp = { + -- HACK: do not reset rtp to allow interop with vim-plug + reset = false, + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/nvim/lua/config/options.lua b/nvim/lua/config/options.lua new file mode 100644 index 0000000..5fce922 --- /dev/null +++ b/nvim/lua/config/options.lua @@ -0,0 +1,24 @@ +-- Options are automatically loaded before lazy.nvim startup + +local opt = vim.opt + +vim.g.man_hardwrap = 1 +vim.env.MANWIDTH = 80 + +vim.diagnostic.config({ virtual_text = false }) + +-- TODO: also try noinsert +opt.completeopt = "menu,menuone,noselect" + +-- Some settings taken from LazyVim's default options +opt.pumblend = 10 -- Popup blend +opt.pumheight = 10 -- Maximum number of entries in a popup +opt.showmode = false -- Dont show mode since we have a statusline +opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time +opt.updatetime = 200 -- Save swap file and trigger CursorHold +if vim.fn.has("nvim-0.9.0") == 1 then + opt.splitkeep = "screen" + opt.shortmess:append({ C = true }) +end +-- do not let markdown plugin change indent +vim.g.markdown_recommended_style = 0 diff --git a/nvim/lua/plugins/coding.lua b/nvim/lua/plugins/coding.lua new file mode 100644 index 0000000..324dc4e --- /dev/null +++ b/nvim/lua/plugins/coding.lua @@ -0,0 +1,142 @@ +---@type LazyPluginSpec +return { + -- snippets + { + "L3MON4D3/LuaSnip", + -- disable luasnip bindings for and + dependencies = { + { + "honza/vim-snippets", + config = function() + require("luasnip.loaders.from_snipmate").lazy_load() + require("luasnip.loaders.from_lua").load({ paths = vim.fn.stdpath("config") .. "/lua/snippets" }) + end, + }, + }, + keys = function() + return {} + end, + opts = { + store_selection_keys = "", + }, + }, + + -- auto completion + { + "hrsh7th/nvim-cmp", + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + + local cmp = require("cmp") + local luasnip = require("luasnip") + + local upstream_format = opts.formatting.format + opts.formatting.format = function(entry, vim_item) + vim_item = upstream_format(entry, vim_item) + local menu = { + nvim_lsp = "[lsp]", + luasnip = "[snip]", + buffer = "[buf]", + path = "[path]", + } + vim_item.menu = menu[entry.source.name] + return vim_item + end + + opts.completion = vim.tbl_extend("force", opts.completion, { + completeopt = "menu,menuone,noselect", + }) + -- TODO: review if I want to keep any of LazyVim's mappings + opts.mapping = cmp.mapping.preset.insert({ + -- lazyvims + [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.complete(), + -- mine + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }) + end, + }, + + -- auto pairs + { + "echasnovski/mini.pairs", + }, + + -- surround + { + "echasnovski/mini.surround", + keys = function() + -- HACK: use function to disable merging with LazyVim's keys definition + return { + { "ys", desc = "Add surrounding", "n" }, + { "S", desc = "Add surrounding", "x" }, + { "ds", desc = "Delete surrounding" }, + { "cs", desc = "Change surrounding" }, + { "yss", "ys_", remap = true }, + } + end, + opts = { + mappings = { + -- TODO: this is tpope/surround like, but should consider using vim-sandwich mappings + -- see: :h MiniSurround-vim-surround-config + add = "ys", + delete = "ds", + find = "", + find_left = "", + highlight = "", + replace = "cs", + update_n_lines = "", + }, + }, + config = function(_, opts) + require("mini.surround").setup(opts) + -- remap visual + vim.keymap.del("x", "ys", { silent = true }) + vim.keymap.set("x", "S", [[:lua MiniSurround.add('visual')]], { silent = true }) + end, + }, + -- comments + { + "numToStr/Comment.nvim", + opts = { + toggler = { + line = "gcc", + block = "gbb", + }, + mappings = { + basic = true, + extra = true, + }, + }, + }, + { "JoosepAlviste/nvim-ts-context-commentstring", enabled = false }, + { "echasnovski/mini.comment", enabled = false }, +} diff --git a/nvim/lua/plugins/colorscheme.lua b/nvim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..8e1ae25 --- /dev/null +++ b/nvim/lua/plugins/colorscheme.lua @@ -0,0 +1,83 @@ +---@type LazyPluginSpec +return { + { + "LazyVim", + opts = { colorscheme = "onenord" }, + dependencies = { "onenord.nvim" }, + }, + { + -- this meta plugin can be used to install all colorschemes to test with telescope + name = "colorschemes", + dir = "", + lazy = true, + dependencies = { + { + -- requires too much configuration to make look good + "rmehri01/onenord.nvim", + opts = function(_, opts) + local colors = require("onenord.colors").load() + opts = vim.tbl_extend("force", opts, { + custom_highlights = { + ["@parameter"] = { fg = colors.fg }, + ["@namespace"] = { fg = colors.fg }, + ["@type"] = { fg = colors.fg }, + ["@variable.builtin"] = { fg = colors.fg }, + }, + }) + return opts + end, + }, + { "folke/tokyonight.nvim" }, + { + "catppuccin/nvim", + name = "catppuccin", + opts = { + color_overrides = { + -- https://github.com/catppuccin/nvim/discussions/323#discussioncomment-5760383 + mocha = { + rosewater = "#BF616A", + flamingo = "#BF616A", + pink = "#B48EAD", + mauve = "#B48EAD", + red = "#BF616A", + maroon = "#BF616A", + peach = "#D08770", + yellow = "#EBCB8B", + green = "#A3BE8C", + teal = "#88c0d0", + sky = "#88c0d0", + sapphire = "#88c0d0", + blue = "#81a1c1", + lavender = "#81a1c1", + text = "#ECEFF4", + subtext1 = "#E5E9F0", + subtext0 = "#D8DEE9", + overlay2 = "#8d9196", + overlay1 = "#81858b", + overlay0 = "#4C566A", + surface2 = "#434C5E", + surface1 = "#3B4252", + surface0 = "#292e39", + base = "#242933", + mantle = "#20242d", + crust = "#1c2028", + }, + }, + }, + }, + { + "shaunsingh/nord.nvim", + dev = true, + init = function() + vim.g.nord_contrats = true + vim.g.nord_borders = true + vim.g.nord_bold = false + vim.g.nord_uniform_diff_background = false + vim.g.nord_disable_background = false + end, + }, + -- conflicts with above + -- { "gbprod/nord.nvim"}, + }, + }, +} diff --git a/nvim/lua/plugins/core.lua b/nvim/lua/plugins/core.lua new file mode 100644 index 0000000..fecdfd8 --- /dev/null +++ b/nvim/lua/plugins/core.lua @@ -0,0 +1,13 @@ +---@type LazyPluginSpec +return { + { + "LazyVim/LazyVim", + opts = { + defaults = { + autocmds = false, + options = false, + keymaps = false, + }, + }, + }, +} diff --git a/nvim/lua/plugins/dap.lua b/nvim/lua/plugins/dap.lua new file mode 100644 index 0000000..302edc4 --- /dev/null +++ b/nvim/lua/plugins/dap.lua @@ -0,0 +1,140 @@ +return { + "mfussenegger/nvim-dap", + + dependencies = { + -- fancy UI for the debugger + { + "rcarriga/nvim-dap-ui", + -- stylua: ignore + keys = { + { "du", function() require("dapui").toggle({ }) end, desc = "Dap UI" }, + { "de", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} }, + }, + opts = {}, + config = function(_, opts) + local dap = require("dap") + local dapui = require("dapui") + dapui.setup(opts) + dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open({}) + end + dap.listeners.before.event_terminated["dapui_config"] = function() + dapui.close({}) + end + dap.listeners.before.event_exited["dapui_config"] = function() + dapui.close({}) + end + end, + }, + + -- virtual text for the debugger + { + "theHamsta/nvim-dap-virtual-text", + opts = {}, + }, + + -- which key integration + { + "folke/which-key.nvim", + opts = { + defaults = { + ["d"] = { name = "+debug" }, + ["da"] = { name = "+adapters" }, + }, + }, + }, + + -- mason.nvim integration + { + "jay-babu/mason-nvim-dap.nvim", + dependencies = "mason.nvim", + cmd = { "DapInstall", "DapUninstall" }, + opts = { + -- Makes a best effort to setup the various debuggers with + -- reasonable debug configurations + automatic_setup = true, + + -- You can provide additional configuration to the handlers, + -- see mason-nvim-dap README for more information + handlers = {}, + + -- You'll need to check that you have the required things installed + -- online, please don't ask me how to install them :) + ensure_installed = { + "cpptools", + }, + }, + config = function(_, opts) + require("mason-nvim-dap").setup(opts) + local dap = require("dap") + dap.configurations.cpp = { + { + name = "Launch file", + type = "cppdbg", + request = "launch", + program = function() + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") + end, + cwd = "${workspaceFolder}", + stopAtEntry = true, + }, + } + end, + }, + + { + "jbyuki/one-small-step-for-vimkind", + -- stylua: ignore + keys = { + { "daL", function() require("osv").launch({ port = 8086 }) end, desc = "Adapter Lua Server" }, + { "dal", function() require("osv").run_this() end, desc = "Adapter Lua" }, + }, + config = function() + local dap = require("dap") + dap.adapters.nlua = function(callback, config) + callback({ type = "server", host = config.host or "127.0.0.1", port = config.port or 8086 }) + end + dap.configurations.lua = { + { + type = "nlua", + request = "attach", + name = "Attach to running Neovim instance", + }, + } + end, + }, + }, + + -- stylua: ignore + keys = { + { "dB", function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = "Breakpoint Condition" }, + { "db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" }, + { "dc", function() require("dap").continue() end, desc = "Continue" }, + { "dC", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" }, + { "dg", function() require("dap").goto_() end, desc = "Go to line (no execute)" }, + { "di", function() require("dap").step_into() end, desc = "Step Into" }, + { "dj", function() require("dap").down() end, desc = "Down" }, + { "dk", function() require("dap").up() end, desc = "Up" }, + { "dl", function() require("dap").run_last() end, desc = "Run Last" }, + { "do", function() require("dap").step_out() end, desc = "Step Out" }, + { "dO", function() require("dap").step_over() end, desc = "Step Over" }, + { "dp", function() require("dap").pause() end, desc = "Pause" }, + { "dr", function() require("dap").repl.toggle() end, desc = "Toggle REPL" }, + { "ds", function() require("dap").session() end, desc = "Session" }, + { "dt", function() require("dap").terminate() end, desc = "Terminate" }, + { "dw", function() require("dap.ui.widgets").hover() end, desc = "Widgets" }, + }, + + config = function() + local Config = require("lazyvim.config") + vim.api.nvim_set_hl(0, "DapStoppedLine", { default = true, link = "Visual" }) + + for name, sign in pairs(Config.icons.dap) do + sign = type(sign) == "table" and sign or { sign } + vim.fn.sign_define( + "Dap" .. name, + { text = sign[1], texthl = sign[2] or "DiagnosticInfo", linehl = sign[3], numhl = sign[3] } + ) + end + end, +} diff --git a/nvim/lua/plugins/editor.lua b/nvim/lua/plugins/editor.lua new file mode 100644 index 0000000..1ec7312 --- /dev/null +++ b/nvim/lua/plugins/editor.lua @@ -0,0 +1,118 @@ +local Util = require("lazyvim.util") + +---@type LazyPluginSpec +return { + { + "nvim-telescope/telescope.nvim", + keys = { + { "fF", Util.telescope("files", { cwd = false }), desc = "Find Files (cwd)" }, + -- from lazyvim + { ",", "Telescope buffers show_all_buffers=true", desc = "Switch Buffer" }, + { "/", Util.telescope("live_grep"), desc = "Grep (root dir)" }, + { ":", "Telescope command_history", desc = "Command History" }, + { "", Util.telescope("files"), desc = "Find Files (root dir)" }, + { "", false }, + -- find + { "fb", "Telescope buffers sort_lastused=true", desc = "Buffers" }, + -- { "ff", Util.telescope("files"), desc = "Find Files (root dir)" }, + { "ff", false }, -- fswitch + { "fF", Util.telescope("files", { cwd = false }), desc = "Find Files (cwd)" }, + { "fr", "Telescope oldfiles", desc = "Recent" }, + { "fR", Util.telescope("oldfiles", { cwd = vim.loop.cwd() }), desc = "Recent (cwd)" }, + -- git + -- { "gc", "Telescope git_commits", desc = "commits" }, + { "gc", false }, + -- { "gs", "Telescope git_status", desc = "status" }, + { "gs", false }, + -- search + { "sa", "Telescope autocommands", desc = "Auto Commands" }, + { "sb", "Telescope current_buffer_fuzzy_find", desc = "Buffer" }, + { "sc", "Telescope command_history", desc = "Command History" }, + { "sC", "Telescope commands", desc = "Commands" }, + { "sd", "Telescope diagnostics bufnr=0", desc = "Document diagnostics" }, + { "sD", "Telescope diagnostics", desc = "Workspace diagnostics" }, + { "sg", Util.telescope("live_grep"), desc = "Grep (root dir)" }, + { "sG", Util.telescope("live_grep", { cwd = false }), desc = "Grep (cwd)" }, + { "sh", "Telescope help_tags", desc = "Help Pages" }, + { "sH", "Telescope highlights", desc = "Search Highlight Groups" }, + { "sk", "Telescope keymaps", desc = "Key Maps" }, + { "sM", "Telescope man_pages", desc = "Man Pages" }, + { "sm", "Telescope marks", desc = "Jump to Mark" }, + { "so", "Telescope vim_options", desc = "Options" }, + { "sR", "Telescope resume", desc = "Resume" }, + { "sw", Util.telescope("grep_string"), desc = "Word (root dir)" }, + { "sW", Util.telescope("grep_string", { cwd = false }), desc = "Word (cwd)" }, + { "uC", Util.telescope("colorscheme", { enable_preview = true }), desc = "Colorscheme with preview" }, + -- { + -- "ss", + -- Util.telescope("lsp_document_symbols", { + -- symbols = { + -- "Class", + -- "Function", + -- "Method", + -- "Constructor", + -- "Interface", + -- "Module", + -- "Struct", + -- "Trait", + -- "Field", + -- "Property", + -- }, + -- }), + -- desc = "Goto Symbol", + -- }, + { "ss", false }, -- use for snippets below + { + "sS", + Util.telescope("lsp_dynamic_workspace_symbols", { + symbols = { + "Class", + "Function", + "Method", + "Constructor", + "Interface", + "Module", + "Struct", + "Trait", + "Field", + "Property", + }, + }), + desc = "Goto Symbol (Workspace)", + }, + }, + }, + { + "benfowler/telescope-luasnip.nvim", + dependencies = { + "telescope.nvim", + }, + config = function() + require("telescope").load_extension("luasnip") + end, + keys = { { "ss", "Telescope luasnip", desc = "Snippets" } }, + }, + { + "neo-tree.nvim", + lazy = false, + opts = { + filesystem = { + -- TODO: review these + bind_to_cwd = false, + follow_current_file = { + enabled = false, + }, + }, + }, + keys = function() + local NeoTree = function(args) + return function() + require("neo-tree.command").execute(args) + end + end + return { + { "fe", NeoTree({ toggle = true, dir = vim.loop.cwd() }) }, + } + end, + }, +} diff --git a/nvim/lua/plugins/example.lua b/nvim/lua/plugins/example.lua new file mode 100644 index 0000000..39f342f --- /dev/null +++ b/nvim/lua/plugins/example.lua @@ -0,0 +1,267 @@ +-- since this is just an example spec, don't actually load anything here and return an empty spec +-- stylua: ignore +if true then return {} end + +-- every spec file under config.plugins will be loaded automatically by lazy.nvim +-- +-- In your plugin files, you can: +-- * add extra plugins +-- * disable/enabled LazyVim plugins +-- * override the configuration of LazyVim plugins +return { + -- add gruvbox + { "ellisonleao/gruvbox.nvim" }, + + -- Configure LazyVim to load gruvbox + { + "LazyVim/LazyVim", + opts = { + colorscheme = "gruvbox", + }, + }, + + -- change trouble config + { + "folke/trouble.nvim", + -- opts will be merged with the parent spec + opts = { use_diagnostic_signs = true }, + }, + + -- disable trouble + { "folke/trouble.nvim", enabled = false }, + + -- add symbols-outline + { + "simrat39/symbols-outline.nvim", + cmd = "SymbolsOutline", + keys = { { "cs", "SymbolsOutline", desc = "Symbols Outline" } }, + config = true, + }, + + -- override nvim-cmp and add cmp-emoji + { + "hrsh7th/nvim-cmp", + dependencies = { "hrsh7th/cmp-emoji" }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + local cmp = require("cmp") + opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } })) + end, + }, + + -- change some telescope options and a keymap to browse plugin files + { + "nvim-telescope/telescope.nvim", + keys = { + -- add a keymap to browse plugin files + -- stylua: ignore + { + "fp", + function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end, + desc = "Find Plugin File", + }, + }, + -- change some options + opts = { + defaults = { + layout_strategy = "horizontal", + layout_config = { prompt_position = "top" }, + sorting_strategy = "ascending", + winblend = 0, + }, + }, + }, + + -- add telescope-fzf-native + { + "telescope.nvim", + dependencies = { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + config = function() + require("telescope").load_extension("fzf") + end, + }, + }, + + -- add pyright to lspconfig + { + "neovim/nvim-lspconfig", + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- pyright will be automatically installed with mason and loaded with lspconfig + pyright = {}, + }, + }, + }, + + -- add tsserver and setup with typescript.nvim instead of lspconfig + { + "neovim/nvim-lspconfig", + dependencies = { + "jose-elias-alvarez/typescript.nvim", + init = function() + require("lazyvim.util").on_attach(function(_, buffer) + -- stylua: ignore + vim.keymap.set( "n", "co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" }) + vim.keymap.set("n", "cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer }) + end) + end, + }, + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- tsserver will be automatically installed with mason and loaded with lspconfig + tsserver = {}, + }, + -- you can do any additional lsp server setup here + -- return true if you don't want this server to be setup with lspconfig + ---@type table + setup = { + -- example to setup with typescript.nvim + tsserver = function(_, opts) + require("typescript").setup({ server = opts }) + return true + end, + -- Specify * to use this function as a fallback for any server + -- ["*"] = function(server, opts) end, + }, + }, + }, + + -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, + -- treesitter, mason and typescript.nvim. So instead of the above, you can use: + { import = "lazyvim.plugins.extras.lang.typescript" }, + + -- add more treesitter parsers + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "bash", + "help", + "html", + "javascript", + "json", + "lua", + "markdown", + "markdown_inline", + "python", + "query", + "regex", + "tsx", + "typescript", + "vim", + "yaml", + }, + }, + }, + + -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above + -- would overwrite `ensure_installed` with the new value. + -- If you'd rather extend the default config, use the code below instead: + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + -- add tsx and treesitter + vim.list_extend(opts.ensure_installed, { + "tsx", + "typescript", + }) + end, + }, + + -- the opts function can also be used to change the default opts: + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function(_, opts) + table.insert(opts.sections.lualine_x, "😄") + end, + }, + + -- or you can return new options to override all the defaults + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function() + return { + --[[add your custom lualine config here]] + } + end, + }, + + -- use mini.starter instead of alpha + { import = "lazyvim.plugins.extras.ui.mini-starter" }, + + -- add jsonls and schemastore ans setup treesitter for json, json5 and jsonc + { import = "lazyvim.plugins.extras.lang.json" }, + + -- add any tools you want to have installed below + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "stylua", + "shellcheck", + "shfmt", + "flake8", + }, + }, + }, + + -- Use for completion and snippets (supertab) + -- first: disable default and behavior in LuaSnip + { + "L3MON4D3/LuaSnip", + keys = function() + return {} + end, + }, + -- then: setup supertab in cmp + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-emoji", + }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + + local luasnip = require("luasnip") + local cmp = require("cmp") + + opts.mapping = vim.tbl_extend("force", opts.mapping, { + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() + -- they way you will only jump inside the snippet region + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }) + end, + }, +} diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..3354f7d --- /dev/null +++ b/nvim/lua/plugins/lsp.lua @@ -0,0 +1,98 @@ +return { + -- lspconfig + { + "neovim/nvim-lspconfig", + ---@class PluginLspOpts + -- + init = function () + local keys = require("lazyvim.plugins.lsp.keymaps").get() + + -- TODO: setup a new mapping for this + -- { "gr", "Telescope lsp_references", desc = "References" }, + keys[#keys+1] = { "gr", false } + end, + opts = { + -- Automatically format on save + -- autoformat = false, + -- LSP Server Settings + ---@type lspconfig.options + servers = { + lua_ls = { + settings = { + Lua = { + diagnostics = { + disable = { "missing-fields", }, + }, + }, + }, + }, + -- Add clangd extensions + -- https://github.com/p00f/clangd_extensions.nvim + ruff_lsp = { + root_dir = function(fname) + return require("lspconfig.util").root_pattern("pyproject.toml", "setup.cfg", "ruff.toml")(fname) + end, + }, + pylsp = { + settings = { + pylsp = { + plugins = { + autopep8 = { enabled = false }, + flake8 = { enabled = false }, + mccabe = { enabled = false }, + pycodestyle = { enabled = false }, + pydocstyle = { enabled = false }, + pyflakes = { enabled = false }, -- covered by flake8 + } + } + } + } + }, + -- you can do any additional lsp server setup here + -- return true if you don't want this server to be setup with lspconfig + ---@type table + setup = { + -- example to setup with typescript.nvim + -- tsserver = function(_, opts) + -- require("typescript").setup({ server = opts }) + -- return true + -- end, + -- Specify * to use this function as a fallback for any server + -- ["*"] = function(server, opts) end, + }, + }, + }, + + -- cmdline tools and lsp servers + { + + "williamboman/mason.nvim", + cmd = "Mason", + keys = { { "cm", "Mason", desc = "Mason" } }, + opts = { + ensure_installed = { + "stylua", + "shfmt", + -- "flake8", + }, + }, + ---@param opts MasonSettings | {ensure_installed: string[]} + config = function(_, opts) + require("mason").setup(opts) + local mr = require("mason-registry") + local function ensure_installed() + for _, tool in ipairs(opts.ensure_installed) do + local p = mr.get_package(tool) + if not p:is_installed() then + p:install() + end + end + end + if mr.refresh then + mr.refresh(ensure_installed) + else + ensure_installed() + end + end, + }, +} diff --git a/nvim/lua/plugins/nvim-treesitter.lua b/nvim/lua/plugins/nvim-treesitter.lua new file mode 100644 index 0000000..8b87f09 --- /dev/null +++ b/nvim/lua/plugins/nvim-treesitter.lua @@ -0,0 +1,23 @@ +return { + -- add more treesitter parsers + { + "nvim-treesitter/nvim-treesitter", + opts = { + -- overwrites the settings from LazyVim + ensure_installed = { + "bash", + "c", + "html", + "json", + "lua", + "markdown", + "markdown_inline", + "python", + "regex", + "vim", + "vimdoc", + "yaml", + }, + }, + }, +} diff --git a/nvim/lua/plugins/productivity.lua b/nvim/lua/plugins/productivity.lua new file mode 100644 index 0000000..a612c82 --- /dev/null +++ b/nvim/lua/plugins/productivity.lua @@ -0,0 +1,120 @@ +-- TODO: finish this +-- Create a function that deindents all lines according to the indentation of the first +local function d(s) + local std = require("std") + local _, e = string.find(s, '^%s*') + local ss = std.string.split(s, '') + local dedent = function(str) return str:sub(e + 1) end + return std.functional.map(dedent, std.elems, ss) +end + +---@type LazyPluginSpec +return { + { + "nvim-orgmode/orgmode", + opts = { + org_agenda_files = { "~/org/**/*.org" }, + org_default_notes_file = "~/org/refile.org", + mappings = { + prefix = "go", + global = { + org_agenda = "goa", + org_capture = "goc", + }, + }, + win_split_mode = function(name) + local bufnr = vim.api.nvim_create_buf(false, true) + vim.api.nvim_buf_set_name(bufnr, name) + + if name == "orgagenda" then + vim.cmd("botright 80vsplit") + local win = vim.api.nvim_get_current_win() + vim.api.nvim_win_set_buf(win, bufnr) + return + end + + local fill = 0.8 + local width = math.floor((vim.o.columns * fill)) + local height = math.floor((vim.o.lines * fill)) + local row = math.floor((((vim.o.lines - height) / 2) - 1)) + local col = math.floor(((vim.o.columns - width) / 2)) + vim.api.nvim_open_win(bufnr, true, { + relative = "editor", + width = width, + height = height, + row = row, + col = col, + style = "minimal", + border = "rounded", + }) + end, + org_agenda_span = "week", + org_agenda_start_on_weekday = false, + org_agenda_start_day = "-2d", + org_archive_location = "archive/%s_archive::", + org_log_done = 'time', + org_log_into_drawer = "LOGBOOK", + org_indent_mode = "noindent", + org_tags_column = -80, -- flushright + org_todo_keywords = { "TODO(t)", "NEXT(n)", "WAITING(w)", "|", "DONE", "CANCELLED" }, + org_todo_keyword_faces = { + TODO = ":foreground #bf616a", + NEXT = ":foreground blue", + WAITING = ":foreground yellow", + CANCELLED = ":foreground grey", + }, + org_capture_templates = { + t = { + description = "Task", + template = "* TODO %?\n:PROPERTIES:\n:CREATED: %U\n:END:", + }, + l = "Log Task", + lh = { + description = "Log Task", + template = [[ +* DONE %? +SCHEDULED: %t +]], + }, + lw = { + description = "Log Task (work)", + template = [[ +* DONE %? +SCHEDULED: %t +]], + target = "~/org/work.org", + headline = "Tasks" + }, + j = { + description = "Journal", + template = "\n*** %u\n**** %U - %?", + target = "~/org/journal.org", + }, + m = { + description = "Meeting", + template = "* Meeting %U\n%?", + target = "~/org/work.org", + headline = "Meetings", + }, + }, + }, + dependencies = { + { + "nvim-treesitter", + opts = function(_, opts) + if type(opts.highlight) == "table" then + opts.hightlight = vim.tbl_extend("error", opts.highlight, { + additional_vim_regex_highlighting = { "org" }, + }) + end + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "org" }) + end + end, + }, + }, + init = function() + require("orgmode").setup_ts_grammar() + end, + }, +} diff --git a/nvim/lua/plugins/ui.lua b/nvim/lua/plugins/ui.lua new file mode 100644 index 0000000..9745a30 --- /dev/null +++ b/nvim/lua/plugins/ui.lua @@ -0,0 +1,147 @@ +---@type LazyPluginSpec +return { + { + "nvim-notify", + }, + { + "bufferline.nvim", + ---@type BufferlineConfig + opts = { + options = { + always_show_bufferline = false, + }, + }, + }, + { + "noice.nvim", + enabled = false, + ---@type NoiceConfig + opts = { + presets = { + command_palette = false, -- don't position the cmdline and popupmenu together + lsp_doc_border = true, + long_message_to_split = true, + }, + cmdline = { + view = "cmdline", + }, + routes = { + { -- send file written messages to mini + filter = { + event = "msg_show", + kind = "", + find = "%[w%]", + }, + opts = { skip = true }, + }, + }, + }, + config = function(_, opts) + -- ensure [w] is written to msg_show so we can match it + vim.opt.shortmess:append("w") + vim.opt.shortmess:remove("W") + + require("noice").setup(opts) + end, + }, + { + "lualine.nvim", + --TODO: Things that were in vim but are missing + -- - git line add/mod/del ar next to branch name rather on right + -- - one status line per splits + -- - maybe a single one is OK too? + -- - I think I want a line stating wihch file is in the split though + -- - unix/dos eof markers + -- - really I only want to know if it's not unix + -- - filetype in text form. It's quite important to glance this quickly + }, + { + "indent-blankline.nvim", + }, + { + "mini.indentscope", + opts = { + draw = { + animation = require("mini.indentscope").gen_animation.linear({ duration = 10 }), + }, + }, + }, + { + "nvimdev/dashboard-nvim", + -- TODO: create cool dashboard header + -- generate logo from text here: + -- https://patorjk.com/software/taag/#p=testall&v=0&f=Computer&t=NEOVIM + -- Can also use use `chafa` and aplha.term to generate text from cli, see + -- https://github.com/goolord/alpha-nvim/discussions/16#discussioncomment-4915947 + -- https://github.com/goolord/alpha-nvim/discussions/16#discussioncomment-5065731 + -- To add orgmode agenda button in alpha + -- dashboard.button("a", "󰕪 " .. " View Agenda", ":lua require('orgmode').action('agenda.agenda')"), + opts = function() + local logo = [[ + ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z + ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z + ██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z + ██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z + ███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║ + ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ + ]] + + logo = string.rep("\n", 8) .. logo .. "\n\n" + + local opts = { + theme = "doom", + hide = { + -- this is taken care of by lualine + -- enabling this messes up the actual laststatus setting after loading a file + statusline = false, + }, + config = { + header = vim.split(logo, "\n"), + -- stylua: ignore + center = { + { action = [[lua require('orgmode').action('agenda.agenda')]], desc = " View Agenda", icon = "󰕪 ", key = "a" }, + { action = "Telescope find_files", desc = " Find file", icon = " ", key = "f" }, + { action = "ene | startinsert", desc = " New file", icon = " ", key = "n" }, + { action = "Telescope oldfiles", desc = " Recent files", icon = " ", key = "r" }, + { action = [[lua require("lazyvim.util").telescope.config_files()()]], desc = " Config", icon = " ", key = "c" }, + { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" }, + { action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "x" }, + { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, + }, + footer = function() + local stats = require("lazy").stats() + local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) + return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" } + end, + }, + } + + for _, button in ipairs(opts.config.center) do + button.desc = button.desc .. string.rep(" ", 43 - #button.desc) + button.key_format = " %s" + end + + -- close Lazy and re-open when the dashboard is ready + if vim.o.filetype == "lazy" then + vim.cmd.close() + vim.api.nvim_create_autocmd("User", { + pattern = "DashboardLoaded", + callback = function() + require("lazy").show() + end, + }) + end + + return opts + end + }, + { + "nvim-navic", + }, + { + "nvim-web-devicons", + }, + { + "nui.nvim", + }, +} diff --git a/nvim/lua/snippets/all.lua b/nvim/lua/snippets/all.lua new file mode 100644 index 0000000..40c6cdb --- /dev/null +++ b/nvim/lua/snippets/all.lua @@ -0,0 +1,17 @@ +-- TODO: finish this +local comment_calculate = require("Comment.ft").calculate +local comment_utils = require("Comment.utils") + +return { + s( + "FPP", + fmt( + [[Copyright © Focal Point Positioning Limited {year}. All Rights Reserved. +This code is the copyright of Focal Point Positioning Limited and +cannot be used, copied or distributed without the express written +permission of Focal Point Positioning Limited. +]], + { year = i("year", os.date("%Y")) } + ) + ), +} diff --git a/nvim/stylua.toml b/nvim/stylua.toml new file mode 100644 index 0000000..0f90030 --- /dev/null +++ b/nvim/stylua.toml @@ -0,0 +1,3 @@ +indent_type = "Spaces" +indent_width = 2 +column_width = 120 diff --git a/qutebrowser/.gitignore b/qutebrowser/.gitignore index 77b9ee0..e622eda 100644 --- a/qutebrowser/.gitignore +++ b/qutebrowser/.gitignore @@ -1,2 +1,3 @@ /qsettings/ autoconfig.yml +/bookmarks/ diff --git a/qutebrowser/config.py b/qutebrowser/config.py index 5a091a5..0994d6b 100644 --- a/qutebrowser/config.py +++ b/qutebrowser/config.py @@ -1,14 +1,11 @@ -## Autogenerated config.py -## -## NOTE: config.py is intended for advanced users who are comfortable -## with manually migrating the config file on qutebrowser upgrades. If -## you prefer, you can also configure qutebrowser using the -## :set/:bind/:config-* commands without having to write a config.py -## file. -## -## Documentation: -## qute://help/configuring.html -## qute://help/settings.html +# noqa: D100 + +from qutebrowser.config.configfiles import ConfigAPI +from qutebrowser.config.config import ConfigContainer + +c: ConfigContainer = c # noqa: F821 pylint: disable=E0602,C0103 +config: ConfigAPI = config # noqa: F821 pylint: disable=E0602,C0103 + def in_terminal(cmd: list): """Wraps cmd to be run in the default TERMINAL, as set by environment. @@ -20,31 +17,8 @@ def in_terminal(cmd: list): t = getenv('TERMINAL', 'xterm') return [t, '-e'] + cmd -try: - from qutebrowser.api import interceptor, message - from PyQt5.QtCore import QUrl - - def intercept(info: interceptor.Request): - url = info.request_url - if url.host() == "twitter.com": - url.setHost("nitter.eu") - message.info("Redirecting to " + url.toString()) - info.redirect(url) - if url.host() == "xkcd.com": - url.setHost("m.xkcd.com") - message.info("Redirecting to " + url.toString()) - info.redirect(url) - if url.host() == "www.bristolpost.co.uk": - url.setUrl("https://outline.com/" + url.toString()) - message.info("Redirecting to " + url.toString()) - info.redirect(url) - - interceptor.register(intercept) -except ImportError: - pass - -## This is here so configs done via the GUI are still loaded. -## Remove it to not load settings done via the GUI. + +## Change the argument to True to still load settings configured via autoconfig.yml config.load_autoconfig(True) ## Aliases for commands. The keys of the given dictionary are the @@ -108,7 +82,16 @@ c.auto_save.session = True ## key. Note that when a key is bound (via `bindings.default` or ## `bindings.commands`), the mapping is ignored. ## Type: Dict -c.bindings.key_mappings = {'': '', '': '', '': '', '': '', '': '', '': '', '': '', '': ''} +c.bindings.key_mappings = { + '': '', + '': '', + '': '', + '': '', + '': '', + '': '', + '': '', + '': '' +} ## When to show a changelog after qutebrowser was upgraded. ## Type: String @@ -144,6 +127,8 @@ c.changelog_after_upgrade = 'patch' ## `colors.webpage.darkmode.threshold.text` to 150 and ## `colors.webpage.darkmode.threshold.background` to 205. - "With ## selective inversion of everything": Combines the two variants above. +## - "With increased text contrast": Set +## `colors.webpage.darkmode.increase_text_contrast` (QtWebEngine 6.3+) ## Type: Bool # c.colors.webpage.darkmode.enabled = False @@ -159,6 +144,10 @@ c.changelog_after_upgrade = 'patch' ## Type: Float # c.colors.webpage.darkmode.grayscale.images = 0.0 +## Increase text contrast by drawing an outline of the uninverted color. +## Type: Bool +# c.colors.webpage.darkmode.increase_text_contrast = False + ## Which images to apply dark mode to. With QtWebEngine 5.15.0, this ## setting can cause frequent renderer process crashes due to a ## https://codereview.qt-project.org/c/qt/qtwebengine- @@ -220,6 +209,7 @@ c.changelog_after_upgrade = 'patch' ## this list show up in the completion window under the Filesystem ## category when the command line contains `:open` but no argument. ## Type: List of String +# TODO: # c.completion.favorite_paths = [] ## Height (in pixels or as percentage of the window) of the completion. @@ -478,7 +468,7 @@ c.content.headers.accept_language = 'en-UK;q=1.0, en;q=0.9, de;q=0.7, fr;q=0.7, ## the full referer. No restart is needed with QtWebKit. ## Type: String ## Valid values: -## - always: Always send the Referer. +## - always: Always send the Referer. With QtWebEngine 6.2+, this value is unavailable and will act like `same-domain`. ## - never: Never send the Referer. This is not recommended, as some sites may break. ## - same-domain: Only send the Referer for the same domain. This will still protect your privacy, but shouldn't break any sites. With QtWebEngine, the referer will still be sent for other domains, but with stripped path information. # c.content.headers.referer = 'same-domain' @@ -636,19 +626,17 @@ config.set('content.notifications.enabled', True, '*://*.gitlab.com/*') config.set('content.notifications.enabled', True, '*://*.google.com/*') ## What notification presenter to use for web notifications. Note that -## not all implementations support all features of notifications: - With -## PyQt 5.14, any setting other than `qt` does not support the `click` -## and `close` events, as well as the `tag` option to replace existing -## notifications. - The `qt` and `systray` options only support showing -## one notification at the time and ignore the `tag` option to replace -## existing notifications. - The `herbe` option only supports showing one +## not all implementations support all features of notifications: - The +## `qt` and `systray` options only support showing one notification at +## the time and ignore the `tag` option to replace existing +## notifications. - The `herbe` option only supports showing one ## notification at the time and doesn't show icons. - The `messages` ## option doesn't show icons and doesn't support the `click` and ## `close` events. ## Type: String ## Valid values: ## - auto: Tries `libnotify`, `systray` and `messages`, uses the first one available without showing error messages. -## - qt: Use Qt's native notification presenter, based on a system tray icon. Switching from or to this value requires a restart of qutebrowser. Recommended over `systray` on PyQt 5.14. +## - qt: Use Qt's native notification presenter, based on a system tray icon. Switching from or to this value requires a restart of qutebrowser. ## - libnotify: Shows messages via DBus in a libnotify-compatible way. If DBus isn't available, falls back to `systray` or `messages`, but shows an error message. ## - systray: Use a notification presenter based on a systray icon. Falls back to `libnotify` or `messages` if not systray is available. This is a reimplementation of the `qt` setting value, but with the possibility to switch to it at runtime. ## - messages: Show notifications as qutebrowser messages. Most notification features aren't available. @@ -689,7 +677,7 @@ c.content.pdfjs = True ## this setting is set to False, the system-wide animation setting is ## considered. ## Type: Bool -# c.content.prefers_reduced_motion = False +c.content.prefers_reduced_motion = True ## Draw the background color and images also when the page is printed. ## Type: Bool @@ -733,10 +721,7 @@ with config.pattern('*://calendar.google.com/*') as p: ## Type: Bool # c.content.site_specific_quirks.enabled = True -## Disable a list of named quirks. The js-string-replaceall quirk is -## needed for Nextcloud Calendar < 2.2.0 with QtWebEngine < 5.15.3. -## However, the workaround is not fully compliant to the ECMAScript spec -## and might cause issues on other websites, so it's disabled by default. +## Disable a list of named quirks. ## Type: FlagList ## Valid values: ## - ua-whatsapp @@ -746,12 +731,10 @@ with config.pattern('*://calendar.google.com/*') as p: ## - js-whatsapp-web ## - js-discord ## - js-string-replaceall -## - js-globalthis -## - js-object-fromentries ## - js-array-at ## - misc-krunker ## - misc-mathml-darkmode -# c.content.site_specific_quirks.skip = ['js-string-replaceall'] +# c.content.site_specific_quirks.skip = [] ## How to proceed on TLS certificate errors. ## Type: String @@ -776,7 +759,8 @@ with config.pattern('*://calendar.google.com/*') as p: ## Enable WebGL. ## Type: Bool -# c.content.webgl = True +c.content.webgl = False +config.set('content.webgl', True, '*://meet.google.com/*') ## Which interfaces to expose via WebRTC. ## Type: String @@ -965,6 +949,10 @@ c.fonts.default_family = ["Fira Code"] ## Type: Font # c.fonts.tabs.unselected = 'default_size default_family' +## Font used for tooltips. If set to null, the Qt default is used. +## Type: Font +# c.fonts.tooltip = None + ## Font family for cursive fonts. ## Type: FontFamily # c.fonts.web.family.cursive = '' @@ -1083,31 +1071,32 @@ c.hints.scatter = False ## CSS selectors used to determine which elements on a page should have ## hints. ## Type: Dict -c.hints.selectors = {'all': ['a', 'area', 'textarea', 'select', - 'input:not([type="hidden"])', 'button', 'frame', - 'iframe', 'img', 'link', 'summary', - '[contenteditable]:not([contenteditable="false"])', - '[onclick]', '[onmousedown]', '[role="link"]', - '[role="option"]', '[role="button"]', - '[role="tab"]', '[role="checkbox"]', - '[role="menuitem"]', '[role="menuitemcheckbox"]', - '[role="menuitemradio"]', '[role="treeitem"]', - '[ng-click]', '[ngClick]', '[data-ng-click]', - '[x-ng-click]', '[tabindex]:not([tabindex="-1"])'], - 'links': ['a[href]', 'area[href]', 'link[href]', '[role="link"][href]'], - 'images': ['img'], - 'media': ['audio', 'img', 'video'], - 'url': ['[src]', '[href]'], - 'inputs': ['input[type="text"]', 'input[type="date"]', - 'input[type="datetime-local"]', - 'input[type="email"]', 'input[type="month"]', - 'input[type="number"]', 'input[type="password"]', - 'input[type="search"]', 'input[type="tel"]', - 'input[type="time"]', 'input[type="url"]', - 'input[type="week"]', 'input:not([type])', - '[contenteditable]:not([contenteditable="false"])', - 'textarea'] - } +# TODO: reduce hints on some websites like reddit +c.hints.selectors = { + 'all': [ + 'a', 'area', 'textarea', 'select', 'input:not([type="hidden"])', + 'button', 'frame', 'iframe', 'img', 'link', 'summary', + '[contenteditable]:not([contenteditable="false"])', '[onclick]', + '[onmousedown]', '[role="link"]', '[role="option"]', '[role="button"]', + '[role="tab"]', '[role="checkbox"]', '[role="menuitem"]', + '[role="menuitemcheckbox"]', '[role="menuitemradio"]', + '[role="treeitem"]', '[aria-haspopup]', '[ng-click]', '[ngClick]', + '[data-ng-click]', '[x-ng-click]', '[tabindex]:not([tabindex="-1"])' + ], + 'links': ['a[href]', 'area[href]', 'link[href]', '[role="link"][href]'], + 'images': ['img'], + 'media': ['audio', 'img', 'video'], + 'url': ['[src]', '[href]'], + 'inputs': [ + 'input[type="text"]', 'input[type="date"]', + 'input[type="datetime-local"]', 'input[type="email"]', + 'input[type="month"]', 'input[type="number"]', + 'input[type="password"]', 'input[type="search"]', 'input[type="tel"]', + 'input[type="time"]', 'input[type="url"]', 'input[type="week"]', + 'input:not([type])', + '[contenteditable]:not([contenteditable="false"])', 'textarea' + ] +} ## Make characters in hint strings uppercase. ## Type: Bool @@ -1286,6 +1275,17 @@ c.new_instance_open_target_window = 'last-visible' ## Type: List of String c.qt.args = ['proxy-pac-url=file://' + str(config.configdir / 'proxy.pac')] +## Enables Web Platform features that are in development. This passes the +## `--enable-experimental-web-platform-features` flag to Chromium. By +## default, this is enabled with Qt 5 to maximize compatibility despite +## an aging Chromium base. +## Type: String +## Valid values: +## - always: Enable experimental web platform features. +## - auto: Enable experimental web platform features when using Qt 5. +## - never: Disable experimental web platform features. +# c.qt.chromium.experimental_web_platform_features = 'auto' + ## When to use Chromium's low-end device mode. This improves the RAM ## usage of renderer processes, at the expense of performance. ## Type: String @@ -1293,13 +1293,14 @@ c.qt.args = ['proxy-pac-url=file://' + str(config.configdir / 'proxy.pac')] ## - always: Always use low-end device mode. ## - auto: Decide automatically (uses low-end mode with < 1 GB available RAM). ## - never: Never use low-end device mode. +# TODO: maybe never? # c.qt.chromium.low_end_device_mode = 'auto' ## Which Chromium process model to use. Alternative process models use ## less resources, but decrease security and robustness. See the ## following pages for more details: - ## https://www.chromium.org/developers/design-documents/process-models -## - https://doc.qt.io/qt-5/qtwebengine-features.html#process-models +## - https://doc.qt.io/qt-6/qtwebengine-features.html#process-models ## Type: String ## Valid values: ## - process-per-site-instance: Pages from separate sites are put into separate processes and separate visits to the same site are also isolated. @@ -1357,13 +1358,25 @@ c.qt.args = ['proxy-pac-url=file://' + str(config.configdir / 'proxy.pac')] # c.qt.force_software_rendering = 'none' ## Turn on Qt HighDPI scaling. This is equivalent to setting -## QT_AUTO_SCREEN_SCALE_FACTOR=1 or QT_ENABLE_HIGHDPI_SCALING=1 (Qt >= -## 5.14) in the environment. It's off by default as it can cause issues -## with some bitmap fonts. As an alternative to this, it's possible to -## set font sizes and the `zoom.default` setting. +## QT_ENABLE_HIGHDPI_SCALING=1 (Qt >= 5.14) in the environment. It's off +## by default as it can cause issues with some bitmap fonts. As an +## alternative to this, it's possible to set font sizes and the +## `zoom.default` setting. ## Type: Bool # c.qt.highdpi = False +## Disable accelerated 2d canvas to avoid graphical glitches. On some +## setups graphical issues can occur on sites like Google sheets and +## PDF.js. These don't occur when accelerated 2d canvas is turned off, so +## we do that by default. So far these glitches only occur on some Intel +## graphics devices. +## Type: String +## Valid values: +## - always: Disable accelerated 2d canvas +## - auto: Disable on Qt6 < 6.6.0, enable otherwise +## - never: Enable accelerated 2d canvas +# c.qt.workarounds.disable_accelerated_2d_canvas = 'auto' + ## Work around locale parsing issues in QtWebEngine 5.15.3. With some ## locales, QtWebEngine 5.15.3 is unusable without this workaround. In ## affected scenarios, QtWebEngine will log "Network service crashed, @@ -1804,6 +1817,7 @@ c.url.searchengines = {'DEFAULT': 'https://duckduckgo.com/?t=chakra&q={}' 'fpp/confluence': 'https://fppnt.atlassian.net/wiki/search?text={}', 'evk': 'https://gitlab.com/search?&scope=issues&group_id=13301433&search={}', 'dev': 'https://devdocs.io/#q={}', + 'phind': 'https://www.phind.com/search?q={}', } ## Page(s) to open at the start. @@ -1853,9 +1867,9 @@ c.url.searchengines = {'DEFAULT': 'https://duckduckgo.com/?t=chakra&q={}' # config.bind("'", 'mode-enter jump_mark') # config.bind('+', 'zoom-in') # config.bind('-', 'zoom-out') -# config.bind('.', 'repeat-command') -# config.bind('/', 'set-cmd-text /') -# config.bind(':', 'set-cmd-text :') +# config.bind('.', 'cmd-repeat-last') +# config.bind('/', 'cmd-set-text /') +# config.bind(':', 'cmd-set-text :') # config.bind(';I', 'hint images tab') # config.bind(';O', 'hint links fill :open -t -r {hint-url}') # config.bind(';R', 'hint --rapid links window') @@ -1911,9 +1925,9 @@ config.bind('', 'clear-keychain ;; search ;; fullscreen --leave ;; fake- # config.bind('', 'back') # config.bind('', 'forward') # config.bind('=', 'zoom') -# config.bind('?', 'set-cmd-text ?') +# config.bind('?', 'cmd-set-text ?') # config.bind('@', 'macro-run') -# config.bind('B', 'set-cmd-text -s :quickmark-load -t') +# config.bind('B', 'cmd-set-text -s :quickmark-load -t') # config.bind('D', 'tab-close -o') # config.bind('F', 'hint all tab') # config.bind('G', 'scroll-to-perc') @@ -1923,7 +1937,7 @@ config.bind('J', 'tab-prev') # config.bind('L', 'forward') # config.bind('M', 'bookmark-add') # config.bind('N', 'search-prev') -# config.bind('O', 'set-cmd-text -s :open -t') +# config.bind('O', 'cmd-set-text -s :open -t') # config.bind('PP', 'open -t -- {primary}') # config.bind('Pp', 'open -t -- {clipboard}') # config.bind('R', 'reload -f') @@ -1931,7 +1945,7 @@ config.bind('J', 'tab-prev') # config.bind('Sh', 'history') # config.bind('Sq', 'bookmark-list') # config.bind('Ss', 'set') -# config.bind('T', 'set-cmd-text -sr :tab-focus') +# config.bind('T', 'cmd-set-text -sr :tab-focus') # config.bind('U', 'undo -w') # config.bind('V', 'mode-enter caret ;; selection-toggle --line') # config.bind('ZQ', 'quit') @@ -1940,7 +1954,7 @@ config.bind('J', 'tab-prev') # config.bind(']]', 'navigate next') # config.bind('`', 'mode-enter set_mark') # config.bind('ad', 'download-cancel') -# config.bind('b', 'set-cmd-text -s :quickmark-load') +# config.bind('b', 'cmd-set-text -s :quickmark-load') # config.bind('cd', 'download-clear') config.unbind('co') config.bind('co', 'download-open') @@ -1948,25 +1962,25 @@ config.bind('co', 'download-open') # config.bind('f', 'hint') # config.bind('g$', 'tab-focus -1') # config.bind('g0', 'tab-focus 1') -# config.bind('gB', 'set-cmd-text -s :bookmark-load -t') +# config.bind('gB', 'cmd-set-text -s :bookmark-load -t') # config.bind('gC', 'tab-clone') # config.bind('gD', 'tab-give') # config.bind('gJ', 'tab-move +') # config.bind('gK', 'tab-move -') -# config.bind('gO', 'set-cmd-text :open -t -r {url:pretty}') +# config.bind('gO', 'cmd-set-text :open -t -r {url:pretty}') # config.bind('gU', 'navigate up -t') # config.bind('g^', 'tab-focus 1') # config.bind('ga', 'open -t') -# config.bind('gb', 'set-cmd-text -s :bookmark-load') +# config.bind('gb', 'cmd-set-text -s :bookmark-load') # config.bind('gd', 'download') # config.bind('gf', 'view-source') # config.bind('gg', 'scroll-to-perc 0') # config.bind('gi', 'hint inputs --first') config.bind('gl', 'tab-move -') # config.bind('gm', 'tab-move') -# config.bind('go', 'set-cmd-text :open {url:pretty}') +# config.bind('go', 'cmd-set-text :open {url:pretty}') config.bind('gr', 'tab-move +') -# config.bind('gt', 'set-cmd-text -s :tab-select') +# config.bind('gt', 'cmd-set-text -s :tab-select') # config.bind('gu', 'navigate up') # config.bind('h', 'scroll left') # config.bind('i', 'mode-enter insert') @@ -1974,16 +1988,18 @@ config.bind('gr', 'tab-move +') # config.bind('k', 'scroll up') # config.bind('l', 'scroll right') config.bind('m', 'spawn mpv {url}') +# TODO: add hints.selector for ytdl compatible links +config.bind('M', 'hint links spawn mpv {hint-url}') # config.bind('n', 'search-next') -# config.bind('o', 'set-cmd-text -s :open') +# config.bind('o', 'cmd-set-text -s :open') # config.bind('pP', 'open -- {primary}') # config.bind('pp', 'open -- {clipboard}') # config.bind('q', 'macro-record') # config.bind('r', 'reload') # config.bind('sf', 'save') -# config.bind('sk', 'set-cmd-text -s :bind') -# config.bind('sl', 'set-cmd-text -s :set -t') -# config.bind('ss', 'set-cmd-text -s :set') +# config.bind('sk', 'cmd-set-text -s :bind') +# config.bind('sl', 'cmd-set-text -s :set -t') +# config.bind('ss', 'cmd-set-text -s :set') config.bind('sq', 'quickmark-save') config.bind('tCh', 'spawn --userscript config-cycle-tld -p content.cookies.accept no-3rdparty never all;; reload') config.bind('tch', 'spawn --userscript config-cycle-tld -p -t content.cookies.accept no-3rdparty never all;; reload') @@ -2011,24 +2027,24 @@ config.bind('tgh', 'spawn --userscript config-cycle-tld -p -t content.geolocatio # config.bind('tsu', 'config-cycle -p -t -u {url} content.javascript.enabled ;; reload') # config.bind('u', 'undo') # config.bind('v', 'mode-enter caret') -# config.bind('wB', 'set-cmd-text -s :bookmark-load -w') +# config.bind('wB', 'cmd-set-text -s :bookmark-load -w') # config.bind('wIf', 'devtools-focus') # config.bind('wIh', 'devtools left') # config.bind('wIj', 'devtools bottom') # config.bind('wIk', 'devtools top') # config.bind('wIl', 'devtools right') # config.bind('wIw', 'devtools window') -# config.bind('wO', 'set-cmd-text :open -w {url:pretty}') +# config.bind('wO', 'cmd-set-text :open -w {url:pretty}') # config.bind('wP', 'open -w -- {primary}') -# config.bind('wb', 'set-cmd-text -s :quickmark-load -w') +# config.bind('wb', 'cmd-set-text -s :quickmark-load -w') # config.bind('wf', 'hint all window') # config.bind('wh', 'back -w') # config.bind('wi', 'devtools') # config.bind('wl', 'forward -w') -# config.bind('wo', 'set-cmd-text -s :open -w') +# config.bind('wo', 'cmd-set-text -s :open -w') # config.bind('wp', 'open -w -- {clipboard}') -# config.bind('xO', 'set-cmd-text :open -b -r {url:pretty}') -# config.bind('xo', 'set-cmd-text -s :open -b') +# config.bind('xO', 'cmd-set-text :open -b -r {url:pretty}') +# config.bind('xo', 'cmd-set-text -s :open -b') # config.bind('yD', 'yank domain -s') # config.bind('yM', 'yank inline [{title}]({url}) -s') # config.bind('yP', 'yank pretty-url -s') diff --git a/qutebrowser/quickmarks b/qutebrowser/quickmarks index 3eb045e..8b9467b 100644 --- a/qutebrowser/quickmarks +++ b/qutebrowser/quickmarks @@ -1,20 +1,25 @@ +attic/pritchard https://coconstruct.com/app/shared/ProjectOverview.aspx?projectOID=1504533 bash/substitution https://tldp.org/LDP/abs/html/parameter-substitution.html cups https://localhost:631/ +deepthought/flexget http://deepthought.lan:8081/ +deepthought/sabnzbd http://deepthought.lan:8080/ dev/bincompat https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B Policies/Binary Compatibility Issues With C++ - KDE Community Wiki dev/bithacks http://graphics.stanford.edu/~seander/bithacks.html#OperationCounting Bit Twiddling Hacks dev/clang-tidy https://clang.llvm.org/extra/clang-tidy/ dev/docs https://devdocs.io/ -finance/amex/dashboard https://global.americanexpress.com/dashboard +finance/amex https://www.americanexpress.com/en-gb/account/login finance/monzo/api https://developers.monzo.com/ finance/nsandi https://www.nsandi.com/Login finance/zopa https://www.zopa.com/login +finances/taxtool https://cooltaxtool.com/ fpp/confluence https://fppnt.atlassian.net/wiki/home fpp/eng/base https://gitlab.com/fppnt/engineering/base fpp/evk https://gitlab.com/fppnt/evk -fpp/evk/boards/sprint https://gitlab.com/groups/fppnt/evk/-/boards/3254472?iteration_id=Current +fpp/evk/board https://gitlab.com/groups/fppnt/evk/-/boards/5435597 fpp/evk/design/architecture https://drive.google.com/drive/folders/1j6SyDxNHr3-nXaz6heYdaVjDuHQq-fMJ fpp/evk/evk https://gitlab.com/fppnt/evk/evk fpp/evk/issues https://gitlab.com/groups/fppnt/evk/-/issues +fpp/evk/mr https://gitlab.com/fppnt/evk/evk/-/merge_requests/ fpp/gitlab https://gitlab.com/fppnt fpp/google/drive https://drive.google.com/drive/shared-drives fpp/mail https://mail.google.com/ @@ -25,6 +30,7 @@ gitlab/ci/env https://docs.gitlab.com/ee/ci/variables/index.html gitlab/issues https://gitlab.com/gitlab-org/gitlab/-/issues hask http://dev.stephendiehl.com/hask/ health/physio https://vitality.ascenti.co.uk/login?access_code=sodaypax +home/automation/hass http://deepthought.lan:8123/lovelace/home humble/books https://www.humblebundle.com/books humble/games https://www.humblebundle.com/games humble/store https://www.humblebundle.com/store @@ -36,3 +42,4 @@ telegram https://web.telegram.org/z/ x4/econ-depgraph https://i.imgur.com/kMzfyf6.jpeg x4/roguey https://roguey.co.uk/x4/ x4/ships https://www.qsna.eu/x4/ships/ +zsh/expansion https://thevaluable.dev/zsh-expansion-guide-example/ diff --git a/qutebrowser/themes/nord-qutebrowser.py b/qutebrowser/themes/nord-qutebrowser.py index e41b08a..62a86d9 100644 --- a/qutebrowser/themes/nord-qutebrowser.py +++ b/qutebrowser/themes/nord-qutebrowser.py @@ -1,3 +1,10 @@ +# noqa: D100 +from qutebrowser.config.configfiles import ConfigAPI +from qutebrowser.config.config import ConfigContainer + +c: ConfigContainer = c # noqa: F821 pylint: disable=E0602,C0103 +config: ConfigAPI = config # noqa: F821 pylint: disable=E0602,C0103 + # https://github.com/Linuus/nord-qutebrowser nord = { @@ -426,6 +433,14 @@ c.colors.tabs.selected.odd.bg = nord['nord0'] ## Type: QtColor c.colors.tabs.selected.odd.fg = nord['nord5'] +## Background color of tooltips. If set to null, the Qt default is used. +## Type: QssColor +c.colors.tooltip.bg = None + +## Foreground color of tooltips. If set to null, the Qt default is used. +## Type: QssColor +c.colors.tooltip.fg = None + ## Background color for webpages if unset (or empty to use the theme's ## color). ## Type: QtColor diff --git a/ssh/config b/ssh/config index ae4ab2e..14c6c6b 100644 --- a/ssh/config +++ b/ssh/config @@ -15,6 +15,9 @@ Host wrt-*.lan User root HostKeyAlgorithms=+ssh-rsa +Host aur.archlinux.org +User aur + Host fpp-nuc HostName localhost Port 22223 diff --git a/systemd/system/suspend@.service b/systemd/system/suspend@.service new file mode 100644 index 0000000..addaeb9 --- /dev/null +++ b/systemd/system/suspend@.service @@ -0,0 +1,12 @@ +# Proxy the system suspend.target to a users suspend.target. Enable with: +# systemctl enable suspend@$(whoami) +[Unit] +Description=Call user's suspend target when system suspends +After=suspend.target + +[Service] +Type=oneshot +ExecStart=/usr/bin/systemctl --user --machine=%i@ start --wait suspend.target + +[Install] +WantedBy=suspend.target diff --git a/systemd/user/pause-mpd.service b/systemd/user/pause-mpd.service new file mode 100644 index 0000000..d550f06 --- /dev/null +++ b/systemd/user/pause-mpd.service @@ -0,0 +1,9 @@ +[Unit] +Description=Pause MPD + +[Service] +Type=oneshot +ExecStart=/usr/bin/mpc -q pause + +[Install] +WantedBy=suspend.target diff --git a/systemd/user/suspend.target b/systemd/user/suspend.target new file mode 100644 index 0000000..6aba376 --- /dev/null +++ b/systemd/user/suspend.target @@ -0,0 +1,3 @@ +[Unit] +Description=User suspend target +StopWhenUnneeded=yes diff --git a/taskrc b/task/taskrc similarity index 100% rename from taskrc rename to task/taskrc diff --git a/vim/after/plugin/togglelist.vim b/vim/after/plugin/togglelist.vim index dbb06f1..278362c 100644 --- a/vim/after/plugin/togglelist.vim +++ b/vim/after/plugin/togglelist.vim @@ -2,47 +2,32 @@ if exists("g:loaded_toggle_list") finish endif - let g:loaded_toggle_list = 1 -function! s:GetBufferList() - redir =>buflist - silent! ls - redir END - return buflist -endfunction - +" Inspired by +" https://github.com/drmingdrmer/vim-toggle-quickfix/blob/master/autoload/togglequickfix.vim function! s:ToggleLocationList() - for bufnum in map(filter(split(s:GetBufferList(), '\n'), 'v:val =~# "Location List"'), 'str2nr(matchstr(v:val, "\\d\\+"))') - lclose - return - endfor - let last = winnr('$') - + let cur = winnr() try - Errors - catch - try - lopen - catch /E776/ - endtry - endtry - if last == winnr('$') + lwindow 10 + catch /E776/ echohl WarningMsg | echon 'No Location List' | echohl None + endtry + if winnr('$') == last + lclose + elseif winnr() != cur + wincmd p endif endfunction function! s:ToggleQuickfixList() - for bufnum in map(filter(split(s:GetBufferList(), '\n'), 'v:val =~ "Quickfix List"'), 'str2nr(matchstr(v:val, "\\d\\+"))') - if bufwinnr(bufnum) != -1 - cclose - return - endif - endfor - let winnr = winnr() - copen 10 - if winnr() != winnr + let last = winnr('$') + let cur = winnr() + cwindow 10 + if winnr('$') == last + cclose + elseif winnr() != cur wincmd p endif endfunction diff --git a/vim/ftplugin/c.vim b/vim/ftplugin/c.vim index dc06376..a2e9e71 100644 --- a/vim/ftplugin/c.vim +++ b/vim/ftplugin/c.vim @@ -9,28 +9,38 @@ augroup fswitch au BufEnter *.c let b:fswitchlocs = 'reg:|source|include/**|' augroup END -" Disable ale as we use ycm -let b:ale_enabled = 0 - -nnoremap gd :YcmCompleter GoTo -nnoremap d :vs:YcmCompleter GoTo -nnoremap gD :YcmCompleter GoToReferences - -nnoremap fi :YcmCompleter FixIt - -" format with = -call operator#user#define_ex_command('ycmcompleter-format', 'YcmCompleter Format') -map = (operator-ycmcompleter-format) -vnoremap = :YcmCompleter Format -" restore = mapping to g= -nnoremap g= = -vnoremap g= = - -" hover popup -let g:ycm_auto_hover = '' -let b:ycm_hover = { 'command': 'GetDoc', 'syntax': &filetype } -nmap gh (YCMHover) -nmap gH :YcmCompleter GetDoc +if exists("g:loaded_youcompleteme") + " Disable ale as we use ycm + let b:ale_enabled = 0 + + nnoremap gd :YcmCompleter GoTo + nnoremap d :vs:YcmCompleter GoTo + nnoremap gD :YcmCompleter GoToReferences + + " replaced with ca (code action) in neovim + nnoremap fi :YcmCompleter FixIt + " replaced with cr (code rename) in neovim + nnoremap fr :YcmCompleter RefactorRename + + " format with = + call operator#user#define_ex_command('ycmcompleter-format', 'YcmCompleter Format') + map = (operator-ycmcompleter-format) + vnoremap = :YcmCompleter Format + " restore = mapping to g= + nnoremap g= = + vnoremap g= = + + " hover popup + let g:ycm_auto_hover = '' + let b:ycm_hover = { 'command': 'GetDoc', 'syntax': &filetype } + nmap gh (YCMHover) + nmap gH :YcmCompleter GetDoc +else + " I'm way to used to using = to format than to switch to gq + nnoremap = gq + nnoremap == gqq + vnoremap = gq +endif let b:tcomment_options = {'whitespace': 'no'} diff --git a/vim/ftplugin/cpp.vim b/vim/ftplugin/cpp.vim index 12c6443..ea6837f 100644 --- a/vim/ftplugin/cpp.vim +++ b/vim/ftplugin/cpp.vim @@ -45,30 +45,6 @@ let g:switch_const_definitions = nnoremap c :call switch#Switch({'definitions': g:switch_const_definitions}) -" Disable ale as we use ycm -let b:ale_enabled = 0 - -nnoremap gd :YcmCompleter GoTo -nnoremap d :vs:YcmCompleter GoTo -nnoremap gD :YcmCompleter GoToReferences - -nnoremap fi :YcmCompleter FixIt -nnoremap fr :YcmCompleter RefactorRename - -" format with = -call operator#user#define_ex_command('ycmcompleter-format', 'YcmCompleter Format') -map = (operator-ycmcompleter-format) -vnoremap = :YcmCompleter Format -" restore = mapping to g= -nnoremap g= = -vnoremap g= = - -" hover popup -let g:ycm_auto_hover = '' -let b:ycm_hover = { 'command': 'GetDoc', 'syntax': &filetype } -nmap gh (YCMHover) -nmap gH :YcmCompleter GetDoc - setlocal errorformat= " TODO I don't remember these errorformat or what they match, maybe CMake? {{{ setlocal errorformat+=\ %##%n\ %m\ %f:%l:%c diff --git a/vim/ftplugin/help.vim b/vim/ftplugin/help.vim index c79df7a..3d477e2 100644 --- a/vim/ftplugin/help.vim +++ b/vim/ftplugin/help.vim @@ -2,6 +2,8 @@ setlocal textwidth=78 setlocal listchars-=extends:❯,precedes:❮ setlocal sidescroll=0 setlocal sidescrolloff=0 +setlocal signcolumn=no +setlocal winfixwidth wincmd L -vertical resize 78 +vertical resize 80 normal ze diff --git a/vim/ftplugin/man.vim b/vim/ftplugin/man.vim index bd6528a..00fb96d 100644 --- a/vim/ftplugin/man.vim +++ b/vim/ftplugin/man.vim @@ -1,8 +1,10 @@ setlocal nolist -setlocal textwidth=80 +setlocal textwidth=88 setlocal listchars-=extends:❯,precedes:❮ setlocal sidescroll=0 setlocal sidescrolloff=0 +setlocal winfixwidth +setlocal nowrap wincmd L -vertical resize 80 +vertical resize 88 normal ze diff --git a/vim/ftplugin/python.vim b/vim/ftplugin/python.vim index c64e31f..83d8895 100644 --- a/vim/ftplugin/python.vim +++ b/vim/ftplugin/python.vim @@ -1,5 +1,7 @@ setlocal foldlevelstart=1 " at least show content of classes -nnoremap gd :YcmCompleter GoTo -nnoremap d :vs:YcmCompleter GoTo -nnoremap gD :YcmCompleter GoToReferences +if exists("g:loaded_youcompleteme") + nnoremap gd :YcmCompleter GoTo + nnoremap d :vs:YcmCompleter GoTo + nnoremap gD :YcmCompleter GoToReferences +endif diff --git a/vim/ultisnips/cpp.snippets b/vim/ultisnips/cpp.snippets index 1d44b8c..a677d5f 100644 --- a/vim/ultisnips/cpp.snippets +++ b/vim/ultisnips/cpp.snippets @@ -35,6 +35,10 @@ $1 &operator=($1 const &) = default; $1 &operator=($1 &&) noexcept = default; endsnippet +snippet spaceship "defaulted spaceship operator <=>" +friend auto operator<=>(${1:type} const&, $1 const&) = default; +endsnippet + snippet ns "namespace .. (namespace)" namespace${1/.+/ /m}${1} { ${VISUAL}${0} diff --git a/vim/vimrc b/vim/vimrc index c487252..bd479a7 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -1,24 +1,211 @@ +" force python3 +if has('python3') | endif + +" space is leader +let g:mapleader = " " + +" disable netrw +"FIXME: it currently breaks vim-fugitive 2023-04-11 +" instead of opening Git status, a netrw buffer opens instead +let g:loaded_netrwPlugin = 1 + " runtimepath {{{1 set runtimepath ^=$XDG_CONFIG_HOME/vim set runtimepath +=$XDG_CONFIG_HOME/vim/after -" force python3 -if has('python3') | endif - " plugins {{{1 -" remove all autocommands -autocmd! - call plug#begin('$XDG_DATA_HOME/vim') " This does not update vim-plug, use PlugUpgrade instead Plug 'junegunn/vim-plug' -Plug 'airblade/vim-gitgutter' " {{{ -" prefer other signs such as ycm diags -let g:gitgutter_sign_priority = 1 -" don't clobber other signs -let g:gitgutter_sign_allow_clobber = 0 -"}}} +if !has("nvim") + Plug 'bling/vim-airline' " {{{2 + let g:airline#extensions#whitespace#enabled = 1 + let g:airline#extensions#tabline#enabled = 1 + let g:airline#extensions#searchcount#enabled = 0 + let g:airline_powerline_fonts = 1 + + let g:asyncrun_status = "stopped" + " let g:airline_section_error = airline#section#create_right(['%{g:asyncrun_status}']) + "}}} + Plug 'raimondi/delimitmate' " {{{2 + let delimitMate_expand_cr = 2 + let g:delimitMate_expand_space = 1 + "}}} + Plug 'tpope/vim-surround' "{{{2 + "}}} + " Plug 'valloric/youcompleteme' {{{2 + Plug 'valloric/youcompleteme', + \{ 'do': './install.py --clangd-completer --clang-completer' } + let g:ycm_clangd_binary_path = 'clangd' " use clangd in path + let g:ycm_clangd_args = ['--clang-tidy'] + let g:ycm_extra_conf_vim_data = ['getcwd()'] + let g:ycm_add_preview_to_completeopt = 1 + let g:ycm_complete_in_comments = 1 + let g:ycm_complete_in_strings = 1 + let g:ycm_autoclose_preview_window_after_insertion = 0 + + let g:ycm_language_server = + \ [ + \ { + \ 'name': 'haskell', + \ 'cmdline': [ 'haskell-language-server-wrapper', '--lsp' ], + \ 'filetypes': [ 'haskell', 'lhaskell' ] + \ }, + \ ] + " }}} + Plug 'svermeulen/vim-yoink' " {{{2 + ""}}} + Plug 'arcticicestudio/nord-vim' " {{{2 + let g:nord_bold = 1 + let g:nord_italic = 1 + let g:nord_italic_comments = 1 + let g:nord_underline = 1 + let g:nord_uniform_status_lines = 0 + let g:nord_uniform_diff_background = 0 + let g:nord_cursor_line_number_background = 0 + let g:nord_bold_vertical_split_line = 0 + "}}} + Plug 'sirver/ultisnips' " replaced by lua-snip {{{2 + Plug 'honza/vim-snippets' + let g:UltiSnipsEditSplit = 'vertical' + let g:UltiSnipsSnippetDirectories = [ expand("$XDG_CONFIG_HOME/vim/ultisnips") ] + if has('fname_case') + let g:UltiSnipsSnippetDirectories = ["UltiSnips", "ultisnips"] + endif + let g:UltiSnipsExpandTrigger = "" + let g:UltiSnipsJumpForwardTrigger = "" + let g:UltiSnipsJumpBackwardTrigger = "" + + " UltiSnips completion function that tries to expand a snippet. If there's no + " snippet for expanding, it checks for completion window and if it's shown, + " selects first element. If there's no completion window it tries to jump to + " next placeholder. If there's no placeholder it just returns TAB key + " https://github.com/Valloric/YouCompleteMe/issues/36#issuecomment-15451411 + function! g:UltiSnips_Complete() + call UltiSnips#ExpandSnippet() + if g:ulti_expand_res == 0 + if pumvisible() + return "\" + else + call UltiSnips#JumpForwards() + if g:ulti_jump_forwards_res == 0 + return "\" + endif + endif + endif + return "" + endfunction + au InsertEnter * exec "inoremap " . g:UltiSnipsExpandTrigger . " =g:UltiSnips_Complete()" + let g:UltiSnipsListSnippets="" + "}}} + Plug 'vim-utils/vim-man' " replaced by builtin {{{2 + let g:man_width = 80 + "}}} + Plug 'airblade/vim-gitgutter' " replaced by gitsigns {{{ + " prefer other signs such as ycm diags + let g:gitgutter_sign_priority = 1 + " don't clobber other signs + let g:gitgutter_sign_allow_clobber = 0 + "}}} + Plug 'justinmk/vim-sneak' " replaced by leap {{{2 + let g:sneak#streak = 1 + let g:sneak#target_labels = "aoeuisnthdpylrcgfqjkxzmwvz" " dvorak + let g:sneak#use_ic_scs = 1 " follow 'ignorecase' and 'smartcase' + + " sneaky f and t + nmap f Sneak_f + nmap F Sneak_F + xmap f Sneak_f + xmap F Sneak_F + omap f Sneak_f + omap F Sneak_F + nmap t Sneak_t + nmap T Sneak_T + xmap t Sneak_t + xmap T Sneak_T + omap t Sneak_t + omap T Sneak_T + "}}} + Plug 'shougo/unite.vim' " replaced by telescope {{{2 + function! UniteSetup() + call unite#filters#matcher_default#use(['matcher_fuzzy']) + call unite#custom#profile('default', 'context', { + \ 'winheight': 20, + \ 'direction': 'botright' + \ }) + + nnoremap [unite] + nmap u [unite] + nnoremap [unite]u :UniteResume + nnoremap [u :UnitePrevious + nnoremap ]u :UniteNext + + " unite-grep {{{3 + " seems not respected + let g:unite_source_grep_max_candidates = 2000 + if executable('ag') + " Use ag in unite grep source. + let g:unite_source_grep_command = 'ag' + let g:unite_source_grep_default_opts = '--smart-case --vimgrep --ignore ''.hg'' --ignore ''.svn'' --ignore ''.git'' --ignore ''.bzr''' + let g:unite_source_grep_recursive_opt = '' + end + nnoremap [unite]a :Unite grep:.:: + nnoremap [unite]A :Unite grep:.:-w: + command! -nargs=+ Ag Unite grep:.:: + + " unite-file_rec {{{3 + if executable('ag') + " Use ag in unite rec source + let g:unite_source_rec_async_command = ['ag', '--follow', '--nocolor', '--nogroup', '-g', ''] + end + nnoremap [unite]f :Unite -start-insert file_rec/async + + " unite-buffer {{{3 + call unite#custom#default_action('buffer', 'open') + nnoremap [unite]b :Unite buffer:- + + " unite-jumplist {{{3 + nnoremap [unite]j :Unite output:jumps: + + " unite-menu {{{3 + let g:unite_source_menu_menus = {} + let g:unite_source_menu_menus.fugitive = { 'description' : 'fugitive menu'} + let g:unite_source_menu_menus.fugitive.command_candidates = { + \ 'Gstatus gs' : 'Gstatus', + \ 'Gcommit -v gc' : 'Gcommit -v', + \ 'Glog' : 'Glog', + \} + + nnoremap gg :Unite menu:fugitive + + let g:unite_source_history_yank_enable = 1 + nnoremap [unite]p :Unite history/yank + endfunction + augroup unit_setup + autocmd VimEnter * ++once call UniteSetup() + augroup END + "}}}2 + Plug 'shougo/vimproc.vim', {'do': 'make'} " {{{2 + "}}}2 + Plug 'tomtom/tcomment_vim' " replaced by comment.nvim {{{2 + let g:tcomment_textobject_inlinecomment = 'gic' + let g:tcomment#filetype#guess = 0 + "let g:tcomment#options = {'whitespace' : 'no'} + "}}}2 + " colorschemes + Plug 'morhetz/gruvbox' " {{{2 + let g:gruvbox_contrast_dark = 'hard' + let g:gruvbox_contrast_light = 'soft' + " }}}2 + " staging + Plug 'puremourning/vimspector' " replaced by lsp {{{2 + let g:vimspector_enable_mappings = 'HUMAN' + " }}} + Plug 'vim-scripts/syntaxrange' " replaced by treesitter {{{2 + " }}} +endif + Plug 'alepez/vim-gtest' Plug 'alx741/vinfo' Plug 'andrewradev/sideways.vim' " {{{2 @@ -26,79 +213,42 @@ nnoremap ,h :SidewaysLeft:delmarks z nnoremap ,l :SidewaysRight:delmarks z "}}} Plug 'andrewradev/switch.vim' -if !has('nvim') - Plug 'bling/vim-airline' "{{{2 - let g:airline#extensions#whitespace#enabled = 1 - let g:airline#extensions#tabline#enabled = 1 - let g:airline#extensions#searchcount#enabled = 0 - let g:airline_powerline_fonts = 1 - - let g:asyncrun_status = "stopped" - " let g:airline_section_error = airline#section#create_right(['%{g:asyncrun_status}']) - "}}} -endif - Plug 'chrisbra/checkattach' Plug 'derekwyatt/vim-fswitch' Plug 'elzr/vim-json' Plug 'firef0x/pkgbuild.vim' Plug 'junegunn/vim-easy-align' -Plug 'justinmk/vim-sneak' -Plug 'klen/python-mode' Plug 'kshenoy/vim-signature' -Plug 'majutsushi/tagbar' +" Plug 'majutsushi/tagbar' " TODO: delete? {{{2 +" map :TagbarToggle +" let g:tagbar_sort = 0 +" let g:tagbar_compact = 1 +" let g:tagbar_autoshowtag = 1 +" let g:tagbar_width = 25 +" let g:tagbar_iconchars = ['+', '-'] +"}}} Plug 'octol/vim-cpp-enhanced-highlight' -Plug 'raimondi/delimitmate' Plug 'sgeb/vim-diff-fold' Plug 'skywind3000/asyncrun.vim' " {{{2 command! -bang -nargs=* -complete=file Make AsyncRun -save=2 -program=make @ let g:asyncrun_open = 10 "}}} -Plug 'shougo/unite.vim' -Plug 'shougo/vimproc.vim', {'do': 'make'} Plug 'sjl/gundo.vim' -Plug 'thinca/vim-qfreplace' -Plug 'tomtom/tcomment_vim' +" Plug 'thinca/vim-qfreplace' " TODO: delete? Plug 'tpope/vim-abolish' Plug 'tpope/vim-characterize' -Plug 'tpope/vim-endwise' +" Plug 'tpope/vim-endwise' " TODO: delete? Plug 'tpope/vim-eunuch' Plug 'tpope/vim-fugitive' Plug 'tpope/vim-repeat' Plug 'tpope/vim-scriptease' Plug 'tpope/vim-speeddating' -Plug 'tpope/vim-surround' "investigate vim-sandwich Plug 'tpope/vim-unimpaired' Plug 'tweekmonster/spellrotate.vim' -Plug 'valloric/youcompleteme', { 'do': './install.py --clangd-completer --clang-completer' } -Plug 'vim-scripts/mediawiki.vim' -Plug 'vim-scripts/replacewithregister' -Plug 'vim-scripts/yankring.vim' +" Plug 'vim-scripts/mediawiki.vim' " TODO: delete? +Plug 'vim-scripts/replacewithregister' " FIXME: is overridden by lsp Plug 'wincent/loupe' -" colorschemes -Plug 'morhetz/gruvbox' " {{{2 -let g:gruvbox_contrast_dark = 'hard' -let g:gruvbox_contrast_light = 'soft' - -if !has('nvim') - Plug 'arcticicestudio/nord-vim' " {{{2 - let g:nord_bold = 1 - let g:nord_italic = 1 - let g:nord_italic_comments = 1 - let g:nord_underline = 1 - let g:nord_uniform_status_lines = 0 - let g:nord_uniform_diff_background = 0 - let g:nord_cursor_line_number_background = 0 - let g:nord_bold_vertical_split_line = 0 -endif - -"}}} - -" snippets -Plug 'sirver/ultisnips' -Plug 'honza/vim-snippets' - " text objects Plug 'kana/vim-textobj-user' Plug 'julian/vim-textobj-variable-segment' @@ -109,14 +259,20 @@ Plug 'kana/vim-operator-user' " Check LucHermites plugins: https://github.com/LucHermitte/lh-cpp Plug 'imsnif/kdl.vim' -Plug 'puremourning/vimspector' Plug 'ilyachur/cmake4vim' Plug 'ilyachur/gtest-vim' -Plug 'git@github.com:/ram-z/vim-orgmode', { 'branch': 'dev' } " {{{2 -Plug 'vim-scripts/syntaxrange' +Plug 'junegunn/vim-peekaboo' "{{{2 + " issue with having it at the bottom is that it doesn't leave much + let g:peekaboo_window = 'bo 16new' + let g:peekaboo_compact = 1 + let g:peekaboo_delay = 500 +"}}} -let g:org_agenda_files = ['~/org/*.org'] +" Plug 'vim-scripts/ansiesc.vim' " TODO: delete? {{{2 +" nmap corwp RestoreWinPosn +" nmap coswp SaveWinPosn +" "}}} Plug 'neovimhaskell/haskell-vim' " {{{2 let g:haskell_enable_quantification = 1 " to enable highlighting of `forall` @@ -137,17 +293,28 @@ Plug 'mtth/scratch.vim' " {{{2 let g:scratch_autohide = 0 "}}} -let g:man_hardwrap = 80 -if !has('nvim') - Plug 'vim-utils/vim-man' " {{{2 - let g:man_width = 80 +Plug 'vim-pandoc/vim-pandoc' " {{{2 +Plug 'vim-pandoc/vim-pandoc-syntax' +let g:pandoc#syntax#conceal#use = 1 +let g:pandoc#syntax#conceal#blacklist = [ + \ 'titleblock', + \ 'codeblock_start', + \ 'codeblock_delim', + \ 'atx', + \ ] +let g:pandoc#syntax#codeblocks#embeds#langs = [ + \ 'plantuml', + \ ] +let g:pandoc#keyboard#blacklist_submodule_mappings = [ + \ 'para', + \ ] "}}} -endif -Plug 'jenterkin/vim-autosource' " {{{2 - let g:autosource_hashdir = $XDG_CACHE_HOME . '/vim/vim-autosource' - let g:autosource_conf_names = ['.vimrc', '.vimrc.lua'] -"}}} +" Plug 'jenterkin/vim-autosource' " TODO: delete? {{{2 +" let g:autosource_hashdir = $XDG_CACHE_HOME . '/vim/vim-autosource' +" let g:autosource_conf_names = ['.vimrc', '.vimrc.lua'] +" "}}} + call plug#end() filetype plugin indent on @@ -183,8 +350,6 @@ set linebreak " wrap long lines at a character in 'breakat' set showbreak=↪ " show these chars for wrapped lines set breakindent " preserve indentation in wrapped text -set lazyredraw " don't redraw while executing macros - set list " show chars defined in 'listchars' set listchars=tab:❭\ " list of strings used for list mode set listchars+=extends:❯,precedes:❮ @@ -238,7 +403,6 @@ endif set showcmd " Show (partial) command in status line. set ruler " show the cursor position all the time set confirm " Ask what to do when closing unsaved documents -set shortmess= " reset option set shortmess+=a " all abbreviations set shortmess+=o " overwrite file-written message set shortmess+=O " file-read message overrides previous @@ -247,6 +411,8 @@ set shortmess+=T " truncate other messages in the middle set shortmess+=W " don't give 'written' or '[w]' when writing a file set shortmess+=A " ignore swapfile warning set shortmess+=I " no splash screen +set shortmess+=F " don't give the file info when editing a file +set shortmess+=c " don't give |ins-completion-menu| messages " editing text {{{2 set backspace=indent,eol,start " allow backspacing over everything in insert mode @@ -264,6 +430,7 @@ set formatoptions+=t " Auto-wrap text using textwidth set formatoptions-=o " Do not insert comment leader after hitting o or O in normal mode set nrformats-=octal " don't inc/dec octal numbers with ^[AX] +set nrformats+=unsigned " treat all numbers as unsigned set complete=. " scan the current buffer ( 'wrapscan' is ignored) set complete+=w " scan buffers from other windows @@ -315,6 +482,7 @@ set backupskip+=.netrc " skip netrc set backupskip+=/dev/shm/pass* " skip passwordstore files set undofile " persistent undo history +set undolevels=10000 " moar undos if !has('nvim') set undodir=$XDG_CACHE_HOME/vim/undo// endif @@ -352,6 +520,7 @@ set wildignore+=*.orig " Merge resolution files " running make and jumping to errors {{{2 set makeprg=make\ -w " print changing directories +set grepformat=%f:%l:%c:%m set grepprg=ag\ --vimgrep\ $* " language specific {{{2 @@ -376,9 +545,9 @@ set sessionoptions+=unix,slash " damn windows and it's silly ways " autocmds {{{1 " Resize splits when the window is resized {{{2 -augroup resize +augroup resize_splits au! - autocmd VimResized * :wincmd = + autocmd VimResized * :tabdo wincmd = augroup END " Only show cursorline in the current window and in normal mode {{{2 @@ -395,7 +564,7 @@ augroup ft_stdin augroup END " Jump to last known cursor position {{{2 -augroup cursor_pos +augroup last_loc au! " blacklist certain filetype let blacklist = ['gitcommit'] @@ -425,9 +594,6 @@ command! ToggleAutoChecktime let b:autochecktime=!get(b:, 'autochecktime', 0) | " bindings {{{1 -" allow both and \ to be -map - " make function! MakeWithOpt() " TODO only do this if makeprg matches make @@ -480,6 +646,9 @@ nnoremap ww :Untrail " Source vnoremap S y:execute @@:echo 'Sourced selection.' nnoremap S ^vg_y:execute @@:echo 'Sourced line.' +" Technically this is similar to execute this file, which is usually mapped to +" r and it would make sense to have that for lua files in nvim folder +nnoremap SS :source %:echo 'Sourced file.' " jump to last cursor position noremap ' ` @@ -498,11 +667,6 @@ nnoremap U " nnoremap r :silent !ranger %:h:redraw! " nnoremap R :silent !ranger:redraw! -" Use sane regexes. -nnoremap / /\v -vnoremap / /\v -cnoremap s/ s/\v - " display the number of matches for the last search nmap # :%s:/::gn @@ -605,7 +769,7 @@ vnoremap zf cabbrev w!! SudoWrite " uppercase previous word -inoremap gUiwgi +inoremap ugUiwgi " http://git.io/v3ZeU nmap qq :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" @@ -623,9 +787,6 @@ nnoremap cl :CloseRightWindow nnoremap cj :CloseBelowWindow nnoremap ck :CloseAboveWindow -" delimitmate {{{2 -let delimitMate_expand_cr = 2 -let g:delimitMate_expand_space = 1 " fswitch {{{2 nnoremap ff :FSHere @@ -648,8 +809,11 @@ function! GitToggle() if buflisted(l:status_buffer) execute 'bdelete '.l:status_buffer else - Git - 16wincmd_ + execute 'Git' + if !empty(FugitiveGitDir()) + " only resize status if Git was sucessful + 16wincmd_ + endif endif endfunction command! GitToggle :call GitToggle() @@ -687,15 +851,8 @@ nmap cog IndentGuidesToggle nmap [og IndentGuidesEnable nmap ]og IndentGuidesDisable -" python-mode {{{2 - -let g:pymode_rope_completion = 0 -let g:pymode_rope = 0 -let g:pymode_run = 0 -let g:pymode_folding = 1 -let g:pymode_lint_ignore = "E221,E266,E501" -let g:pymode_lint_cwindow = 0 " don't open cwindow when linting -let g:pymode_syntax_space_errors = 0 " don't bother me when I'm typing +" netrw {{{2 +let g:netrw_sort_sequence = '[\/]$,\.\%(h\|hpp\)$,\.c$,\.cpp$,\~\=\*$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$' " signature {{{2 " disable '[ mappings @@ -734,134 +891,6 @@ if ! &diff let g:syntastic_check_on_open=1 endif -" tagbar {{{2 -map :TagbarToggle -let g:tagbar_sort = 0 -let g:tagbar_compact = 1 -let g:tagbar_autoshowtag = 1 -let g:tagbar_width = 25 -let g:tagbar_iconchars = ['+', '-'] - -" tcomments {{{2 -let g:tcomment_textobject_inlinecomment = 'gic' -let g:tcomment#filetype#guess = 0 -"let g:tcomment#options = {'whitespace' : 'no'} - -" ultisnips {{{2 -let g:UltiSnipsEditSplit = 'vertical' -let g:UltiSnipsSnippetDirectories = [ expand("$XDG_CONFIG_HOME/vim/ultisnips") ] -if has('fname_case') - let g:UltiSnipsSnippetDirectories = ["UltiSnips", "ultisnips"] -endif -let g:UltiSnipsExpandTrigger = "" -let g:UltiSnipsJumpForwardTrigger = "" -let g:UltiSnipsJumpBackwardTrigger = "" - -" UltiSnips completion function that tries to expand a snippet. If there's no -" snippet for expanding, it checks for completion window and if it's shown, -" selects first element. If there's no completion window it tries to jump to -" next placeholder. If there's no placeholder it just returns TAB key -" https://github.com/Valloric/YouCompleteMe/issues/36#issuecomment-15451411 -function! g:UltiSnips_Complete() - call UltiSnips#ExpandSnippet() - if g:ulti_expand_res == 0 - if pumvisible() - return "\" - else - call UltiSnips#JumpForwards() - if g:ulti_jump_forwards_res == 0 - return "\" - endif - endif - endif - return "" -endfunction -au InsertEnter * exec "inoremap " . g:UltiSnipsExpandTrigger . " =g:UltiSnips_Complete()" -let g:UltiSnipsListSnippets="" - -" unite {{{2 -call unite#filters#matcher_default#use(['matcher_fuzzy']) -call unite#custom#profile('default', 'context', { - \ 'winheight': 20, - \ 'direction': 'botright' - \ }) - -nnoremap [unite] -nmap u [unite] -nnoremap [unite]u :UniteResume -nnoremap [u :UnitePrevious -nnoremap ]u :UniteNext - -" unite-grep {{{3 -" seems not respected -let g:unite_source_grep_max_candidates = 2000 -if executable('ag') - " Use ag in unite grep source. - let g:unite_source_grep_command = 'ag' - let g:unite_source_grep_default_opts = '--smart-case --vimgrep --ignore ''.hg'' --ignore ''.svn'' --ignore ''.git'' --ignore ''.bzr''' - let g:unite_source_grep_recursive_opt = '' -end -nnoremap [unite]a :Unite grep:.:: -nnoremap [unite]A :Unite grep:.:-w: -command! -nargs=+ Ag Unite grep:.:: - -" unite-file_rec {{{3 -if executable('ag') - " Use ag in unite rec source - let g:unite_source_rec_async_command = ['ag', '--follow', '--nocolor', '--nogroup', '-g', ''] -end -nnoremap [unite]f :Unite -start-insert file_rec/async -call unite#custom#source('file_rec/async', 'sorters', 'sorter_selecta') - -" unite-buffer {{{3 -call unite#custom#default_action('buffer', 'open') -nnoremap [unite]b :Unite buffer:- - -" unite-jumplist {{{3 -nnoremap [unite]j :Unite output:jumps: - -" unite-menu {{{3 -let g:unite_source_menu_menus = {} -let g:unite_source_menu_menus.fugitive = { 'description' : 'fugitive menu'} -let g:unite_source_menu_menus.fugitive.command_candidates = { - \ 'Gstatus gs' : 'Gstatus', - \ 'Gcommit -v gc' : 'Gcommit -v', - \ 'Glog' : 'Glog', - \} - -nnoremap gg :Unite menu:fugitive - -let g:unite_source_history_yank_enable = 1 -nnoremap [unite]p :Unite history/yank - -" yankring {{{2 -nnoremap p :YRShow -let g:yankring_history_dir = expand('$XDG_CACHE_HOME/vim') -let g:yankring_replace_n_pkey = '' -let g:yankring_replace_n_nkey = '' - -" map Y to y$ for the yank ring -function! YRRunAfterMaps() - nnoremap Y :YRYankCount 'y$' -endfunction - -" youcompleteme {{{2 -let g:ycm_clangd_binary_path = 'clangd' " use clangd in path -let g:ycm_clangd_args = ['--clang-tidy'] -let g:ycm_extra_conf_vim_data = ['getcwd()'] -let g:ycm_add_preview_to_completeopt = 1 -let g:ycm_complete_in_comments = 1 -let g:ycm_complete_in_strings = 1 -let g:ycm_autoclose_preview_window_after_insertion = 0 - -let g:ycm_language_server = - \ [ - \ { - \ 'name': 'haskell', - \ 'cmdline': [ 'haskell-language-server-wrapper', '--lsp' ], - \ 'filetypes': [ 'haskell', 'lhaskell' ] - \ }, - \ ] " vim-easy-align {{{2 " start interactive EasyAlign in visual mode @@ -881,25 +910,6 @@ nnoremap tu :GTestRunUnderCursor " vim-json {{{2 let g:vim_json_syntax_conceal = 0 -" vim-sneak {{{2 -let g:sneak#streak = 1 -let g:sneak#target_labels = "aoeuisnthdpylrcgfqjkxzmwvz" " dvorak -let g:sneak#use_ic_scs = 1 " follow 'ignorecase' and 'smartcase' - -" sneaky f and t -nmap f Sneak_f -nmap F Sneak_F -xmap f Sneak_f -xmap F Sneak_F -omap f Sneak_f -omap F Sneak_F -nmap t Sneak_t -nmap T Sneak_T -xmap t Sneak_t -xmap T Sneak_T -omap t Sneak_t -omap T Sneak_T - " functions {{{1 " Convenient command to see the difference between the current buffer and the @@ -918,21 +928,21 @@ nnoremap gs :set operatorfunc=SortLinesOpFuncg@ vnoremap gs :sort " edit configs {{{2 +" TODO: populate location list with both .vim and .lua files +" TODO: create file if it doesn't exist in nvim or vim rtps function! EditConfig(what, ext = '.vim') - let l:dir = split(&runtimepath,',')[0] - if a:what == 'vimrc' - let l:file = expand($MYVIMRC) - elseif ! isdirectory(globpath(l:dir, a:what)) - echoe a:what." is not valid!" + if a:what == 'vimrc' || a:what == 'init.lua' + let l:file = a:what elseif empty(&filetype) echoe 'filetype is empty!' + return else - let l:file = l:dir.'/'.a:what.'/'.&filetype.a:ext + let l:file = a:what.'/'.&filetype.a:ext endif - execute ':vsplit '.file - execute ':lcd %:p:h' + execute ':Vvsplit! '.file endf +nmap en :call EditConfig('init.lua') nmap ev :call EditConfig('vimrc') nmap ef :call EditConfig('ftplugin') nmap es :call EditConfig('syntax') @@ -966,8 +976,6 @@ function! SwitchSpell() endfunction nnoremap coS :call SwitchSpell() -" fix spelling with first choice -nnoremap f 1z= " gitdir or home {{{2 " from derek wyatt: diff --git a/weechat/alias.conf b/weechat/alias.conf index 4a88a6e..42d686b 100644 --- a/weechat/alias.conf +++ b/weechat/alias.conf @@ -6,50 +6,53 @@ # # 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/weechat/quickstart/ # +config_version = 2 + [cmd] -AAWAY = "allserv /away" -AME = "allchan /me" -AMSG = "allchan /msg *" -ANICK = "allserv /nick" +aaway = "allserv /away" +ame = "allchan /me" +amsg = "allchan /msg *" +anick = "allserv /nick" b = "buffer" bare = "window bare" -BYE = "quit" -C = "buffer clear" -CHAT = "dcc chat" -CL = "buffer clear" -CLOSE = "buffer close" -EXIT = "quit" +bye = "quit" +c = "buffer clear" +chat = "dcc chat" +cl = "buffer clear" +close = "buffer close" +exit = "quit" flip = "/say (╯°□°)╯︵ ┻━┻" -IG = "ignore" +ig = "ignore" issue = "/slack slash /gitlab $1 issue show $2" -J = "join" -K = "kick" -KB = "kickban" -LEAVE = "part" -M = "msg" -MUB = "unban *" -N = "names" +j = "join" +k = "kick" +kb = "kickban" +leave = "part" +m = "msg" +meet = "/say https://meet.google.com/skx-qdpa-znp" +mub = "unban *" +n = "names" parrotwave = "/say :parrotwave1: :parrotwave2: :parrotwave3: :parrotwave4: :parrotwave5: :parrotwave6: :parrotwave7:" -Q = "query" +q = "query" rap = "/slack slash /gitlab rap $*" rap-issue = "/slack slash /gitlab rap issue show $*" rap-search = "/slack slash /gitlab rap issue search $*" -REDRAW = "window refresh" -SAY = "msg *" +redraw = "window refresh" +say = "msg *" shrug = "/say ¯\_(ツ)_/¯" -SIGNOFF = "quit" -T = "topic" -UB = "unban" -UMODE = "mode $nick" -V = "command core version" -W = "who" -WC = "window merge" -WI = "whois" -WII = "whois $1 $1" -WW = "whowas" +signoff = "quit" +t = "topic" +ub = "unban" +umode = "mode $nick" +v = "command core version" +w = "who" +wc = "window merge" +wi = "whois" +wii = "whois $1 $1" +ww = "whowas" [completion] issue = "rap|base" diff --git a/weechat/autosort.conf b/weechat/autosort.conf index 0e49df0..885e357 100644 --- a/weechat/autosort.conf +++ b/weechat/autosort.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/weechat/quickstart/ # [sorting] diff --git a/weechat/buffer_autoset.conf b/weechat/buffer_autoset.conf index b6ae37e..6d1bd0c 100644 --- a/weechat/buffer_autoset.conf +++ b/weechat/buffer_autoset.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/weechat/quickstart/ # [look] diff --git a/weechat/buflist.conf b/weechat/buflist.conf index 40033d9..42c2698 100644 --- a/weechat/buflist.conf +++ b/weechat/buflist.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/weechat/quickstart/ # [look] diff --git a/weechat/charset.conf b/weechat/charset.conf index f9c9d46..0cf83fa 100644 --- a/weechat/charset.conf +++ b/weechat/charset.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/weechat/quickstart/ # [default] diff --git a/weechat/colorize_nicks.conf b/weechat/colorize_nicks.conf index c36c5a8..cb8c914 100644 --- a/weechat/colorize_nicks.conf +++ b/weechat/colorize_nicks.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/weechat/quickstart/ # [look] diff --git a/weechat/exec.conf b/weechat/exec.conf index 5d44149..9e387c1 100644 --- a/weechat/exec.conf +++ b/weechat/exec.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/weechat/quickstart/ # [command] diff --git a/weechat/fifo.conf b/weechat/fifo.conf index ee18e2f..c88a1ef 100644 --- a/weechat/fifo.conf +++ b/weechat/fifo.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/weechat/quickstart/ # [file] diff --git a/weechat/fset.conf b/weechat/fset.conf index 1b52d85..d3871a0 100644 --- 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/weechat/quickstart/ # [look] @@ -32,6 +32,8 @@ option1 = "" option2 = "${marked} ${name} ${type} ${value2}${newline} ${empty_name} ${_default_value}${color:darkgray} -- ${min}..${max}${newline} ${empty_name} ${description}" [color] +color_name = 246 +color_name_selected = default default_value = default default_value_selected = white description = default diff --git a/weechat/guile.conf b/weechat/guile.conf index 57e43f2..4a0d42f 100644 --- a/weechat/guile.conf +++ b/weechat/guile.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/weechat/quickstart/ # [look] diff --git a/weechat/logger.conf b/weechat/logger.conf index 741d79e..b5729fd 100644 --- 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/weechat/quickstart/ # [look] @@ -23,6 +23,7 @@ color_lines = on flush_delay = 120 fsync = off info_lines = off +log_conditions = "" mask = "$plugin.$name.weechatlog" name_lower_case = on nick_prefix = "" diff --git a/weechat/lua.conf b/weechat/lua.conf index ac0dd0e..e399662 100644 --- a/weechat/lua.conf +++ b/weechat/lua.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/weechat/quickstart/ # [look] diff --git a/weechat/perl.conf b/weechat/perl.conf index d19ceec..e9d81e8 100644 --- a/weechat/perl.conf +++ b/weechat/perl.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/weechat/quickstart/ # [look] diff --git a/weechat/perl/highmon.pl b/weechat/perl/highmon.pl index 066fa43..f843cad 100644 --- a/weechat/perl/highmon.pl +++ b/weechat/perl/highmon.pl @@ -1,6 +1,5 @@ # # highmon.pl - Highlight Monitoring for weechat 0.3.0 -# Version 2.6 # # Add 'Highlight Monitor' buffer/bar to log all highlights in one spot # @@ -73,6 +72,8 @@ # Bugs and feature requests at: https://github.com/KenjiE20/highmon # History: +# 2020-06-21, Sebastien Helleu : +# v2.7: make call to bar_new compatible with WeeChat >= 2.9 # 2019-05-13, HubbeKing # v2.6: -add: send "logger_backlog" signal on buffer open if logging is enabled # 2014-08-16, KenjiE20 : @@ -266,7 +267,14 @@ sub highmon_bar_open # Make the bar item weechat::bar_item_new("highmon", "highmon_bar_build", ""); - $highmon_bar = weechat::bar_new ("highmon", "off", 100, "root", "", "bottom", "vertical", "vertical", 0, 0, "default", "cyan", "default", "on", "highmon"); + if (weechat::info_get("version_number", "") >= 0x02090000) + { + $highmon_bar = weechat::bar_new ("highmon", "off", 100, "root", "", "bottom", "vertical", "vertical", 0, 0, "default", "cyan", "default", "default", "on", "highmon"); + } + else + { + $highmon_bar = weechat::bar_new ("highmon", "off", 100, "root", "", "bottom", "vertical", "vertical", 0, 0, "default", "cyan", "default", "on", "highmon"); + } return weechat::WEECHAT_RC_OK; } @@ -717,7 +725,7 @@ sub highmon_new_message if ($cb_high == "1" || (weechat::config_get_plugin("merge_private") eq "on" && $cb_tags =~ /notify_private/)) { # Pre bug #29618 (0.3.3) away detect - if (weechat::info_get("version_number", "") <= 197120) + if (weechat::info_get("version_number", "") <= 0x00030200) { $away = ''; # Get infolist for this server @@ -1131,7 +1139,7 @@ sub format_buffer_name } # Check result of register, and attempt to behave in a sane manner -if (!weechat::register("highmon", "KenjiE20", "2.6", "GPL3", "Highlight Monitor", "", "")) +if (!weechat::register("highmon", "KenjiE20", "2.7", "GPL3", "Highlight Monitor", "", "")) { # Double load weechat::print ("", "\tHighmon is already loaded"); diff --git a/weechat/plugins.conf b/weechat/plugins.conf index dd3eb42..8d99d30 100644 --- a/weechat/plugins.conf +++ b/weechat/plugins.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/weechat/quickstart/ # [var] @@ -64,7 +64,9 @@ python.go.color_number = "yellow,magenta" python.go.color_number_selected = "yellow,red" python.go.fuzzy_search = "off" python.go.message = "Go to: " +python.go.min_chars = "0" python.go.short_name = "off" +python.go.short_name_server = "off" python.go.sort = "number,beginning" python.go.use_core_instead_weechat = "off" python.grep.clear_buffer = "off" @@ -186,7 +188,9 @@ python.go.color_number = "color for buffer number (not selected) (default: "yell python.go.color_number_selected = "color for selected buffer number (default: "yellow,red")" python.go.fuzzy_search = "search buffer matches using approximation (default: "off")" python.go.message = "message to display before list of buffers (default: "Go to: ")" +python.go.min_chars = "Minimum chars to search and display list of matching buffers (default: "0")" python.go.short_name = "display and search in short names instead of buffer name (default: "off")" +python.go.short_name_server = "prefix short names with server names for search and display (default: "off")" python.go.sort = "comma-separated list of keys to sort buffers (the order is important, sorts are performed in the given order): name = sort by name (or short name), (default: "number,beginning")" python.go.use_core_instead_weechat = "use name "core" instead of "weechat" for core buffer (default: "off")" python.screen_away.away_suffix = "What to append to your nick when you're away." @@ -235,7 +239,7 @@ python.slack.shared_name_prefix = "The prefix of buffer names for shared channel python.slack.short_buffer_names = "Use `foo.#channel` rather than `foo.slack.com.#channel` as the internal name for Slack buffers." python.slack.show_buflist_presence = "Display a `+` character in the buffer list for present users." python.slack.show_reaction_nicks = "Display the name of the reacting user(s) alongside each reactji." -python.slack.slack_api_token = "List of Slack API tokens, one per Slack instance you want to connect to. See the README for details on how to get these." +python.slack.slack_api_token = "List of Slack API tokens, one per Slack instance you want to connect to; see the README for details on how to get these (note: content is evaluated, see /help eval)." python.slack.slack_timeout = "How long (ms) to wait when communicating with Slack." python.slack.switch_buffer_on_join = "When /joining a channel, automatically switch to it as well." python.slack.thread_broadcast_prefix = "Prefix to distinguish thread messages that were also sent to the channel, when thread_messages_in_channel is enabled." diff --git a/weechat/python.conf b/weechat/python.conf index 24d67cd..5678693 100644 --- a/weechat/python.conf +++ b/weechat/python.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/weechat/quickstart/ # [look] diff --git a/weechat/python/autosort.py b/weechat/python/autosort.py index 8f7c263..4312cda 100644 --- a/weechat/python/autosort.py +++ b/weechat/python/autosort.py @@ -25,6 +25,13 @@ # # Changelog: +# 3.9: +# * Remove `buffers.pl` from recommended settings. +# 3,8: +# * Fix relative sorting on script name in default rules. +# * Document a useful property of stable sort algorithms. +# 3.7: +# * Make default rules work with bitlbee, matrix and slack. # 3.6: # * Add more documentation on provided info hooks. # 3.5: @@ -80,7 +87,7 @@ import weechat SCRIPT_NAME = 'autosort' SCRIPT_AUTHOR = 'Maarten de Vries ' -SCRIPT_VERSION = '3.6' +SCRIPT_VERSION = '3.9' SCRIPT_LICENSE = 'GPL3' SCRIPT_DESC = 'Flexible automatic (or manual) buffer sorting based on eval expressions.' @@ -173,22 +180,21 @@ class Config: default_rules = json.dumps([ '${core_first}', - '${irc_last}', - '${buffer.plugin.name}', + '${info:autosort_order,${info:autosort_escape,${script_or_plugin}},core,*,irc,bitlbee,matrix,slack}', + '${script_or_plugin}', '${irc_raw_first}', - '${if:${plugin}==irc?${server}}', - '${if:${plugin}==irc?${info:autosort_order,${type},server,*,channel,private}}', - '${if:${plugin}==irc?${hashless_name}}', + '${server}', + '${info:autosort_order,${type},server,*,channel,private}', + '${hashless_name}', '${buffer.full_name}', ]) default_helpers = json.dumps({ - 'core_first': '${if:${buffer.full_name}!=core.weechat}', - 'irc_first': '${if:${buffer.plugin.name}!=irc}', - 'irc_last': '${if:${buffer.plugin.name}==irc}', - 'irc_raw_first': '${if:${buffer.full_name}!=irc.irc_raw}', - 'irc_raw_last': '${if:${buffer.full_name}==irc.irc_raw}', - 'hashless_name': '${info:autosort_replace,#,,${info:autosort_escape,${buffer.name}}}', + 'core_first': '${if:${buffer.full_name}!=core.weechat}', + 'irc_raw_first': '${if:${buffer.full_name}!=irc.irc_raw}', + 'irc_raw_last': '${if:${buffer.full_name}==irc.irc_raw}', + 'hashless_name': '${info:autosort_replace,#,,${info:autosort_escape,${buffer.name}}}', + 'script_or_plugin': '${if:${script_name}?${script_name}:${plugin}}', }) default_signal_delay = 5 @@ -961,6 +967,9 @@ order can be customized by defining your own sort rules, but the default should be sane enough for most people. It can also group IRC channel/private buffers under their server buffer if you like. +Autosort uses a stable sorting algorithm, meaning that you can manually move buffers +to change their relative order, if they sort equal with your rule set. + {*white}# Sort rules{reset} Autosort evaluates a list of eval expressions (see {*default}/help eval{reset}) and sorts the buffers based on evaluated result. Earlier rules will be considered first. Only @@ -993,12 +1002,9 @@ If you remove all signals you can still sort your buffers manually with the {*white}# Recommended settings For the best visual effect, consider setting the following options: {*white}/set {cyan}irc.look.server_buffer{reset} {brown}independent{reset} - {*white}/set {cyan}buffers.look.indenting{reset} {brown}on{reset} -The first setting allows server buffers to be sorted independently, which is +This setting allows server buffers to be sorted independently, which is needed to create a hierarchical tree view of the server and channel buffers. -The second one indents channel and private buffers in the buffer list of the -`{*default}buffers.pl{reset}` script. If you are using the {*default}buflist{reset} plugin you can (ab)use Unicode to draw a tree structure with the following setting (modify to suit your need): diff --git a/weechat/python/buffer_autoset.py b/weechat/python/buffer_autoset.py index 38dbc4b..9725cd7 100644 --- a/weechat/python/buffer_autoset.py +++ b/weechat/python/buffer_autoset.py @@ -22,6 +22,8 @@ # # History: # +# 2021-06-02, Sébastien Helleu : +# version 1.2: fix /help buffer_autoset # 2018-04-14, Kim B. Heino: # version 1.1: on startup apply settings to already opened buffers # 2017-06-21, Sébastien Helleu : @@ -31,9 +33,9 @@ # 2015-07-12, Sébastien Helleu : # version 0.8: add option buffer_autoset.look.timer to add a small timer # before setting buffer properties -# 2015-04-05, Nils Görs : +# 2015-04-05, Nils Görs : # version 0.7: increase priority of hook_signal('buffer_opened') -# 2012-12-09, Nils Görs : +# 2012-12-09, Nils Görs : # version 0.6: add support of core buffer # 2012-03-09, Sébastien Helleu : # version 0.5: fix reload of config file @@ -50,7 +52,7 @@ SCRIPT_NAME = "buffer_autoset" SCRIPT_AUTHOR = "Sébastien Helleu " -SCRIPT_VERSION = "1.1" +SCRIPT_VERSION = "1.2" SCRIPT_LICENSE = "GPL3" SCRIPT_DESC = "Auto-set buffer properties when a buffer is opened" @@ -291,26 +293,25 @@ if __name__ == "__main__" and import_ok: "[add buffer property value] | [del option]", " add: add a buffer/property/value in configuration file\n" " del: delete an option from configuration file\n" - " buffer: name of a buffer (can start or end with \"*\" as " - "wildcard)\n" + " buffer: name of a buffer (wildcard \"*\" is allowed)\n" "property: buffer property\n" " value: value for property\n" " option: name of option from configuration file\n\n" "Examples:\n" " disable timestamp on channel #weechat:\n" - " /" + SCRIPT_COMMAND + " add irc.freenode.#weechat " + " /" + SCRIPT_COMMAND + " add irc.libera.#weechat " "time_for_each_line 0\n" " add word \"weechat\" in highlight list on channel " "#savannah:\n" - " /" + SCRIPT_COMMAND + " add irc.freenode.#savannah " + " /" + SCRIPT_COMMAND + " add irc.libera.#savannah " "highlight_words_add weechat\n" - " disable highlights from nick \"mike\" on freenode server, " + " disable highlights from nick \"mike\" on libera server, " "channel #weechat (requires WeeChat >= 0.3.4):\n" - " /" + SCRIPT_COMMAND + " add irc.freenode.#weechat " + " /" + SCRIPT_COMMAND + " add irc.libera.#weechat " "hotlist_max_level_nicks_add mike:2\n" - " disable hotlist changes for nick \"bot\" on freenode " + " disable hotlist changes for nick \"bot\" on libera " "server (all channels) (requires WeeChat >= 0.3.4):\n" - " /" + SCRIPT_COMMAND + " add irc.freenode.* " + " /" + SCRIPT_COMMAND + " add irc.libera.* " "hotlist_max_level_nicks_add bot:-1", "add %(buffers_plugins_names)|" "%(buffer_autoset_current_buffer) " diff --git a/weechat/python/colorize_nicks.py b/weechat/python/colorize_nicks.py index 2c85c7c..10ffb71 100644 --- a/weechat/python/colorize_nicks.py +++ b/weechat/python/colorize_nicks.py @@ -21,6 +21,9 @@ # # # History: +# 2022-11-07: mva +# version 30: add ":" and "," to VALID_NICK regexp, +# to don't reset colorization in input_line # 2022-07-11: ncfavier # version 29: check nick for exclusion *after* stripping # decrease minimum min_nick_length to 1 @@ -93,13 +96,13 @@ w = weechat SCRIPT_NAME = "colorize_nicks" SCRIPT_AUTHOR = "xt " -SCRIPT_VERSION = "29" +SCRIPT_VERSION = "30" SCRIPT_LICENSE = "GPL" SCRIPT_DESC = "Use the weechat nick colors in the chat area" # Based on the recommendations in RFC 7613. A valid nick is composed # of anything but " ,*?.!@". -VALID_NICK = r'([@~&!%+-])?([^\s,\*?\.!@]+)' +VALID_NICK = r'([@~&!%+-])?([^\s,\*?\.!@:,]+)' valid_nick_re = re.compile(VALID_NICK) ignore_channels = [] ignore_nicks = [] diff --git a/weechat/python/go.py b/weechat/python/go.py index 2ab47ed..25041a8 100644 --- a/weechat/python/go.py +++ b/weechat/python/go.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2009-2014 Sébastien Helleu +# Copyright (C) 2009-2023 Sébastien Helleu # Copyright (C) 2010 m4v # Copyright (C) 2011 stfn # @@ -21,6 +21,12 @@ # # History: # +# 2023-06-21, Sébastien Helleu : +# version 2.9: add option "min_chars" +# 2023-01-08, Sébastien Helleu : +# version 2.8: send buffer pointer with signal "input_text_changed" +# 2021-05-25, Tomáš Janoušek : +# version 2.7: add new option to prefix short names with server names # 2019-07-11, Simmo Saan # version 2.6: fix detection of "/input search_text_here" # 2017-04-01, Sébastien Helleu : @@ -94,7 +100,7 @@ from __future__ import print_function SCRIPT_NAME = 'go' SCRIPT_AUTHOR = 'Sébastien Helleu ' -SCRIPT_VERSION = '2.6' +SCRIPT_VERSION = '2.9' SCRIPT_LICENSE = 'GPL3' SCRIPT_DESC = 'Quick jump to buffers' @@ -106,13 +112,19 @@ try: import weechat except ImportError: print('This script must be run under WeeChat.') - print('Get WeeChat now at: http://www.weechat.org/') + print('Get WeeChat now at: https://weechat.org/') IMPORT_OK = False import re # script options SETTINGS = { + 'auto_jump': ( + 'off', + 'automatically jump to buffer when it is uniquely selected'), + 'buffer_number': ( + 'on', + 'display buffer number'), 'color_number': ( 'yellow,magenta', 'color for buffer number (not selected)'), @@ -131,12 +143,21 @@ SETTINGS = { 'color_name_highlight_selected': ( 'red,brown', 'color for highlight in a selected buffer name'), + 'fuzzy_search': ( + 'off', + 'search buffer matches using approximation'), 'message': ( 'Go to: ', 'message to display before list of buffers'), + 'min_chars': ( + '0', + 'Minimum chars to search and display list of matching buffers'), 'short_name': ( 'off', 'display and search in short names instead of buffer name'), + 'short_name_server': ( + 'off', + 'prefix short names with server names for search and display'), 'sort': ( 'number,beginning', 'comma-separated list of keys to sort buffers ' @@ -149,15 +170,6 @@ SETTINGS = { 'use_core_instead_weechat': ( 'off', 'use name "core" instead of "weechat" for core buffer'), - 'auto_jump': ( - 'off', - 'automatically jump to buffer when it is uniquely selected'), - 'fuzzy_search': ( - 'off', - 'search buffer matches using approximation'), - 'buffer_number': ( - 'on', - 'display buffer number'), } # hooks management @@ -317,9 +329,14 @@ def go_matching_buffers(strinput): strinput = strinput.lower() infolist = weechat.infolist_get('buffer', '', '') while weechat.infolist_next(infolist): + pointer = weechat.infolist_pointer(infolist, 'pointer') short_name = weechat.infolist_string(infolist, 'short_name') + server = weechat.buffer_get_string(pointer, 'localvar_server') if go_option_enabled('short_name'): - name = weechat.infolist_string(infolist, 'short_name') + if go_option_enabled('short_name_server') and server: + name = server + '.' + short_name + else: + name = short_name else: name = weechat.infolist_string(infolist, 'name') if name == 'weechat' \ @@ -332,7 +349,6 @@ def go_matching_buffers(strinput): full_name = '%s.%s' % ( weechat.infolist_string(infolist, 'plugin_name'), weechat.infolist_string(infolist, 'name')) - pointer = weechat.infolist_pointer(infolist, 'pointer') matching = name.lower().find(strinput) >= 0 if not matching and strinput[-1] == ' ': matching = name.lower().endswith(strinput.strip()) @@ -401,6 +417,11 @@ def go_matching_buffers(strinput): def go_buffers_to_string(listbuf, pos, strinput): """Return string built with list of buffers found (matching user input).""" + try: + if len(strinput) < int(weechat.config_get_plugin('min_chars')): + return '' + except: + pass string = '' strinput = strinput.lower() for i in range(len(listbuf)): @@ -491,7 +512,7 @@ def go_command_run_input(data, buf, command): if buffers_pos >= len(buffers): buffers_pos = 0 weechat.hook_signal_send('input_text_changed', - weechat.WEECHAT_HOOK_SIGNAL_STRING, '') + weechat.WEECHAT_HOOK_SIGNAL_POINTER, buf) return weechat.WEECHAT_RC_OK_EAT elif command == '/input complete_previous': # choose previous buffer in list @@ -499,7 +520,7 @@ def go_command_run_input(data, buf, command): if buffers_pos < 0: buffers_pos = len(buffers) - 1 weechat.hook_signal_send('input_text_changed', - weechat.WEECHAT_HOOK_SIGNAL_STRING, '') + weechat.WEECHAT_HOOK_SIGNAL_POINTER, buf) return weechat.WEECHAT_RC_OK_EAT elif command == '/input return': # switch to selected buffer (if any) diff --git a/weechat/python/grep.py b/weechat/python/grep.py index 64dbc52..b675122 100644 --- a/weechat/python/grep.py +++ b/weechat/python/grep.py @@ -69,6 +69,18 @@ # # History: # +# 2022-11-11, anonymous2ch +# version 0.8.6: ignore utf-8 decoding errors +# +# 2021-05-02, Sébastien Helleu +# version 0.8.5: add compatibility with WeeChat >= 3.2 (XDG directories) +# +# 2020-10-11, Thom Wiggers +# version 0.8.4: Python3 compatibility fix +# +# 2020-05-06, Dominique Martinet and hexa- +# version 0.8.3: more python3 compatibility fixes... +# # 2019-06-30, dabbill # and Sébastien Helleu # version 0.8.2: make script compatible with Python 3 @@ -230,7 +242,7 @@ except ImportError: SCRIPT_NAME = "grep" SCRIPT_AUTHOR = "Elián Hanisch " -SCRIPT_VERSION = "0.8.2" +SCRIPT_VERSION = "0.8.6" SCRIPT_LICENSE = "GPL3" SCRIPT_DESC = "Search in buffers and logs" SCRIPT_COMMAND = "grep" @@ -446,9 +458,13 @@ def get_config_log_filter(): return [] def get_home(): - home = weechat.config_string(weechat.config_get('logger.file.path')) - home = home.replace('%h', weechat.info_get('weechat_dir', '')) - home = path.abspath(path.expanduser(home)) + options = { + 'directory': 'data', + } + home = weechat.string_eval_path_home( + weechat.config_string(weechat.config_get('logger.file.path')), + {}, {}, options, + ) return home def strip_home(s, dir=''): @@ -596,7 +612,10 @@ def get_file_by_name(buffer_name): if '$server' in mask: mask = mask.replace('$server', server) # change the unreplaced vars by '*' - from string import letters + try: + from string import letters + except ImportError: + from string import ascii_letters as letters if '%' in mask: # vars for time formatting mask = mask.replace('%', '$') @@ -722,7 +741,7 @@ def grep_file(file, head, tail, after_context, before_context, count, regexp, hi check = lambda s: check_string(s, regexp, hilight, exact) try: - file_object = open(file, 'r') + file_object = open(file, 'r', errors='ignore') except IOError: # file doesn't exist return lines @@ -885,8 +904,7 @@ def grep_buffer(buffer, head, tail, after_context, before_context, count, regexp check = lambda s: check_string(s, regexp, hilight, exact) if before_context: - before_context_range = range(1, before_context + 1) - before_context_range.reverse() + before_context_range = reversed(range(1, before_context + 1)) while infolist_next(infolist): line = get_line(infolist) @@ -984,7 +1002,7 @@ def show_matching_lines(): buffer_update() else: global hook_file_grep, grep_stdout, grep_stderr, pattern_tmpl - grep_stdout = grep_stderr = '' + grep_stdout = grep_stderr = b'' hook_file_grep = weechat.hook_process( 'func:grep_process', get_config_int('timeout_secs') * 1000, @@ -1009,14 +1027,17 @@ def grep_process(*args): except Exception as e: result = e - return pickle.dumps(result) - -grep_stdout = grep_stderr = '' + return pickle.dumps(result, 0) def grep_process_cb(data, command, return_code, out, err): global grep_stdout, grep_stderr, matched_lines, hook_file_grep + if isinstance(out, str): + out = out.encode() grep_stdout += out + + if isinstance(err, str): + err = err.encode() grep_stderr += err def set_buffer_error(message): @@ -1548,7 +1569,7 @@ def cmd_logs(data, buffer, args): buffer = buffer_create() if get_config_boolean('clear_buffer'): weechat.buffer_clear(buffer) - file_list = zip(file_list, file_sizes) + file_list = list(zip(file_list, file_sizes)) msg = 'Found %s logs.' %len(file_list) print_line(msg, buffer, display=True) @@ -1738,8 +1759,11 @@ Examples: debug = pybuffer.debugBuffer(globals(), '%s_debug' % SCRIPT_NAME) except: def debug(s, *args): - if not isinstance(s, basestring): - s = str(s) + try: + if not isinstance(s, basestring): + s = str(s) + except NameError: + pass if args: s = s %args prnt('', '%s\t%s' %(script_nick, s)) diff --git a/weechat/python/wee-slack b/weechat/python/wee-slack index 39ff696..c303a77 160000 --- a/weechat/python/wee-slack +++ b/weechat/python/wee-slack @@ -1 +1 @@ -Subproject commit 39ff696e6ad2c3c6381b2556786394adb06bf935 +Subproject commit c303a77c5420f2f97306802953d57a9587ba5fd6 diff --git a/weechat/relay.conf b/weechat/relay.conf index 237b2d5..7f72fab 100644 --- a/weechat/relay.conf +++ b/weechat/relay.conf @@ -6,9 +6,11 @@ # # 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/weechat/quickstart/ # +config_version = 2 + [look] auto_open_buffer = on raw_messages = 256 @@ -37,8 +39,8 @@ nonce_size = 16 password = "" password_hash_algo = "*" password_hash_iterations = 100000 -ssl_cert_key = "%h/ssl/relay.pem" -ssl_priorities = "NORMAL:-VERS-SSL3.0" +tls_cert_key = "%h/ssl/relay.pem" +tls_priorities = "NORMAL:-VERS-SSL3.0" totp_secret = "" totp_window = 0 websocket_allowed_origins = "" diff --git a/weechat/ruby.conf b/weechat/ruby.conf index 555f48f..c7d00c9 100644 --- a/weechat/ruby.conf +++ b/weechat/ruby.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/weechat/quickstart/ # [look] diff --git a/weechat/ruby/colorizer.rb b/weechat/ruby/colorizer.rb index 21c15bb..14d1729 100644 --- a/weechat/ruby/colorizer.rb +++ b/weechat/ruby/colorizer.rb @@ -32,12 +32,13 @@ # Changelog: # # 0.1: Initial release. -# +# 0.2: Add compatibility with new weechat_print modifier data (WeeChat >= 2.9). +# 0.3: Fix the compatibility checker SCRIPT_NAME = 'colorizer' SCRIPT_AUTHOR = 'Michael B. Hix' SCRIPT_DESC = 'Colorize text in buffers based on rules.' -SCRIPT_VERSION = '0.1' +SCRIPT_VERSION = '0.3' SCRIPT_LICENSE = 'BSD' # A default coloring rule. @@ -157,8 +158,16 @@ end # Handle message printing. # def colorize_cb( data, modifier, modifier_data, message ) - _,buffer,_ = modifier_data.split( ';' ) - return message unless @buffer_regex =~ buffer + if modifier_data.start_with?('0x') + # WeeChat >= 2.9 + buffer, tags = modifier_data.split( ';' ) + buffer_name = Weechat.buffer_get_string(buffer, 'name') + else + # WeeChat <= 2.8 + plugin, buffer_name, tags = modifier_data.split( ';' ) + end + + return message unless @buffer_regex =~ buffer_name reset = Weechat.color( 'reset' ) @rules.each do |reg, color_str| diff --git a/weechat/ruby/samechannel.rb b/weechat/ruby/samechannel.rb index 84aa4ad..89f8478 100644 --- a/weechat/ruby/samechannel.rb +++ b/weechat/ruby/samechannel.rb @@ -1,3 +1,4 @@ +# coding: utf-8 # # (c) 2013 Hendrik 'henk' Jaeger # (c) 2015 arza @@ -22,12 +23,15 @@ # 2015-09-24 0.1 arza: # - option -m/--minimum for minimum count of mutual channels # - fixed completion +# 2021-11-06 0.2 Sébastien Helleu: +# - make script compatible with WeeChat >= 3.4 +# (new parameters in function hdata_search) def weechat_init Weechat.register( "samechannel", "henk", - "0.1", + "0.2", "GPL3", "Lists multiple occurences of the same nick(s) in a set of channels.", "", @@ -156,10 +160,17 @@ def find_channels( names, serverptr ) end def find_servers( names ) + weechat_version = Weechat.info_get('version_number', '').to_i serverptrlist = Weechat.hdata_get_list($hdata_ircserver, 'irc_servers') if names matching_servers = names.map do |name| - foundserverptr = Weechat.hdata_search($hdata_ircserver, serverptrlist, '${irc_server.name} =~ ' + name, 1) + if weechat_version >= 0x03040000 + foundserverptr = Weechat.hdata_search($hdata_ircserver, serverptrlist, + '${irc_server.name} =~ ${name}', + {}, {'name' => name}, {}, 1) + else + foundserverptr = Weechat.hdata_search($hdata_ircserver, serverptrlist, '${irc_server.name} =~ ' + name, 1) + end end else return hhh_get_ptrarray($hdata_ircserver, serverptrlist) diff --git a/weechat/script.conf b/weechat/script.conf index 3f8633b..69fe2d5 100644 --- a/weechat/script.conf +++ b/weechat/script.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/weechat/quickstart/ # [look] diff --git a/weechat/sec.conf b/weechat/sec.conf index 852b989..6b8d72f 100644 --- a/weechat/sec.conf +++ b/weechat/sec.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/weechat/quickstart/ # [crypt] diff --git a/weechat/tcl.conf b/weechat/tcl.conf index 30bcee2..3aff5a0 100644 --- a/weechat/tcl.conf +++ b/weechat/tcl.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/weechat/quickstart/ # [look] diff --git a/weechat/trigger.conf b/weechat/trigger.conf index 30bdbc3..7085f94 100644 --- a/weechat/trigger.conf +++ b/weechat/trigger.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/weechat/quickstart/ # [look] @@ -22,8 +22,6 @@ flag_return_code = lightmagenta identifier = cyan regex = white replace = cyan -trigger = green -trigger_disabled = red [trigger] beep.arguments = "" diff --git a/weechat/typing.conf b/weechat/typing.conf index dd8b7b0..1b69a5a 100644 --- a/weechat/typing.conf +++ b/weechat/typing.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/weechat/quickstart/ # [look] diff --git a/weechat/weechat.conf b/weechat/weechat.conf index 70a79c8..b59d29e 100644 --- a/weechat/weechat.conf +++ b/weechat/weechat.conf @@ -6,9 +6,11 @@ # # 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/weechat/quickstart/ # +config_version = 2 + [debug] [startup] @@ -36,6 +38,7 @@ buffer_search_regex = off buffer_search_where = message buffer_time_format = "${color:253}%H:${color:245}%M" buffer_time_same = "" +chat_space_right = off color_basic_force_bold = off color_inactive_buffer = off color_inactive_message = on @@ -75,6 +78,7 @@ hotlist_suffix = "" hotlist_unique_numbers = on hotlist_update_on_buffer_switch = on input_cursor_scroll = 20 +input_multiline_lead_linebreak = on input_share = none input_share_overwrite = off input_undo_max = 32 @@ -96,7 +100,6 @@ nick_color_hash_salt = "" nick_color_stop_chars = "_|[" nick_prefix = "" nick_suffix = "" -paste_auto_add_newline = on paste_bracketed = off paste_bracketed_timer_delay = 10 paste_max_lines = 1 @@ -178,6 +181,8 @@ chat_prefix_suffix = 31 chat_read_marker = 31 chat_read_marker_bg = default chat_server = brown +chat_status_disabled = red +chat_status_enabled = green chat_tags = red chat_text_found = yellow chat_text_found_bg = lightmagenta @@ -205,7 +210,8 @@ status_filter = green status_more = 229 status_mouse = green status_name = 121 -status_name_ssl = 121 +status_name_insecure = lightmagenta +status_name_tls = white status_nicklist_count = default status_number = yellow status_time = default @@ -434,49 +440,53 @@ python = message irc_smart = on;*;irc_smart_filter;* [key] -ctrl-? = "/input delete_previous_char" -ctrl-A = "/input move_beginning_of_line" -ctrl-B = "/input move_previous_char" -ctrl-Cb = "/input insert \x02" -ctrl-Cc = "/input insert \x03" -ctrl-Ci = "/input insert \x1D" -ctrl-Co = "/input insert \x0F" -ctrl-Cr = "/input insert \x12" -ctrl-Cu = "/input insert \x15" -ctrl-D = "/input delete_next_char" -ctrl-E = "/input move_end_of_line" -ctrl-F = "/input move_next_char" -ctrl-H = "/window -1" -ctrl-I = "/input complete_next" -ctrl-J = "/input return" -ctrl-K = "/input delete_end_of_line" -ctrl-L = "/window +1" -ctrl-M = "/input return" -ctrl-N = "/buffer +1" -ctrl-P = "/buffer -1" -ctrl-R = "/input search_text" -ctrl-Sctrl-U = "/input set_unread" -ctrl-T = "/input transpose_chars" -ctrl-U = "/input delete_beginning_of_line" -ctrl-W = "/input delete_previous_word" -ctrl-X = "/input switch_active_buffer" -ctrl-Y = "/input clipboard_paste" -meta-meta-OP = "/bar scroll buflist * b" -meta-meta-OQ = "/bar scroll buflist * e" -meta-meta2-11~ = "/bar scroll buflist * b" -meta-meta2-12~ = "/bar scroll buflist * e" -meta-meta2-1~ = "/window scroll_top" -meta-meta2-23~ = "/bar scroll nicklist * b" -meta-meta2-24~ = "/bar scroll nicklist * e" -meta-meta2-4~ = "/window scroll_bottom" -meta-meta2-5~ = "/window scroll_up" -meta-meta2-6~ = "/window scroll_down" -meta-meta2-7~ = "/window scroll_top" -meta-meta2-8~ = "/window scroll_bottom" -meta-meta2-A = "/buffer -1" -meta-meta2-B = "/buffer +1" -meta-meta2-C = "/buffer +10" -meta-meta2-D = "/buffer -10" +backspace = "/input delete_previous_char" +ctrl-^ = "/buffer +" +ctrl-_ = "/input undo" +ctrl-a = "/input move_beginning_of_line" +ctrl-b = "/input move_previous_char" +ctrl-c,b = "/input insert \x02" +ctrl-c,c = "/input insert \x03" +ctrl-c,i = "/input insert \x1D" +ctrl-c,o = "/input insert \x0F" +ctrl-c,r = "/input insert \x12" +ctrl-c,u = "/input insert \x15" +ctrl-d = "/input delete_next_char" +ctrl-down = "/input history_global_next" +ctrl-e = "/input move_end_of_line" +ctrl-f = "/input move_next_char" +ctrl-f1 = "/bar scroll buflist * -100%" +ctrl-f2 = "/bar scroll buflist * +100%" +ctrl-h = "/window -1" +ctrl-k = "/input delete_end_of_line" +ctrl-l = "/window +1" +ctrl-left = "/input move_previous_word" +ctrl-n = "/buffer +1" +ctrl-p = "/buffer -1" +ctrl-r = "/input search_text" +ctrl-right = "/input move_next_word" +ctrl-s,ctrl-u = "/allbuf /buffer set unread" +ctrl-t = "/input transpose_chars" +ctrl-u = "/input delete_beginning_of_line" +ctrl-up = "/input history_global_previous" +ctrl-w = "/input delete_previous_word" +ctrl-x = "/buffer switch" +ctrl-y = "/input clipboard_paste" +delete = "/input delete_next_char" +down = "/input history_next" +end = "/input move_end_of_line" +f1 = "/bar scroll buflist * -100%" +f10 = "/bar scroll title * +30%" +f11 = "/bar scroll nicklist * -100%" +f12 = "/bar scroll nicklist * +100%" +f2 = "/bar scroll buflist * +100%" +f5 = "/buffer -1" +f6 = "/buffer +1" +f7 = "/window -1" +f8 = "/window +1" +f9 = "/bar scroll title * -30%" +home = "/input move_beginning_of_line" +left = "/input move_previous_char" meta-! = "/buffer *1" meta-# = "/buffer *3" meta-$ = "/buffer *4" @@ -485,7 +495,7 @@ meta-& = "/buffer *7" meta-( = "/buffer *9" meta-) = "/buffer *10" meta-* = "/buffer *8" -meta-/ = "/input jump_last_buffer_displayed" +meta-/ = "/buffer jump last_displayed" meta-0 = "/buffer *10" meta-1 = "/buffer *1" meta-2 = "/buffer *2" @@ -496,237 +506,188 @@ meta-6 = "/buffer *6" meta-7 = "/buffer *7" meta-8 = "/buffer *8" meta-9 = "/buffer *9" -meta-< = "/input jump_previously_visited_buffer" +meta-< = "/buffer jump prev_visited" meta-= = "/filter toggle" -meta-> = "/input jump_next_visited_buffer" +meta-> = "/buffer jump next_visited" meta-@ = "/buffer *2" meta-B = "/buflist toggle" -meta-OA = "/input history_global_previous" -meta-OB = "/input history_global_next" -meta-OC = "/input move_next_word" -meta-OD = "/input move_previous_word" -meta-OF = "/input move_end_of_line" -meta-OH = "/input move_beginning_of_line" -meta-OP = "/bar scroll buflist * -100%" -meta-OQ = "/bar scroll buflist * +100%" -meta-Oa = "/input history_global_previous" -meta-Ob = "/input history_global_next" -meta-Oc = "/input move_next_word" -meta-Od = "/input move_previous_word" -meta2-11^ = "/bar scroll buflist * -100%" -meta2-11~ = "/bar scroll buflist * -100%" -meta2-12^ = "/bar scroll buflist * +100%" -meta2-12~ = "/bar scroll buflist * +100%" -meta2-15~ = "/buffer -1" -meta2-17~ = "/buffer +1" -meta2-18~ = "/window -1" -meta2-19~ = "/window +1" -meta2-1;3A = "/buffer -1" -meta2-1;3B = "/buffer +1" -meta2-1;3C = "/buffer +1" -meta2-1;3D = "/buffer -1" -meta2-1;3P = "/bar scroll buflist * b" -meta2-1;3Q = "/bar scroll buflist * e" -meta2-1;5A = "/input history_global_previous" -meta2-1;5B = "/input history_global_next" -meta2-1;5C = "/input move_next_word" -meta2-1;5D = "/input move_previous_word" -meta2-1;5P = "/bar scroll buflist * -100%" -meta2-1;5Q = "/bar scroll buflist * +100%" -meta2-1~ = "/input move_beginning_of_line" -meta2-200~ = "/input paste_start" -meta2-201~ = "/input paste_stop" -meta2-20~ = "/bar scroll title * -30%" -meta2-21~ = "/bar scroll title * +30%" -meta2-23~ = "/bar scroll nicklist * -100%" -meta2-24~ = "/bar scroll nicklist * +100%" -meta2-3~ = "/input delete_next_char" -meta2-4~ = "/input move_end_of_line" -meta2-5;3~ = "/window scroll_up" -meta2-5~ = "/window page_up" -meta2-6;3~ = "/window scroll_down" -meta2-6~ = "/window page_down" -meta2-7~ = "/input move_beginning_of_line" -meta2-8~ = "/input move_end_of_line" -meta2-A = "/input history_previous" -meta2-B = "/input history_next" -meta2-C = "/input move_next_char" -meta2-D = "/input move_previous_char" -meta2-F = "/input move_end_of_line" -meta2-G = "/window page_down" -meta2-H = "/input move_beginning_of_line" -meta2-I = "/window page_up" -meta2-Z = "/input complete_previous" -meta2-[E = "/buffer -1" meta-^ = "/buffer *6" meta-_ = "/input redo" -meta-a = "/input jump_smart" +meta-a = "/buffer jump smart" meta-b = "/input move_previous_word" meta-d = "/input delete_next_word" +meta-down = "/buffer +1" +meta-end = "/window scroll_bottom" meta-f = "/input move_next_word" -meta-h = "/input hotlist_clear" -meta-jmeta-l = "/input jump_last_buffer" -meta-jmeta-r = "/server raw" -meta-jmeta-s = "/server jump" -meta-j01 = "/buffer 1" -meta-j02 = "/buffer 2" -meta-j03 = "/buffer 3" -meta-j04 = "/buffer 4" -meta-j05 = "/buffer 5" -meta-j06 = "/buffer 6" -meta-j07 = "/buffer 7" -meta-j08 = "/buffer 8" -meta-j09 = "/buffer 9" -meta-j10 = "/buffer 10" -meta-j11 = "/buffer 11" -meta-j12 = "/buffer 12" -meta-j13 = "/buffer 13" -meta-j14 = "/buffer 14" -meta-j15 = "/buffer 15" -meta-j16 = "/buffer 16" -meta-j17 = "/buffer 17" -meta-j18 = "/buffer 18" -meta-j19 = "/buffer 19" -meta-j20 = "/buffer 20" -meta-j21 = "/buffer 21" -meta-j22 = "/buffer 22" -meta-j23 = "/buffer 23" -meta-j24 = "/buffer 24" -meta-j25 = "/buffer 25" -meta-j26 = "/buffer 26" -meta-j27 = "/buffer 27" -meta-j28 = "/buffer 28" -meta-j29 = "/buffer 29" -meta-j30 = "/buffer 30" -meta-j31 = "/buffer 31" -meta-j32 = "/buffer 32" -meta-j33 = "/buffer 33" -meta-j34 = "/buffer 34" -meta-j35 = "/buffer 35" -meta-j36 = "/buffer 36" -meta-j37 = "/buffer 37" -meta-j38 = "/buffer 38" -meta-j39 = "/buffer 39" -meta-j40 = "/buffer 40" -meta-j41 = "/buffer 41" -meta-j42 = "/buffer 42" -meta-j43 = "/buffer 43" -meta-j44 = "/buffer 44" -meta-j45 = "/buffer 45" -meta-j46 = "/buffer 46" -meta-j47 = "/buffer 47" -meta-j48 = "/buffer 48" -meta-j49 = "/buffer 49" -meta-j50 = "/buffer 50" -meta-j51 = "/buffer 51" -meta-j52 = "/buffer 52" -meta-j53 = "/buffer 53" -meta-j54 = "/buffer 54" -meta-j55 = "/buffer 55" -meta-j56 = "/buffer 56" -meta-j57 = "/buffer 57" -meta-j58 = "/buffer 58" -meta-j59 = "/buffer 59" -meta-j60 = "/buffer 60" -meta-j61 = "/buffer 61" -meta-j62 = "/buffer 62" -meta-j63 = "/buffer 63" -meta-j64 = "/buffer 64" -meta-j65 = "/buffer 65" -meta-j66 = "/buffer 66" -meta-j67 = "/buffer 67" -meta-j68 = "/buffer 68" -meta-j69 = "/buffer 69" -meta-j70 = "/buffer 70" -meta-j71 = "/buffer 71" -meta-j72 = "/buffer 72" -meta-j73 = "/buffer 73" -meta-j74 = "/buffer 74" -meta-j75 = "/buffer 75" -meta-j76 = "/buffer 76" -meta-j77 = "/buffer 77" -meta-j78 = "/buffer 78" -meta-j79 = "/buffer 79" -meta-j80 = "/buffer 80" -meta-j81 = "/buffer 81" -meta-j82 = "/buffer 82" -meta-j83 = "/buffer 83" -meta-j84 = "/buffer 84" -meta-j85 = "/buffer 85" -meta-j86 = "/buffer 86" -meta-j87 = "/buffer 87" -meta-j88 = "/buffer 88" -meta-j89 = "/buffer 89" -meta-j90 = "/buffer 90" -meta-j91 = "/buffer 91" -meta-j92 = "/buffer 92" -meta-j93 = "/buffer 93" -meta-j94 = "/buffer 94" -meta-j95 = "/buffer 95" -meta-j96 = "/buffer 96" -meta-j97 = "/buffer 97" -meta-j98 = "/buffer 98" -meta-j99 = "/buffer 99" +meta-f1 = "/bar scroll buflist * b" +meta-f11 = "/bar scroll nicklist * b" +meta-f12 = "/bar scroll nicklist * e" +meta-f2 = "/bar scroll buflist * e" +meta-h = "/hotlist clear" +meta-home = "/window scroll_top" +meta-j,0,1 = "/buffer 1" +meta-j,0,2 = "/buffer 2" +meta-j,0,3 = "/buffer 3" +meta-j,0,4 = "/buffer 4" +meta-j,0,5 = "/buffer 5" +meta-j,0,6 = "/buffer 6" +meta-j,0,7 = "/buffer 7" +meta-j,0,8 = "/buffer 8" +meta-j,0,9 = "/buffer 9" +meta-j,1,0 = "/buffer 10" +meta-j,1,1 = "/buffer 11" +meta-j,1,2 = "/buffer 12" +meta-j,1,3 = "/buffer 13" +meta-j,1,4 = "/buffer 14" +meta-j,1,5 = "/buffer 15" +meta-j,1,6 = "/buffer 16" +meta-j,1,7 = "/buffer 17" +meta-j,1,8 = "/buffer 18" +meta-j,1,9 = "/buffer 19" +meta-j,2,0 = "/buffer 20" +meta-j,2,1 = "/buffer 21" +meta-j,2,2 = "/buffer 22" +meta-j,2,3 = "/buffer 23" +meta-j,2,4 = "/buffer 24" +meta-j,2,5 = "/buffer 25" +meta-j,2,6 = "/buffer 26" +meta-j,2,7 = "/buffer 27" +meta-j,2,8 = "/buffer 28" +meta-j,2,9 = "/buffer 29" +meta-j,3,0 = "/buffer 30" +meta-j,3,1 = "/buffer 31" +meta-j,3,2 = "/buffer 32" +meta-j,3,3 = "/buffer 33" +meta-j,3,4 = "/buffer 34" +meta-j,3,5 = "/buffer 35" +meta-j,3,6 = "/buffer 36" +meta-j,3,7 = "/buffer 37" +meta-j,3,8 = "/buffer 38" +meta-j,3,9 = "/buffer 39" +meta-j,4,0 = "/buffer 40" +meta-j,4,1 = "/buffer 41" +meta-j,4,2 = "/buffer 42" +meta-j,4,3 = "/buffer 43" +meta-j,4,4 = "/buffer 44" +meta-j,4,5 = "/buffer 45" +meta-j,4,6 = "/buffer 46" +meta-j,4,7 = "/buffer 47" +meta-j,4,8 = "/buffer 48" +meta-j,4,9 = "/buffer 49" +meta-j,5,0 = "/buffer 50" +meta-j,5,1 = "/buffer 51" +meta-j,5,2 = "/buffer 52" +meta-j,5,3 = "/buffer 53" +meta-j,5,4 = "/buffer 54" +meta-j,5,5 = "/buffer 55" +meta-j,5,6 = "/buffer 56" +meta-j,5,7 = "/buffer 57" +meta-j,5,8 = "/buffer 58" +meta-j,5,9 = "/buffer 59" +meta-j,6,0 = "/buffer 60" +meta-j,6,1 = "/buffer 61" +meta-j,6,2 = "/buffer 62" +meta-j,6,3 = "/buffer 63" +meta-j,6,4 = "/buffer 64" +meta-j,6,5 = "/buffer 65" +meta-j,6,6 = "/buffer 66" +meta-j,6,7 = "/buffer 67" +meta-j,6,8 = "/buffer 68" +meta-j,6,9 = "/buffer 69" +meta-j,7,0 = "/buffer 70" +meta-j,7,1 = "/buffer 71" +meta-j,7,2 = "/buffer 72" +meta-j,7,3 = "/buffer 73" +meta-j,7,4 = "/buffer 74" +meta-j,7,5 = "/buffer 75" +meta-j,7,6 = "/buffer 76" +meta-j,7,7 = "/buffer 77" +meta-j,7,8 = "/buffer 78" +meta-j,7,9 = "/buffer 79" +meta-j,8,0 = "/buffer 80" +meta-j,8,1 = "/buffer 81" +meta-j,8,2 = "/buffer 82" +meta-j,8,3 = "/buffer 83" +meta-j,8,4 = "/buffer 84" +meta-j,8,5 = "/buffer 85" +meta-j,8,6 = "/buffer 86" +meta-j,8,7 = "/buffer 87" +meta-j,8,8 = "/buffer 88" +meta-j,8,9 = "/buffer 89" +meta-j,9,0 = "/buffer 90" +meta-j,9,1 = "/buffer 91" +meta-j,9,2 = "/buffer 92" +meta-j,9,3 = "/buffer 93" +meta-j,9,4 = "/buffer 94" +meta-j,9,5 = "/buffer 95" +meta-j,9,6 = "/buffer 96" +meta-j,9,7 = "/buffer 97" +meta-j,9,8 = "/buffer 98" +meta-j,9,9 = "/buffer 99" +meta-j,meta-l = "/buffer +" +meta-j,meta-r = "/server raw" +meta-j,meta-s = "/server jump" meta-k = "/input grab_key_command" +meta-left = "/buffer -1" meta-m = "/mute mouse toggle" meta-n = "/window scroll_next_highlight" meta-p = "/window scroll_previous_highlight" +meta-pgdn = "/window scroll_down" +meta-pgup = "/window scroll_up" meta-r = "/input delete_line" +meta-right = "/buffer +1" meta-s = "/mute aspell toggle" meta-u = "/window scroll_unread" +meta-up = "/buffer -1" meta-w = "/close" -meta-wmeta-meta2-A = "/window up" -meta-wmeta-meta2-B = "/window down" -meta-wmeta-meta2-C = "/window right" -meta-wmeta-meta2-D = "/window left" -meta-wmeta2-1;3A = "/window up" -meta-wmeta2-1;3B = "/window down" -meta-wmeta2-1;3C = "/window right" -meta-wmeta2-1;3D = "/window left" -meta-wmeta-b = "/window balance" -meta-wmeta-s = "/window swap" -meta-x = "/input zoom_merged_buffer" +meta-w,meta-b = "/window balance" +meta-w,meta-down = "/window down" +meta-w,meta-left = "/window left" +meta-w,meta-right = "/window right" +meta-w,meta-s = "/window swap" +meta-w,meta-up = "/window up" +meta-x = "/buffer zoom" meta-z = "/window zoom" -ctrl-^ = "/input jump_last_buffer" -ctrl-_ = "/input undo" +pgdn = "/window page_down" +pgup = "/window page_up" +return = "/input return" +right = "/input move_next_char" +shift-tab = "/input complete_previous" +tab = "/input complete_next" +up = "/input history_previous" [key_search] -ctrl-J = "/input search_stop" -ctrl-M = "/input search_stop" -ctrl-R = "/input search_switch_case" -meta2-A = "/input search_previous" -meta2-B = "/input search_next" +ctrl-r = "/input search_switch_case" +down = "/input search_next" +return = "/input search_stop" +up = "/input search_previous" [key_cursor] -ctrl-J = "/cursor stop" -ctrl-M = "/cursor stop" -meta-meta2-A = "/cursor move area_up" -meta-meta2-B = "/cursor move area_down" -meta-meta2-C = "/cursor move area_right" -meta-meta2-D = "/cursor move area_left" -meta2-1;3A = "/cursor move area_up" -meta2-1;3B = "/cursor move area_down" -meta2-1;3C = "/cursor move area_right" -meta2-1;3D = "/cursor move area_left" -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:Q = "hsignal:chat_quote_time_prefix_message;/cursor stop" +@chat:m = "hsignal:chat_quote_message;/cursor stop" +@chat:q = "hsignal:chat_quote_prefix_message;/cursor stop" @item(buffer_nicklist):K = "/window ${_window_number};/kickban ${nick}" @item(buffer_nicklist):b = "/window ${_window_number};/ban ${nick}" @item(buffer_nicklist):k = "/window ${_window_number};/kick ${nick}" @item(buffer_nicklist):q = "/window ${_window_number};/query ${nick};/cursor stop" @item(buffer_nicklist):w = "/window ${_window_number};/whois ${nick}" -@chat:Q = "hsignal:chat_quote_time_prefix_message;/cursor stop" -@chat:m = "hsignal:chat_quote_message;/cursor stop" -@chat:q = "hsignal:chat_quote_prefix_message;/cursor stop" +down = "/cursor move down" +left = "/cursor move left" +meta-down = "/cursor move area_down" +meta-left = "/cursor move area_left" +meta-right = "/cursor move area_right" +meta-up = "/cursor move area_up" +return = "/cursor stop" +right = "/cursor move right" +up = "/cursor move up" [key_mouse] +@*:button3 = "/cursor go ${_x},${_y}" @bar(buffers):ctrl-wheeldown = "hsignal:buffers_mouse" @bar(buffers):ctrl-wheelup = "hsignal:buffers_mouse" @bar(buflist):ctrl-wheeldown = "hsignal:buflist_mouse" @@ -736,6 +697,8 @@ meta2-D = "/cursor move left" @bar(nicklist):button1-gesture-down-long = "/bar scroll nicklist ${_window_number} e" @bar(nicklist):button1-gesture-up = "/bar scroll nicklist ${_window_number} -100%" @bar(nicklist):button1-gesture-up-long = "/bar scroll nicklist ${_window_number} b" +@bar:wheeldown = "/bar scroll ${_bar_name} ${_window_number} +20%" +@bar:wheelup = "/bar scroll ${_bar_name} ${_window_number} -20%" @chat(fset.fset):button1 = "/window ${_window_number};/fset -go ${_chat_line_y}" @chat(fset.fset):button2* = "hsignal:fset_mouse" @chat(fset.fset):wheeldown = "/fset -down 5" @@ -749,6 +712,11 @@ meta2-D = "/cursor move left" @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" @chat(script.scripts):wheelup = "/script up 5" +@chat:button1 = "/window ${_window_number}" +@chat:ctrl-wheeldown = "/window scroll_horiz -window ${_window_number} +10%" +@chat:ctrl-wheelup = "/window scroll_horiz -window ${_window_number} -10%" +@chat:wheeldown = "/window scroll_down -window ${_window_number}" +@chat:wheelup = "/window scroll_up -window ${_window_number}" @item(buffer_nicklist):button1 = "/window ${_window_number};/query ${nick}" @item(buffer_nicklist):button1-gesture-left = "/window ${_window_number};/kick ${nick}" @item(buffer_nicklist):button1-gesture-left-long = "/window ${_window_number};/kickban ${nick}" @@ -762,11 +730,3 @@ meta2-D = "/cursor move left" @item(buflist2):button2* = "hsignal:buflist_mouse" @item(buflist3):button1* = "hsignal:buflist_mouse" @item(buflist3):button2* = "hsignal:buflist_mouse" -@bar:wheeldown = "/bar scroll ${_bar_name} ${_window_number} +20%" -@bar:wheelup = "/bar scroll ${_bar_name} ${_window_number} -20%" -@chat:button1 = "/window ${_window_number}" -@chat:ctrl-wheeldown = "/window scroll_horiz -window ${_window_number} +10%" -@chat:ctrl-wheelup = "/window scroll_horiz -window ${_window_number} -10%" -@chat:wheeldown = "/window scroll_down -window ${_window_number}" -@chat:wheelup = "/window scroll_up -window ${_window_number}" -@*:button3 = "/cursor go ${_x},${_y}" diff --git a/weechat/xfer.conf b/weechat/xfer.conf index e644bb6..205843a 100644 --- a/weechat/xfer.conf +++ b/weechat/xfer.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/weechat/quickstart/ # [look] diff --git a/xprofile.d/10-screensaver.sh b/xprofile.d/10-screensaver.sh index 4e9a048..3fcfa95 100755 --- a/xprofile.d/10-screensaver.sh +++ b/xprofile.d/10-screensaver.sh @@ -20,9 +20,14 @@ elif [[ $(hostname) == "skull-canyon" ]]; then xidlehook \ --socket=$XIDLEHOOK_SOCKET \ --not-when-fullscreen \ - --timer 300 'xset dpms force off' '' \ - --timer 300 'i3lock -c 000000' '' \ + --timer 300 'xset dpms force off' '' \ + --timer 300 'loginctl lock-session' '' \ & fi +# FIXME: as soon as dpms force off comes on the session is locked regardles +# TODO: maybe there is no need for xidlehook +# Although, I'm not sure how suspend will work +# xset s 300 60 # notify after 300, lock 60 after +# xset dpms 300 360 1800 xss-lock -- i3lock --nofork --color=000000 & diff --git a/xprofile.d/10-xkb.sh b/xprofile.d/10-xkb.sh index 1606d1d..7e00da1 100755 --- a/xprofile.d/10-xkb.sh +++ b/xprofile.d/10-xkb.sh @@ -1,5 +1,3 @@ #!/usr/bin/env bash -xkb_file=default -[[ -f $XDG_CONFIG_HOME/xkb/$(hostname).xkb ]] && xkb_file=$(hostname) -xkbcomp -I$XDG_CONFIG_HOME/xkb $XDG_CONFIG_HOME/xkb/$xkb_file.xkb $DISPLAY +inputplug -0c xkbload diff --git a/xprofile.d/99-applications.sh b/xprofile.d/99-applications.sh index 229a9e6..bd965d7 100755 --- a/xprofile.d/99-applications.sh +++ b/xprofile.d/99-applications.sh @@ -10,3 +10,6 @@ fi picom & unclutter --timeout 1 & xcape -e "Control_L=Escape;Control_R=Escape" + +#TODO: +# add support for kdeconnect-indicator if it is installed diff --git a/zsh/lib/fzf.zsh b/zsh/lib/10-fzf.zsh similarity index 100% rename from zsh/lib/fzf.zsh rename to zsh/lib/10-fzf.zsh diff --git a/zsh/lib/kitty.zsh b/zsh/lib/kitty.zsh deleted file mode 100644 index e606c01..0000000 --- a/zsh/lib/kitty.zsh +++ /dev/null @@ -1,6 +0,0 @@ -if test -n "$KITTY_INSTALLATION_DIR"; then - export KITTY_SHELL_INTEGRATION="enabled" - autoload -Uz -- "$KITTY_INSTALLATION_DIR"/shell-integration/zsh/kitty-integration - kitty-integration - unfunction kitty-integration -fi diff --git a/zsh/lib/motd.zsh b/zsh/lib/motd.zsh index c115506..be5b477 100644 --- a/zsh/lib/motd.zsh +++ b/zsh/lib/motd.zsh @@ -11,8 +11,7 @@ msg() } if [[ -d ~/org ]]; then - # 44 seems to be the number of color escape characters used by grep - todo | cut -c-$((COLUMNS + 44)) + org-agenda fi if (( $+commands[checkupdates] )); then diff --git a/zshenv b/zshenv index 93993b0..c184a18 100644 --- a/zshenv +++ b/zshenv @@ -28,9 +28,9 @@ fi # vim stuff [[ -d "$XDG_CACHE_HOME/vim/backup" ]] || mkdir -p "$XDG_CACHE_HOME"/vim/{backup,undo,view} -export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC' -export EDITOR=vim -export VISUAL=vim +export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/"..(has("nvim")?"nvim/init.lua":"vim/vimrc") | source $MYVIMRC' +export EDITOR=nvim +export VISUAL=nvim # default browser export BROWSER=qutebrowser @@ -44,9 +44,6 @@ export LESSHISTFILE="$XDG_CACHE_HOME/lesshst" # urxvtd export RXVT_SOCKET="$XDG_RUNTIME_DIR/urxvtd-$HOST" -# task -export TASKRC="$XDG_CONFIG_HOME/taskrc" - # mpv & mplayer export MPV_HOME="$XDG_CONFIG_HOME/mpv" export MPLAYER_HOME="$XDG_CONFIG_HOME/mplayer"