Compare commits

..

1 commit

Author SHA1 Message Date
88bd9e427f
nvim: Add vim-scimark plugin 2024-09-18 16:28:41 +02:00
96 changed files with 2254 additions and 1693 deletions

View file

@ -4,7 +4,7 @@
# a development environment based on git and nvim. # a development environment based on git and nvim.
[base] [base]
depends = ["shell", "vcs", "nvim", "scripts", "ssh", "terminal", "bootstrap"] depends = ["shell", "git", "nvim", "scripts", "ssh", "terminal", "bootstrap"]
[bootstrap.files] [bootstrap.files]
"bootstrap/dotlink.sh" = "~/.config/sh/alias.d/dotlink.sh" "bootstrap/dotlink.sh" = "~/.config/sh/alias.d/dotlink.sh"
@ -13,13 +13,9 @@ depends = ["shell", "vcs", "nvim", "scripts", "ssh", "terminal", "bootstrap"]
"sh/README.md" = { target = "~/NOWHERE", type = "symbolic", if = "false" } "sh/README.md" = { target = "~/NOWHERE", type = "symbolic", if = "false" }
sh = "~" sh = "~"
[vcs.files] [git.files]
"vcs/README.md" = { target = "~/NOWHERE", type = "symbolic", if = "false" } "git/README.md" = { target = "~/NOWHERE", type = "symbolic", if = "false" }
"vcs/git/config" = "~/.config" git = "~"
"vcs/jj/config" = "~/.config"
"vcs/gitignore/config" = "~/.config"
"vcs/gitignore/local" = "~/.local"
vcs = "~"
[nvim.files] [nvim.files]
"nvim/.config/nvim/spell/de.utf-8.add.spl" = { target = "~/.config/nvim/spell/de.utf-8.add.spl", type = "symbolic" } "nvim/.config/nvim/spell/de.utf-8.add.spl" = { target = "~/.config/nvim/spell/de.utf-8.add.spl", type = "symbolic" }
@ -71,15 +67,8 @@ social = "~"
[writing.files] [writing.files]
"writing/README.md" = { target = "~/NOWHERE", type = "symbolic", if = "false" } "writing/README.md" = { target = "~/NOWHERE", type = "symbolic", if = "false" }
"writing/jrnl/config" = "~/.config" "writing/.config/papis/papistui.yaml" = { target = "~/.config/papis/papistui.yaml", type = "symbolic" }
"writing/papis/config/papis/papistui.yaml" = { target = "~/.config/papis/papistui.yaml", type = "symbolic" } "writing/.config/sioyek/prefs_user.config" = { target = "~/.config/sioyek/prefs_user.config", type = "template", prepend = "# TEMPLATED BY DOTTER\n" }
"writing/papis/config" = "~/.config"
"writing/sioyek/config/sioyek/prefs_user.config" = { target = "~/.config/sioyek/prefs_user.config", type = "template", prepend = "# TEMPLATED BY DOTTER\n" }
"writing/sioyek/config" = "~/.config"
"writing/zathura/config" = "~/.config"
"writing/zk/config" = "~/.config"
"writing/zk/config/sh/alias.d/zk.sh" = { target = "~/.config/sh/alias.d/zk.sh", type = "symbolic" }
"writing/pandoc/local" = "~/.local"
writing = "~" writing = "~"
# WORKSTATION: A desktop machine, with wayland environment and display attached. # WORKSTATION: A desktop machine, with wayland environment and display attached.

View file

@ -53,12 +53,13 @@ Enjoy!
* [`waybar`](https://github.com/Alexays/Waybar) - Easily customizable statusbar for wayland * [`waybar`](https://github.com/Alexays/Waybar) - Easily customizable statusbar for wayland
* [`bemenu`](https://github.com/Cloudef/bemenu) - Extended dmenu replacement for wayland, X11 and ncurses * [`bemenu`](https://github.com/Cloudef/bemenu) - Extended dmenu replacement for wayland, X11 and ncurses
* [`fontconfig`] - System-wide font replacements and styling settings * [`fontconfig`] - System-wide font replacements and styling settings
* [`wezterm`](https://wezfurlong.org/wezterm/) - Terminal emulator and multiplexer (fast, understandable and lua configurable) * [`wezterm`](https://wezfurlong.org/wezterm/) - Terminal emulator (fast, understandable and lua configurable)
* [`tmux`](https://github.com/tmux/tmux/) - terminal multiplexer (slowly migrating away in favor of wezterm)
* [`nvim`](https://neovim.io/) - Neovim configuration * [`nvim`](https://neovim.io/) - Neovim configuration
* [`vifm`](https://github.com/vifm/vifm) - vim-like file-manager * [`vifm`](https://github.com/vifm/vifm) - vim-like file-manager
* [`qutebrowser`](https://github.com/qutebrowser/qutebrowser) - vim-key enabled web browser * [`qutebrowser`](https://github.com/qutebrowser/qutebrowser) - vim-key enabled web browser
* [`pass`](pass/README.md) - Password management suite * [`pass`](pass/README.md) - Password management suite
* [`bibtex`] - LateX/BibteX/pandoc plaintext writing & reference suite (slowly migrating toward [typst](https://typst.app)) * [`bibtex`] - LateX/BibteX/pandoc plaintext writing & reference suite
* [`git`](git/README.md) - distributed version control system. * [`git`](git/README.md) - distributed version control system.
* [`office`](office/README.md) - office/productivity software for writing e-mail and setting appointments * [`office`](office/README.md) - office/productivity software for writing e-mail and setting appointments

View file

@ -11,7 +11,6 @@ PKG_TSV_FILE=${PKG_TSV_FILE:-bootstrap/packages_stable.tsv}
packages_repo="${BOOTSTRAP_PACKAGES:-$(grep -e ' R ' "$PKG_TSV_FILE" | cut -f1 -d' ')}" packages_repo="${BOOTSTRAP_PACKAGES:-$(grep -e ' R ' "$PKG_TSV_FILE" | cut -f1 -d' ')}"
packages_aur="${BOOTSTRAP_PACKAGES_AUR:-$(grep -e ' A ' "$PKG_TSV_FILE" | cut -f1 -d' ')}" packages_aur="${BOOTSTRAP_PACKAGES_AUR:-$(grep -e ' A ' "$PKG_TSV_FILE" | cut -f1 -d' ')}"
packages_pipx="${BOOTSTRAP_PACKAGES_PIPX:-$(grep -e ' P ' "$PKG_TSV_FILE" | cut -f1,5 -d' ')}" packages_pipx="${BOOTSTRAP_PACKAGES_PIPX:-$(grep -e ' P ' "$PKG_TSV_FILE" | cut -f1,5 -d' ')}"
packages_uv="${BOOTSTRAP_PACKAGES_PIPX:-$(grep -e ' U ' "$PKG_TSV_FILE" | cut -f1,5 -d' ')}"
main() { main() {
local cmd="" local cmd=""
@ -19,7 +18,7 @@ main() {
case "$1" in case "$1" in
-v | --version) -v | --version)
printf "Package bootstrap script.\n\n©Marty Oehme\n\nVersion: 0.4\n" printf "Package bootstrap script.\n\n©Marty Oehme\n\nVersion: 0.3\n"
;; ;;
-h | --help) -h | --help)
printf "Usage: install [-f|--force][-v|--version][-h|--help]\n\n-f Do not ask for any confirmations but force update and installation.\n" printf "Usage: install [-f|--force][-v|--version][-h|--help]\n\n-f Do not ask for any confirmations but force update and installation.\n"
@ -73,14 +72,6 @@ install_packages() {
fi fi
} }
# check if any packages in list
has_pkg() { # 1=variable containing packages
if [ -n "$1" ]; then
return 0
fi
return 1
}
install_pipx() { install_pipx() {
if type pipx >/dev/null 2>&1; then if type pipx >/dev/null 2>&1; then
echo "Existing pipx installation found .........................................." echo "Existing pipx installation found .........................................."
@ -93,18 +84,6 @@ install_pipx() {
fi fi
} }
install_uv() {
if type uv >/dev/null 2>&1; then
echo "Existing uv installation found .........................................."
return
fi
if "$unattended"; then
paru -S --noconfirm uv
else
paru -S uv
fi
}
install_pipx_pkgs() { install_pipx_pkgs() {
while IFS= read -r line; do while IFS= read -r line; do
if [ -z "$line" ]; then return; fi if [ -z "$line" ]; then return; fi
@ -118,20 +97,6 @@ install_pipx_pkgs() {
done <<<"$packages_pipx" done <<<"$packages_pipx"
} }
install_uv_pkgs() {
while IFS= read -r line; do
if [ -z "$line" ]; then return; fi
prog=$(echo "$line" | cut -f1 -d' ')
injections=$(echo "$line" | cut -f2 -d' ')
cmd_with_args="uv tool install"
for inject_args in ${injections//,/ }; do
cmd_with_args+=" --with $inject_args"
done
$cmd_with_args "$prog"
done <<<"$packages_uv"
}
install() { install() {
unattended=$1 unattended=$1
echo "Beginning package bootstrap ..............................................." echo "Beginning package bootstrap ..............................................."
@ -140,20 +105,11 @@ install() {
echo "Installing apps ..........................................................." echo "Installing apps ..........................................................."
update_repos "$unattended" update_repos "$unattended"
install_packages "$unattended" install_packages "$unattended"
echo "Done ......................................................................"
if has_pkg "$packages_pipx"; then echo "Installing pipx ..........................................................."
echo "Installing pipx ..........................................................." install_pipx
install_pipx echo "Installing pipx packages .................................................."
echo "Installing pipx packages .................................................." install_pipx_pkgs
install_pipx_pkgs
fi
if has_pkg "$packages_uv"; then
echo "Installing uv ..........................................................."
install_uv
echo "Installing uv packages .................................................."
install_uv_pkgs
fi
echo "Done ......................................................................" echo "Done ......................................................................"
} }

View file

@ -29,10 +29,9 @@ bash-language-server Bash language server implementation based on Tree Sitter an
bat Cat clone with syntax highlighting and git integration R bat Cat clone with syntax highlighting and git integration R
bats Bash Automated Testing System R bats Bash Automated Testing System R
bc An arbitrary precision calculator language R bc An arbitrary precision calculator language R
beancount A personal double entry accounting and budgeting software U git+https://github.com/bratekarate/beancount-categorizer.git,beancount-dkb,fava,git+https://github.com/andreasgerstmayr/fava-dashboards.git,python-magic,smart-importer,neovim beancount A personal double entry accounting and budgeting software P git+https://github.com/bratekarate/beancount-categorizer.git,beancount-dkb,fava,python-magic,smart-importer
beanquery A customizable light-weight SQL query tool that works on tabular data, including Beancount U
bearssl Implementation of the SSL/TLS protocol (RFC 5246) written in C R bearssl Implementation of the SSL/TLS protocol (RFC 5246) written in C R
beets Organize your music collection from the command line U beetcamp,beets-describe,beets-ydl,pyacoustid,pylast beets Organize your music collection from the command line P beetcamp,deets-describe,beets-ydl,pyacoustid,pylast
bemenu-dmenu Symlink for using bemenu (native wayland support) as a drop-in replacement to dmenu A bemenu-dmenu Symlink for using bemenu (native wayland support) as a drop-in replacement to dmenu A
bemoji Emoji picker that remembers your favorites A bemoji Emoji picker that remembers your favorites A
bibclean BibTeX and Scribe bibliography prettyprinter and syntax checker A bibclean BibTeX and Scribe bibliography prettyprinter and syntax checker A
@ -42,8 +41,8 @@ bind A complete, highly portable implementation of the DNS protocol R
bluetuith-bin A TUI based bluetooth manager A bluetuith-bin A TUI based bluetooth manager A
bluez-utils Development and debugging utilities for the bluetooth protocol stack R bluez-utils Development and debugging utilities for the bluetooth protocol stack R
booster Fast and secure initramfs generator R booster Fast and secure initramfs generator R
bottom A graphical process/system monitor R
brightnessctl Lightweight brightness control tool R brightnessctl Lightweight brightness control tool R
btop A monitor of system resources, bpytop ported to C++ R
caddy Fast web server with automatic HTTPS R caddy Fast web server with automatic HTTPS R
calcurse A text-based personal organizer R calcurse A text-based personal organizer R
catdoc A convertor for Microsoft Word, Excel, PowerPoint and RTF Files to text R catdoc A convertor for Microsoft Word, Excel, PowerPoint and RTF Files to text R
@ -66,11 +65,10 @@ dos2unix Text file format converter R
dotter-rs-bin A dotfile manager and templater written in Rust A dotter-rs-bin A dotfile manager and templater written in Rust A
duf Disk Usage/Free Utility R duf Disk Usage/Free Utility R
dust A more intuitive version of du in rust R dust A more intuitive version of du in rust R
edir Program to rename, remove, and copy files and directories using your editor A
efm-langserver General purpose Language Server A efm-langserver General purpose Language Server A
enca Charset analyser and converter R enca Charset analyser and converter R
entr Run arbitrary commands when files change R entr Run arbitrary commands when files change R
euporie View and work with ipnb Python notebooks from the cli U euporie View and work with ipnb Python notebooks from the cli P
exercism-bin Command line client for exercism.io A exercism-bin Command line client for exercism.io A
exfat-utils Utilities for exFAT file system R exfat-utils Utilities for exFAT file system R
eza A modern replacement for ls (community fork of exa) R eza A modern replacement for ls (community fork of exa) R
@ -91,6 +89,7 @@ git-lfs Git extension for versioning large files R
gitlint Git commit message linter A gitlint Git commit message linter A
gitui Blazing fast terminal-ui for git written in Rust R gitui Blazing fast terminal-ui for git written in Rust R
gk6x-bin Configure keys, macros, and lighting on GK6X keyboards (GK64, GK84, GK61, etc) A gk6x-bin Configure keys, macros, and lighting on GK6X keyboards (GK64, GK84, GK61, etc) A
glances CLI curses-based monitoring tool R
glfw-wayland A free, open source, portable framework for graphical application development (wayland) R glfw-wayland A free, open source, portable framework for graphical application development (wayland) R
glow Command-line markdown renderer R glow Command-line markdown renderer R
gnu-netcat GNU rewrite of netcat, the network piping application R gnu-netcat GNU rewrite of netcat, the network piping application R
@ -158,7 +157,7 @@ maim Utility to take a screenshot using imlib2 R
mako Lightweight notification daemon for Wayland R mako Lightweight notification daemon for Wayland R
man-db A utility for reading man pages R man-db A utility for reading man pages R
man-pages Linux man pages R man-pages Linux man pages R
markdown-anki-decks Construct and modify anki decks directly with markdown U markdown-anki-decks Construct and modify anki decks directly with markdown P
markdownlint-cli MarkdownLint Command Line Interface A markdownlint-cli MarkdownLint Command Line Interface A
masterpdfeditor-free A complete solution for creation and editing PDF files - Free version without watermark A masterpdfeditor-free A complete solution for creation and editing PDF files - Free version without watermark A
mbsync-git free (GPL) mailbox synchronization program A mbsync-git free (GPL) mailbox synchronization program A
@ -167,7 +166,6 @@ mermaid-cli Generation of diagram and flowchart from text in a similar manner as
mimeo Open files by MIME-type or file name using regular expressions. A mimeo Open files by MIME-type or file name using regular expressions. A
minidlna A DLNA/UPnP-AV Media server (aka ReadyDLNA) R minidlna A DLNA/UPnP-AV Media server (aka ReadyDLNA) R
minio-client Replacement for ls, cp, mkdir, diff and rsync commands for filesystems and object storage R minio-client Replacement for ls, cp, mkdir, diff and rsync commands for filesystems and object storage R
miniserve Tool to serve files via HTTP R
mopidy-bandcamp Mopidy backend for Bandcamp A mopidy-bandcamp Mopidy backend for Bandcamp A
mopidy-iris A Mopidy Web client that utilizes the Spotify and EchoNest frameworks. (Formerly Spotmop) A mopidy-iris A Mopidy Web client that utilizes the Spotify and EchoNest frameworks. (Formerly Spotmop) A
mopidy-local Mopidy extension for local media playback A mopidy-local Mopidy extension for local media playback A
@ -209,7 +207,7 @@ offpunk Fork of the command-line Gemini client AV-98 with added offline capabili
oh-my-zsh-git A community-driven framework for managing your zsh configuration. Includes 180+ optional plugins and over 120 themes to spice up your morning, and an auto-update tool so that makes it easy to keep up with the latest updates from the community A oh-my-zsh-git A community-driven framework for managing your zsh configuration. Includes 180+ optional plugins and over 120 themes to spice up your morning, and an auto-update tool so that makes it easy to keep up with the latest updates from the community A
os-prober Utility to detect other OSes on a set of drives R os-prober Utility to detect other OSes on a set of drives R
pacman-contrib Contributed scripts and tools for pacman systems R pacman-contrib Contributed scripts and tools for pacman systems R
papis Papis is a powerful and highly extensible command-line based document and bibliography manager. U whoosh,papis-zotero,papis-scihub,git+https://git.martyoeh.me/Marty/papis-extract.git,git+https://github.com/supersambo/papis-tui,pybtex-apa-style,git+https://git.martyoeh.me/Marty/papis-bbt-formatter.git papis Papis is a powerful and highly extensible command-line based document and bibliography manager. P whoosh,papis-zotero,papis-scihub,git+https://git.martyoeh.me/Marty/papis-extract.git,git+https://github.com/supersambo/papis-tui,pybtex-apa-style,git+https://git.martyoeh.me/Marty/papis-bbt-formatter.git
parallel A shell tool for executing jobs in parallel R parallel A shell tool for executing jobs in parallel R
parsec-bin Remotely connect to a gaming pc for a low latency remote computing experience A parsec-bin Remotely connect to a gaming pc for a low latency remote computing experience A
paru-bin Feature packed AUR helper A paru-bin Feature packed AUR helper A
@ -234,7 +232,7 @@ protonvpn Official ProtonVPN metapackage that installs protonvpn-gui and protonv
ptpython Python REPL build on top of prompt_toolkit A ptpython Python REPL build on top of prompt_toolkit A
pulsemixer CLI and curses mixer for pulseaudio R pulsemixer CLI and curses mixer for pulseaudio R
pup Command line tool for processing HTML A pup Command line tool for processing HTML A
pv A terminal-based tool for monitoring the progress of data through a pipeline R pv A terminal-based tool for monitoring the progress of data through a pipeline. R
pyright Type checker for the Python language R pyright Type checker for the Python language R
python-adblock Brave's adblock library in Python R python-adblock Brave's adblock library in Python R
python-dictcc commandline tool for dict.cc A python-dictcc commandline tool for dict.cc A
@ -259,7 +257,6 @@ python-pyqt6-networkauth Python bindings for QtNetworkAuth R
python-readability-lxml Fast html to text parser (article readability tool) python library R python-readability-lxml Fast html to text parser (article readability tool) python library R
python-slugify A Python slugify application that handles unicode R python-slugify A Python slugify application that handles unicode R
python-tasklib Python library for interacting with taskwarrior databases R python-tasklib Python library for interacting with taskwarrior databases R
python-tgpt Programmatic access to tgpt through python U
qemu-desktop A QEMU setup for desktop environments R qemu-desktop A QEMU setup for desktop environments R
qt5-wayland Provides APIs for Wayland R qt5-wayland Provides APIs for Wayland R
qt5-xmlpatterns Support for XPath, XQuery, XSLT and XML schema validation R qt5-xmlpatterns Support for XPath, XQuery, XSLT and XML schema validation R
@ -284,6 +281,7 @@ scc-bin Sloc, Cloc and Code: scc is a very fast accurate code counter with compl
scrcpy Display and control your Android device R scrcpy Display and control your Android device R
screen Full-screen window manager that multiplexes a physical terminal R screen Full-screen window manager that multiplexes a physical terminal R
sd Intuitive find & replace R sd Intuitive find & replace R
sfz A simple static file server A
shellcheck-bin Shell script analysis tool (binary release, static) A shellcheck-bin Shell script analysis tool (binary release, static) A
shfmt Format shell programs R shfmt Format shell programs R
sioyek PDF viewer for research papers and technical books. A sioyek PDF viewer for research papers and technical books. A
@ -313,7 +311,8 @@ tidy-viewer CLI csv pretty printer that uses column styling A
timew Timewarrior, A command line time tracking application R timew Timewarrior, A command line time tracking application R
tinyxxd Standalone version of the hex dump utility that comes with ViM R tinyxxd Standalone version of the hex dump utility that comes with ViM R
tlp Linux Advanced Power Management R tlp Linux Advanced Power Management R
toilet Free replacement for the FIGlet utility R tmux Terminal multiplexer R
toilet free replacement for the FIGlet utility. A
topgrade-bin Invoke the upgrade procedure of multiple package managers A topgrade-bin Invoke the upgrade procedure of multiple package managers A
traceroute Tracks the route taken by packets over an IP network R traceroute Tracks the route taken by packets over an IP network R
translate-shell A command-line interface and interactive shell for Google Translate R translate-shell A command-line interface and interactive shell for Google Translate R

Can't render this file because it has a wrong number of fields in line 32.

View file

@ -2,9 +2,15 @@ Name Description Source Target
adbfs-rootless-git fuse filesystem over adb tool for android devices, no device root required A adbfs-rootless-git fuse filesystem over adb tool for android devices, no device root required A
arch-install-scripts Scripts to aid in installing Arch Linux R arch-install-scripts Scripts to aid in installing Arch Linux R
blueberry Bluetooth configuration tool R blueberry Bluetooth configuration tool R
dotter-rs-bin A dotfile manager and templater written in Rust A
eza A modern replacement for ls (community fork of exa) R
feishin-appimage A modern self-hosted music player. A feishin-appimage A modern self-hosted music player. A
khal CLI calendar application built around CalDAV R
m4b-tool-bin A command line utility to merge, split and chapterize audiobook files such as mp3, ogg, flac, m4a or m4b A m4b-tool-bin A command line utility to merge, split and chapterize audiobook files such as mp3, ogg, flac, m4a or m4b A
nodejs-markmap-cli Create markmaps (mindmaps from markdown) from CLI A nodejs-markmap-cli Create markmaps (mindmaps from markdown) from CLI A
pv A terminal-based tool for monitoring the progress of data through a pipeline R
qpwgraph PipeWire Graph Qt GUI Interface R qpwgraph PipeWire Graph Qt GUI Interface R
texlive-latexextra TeX Live - LaTeX additional packages R texlive-latexextra TeX Live - LaTeX additional packages R
toilet Free replacement for the FIGlet utility R
vifm A file manager with curses interface, which provides Vi[m]-like environment R
woeusb-ng Simple tool that enable you to create your own usb stick with Windows installer. A woeusb-ng Simple tool that enable you to create your own usb stick with Windows installer. A

1 Name Description Source Target
2 adbfs-rootless-git fuse filesystem over adb tool for android devices, no device root required A
3 arch-install-scripts Scripts to aid in installing Arch Linux R
4 blueberry Bluetooth configuration tool R
5 dotter-rs-bin A dotfile manager and templater written in Rust A
6 eza A modern replacement for ls (community fork of exa) R
7 feishin-appimage A modern self-hosted music player. A
8 khal CLI calendar application built around CalDAV R
9 m4b-tool-bin A command line utility to merge, split and chapterize audiobook files such as mp3, ogg, flac, m4a or m4b A
10 nodejs-markmap-cli Create markmaps (mindmaps from markdown) from CLI A
11 pv A terminal-based tool for monitoring the progress of data through a pipeline R
12 qpwgraph PipeWire Graph Qt GUI Interface R
13 texlive-latexextra TeX Live - LaTeX additional packages R
14 toilet Free replacement for the FIGlet utility R
15 vifm A file manager with curses interface, which provides Vi[m]-like environment R
16 woeusb-ng Simple tool that enable you to create your own usb stick with Windows installer. A

View file

@ -8,23 +8,6 @@ time_to_lockscreen=300
time_to_screendim=600 time_to_screendim=600
time_to_suspend=900 time_to_suspend=900
NO_RESTART="$1"
should_start() { # 1=program binary name
# not running, start
if ! pidof "$1"; then
return 0
fi
# only reload, no restarting
if [ "$NO_RESTART" = "no-restart" ]; then
return 1
else
# kill then it can restart
killall "$1"
return 0
fi
}
## OPTIONS ## OPTIONS
riverctl spawn "dbus-update-activation-environment SEATD_SOCK DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=river" riverctl spawn "dbus-update-activation-environment SEATD_SOCK DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=river"
riverctl focus-follows-cursor normal riverctl focus-follows-cursor normal
@ -48,8 +31,7 @@ riverctl rule-add -app-id "org.pwmt.zathura" csd
## DEBUG ## DEBUG
# Reload river configuration # Reload river configuration
riverctl map normal $mod+Shift F12 spawn "$HOME/.config/river/init no-restart" riverctl map normal $mod+Shift F12 spawn "$HOME/.config/river/init"
riverctl map normal $mod+Shift+Control F12 spawn "$HOME/.config/river/init"
## HOTKEYS ## HOTKEYS
# close focused view # close focused view
@ -143,7 +125,7 @@ riverctl map normal $mod+Control L snap right
# Mod+F to toggle fullscreen # Mod+F to toggle fullscreen
riverctl map normal $mod F toggle-fullscreen riverctl map normal $mod F toggle-fullscreen
# if we are running filtile we also have access to monocle mode # if we are running filtile we also have access to monocle mode
if [ "$layout" = "filtile" ]; then if [ "$layout" = "filtile" ]; then
riverctl map normal $mod+Shift F spawn "riverctl send-layout-cmd $layout monocle" riverctl map normal $mod+Shift F spawn "riverctl send-layout-cmd $layout monocle"
fi fi
@ -285,17 +267,11 @@ done
setxkbmap -option "compose:menu" setxkbmap -option "compose:menu"
# start dynamic display configuration # start dynamic display configuration
should_start kanshi && riverctl spawn kanshi [ "$(pidof kanshi)" -eq 0 ] || riverctl spawn kanshi
# set a nice wallpaper # set a nice wallpaper
if exist swaybg; then if exist swww; then
killall swaybg riverctl spawn "swww init"
riverctl spawn "swaybg \
-o 'LG Electronics W2442 0x000574E1' -i pictures/wall_l.jpg \
-o 'LG Electronics W2442 0x000574FD' -i pictures/wall_r.jpg \
"
elif exist swww; then
riverctl spawn "swww-daemon"
outputs=$(swww query | cut -d':' -f1) outputs=$(swww query | cut -d':' -f1)
if [ "$(echo "$outputs" | grep -c -e '^DP')" -eq 2 ] && [ -e "$HOME/pictures/wall_r.jpg" ]; then if [ "$(echo "$outputs" | grep -c -e '^DP')" -eq 2 ] && [ -e "$HOME/pictures/wall_r.jpg" ]; then
swww img -o "$(echo "$outputs" | head -n1)" "$HOME/pictures/wall_l.jpg" swww img -o "$(echo "$outputs" | head -n1)" "$HOME/pictures/wall_l.jpg"
@ -306,36 +282,37 @@ elif exist swww; then
fi fi
# start status bar # start status bar
should_start waybar && riverctl spawn waybar killall waybar
riverctl spawn waybar
# start redshift-like sundown warming using current location or standard values # start redshift-like sundown warming using current location or standard values
if should_start wlsunset; then killall wlsunset
loc=$(curl ipinfo.io | grep -e '"loc": ' | sed -e 's/^.*"loc": "\(.*\)",$/\1/') loc=$(curl ipinfo.io | grep -e '"loc": ' | sed -e 's/^.*"loc": "\(.*\)",$/\1/')
if [ -n "$loc" ]; then if [ -n "$loc" ]; then
riverctl spawn "wlsunset -l \"$(echo "$loc" | cut -d, -f1)\" -L \"$(echo "$loc" | cut -d, -f2)\"" riverctl spawn "wlsunset -l \"$(echo "$loc" | cut -d, -f1)\" -L \"$(echo "$loc" | cut -d, -f2)\""
else else
riverctl spawn "wlsunset -S \"09:00\" -s \"21:00\" -d \"3600\"" riverctl spawn "wlsunset -S \"09:00\" -s \"21:00\" -d \"3600\""
fi
unset loc
fi fi
unset loc
# start screen idle locking/dimming/sleep tool # start screen idle locking/dimming/sleep tool
should_start swayidle && riverctl spawn "swayidle \ killall swayidle
riverctl spawn "swayidle \
timeout ${time_to_suspend} \"[ $(cat /sys/class/power_supply/AC/online) -eq 0 ] && systemctl suspend-then-hibernate\" timeout ${time_to_suspend} \"[ $(cat /sys/class/power_supply/AC/online) -eq 0 ] && systemctl suspend-then-hibernate\"
timeout ${time_to_screendim} \"wlopm --off '*'\" \ timeout ${time_to_screendim} \"wlopm --off '*'\" \
resume \"wlopm --on '*'\" \ resume \"wlopm --on '*'\" \
timeout ${time_to_lockscreen} \"pidof waylock || lockscreen\" \ timeout ${time_to_lockscreen} \"pidof waylock || lockscreen\" \
after-resume \"wlopm --on '*'\" \ after-resume \"wlopm --on '*'\" \
before-sleep \"pidof waylock || lockscreen\" &" before-sleep \"pidof waylock || lockscreen\" &"
killall clipman
should_start wl-paste && riverctl spawn "wl-paste -t text --watch clipman store" riverctl spawn "wl-paste -t text --watch clipman store"
# bash ~/.config/bin/gtktheme # setting our gtk variables # bash ~/.config/bin/gtktheme # setting our gtk variables
# killall polkit-gnome-authentication-agent-1 # killall polkit-gnome-authentication-agent-1
# /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & # /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &
# start layouting engine # start layouting engine
killall $layout killall $layout
riverctl spawn "$layout --tags all --output all main-ratio 0.65,\ riverctl spawn "$layout\
--tags all --output all main-ratio 0.65,\
--tags all --output all view-padding 6,\ --tags all --output all view-padding 6,\
--tags all --output all outer-padding 0,\ --tags all --output all outer-padding 0,\
--tags all --output all smart-padding on,\ --tags all --output all smart-padding on,\

View file

@ -2,11 +2,10 @@
"layer": "top", "layer": "top",
"modules-left": ["river/tags", "custom/events", "custom/vidl", "river/window"], "modules-left": ["river/tags", "custom/events", "custom/vidl", "river/window"],
"modules-center": ["clock", "custom/media"], "modules-center": ["clock", "custom/media"],
"modules-right": ["river/mode", "custom/wireguard", "custom/archupdates", "pulseaudio", "backlight", "network", "cpu", "memory", "temperature", "tray", "battery"], "modules-right": ["river/mode", "custom/wireguard", "custom/archupdates", "pulseaudio", "backlight", "network", "cpu", "memory", "temperature", "battery", "tray"],
"custom/archupdates": { "custom/archupdates": {
"format": "{icon}", "format": "{} {icon}",
"format-alt": "{} {icon}", "format-alt-click": "right",
"format-alt-click": "click-right",
"format-icons": { "format-icons": {
"default": "" "default": ""
}, },
@ -17,22 +16,17 @@
}, },
"backlight": { "backlight": {
"device": "intel_backlight", "device": "intel_backlight",
"format": "{icon}", "format": "{percent}% {icon}",
"format-alt": "{percent}% {icon}", "format-icons": ["滋", "", "", ""],
"format-alt-click": "click-right",
"format-icons": ["󰛩", "󱩎", "󱩏", "󱩐", "󱩑", "󱩒", "󱩓", "󱩔", "󱩕", "󱩖", "󰛨"],
"tooltip-format": "{percent}% {icon}",
"on-scroll-up": "brightnessctl set 1%+", "on-scroll-up": "brightnessctl set 1%+",
"on-scroll-down": "brightnessctl set 1%-" "on-scroll-down": "brightnessctl set 1%-"
}, },
"battery": { "battery": {
"format": "{icon}", "format": "{capacity}% {icon}",
"format-warning": "{capacity}% {icon}", "format-alt":"{capacity}% ({time}) {icon}",
"format-critical": "{capacity}% {icon}",
"format-alt":"{capacity}% {icon}",
"format-alt-click": "click-right", "format-alt-click": "click-right",
"format-icons": ["", "", "", "", ""], "format-icons": ["", "", "", "", ""],
"interval": 10, "interval": 60,
"states": { "states": {
"warning": 30, "warning": 30,
"critical": 15 "critical": 15
@ -45,15 +39,14 @@
}, },
"cpu": { "cpu": {
"interval": 10, "interval": 10,
"format": "", "format": "{usage}% ",
"format-alt": "{usage}% ",
"format-alt-click": "click-right",
"max-length": 10, "max-length": 10,
"states": { "states": {
"warning": 50, "warning": 50,
"critical": 80 "critical": 80
}, },
"on-click": "$TERMINAL start --class float htop" "on-click": "$TERMINAL start --class float top",
"on-click-right": "$TERMINAL start --class float glances"
}, },
"custom/events": { "custom/events": {
"exec-if": "command -v khal >/dev/null 2>&1", "exec-if": "command -v khal >/dev/null 2>&1",
@ -61,7 +54,7 @@
"return-type": "json", "return-type": "json",
"interval": 300, "interval": 300,
"on-click": "$TERMINAL start --class float ikhal", "on-click": "$TERMINAL start --class float ikhal",
"format": "{icon}{0}", // issue tracked here https://github.com/Alexays/Waybar/issues/3623 "format": "{icon}{}",
"format-icons": { "format-icons": {
"event": " ", "event": " ",
"no-event": "", "no-event": "",
@ -69,12 +62,9 @@
}, },
"memory": { "memory": {
"interval": 30, "interval": 30,
"format": "{icon}", "format": "{avail:0.1f}G ",
"format-alt": "{used:0.1f}G/{total:0.1f}G ", "format-alt": "{used:0.1f}G/{total:0.1f}G ",
"format-alt-click": "click-right", "format-alt-click": "click-right",
"tooltip": true,
"tooltip-format": "{used:0.1f}G/{total:0.1f}G \nUsed: {percentage} %\nSwap: {swapPercentage} %",
"format-icons": ["󰪞", "󰪟", "󰪠", "󰪡", "󰪢", "󰪣", "󰪤", "󰪥"],
"max-length": 10 "max-length": 10
}, },
"mpd": { "mpd": {
@ -103,7 +93,7 @@
}, },
"custom/media": { "custom/media": {
"format": "{icon}{}", "format": "{icon}{}",
"format-alt-click": "click-right", "format-alt-click": "right",
"return-type": "json", "return-type": "json",
"format-icons": { "format-icons": {
"Playing": " ", "Playing": " ",
@ -118,11 +108,11 @@
}, },
"network": { "network": {
"format": "{ifname}", "format": "{ifname}",
"format-wifi": "", "format-wifi": "{signalStrength}% ",
"format-ethernet": "󰈀 ", "format-ethernet": "{ipaddr}/{cidr} 󰈀",
"format-disconnected": "󰖪 ", "format-disconnected": "󰖪",
"tooltip-format": "{ifname} via {gwaddr} 󰈁", "tooltip-format": "{ifname} via {gwaddr} 󰈁",
"tooltip-format-wifi": "{essid}: {bandwidthDownBits}-{bandwidthUpBits} ({signalStrength}%)  {ifname}", "tooltip-format-wifi": "{essid}: {bandwidthDownBits}-{bandwidthUpBits} ({signalStrength}%)  {ifname}",
"tooltip-format-ethernet": "{ifname} 󰈀", "tooltip-format-ethernet": "{ifname} 󰈀",
"tooltip-format-disconnected": "Disconnected", "tooltip-format-disconnected": "Disconnected",
"max-length": 50, "max-length": 50,
@ -130,11 +120,9 @@
// "on-click-right": "sudo rfkill toggle wlan" // "on-click-right": "sudo rfkill toggle wlan"
}, },
"pulseaudio": { "pulseaudio": {
"format": "{icon}", "format": "{volume}% {icon}",
"format-alt": "{volume}% {icon}",
"format-bluetooth": "{volume}% {icon} ", "format-bluetooth": "{volume}% {icon} ",
"format-alt-click": "click-right", "format-muted": "",
"format-muted": "󰖁",
"format-icons": { "format-icons": {
"headphone": "", "headphone": "",
"hands-free": "", "hands-free": "",
@ -142,24 +130,22 @@
"phone": "", "phone": "",
"portable": "", "portable": "",
"car": "", "car": "",
"default": ["", "", ""] "default": ["", ""]
}, },
"scroll-step": 2, "scroll-step": 1,
"on-click": "$TERMINAL start --class float pulsemixer", "on-click": "$TERMINAL start --class float pulsemixer",
"on-scroll-up": "pactl set-sink-volume @DEFAULT_SINK@ +1%", "on-scroll-up": "pactl set-sink-volume @DEFAULT_SINK@ +1%",
"on-scroll-down": "pactl set-sink-volume @DEFAULT_SINK@ -1%" "on-scroll-down": "pactl set-sink-volume @DEFAULT_SINK@ -1%"
}, },
"river/tags": { "river/tags": {
"num-tags": 10, "num-tags": 10,
"tag-labels": [ "", "", "", "", "", "", "", "", "", "" ], "tag-labels": [ "", "", "", "", "", "", "", "", "", "" ]
}, },
"river/mode": { "river/mode": {
"format": "{} ", "format": "{} ",
}, },
"river/window": { "river/window": {
"format": " ", "format": " {}",
"format-alt": " {}",
"format-alt-click": "click-right",
"max-length": 70 "max-length": 70
}, },
"temperature": { "temperature": {
@ -167,9 +153,7 @@
"hwmon-path": "/sys/class/hwmon/hwmon5/temp1_input", "hwmon-path": "/sys/class/hwmon/hwmon5/temp1_input",
"critical-threshold": 80, "critical-threshold": 80,
// "format-critical": "{temperatureC}° ", // "format-critical": "{temperatureC}° ",
"format": "", "format": "{temperatureC}° ",
"format-alt": "{temperatureC}° ",
"format-alt-click": "click-right",
"on-click": "$TERMINAL start --class float watch sensors" "on-click": "$TERMINAL start --class float watch sensors"
}, },
"tray": { "tray": {
@ -188,20 +172,20 @@
"pia": "󰖂", "pia": "󰖂",
"netbird": "󱗆" "netbird": "󱗆"
}, },
"format-alt": "{} {icon}",
"format-alt-click": "click-right",
"exec": "~/.config/waybar/modules/wireguard json", "exec": "~/.config/waybar/modules/wireguard json",
"exec-if": "command -v nmcli >/dev/null 2>&1", "exec-if": "command -v nmcli >/dev/null 2>&1",
"return-type": "json", "return-type": "json",
"signal": 6, "signal": 6,
"interval": 20, "interval": 60,
}, },
"custom/vidl": { "custom/vidl": {
"format": "", "format": "{icon}{}",
"format-alt": " {}", "format-alt-click": "right",
"format-alt-click": "click-right", "format-icons": {
"default": " "
},
"exec": "wc -l ~/.local/share/vidl/vidl_queue | cut -d' ' -f1", "exec": "wc -l ~/.local/share/vidl/vidl_queue | cut -d' ' -f1",
"exec-if": "[ $(vidl -p) = 'running' ] && [ $(vidl -P) -gt 0 ]", "exec-if": "[ -f ~/.local/share/vidl/vidl_queue ]",
"interval": 5, "interval": 5,
"on-click": "$TERMINAL start --class float nvim ~/.local/share/vidl/vidl_queue" "on-click": "$TERMINAL start --class float nvim ~/.local/share/vidl/vidl_queue"
}, },

View file

@ -45,13 +45,6 @@ window#waybar.hidden {
color: @base0C; color: @base0C;
} }
/* give coherent background */
.modules-right {
padding: 0;
margin: 0;
background-color: @base01;
}
#clock, #clock,
#battery, #battery,
#cpu, #cpu,
@ -71,7 +64,7 @@ window#waybar.hidden {
#custom-events, #custom-events,
#custom-vidl, #custom-vidl,
#custom-media { #custom-media {
padding: 0 5px; padding: 0 10px;
margin: 0 5px; margin: 0 5px;
color: @base05; color: @base05;
background-color: @base01; background-color: @base01;
@ -91,10 +84,6 @@ window#waybar.hidden {
background-color: @base02; background-color: @base02;
} }
#mode.interact_float {
background-color: @base0D;
}
/* Mark active output through highlighted window background */ /* Mark active output through highlighted window background */
#window { #window {
background-color: transparent; background-color: transparent;

View file

@ -11,7 +11,7 @@
[interactive] [interactive]
diffFilter = git delta --color-only diffFilter = git delta --color-only
[merge] [merge]
conflictStyle = zdiff3 conflictstyle = diff3
[delta] [delta]
navigate = true navigate = true
line-numbers = true line-numbers = true
@ -20,34 +20,27 @@
smtpserver = "/usr/bin/msmtp" smtpserver = "/usr/bin/msmtp"
annotate = yes annotate = yes
[alias] [alias]
ignore = "!gitignore -f" # requires gitignore script to be in PATH ignore = "!gitignore -f"
last = "diff HEAD~ HEAD" last = "diff HEAD~ HEAD"
pushall = "!git remote | xargs -I R git push R" # push to all connected remotes pushall = "!git remote | xargs -I R git push R" # push to all connected remotes
fetchall = "!git remote | xargs -I R git fetch R" # fetch from all connected remotes fetchall = "!git remote | xargs -I R git fetch R" # fetch from all connected remotes
diffword = "!git diff --word-diff=color --word-diff-regex='[0-9A-Za-z_]+'" # word-wise diff, good for prose diffword = "!git diff --word-diff=color --word-diff-regex='[0-9A-Za-z_]+'" # word-wise diff, good for prose
diffsyn = "!git difftool --tool difftastic" # add syntax-driven diff using treesitter diffsyn = "!git difftool --tool difftastic" # add syntax-driven diff using treesitter
diffside = "!DELTA_FEATURES='+side-by-side' git diff" # add side-by-side diffing diffside = "!DELTA_FEATURES='+side-by-side' git diff" # add side-by-side diffing
delta = "![ $TERM_DARK = false ] && delta --light || delta" # Take care that we always display right color scheme delta = "![ $TERM_DARK = false ] && delta --light || delta" # Take care that we always display right color scheme
# check out a github PR directly on the commandline, creates pr/4 or pr/<number> branch locally
pr = "!f() { git fetch -fu ${2:-$(git remote |grep ^github || echo origin)} refs/pull/$1/head:pr/$1 }; f"
# remove all pr/<number> local branches
pr-clean = "!git for-each-ref refs/heads/pr/* --format = '%(refname)' | while read ref ; do branch = ${ref#refs/heads/} ; git branch -D $branch ; done"
[commit] [commit]
gpgsign = true # sign commits as me gpgsign = true # sign commits as me
verbose = true # Always show diff when preparing commit message verbose = true # Always show diff when preparing commit message
[tag]
gpgsign = true
[fetch] [fetch]
prune = true # remove references to non-existent remote branches prune = true # remove references to non-existent remote branches
[pull] [pull]
rebase = true # always rebase on pulling, obviates merge commits rebase = true # always rebase on pulling, obviates merge commits
[diff] [diff]
colorMoved = zebra # also color stuff that has simply been moved, in a classy zebra-color colorMoved = zebra # also color stuff that has simply been moved, in a classy zebra-color
[difftool] [difftool]
prompt = false prompt = false
[difftool "difftastic"] [difftool "difftastic"]
cmd = difft "$LOCAL" "$REMOTE" cmd = difft "$LOCAL" "$REMOTE"
[color "diff"] [color "diff"]
meta = "9" meta = "9"
frag = "magenta bold" frag = "magenta bold"

View file

@ -1,17 +1,15 @@
# Version control software module # Git module
[git](https://git-scm.com/) - a distributed version control system [git](https://git-scm.com/) - a distributed version control system
[jujutsu](https://martinvonz.github.io/jj/latest/) - a change-based version control system
## What's in this module ## What's in this module
[[_TOC_]] [[_TOC_]]
## Global vcs settings ## Global git settings
This are probably the first things that need to be customized, since it points to a different identity for each git user. This is probably the first thing that needs to be customized, since it points to a different identity for each git user.
I sign all my commits by default, so take out the corresponding lines if you don't, or exchange it with your gpg key. I sign all my commits by default, so take out the corresponding lines if you don't, or exchange it with your gpg key.
Similarly for jujutsu, change the identity and remove the lines concerning gpg signing if you don't use it.
Git will rewrite any remotes using http(s) to use the ssh notation for pushes to github and gitlab so that, even if you set up the repository using an https url you can utilize your usual ssh key for pushing. Git will rewrite any remotes using http(s) to use the ssh notation for pushes to github and gitlab so that, even if you set up the repository using an https url you can utilize your usual ssh key for pushing.

View file

@ -39,11 +39,13 @@ osd-font='Iosevka Nerd Font'
osd-font-size=15 osd-font-size=15
### Subtitles ### Subtitles
## options and compatibility ## options and compatibility
sub-ass-use-video-data=all # vsfilter backward compatibility
sub-ass-vsfilter-blur-compat=yes
sub-ass-scale-with-window=no sub-ass-scale-with-window=no
# custom ass style params # custom ass style params
sub-ass-style-overrides=Kerning=yes sub-ass-force-style=Kerning=yes
# fuzzy-search available subs in folder # fuzzy-search available subs in folder
sub-auto=fuzzy sub-auto=fuzzy
# search for external subs in these relative subdirectories # search for external subs in these relative subdirectories
@ -83,6 +85,7 @@ audio-pitch-correction=yes
### Video ### Video
hwdec=auto hwdec=auto
profile=opengl-hq
opengl-early-flush=auto opengl-early-flush=auto
opengl-pbo=no opengl-pbo=no
# ever so slightly up saturation # ever so slightly up saturation

View file

@ -11,37 +11,35 @@ if require("core.util").is_available("zk") and require("zk.util").notebook_root(
map("n", "<CR>", "<cmd>lua vim.lsp.buf.definition()<cr>", { silent = true }) map("n", "<CR>", "<cmd>lua vim.lsp.buf.definition()<cr>", { silent = true })
end end
-- edit code cells with full lsp access
map("n", "<localleader>ce", "<cmd>FeMaco<cr>", { silent = true, desc = "edit code block" })
-- execute code cells -- execute code cells
if vim.fn.mapcheck("<localleader>cc") == "" then map("n", "<localleader>cc", "<cmd>MdEval<cr>", { silent = true, desc = "evaluate code block" })
map("n", "<localleader>cc", require("mdeval").eval_code_block, { silent = true, desc = "evaluate code block" }) map("n", "<localleader>cx", "<cmd>MdEvalClean<cr>", { silent = true, desc = "clear code results" })
end
if vim.fn.mapcheck("<localleader>cx") == "" then
map("n", "<localleader>cx", require("mdeval").eval_clean_results, { silent = true, desc = "clear code results" })
end
-- jump to beginning of previous/ next cell code -- jump to beginning of previous/ next cell code
map("n", "]c", "/^```<cr>}:nohl<cr>", { desc = "next code cell" }) map("n", "]c", "/^```<cr>}:nohl<cr>", { desc = "next code cell" })
map("n", "[c", "?^```<cr>n}:nohl<cr>", { desc = "previous code cell" }) map("n", "[c", "?^```<cr>n}:nohl<cr>", { desc = "previous code cell" })
-- insert cell header above/below -- insert cell header above/below
map("n", "<localleader>co", "o```python<cr><cr>```<esc>k", { desc = "Insert code cell below" }) map("n", "<localleader>co", "o```python<cr><cr>```<esc>k", { desc = "Insert quarto cell below" })
map("n", "<localleader>cO", "O```python<cr><cr>```<esc>k", { desc = "Insert code cell above" }) map("n", "<localleader>cO", "O```python<cr><cr>```<esc>k", { desc = "Insert quarto cell above" })
if require("core.util").is_available("which-key") then if require("core.util").is_available("which-key") then
require("which-key").add({ "<localleader>p", group = "prose" }) require("which-key").add({ "<localleader>p", group = "prose" })
end end
-- show nice md preview in browser (auto-syncs scrolling) -- show nice md preview in browser (auto-syncs scrolling)
local peek_key = "<localleader>po"
if require("core.util").is_available("peek") then if require("core.util").is_available("peek") then
map("n", peek_key, function() local peek = require("peek")
local peek = require("peek") local function togglePeek()
if peek.is_open() then if peek.is_open() then
peek.close() peek.close()
else else
peek.open() peek.open()
end end
end, { desc = "show md preview" }) end
elseif vim.fn.exists(":MarkdownPreviewToggle") > 0 then map("n", "<leader>po", togglePeek, { desc = "show md preview" })
map("n", peek_key, "<Plug>MarkdownPreviewToggle", { desc = "show md preview" }) else
map("n", "<leader>po", "<Plug>MarkdownPreviewToggle", { desc = "show md preview" })
end end
-- create mindmaps directly from markdown! requires external executable -- create mindmaps directly from markdown! requires external executable

View file

@ -1,24 +1,17 @@
if require("core.util").is_available("quarto") then local default_buffer_session = function()
vim.keymap.set("n", "<localleader>po", require("quarto").quartoPreview, { desc = "show quarto preview" }) local buffer_path = vim.api.nvim_buf_get_name(0) or vim.fn.tempname()
end local temp_path = vim.fn.stdpath("run") .. "/molten-sessions" .. buffer_path .. ".json"
-- TODO: Puths kernel into local file dir currently, local dir = vim.fn.fnamemodify(temp_path, ":p:h")
-- could take an argument to put it into temporary dir instead. if vim.fn.getftype(dir) ~= "dir" then
local kernel_filename = function() vim.fn.mkdir(dir, "p")
local buf = vim.api.nvim_buf_get_name(0)
if not buf or buf:match("^$") then
vim.fn.tempname()
end end
local path, name = buf:match("(.-)([^\\/]-%.?([^%.\\/]*))$") return temp_path
return path .. "." .. name .. ".kernel.json"
end end
-- Start quarto session -- Start quarto session
local startsession = function(opts) local startsession = function(file, args)
local args = opts.fargs file = file or default_buffer_session()
local kernel_filen = args[1] or kernel_filename()
vim.b["sessionfile"] = kernel_filen
local path = require("core.util").get_python_venv_bin() local path = require("core.util").get_python_venv_bin()
if not path then if not path then
@ -26,53 +19,39 @@ local startsession = function(opts)
end end
vim.g["python3_host_prog"] = path vim.g["python3_host_prog"] = path
-- simply attach to existing if exists if vim.fn.executable("jupyter-console") ~= 1 then
if vim.fn.filereadable(kernel_filen) == 1 then
vim.cmd("MoltenInit " .. kernel_filen)
return return
end end
-- look for session maker if args then
local exec_name = "jupyter-kernel" file = args[0]
local exec_path = (require("core.util").get_python_venv_basefolder() or "") .. "/bin/" .. exec_name
if vim.fn.filereadable(exec_path) ~= 1 then
exec_path = exec_name
if vim.fn.executable(exec_path) ~= 1 then
return
end
end end
-- make our own session
local once = false local once = false
vim.fn.jobstart({ exec_path, "--KernelManager.connection_file", kernel_filen }, { vim.fn.jobstart({ "jupyter", "console", "-f", file }, {
on_stderr = function(_, data) on_stdout = function(_)
if not once then if not once then
for _, v in pairs(data) do vim.cmd("MoltenInit " .. file)
if v:find("connect a client") then
vim.cmd("MoltenInit " .. kernel_filen)
once = true
end
end
end end
once = true
end, end,
on_exit = function(_) on_exit = function(_)
vim.notify(string.format("jupyter kernel stopped: %s", kernel_filen), vim.log.levels.INFO) vim.notify(string.format("jupyter kernel stopped: %s", file), vim.log.levels.INFO)
end, end,
stdin = nil, stdin = nil,
}) })
end end
vim.api.nvim_create_user_command("JupyterStart", function()
vim.api.nvim_create_user_command("JupyterStart", function(opts) startsession(vim.b["sessionfile"] or default_buffer_session())
startsession(opts) end, {})
end, { nargs = "?" })
vim.keymap.set("n", "<localleader>cS", ":JupyterStart<cr>", { desc = "start code session", silent = true })
if vim.g.quarto_auto_init_molten_session then if vim.g.quarto_auto_init_molten_session then
vim.api.nvim_create_autocmd({ "BufEnter" }, { vim.api.nvim_create_autocmd({ "InsertEnter", "BufEnter" }, {
callback = function() callback = function()
if vim.b["sessionfile"] == nil then if vim.b["sessionfile"] == nil then
vim.schedule(function() local path = default_buffer_session()
startsession() vim.b["sessionfile"] = path
vim.schedule_wrap(function()
startsession(path)
end) end)
end end
end, end,

View file

@ -1,3 +0,0 @@
if vim.fn.exists(":TypstPreviewToggle") > 0 then
vim.keymap.set("n", "<localleader>po", "<cmd>TypstPreviewToggle<cr>", { desc = "show typst preview" })
end

View file

@ -1,7 +0,0 @@
-- Set filetypes for 'djot' - an update markdown alternative
-- https://github.com/jgm/djot
vim.filetype.add({
extension = {
dj = "djot",
},
})

View file

@ -1,87 +1,98 @@
{ {
"Arduino.nvim": { "branch": "main", "commit": "5988e7b08d8d6dc0a2d37e805cbed57dc13d869a" }, "Arduino.nvim": { "branch": "main", "commit": "5988e7b08d8d6dc0a2d37e805cbed57dc13d869a" },
"FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" },
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
"Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" }, "Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" },
"aerial.nvim": { "branch": "master", "commit": "d5ba0e3cfede432cec7e6ab28724c4a554ea0f09" },
"bats.vim": { "branch": "master", "commit": "6a5d2ef22b0ede503d867770afd02ebb1f97b709" }, "bats.vim": { "branch": "master", "commit": "6a5d2ef22b0ede503d867770afd02ebb1f97b709" },
"blink.cmp": { "branch": "main", "commit": "b6f11a0aa33e601c469a126e3ed6e35208fe3ea3" }, "cmp-beancount": { "branch": "main", "commit": "29e23297c06b9d69771e4b14e0fb3b9d583a150e" },
"blink.compat": { "branch": "main", "commit": "b0c87b64f9c669d3bcfaea8a80396fbc16e0fcb5" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-calc": { "branch": "main", "commit": "5947b412da67306c5b68698a02a846760059be2e" }, "cmp-calc": { "branch": "main", "commit": "5947b412da67306c5b68698a02a846760059be2e" },
"cmp-pandoc.nvim": { "branch": "main", "commit": "30faa4456a7643c4cb02d8fa18438fd484ed7602" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-latex-symbols": { "branch": "main", "commit": "165fb66afdbd016eaa1570e41672c4c557b57124" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
"cmp-pandoc-references": { "branch": "master", "commit": "2c808dff631a783ddd2c554c4c6033907589baf6" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp-rg": { "branch": "master", "commit": "677a7874ee8f1afc648c2e7d63a97bc21a7663c5" },
"cmp-spell": { "branch": "master", "commit": "694a4e50809d6d645c1ea29015dad0c293f019d6" }, "cmp-spell": { "branch": "master", "commit": "694a4e50809d6d645c1ea29015dad0c293f019d6" },
"codecompanion.nvim": { "branch": "main", "commit": "29c8c9142169c447ad1374bbb6885c611506fda3" }, "cmp-treesitter": { "branch": "master", "commit": "958fcfa0d8ce46d215e19cc3992c542f576c4123" },
"conform.nvim": { "branch": "master", "commit": "80b57f662b5e13ae8c2c7c38639966084625fa5e" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" }, "completion-vcard": { "branch": "master", "commit": "2220fd517a985ececed1adcf0e5be8f2815564c7" },
"dial.nvim": { "branch": "master", "commit": "34bbd9c387c358190e61ce71017faad3dffa7a74" }, "conform.nvim": { "branch": "master", "commit": "acc7337cfd24ddfa3109bfc8c258c09c88c5c450" },
"dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" }, "dial.nvim": { "branch": "master", "commit": "ed4d6a5bbd5e479b4c4a3019d148561a2e6c1490" },
"fidget.nvim": { "branch": "main", "commit": "b61e8af9b8b68ee0ec7da5fb7a8c203aae854f2e" }, "dressing.nvim": { "branch": "master", "commit": "71349f24c6e07b39f33600985843c289ca735308" },
"fidget.nvim": { "branch": "main", "commit": "ef99df04a1c53a453602421bc0f756997edc8289" },
"flash.nvim": { "branch": "main", "commit": "ec0bf2842189f65f60fd40bf3557cac1029cc932" }, "flash.nvim": { "branch": "main", "commit": "ec0bf2842189f65f60fd40bf3557cac1029cc932" },
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, "friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" },
"fwatch.nvim": { "branch": "main", "commit": "a691f7349dc66285cd75a1a698dd28bca45f2bf8" }, "fwatch.nvim": { "branch": "main", "commit": "a691f7349dc66285cd75a1a698dd28bca45f2bf8" },
"fzf-lua": { "branch": "main", "commit": "1176d512b1390f992c775f08dcb155d4e0ba01cf" }, "git-conflict.nvim": { "branch": "main", "commit": "bfd9fe6fba9a161fc199771d85996236a0d0faad" },
"git-conflict.nvim": { "branch": "main", "commit": "4bbfdd92d547d2862a75b4e80afaf30e73f7bbb4" }, "gitsigns.nvim": { "branch": "main", "commit": "0b04035bb7b3c83e999b9676e2fb46fd0aa9f910" },
"gitsigns.nvim": { "branch": "main", "commit": "c23bbd3ed2c7a3fdc3399e97e24f9e158f57612f" }, "glance.nvim": { "branch": "master", "commit": "51059bcf21016387b6233c89eed220cf47fca752" },
"glance.nvim": { "branch": "master", "commit": "1a08824835d7582457b67acbe23ca33487912a5e" }, "grug-far.nvim": { "branch": "main", "commit": "536b23dcf3165a622654544e5f9f395584e73b57" },
"grug-far.nvim": { "branch": "main", "commit": "3a8690461afac34c0e5bacb0f7b4bc3066aab665" }, "image.nvim": { "branch": "master", "commit": "da64ce69598875c9af028afe129f916b02ccc42e" },
"helpview.nvim": { "branch": "main", "commit": "aca211993d7dd82bc03e7650bae859a570ba27d6" }, "img-clip.nvim": { "branch": "main", "commit": "fc30500c35663aa1762697f5aba31d43b86028f0" },
"hunk.nvim": { "branch": "master", "commit": "eb89245a66bdfce10436d15923bf4deb43d23c96" },
"image.nvim": { "branch": "master", "commit": "6ffafab2e98b5bda46bf227055aa84b90add8cdc" },
"img-clip.nvim": { "branch": "main", "commit": "28a32d811d69042f4fa5c3d5fa35571df2bc1623" },
"jupytext.nvim": { "branch": "main", "commit": "c8baf3ad344c59b3abd461ecc17fc16ec44d0f7b" }, "jupytext.nvim": { "branch": "main", "commit": "c8baf3ad344c59b3abd461ecc17fc16ec44d0f7b" },
"lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" }, "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
"lazydev.nvim": { "branch": "main", "commit": "f59bd14a852ca43db38e3662395354cb2a9b13e0" }, "lazydev.nvim": { "branch": "main", "commit": "491452cf1ca6f029e90ad0d0368848fac717c6d2" },
"ltex_extra.nvim": { "branch": "dev", "commit": "09dc879b1873001f855bca5ad1f024ca15b9bbaf" }, "lsp-setup.nvim": { "branch": "main", "commit": "6e4e977512ce426d8b52c27f3b6e6aefc73e1452" },
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, "ltex_extra.nvim": { "branch": "dev", "commit": "57192d7ae5ba8cef3c10e90f2cd62d4a7cdaab69" },
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
"luarocks.nvim": { "branch": "main", "commit": "1db9093915eb16ba2473cfb8d343ace5ee04130a" }, "luarocks.nvim": { "branch": "main", "commit": "1db9093915eb16ba2473cfb8d343ace5ee04130a" },
"luvit-meta": { "branch": "main", "commit": "1df30b60b1b4aecfebc785aa98943db6c6989716" }, "luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" },
"markmap.nvim": { "branch": "main", "commit": "5fb6755cf5434511cc23a4936c9eb76b9142fba5" }, "markmap.nvim": { "branch": "main", "commit": "5fb6755cf5434511cc23a4936c9eb76b9142fba5" },
"mason-conform.nvim": { "branch": "main", "commit": "abce2be529f3b4b336c56d0ba6336a9144e0fee6" }, "mason-conform.nvim": { "branch": "main", "commit": "abce2be529f3b4b336c56d0ba6336a9144e0fee6" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "62360f061d45177dda8afc1b0fd1327328540301" },
"mason-nvim-lint": { "branch": "main", "commit": "b579a00ee39dcd590b1023028dc8fb3d203a67b0" }, "mason-nvim-lint": { "branch": "main", "commit": "b579a00ee39dcd590b1023028dc8fb3d203a67b0" },
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" }, "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
"mdeval.nvim": { "branch": "master", "commit": "0e1b248db174a9659a9ab16eb8c90ff3aec55264" }, "mdeval.nvim": { "branch": "master", "commit": "2c32e2f3e7d8f222e7a4724989f218d036e1081d" },
"mini.nvim": { "branch": "main", "commit": "0420076298c4457f200c2de468f65d080597a347" }, "mini.nvim": { "branch": "main", "commit": "19e1584124cda35388d4fdb911eab7124014e541" },
"molten-nvim": { "branch": "main", "commit": "a286aa914d9a154bc359131aab788b5a077a5a99" }, "molten-nvim": { "branch": "main", "commit": "eb6d0fe33e14989b0f1fbe25d9732889ee57bd1a" },
"neo-tree.nvim": { "branch": "main", "commit": "5d172e8315444dbc32867d1c7b04d8e7e68ec4e1" }, "neogen": { "branch": "main", "commit": "dc50715c009f89b8111197fd2f282f6042daa7ea" },
"neogen": { "branch": "main", "commit": "b2e78708876f4da507839726816010a68e33fec8" }, "neotest": { "branch": "master", "commit": "32ff2ac21135a372a42b38ae131e531e64833bd3" },
"neotest": { "branch": "master", "commit": "d66cf4e05a116957f0d3a7755a24291c7d1e1f72" }, "neotest-python": { "branch": "master", "commit": "e5bff6dcf3cb33e6dfb97722e142961099c6021e" },
"neotest-python": { "branch": "master", "commit": "a2861ab3c9a0bf75a56b11835c2bfc8270f5be7e" },
"nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" },
"nvim-FeMaco.lua": { "branch": "main", "commit": "96bbf843595dbe865838b3f2484b73557f34700c" }, "nvim-FeMaco.lua": { "branch": "main", "commit": "96bbf843595dbe865838b3f2484b73557f34700c" },
"nvim-colorizer.lua": { "branch": "master", "commit": "9b5fe0450bfb2521c6cea29391e5ec571f129136" }, "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
"nvim-coverage": { "branch": "main", "commit": "a939e425e363319d952a6c35fb3f38b34041ded2" }, "nvim-colorizer.lua": { "branch": "master", "commit": "194ec600488f7c7229668d0e80bd197f3a2b84ff" },
"nvim-lint": { "branch": "master", "commit": "6e9dd545a1af204c4022a8fcd99727ea41ffdcc8" }, "nvim-coverage": { "branch": "main", "commit": "aa4b4400588e2259e87e372b1e4e90ae13cf5a39" },
"nvim-lspconfig": { "branch": "master", "commit": "bf81bef7d75a0f4a0cf61462b318ea00b3c97cc8" }, "nvim-lint": { "branch": "master", "commit": "ad0fe35e80f5cd31a0f19176d7b30e5c3011119d" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-lspconfig": { "branch": "master", "commit": "ad32182cc4a03c8826a64e9ced68046c575fdb7d" },
"nvim-surround": { "branch": "main", "commit": "ae298105122c87bbe0a36b1ad20b06d417c0433e" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-toggleterm.lua": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, "nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" },
"nvim-treesitter": { "branch": "master", "commit": "cfc6f2c117aaaa82f19bcce44deec2c194d900ab" }, "nvim-toggleterm.lua": { "branch": "main", "commit": "48be57eaba817f038d61bbf64d2c597f578c0827" },
"nvim-treesitter-context": { "branch": "master", "commit": "9a49f43a2ec9bf77aecfb0fcbc43af43338375c0" }, "nvim-tree.lua": { "branch": "master", "commit": "ad0b95dee55955817af635fa121f6e2486b10583" },
"nvim-treesitter": { "branch": "master", "commit": "f197a15b0d1e8d555263af20add51450e5aaa1f0" },
"nvim-treesitter-context": { "branch": "master", "commit": "0f3332788e0bd37716fbd25f39120dcfd557c90f" },
"nvim-treesitter-endwise": { "branch": "master", "commit": "8b34305ffc28bd75a22f5a0a9928ee726a85c9a6" }, "nvim-treesitter-endwise": { "branch": "master", "commit": "8b34305ffc28bd75a22f5a0a9928ee726a85c9a6" },
"nvim-treesitter-textsubjects": { "branch": "master", "commit": "199f3d1a58f8b98e3da0b9d2be6343ce4d27fc1b" }, "nvim-treesitter-textsubjects": { "branch": "master", "commit": "a8d2844bba925d9450ef7ab215f3b054028288ca" },
"nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" }, "nvim-ts-autotag": { "branch": "main", "commit": "dc5e1687ab76ee02e0f11c5ce137f530b36e98b3" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "6b5f95aa4d24f2c629a74f2c935c702b08dbde62" },
"nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" }, "nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" },
"otter.nvim": { "branch": "main", "commit": "0e42fa795c35c7190935e3beda3791189c41bb72" }, "otter.nvim": { "branch": "main", "commit": "3b4fa74f0a385207fa9c29b61b07178345a3dab2" },
"peek.nvim": { "branch": "master", "commit": "5820d937d5414baea5f586dc2a3d912a74636e5b" }, "peek.nvim": { "branch": "master", "commit": "5820d937d5414baea5f586dc2a3d912a74636e5b" },
"plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
"quarto-nvim": { "branch": "main", "commit": "abc417c7e7422033f1090c0da5f30ef3ecb0c7ca" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "dc788723f717bdd3041838b8db34cce53c9aa920" }, "quarto-nvim": { "branch": "main", "commit": "09fabb62d414e56ee3245c558aaedbdc662b6493" },
"render-markdown": { "branch": "main", "commit": "f2bdf9f866671456f7a6119cc94501048d9d172c" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "a2072fef01645c5b06045f126437ff8e2057ef3c" },
"render-markdown": { "branch": "main", "commit": "ced4a66f9bc38580f4797a789d2d5575fcd809fd" },
"smartcolumn.nvim": { "branch": "main", "commit": "d01b99355c7fab13233f48d0f28dc097e68a03f7" }, "smartcolumn.nvim": { "branch": "main", "commit": "d01b99355c7fab13233f48d0f28dc097e68a03f7" },
"stickybuf.nvim": { "branch": "master", "commit": "2160fcd536d81f5fa43f7167dba6634e814e3154" }, "stickybuf.nvim": { "branch": "master", "commit": "2160fcd536d81f5fa43f7167dba6634e814e3154" },
"texpresso.vim": { "branch": "main", "commit": "907838c08bbf99ad6bed3c908f1d0551a92ab4e0" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, "telescope-luasnip.nvim": { "branch": "master", "commit": "11668478677de360dea45cf2b090d34f21b8ae07" },
"trouble.nvim": { "branch": "main", "commit": "bac1d9a9f51eecf4424b6ca8675db5a170fe572b" }, "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"texpresso.vim": { "branch": "main", "commit": "1cc949fde8ed3220968039b6b1b6ccdd9f475087" },
"todo-comments.nvim": { "branch": "main", "commit": "313b04e5b02d29ab9275c9295ff5e2b73921b0eb" },
"trouble.nvim": { "branch": "main", "commit": "40c5317a6e90fe3393f07b0fee580d9e93a216b4" },
"twilight.nvim": { "branch": "main", "commit": "8bb7fa7b918baab1ca81b977102ddb54afa63512" }, "twilight.nvim": { "branch": "main", "commit": "8bb7fa7b918baab1ca81b977102ddb54afa63512" },
"typst-preview.nvim": { "branch": "master", "commit": "00ff6829030f302e8ff24d0e3a68625dd1a3ac40" },
"undotree": { "branch": "main", "commit": "eab459ab87dd249617b5f7187bb69e614a083047" }, "undotree": { "branch": "main", "commit": "eab459ab87dd249617b5f7187bb69e614a083047" },
"vifm.vim": { "branch": "master", "commit": "a8130c37d144b51d84bee19f0532abcd3583383f" }, "vifm.vim": { "branch": "master", "commit": "a8130c37d144b51d84bee19f0532abcd3583383f" },
"vim-criticmarkup": { "branch": "master", "commit": "d15dc134eb177a170c79f6377f81eb02a9d20b02" }, "vim-criticmarkup": { "branch": "master", "commit": "d15dc134eb177a170c79f6377f81eb02a9d20b02" },
"vim-numbertoggle": { "branch": "main", "commit": "df9b1fe616507340718716204ba7f434125bdf7a" }, "vim-numbertoggle": { "branch": "main", "commit": "df9b1fe616507340718716204ba7f434125bdf7a" },
"vim-scimark": { "branch": "master", "commit": "9b66a88fa4bb87b8baab3c4aecc43b985b32e7fd" },
"vim-spellsync": { "branch": "master", "commit": "3d6dd50de9c4d953cc16638112a6ae196df41463" }, "vim-spellsync": { "branch": "master", "commit": "3d6dd50de9c4d953cc16638112a6ae196df41463" },
"wezterm.nvim": { "branch": "main", "commit": "f73bba23ab4becd146fa2d0a3a16a84b987eeaca" }, "wezterm.nvim": { "branch": "main", "commit": "f73bba23ab4becd146fa2d0a3a16a84b987eeaca" },
"which-key.nvim": { "branch": "main", "commit": "b74a3c85f03225bc91f4f5a9056518d3fa9a3470" }, "which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" },
"wrapping.nvim": { "branch": "master", "commit": "3a823200c297885b70515fa8d974e1763c578e26" }, "wrapping.nvim": { "branch": "master", "commit": "3a823200c297885b70515fa8d974e1763c578e26" },
"zen-mode.nvim": { "branch": "main", "commit": "04b52674b8c800f8b7d4609e8bd8d0212e3ffa79" }, "zen-mode.nvim": { "branch": "main", "commit": "04b52674b8c800f8b7d4609e8bd8d0212e3ffa79" },
"zk-nvim": { "branch": "main", "commit": "50d92038d22ad9a537dcfd463c38527591430df6" } "zk-nvim": { "branch": "main", "commit": "66b9b490e930fb77f93a2a0c64e0da9a5144fd0a" }
} }

View file

@ -5,7 +5,7 @@ vim.api.nvim_create_autocmd({ "TextYankPost" }, {
group = vim.api.nvim_create_augroup("highlightyanks", { clear = true }), group = vim.api.nvim_create_augroup("highlightyanks", { clear = true }),
}) })
-- Special setting for editing gopass files - make sure nothing leaks outside the directories it -- Special setting for editing gopass files - make sure nothing leaks outside the directories it
-- is supposed to -- is supposed to
vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, { vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, {
pattern = { pattern = {
@ -42,3 +42,4 @@ vim.api.nvim_create_user_command("SpellToggle", function(opt)
vim.notify("Spellcheck disabled") vim.notify("Spellcheck disabled")
end end
end, { nargs = "*", bang = true }) end, { nargs = "*", bang = true })

View file

@ -40,17 +40,7 @@ require("lazy").setup({
spec = { spec }, spec = { spec },
defaults = { lazy = true, version = "*" }, defaults = { lazy = true, version = "*" },
performance = { performance = {
rtp = { rtp = { disabled_plugins = { "netrw", "netrwPlugin" } },
disabled_plugins = {
"netrw",
"netrwPlugin",
"gzip",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
cache = { enable = true }, cache = { enable = true },
}, },
}) })

View file

@ -113,14 +113,14 @@ map("t", "\\\\", [[<C-\><C-n>]], { desc = "exit terminal mode" })
map("n", "<leader>/", ":noh<cr>", { desc = "remove highlights" }) map("n", "<leader>/", ":noh<cr>", { desc = "remove highlights" })
-- split buffers vertically/horizontally with the leader \ or - (mirrors my -- split buffers vertically/horizontally with the leader \ or - (mirrors my
-- multiplexer setup) -- tmux setup)
map("n", "<leader>-", ":sp<cr>", { desc = "open horiz split" }) map("n", "<leader>-", ":sp<cr>", { desc = "open horiz split" })
map("n", "<leader>\\", ":vsp<cr>", { desc = "open vert split" }) map("n", "<leader>\\", ":vsp<cr>", { desc = "open vert split" })
-- open actual new tab with leader-T -- open actual new tab with leader-T
map("n", "<leader>T", ":tabedit | Vifm<cr>", { desc = "open tab" }) map("n", "<leader>T", ":tabedit | Vifm<cr>", { desc = "open tab" })
-- select the whole buffer with <leader>-a -- select the whole buffer with <leader>-a
map("n", "<leader>A", "ggVG", { desc = "select all" }) map("n", "<leader>a", "ggVG", { desc = "select all" })
-- Format current Paragraph (esp useful in prose writing) -- Format current Paragraph (esp useful in prose writing)
map("n", "<localleader>q", "gqap", { silent = true, desc = "Format current paragraph" }) map("n", "<localleader>q", "gqap", { silent = true, desc = "Format current paragraph" })

View file

@ -64,11 +64,6 @@ function T.get_python_venv_basefolder(workspace)
return venv_path_cached return venv_path_cached
end end
local match local match
match = vim.fn.finddir(".venv", "**1")
if match ~= "" then
venv_path_cached = match
return venv_path_cached
end
-- Look downwards for file, can be nested. Limit to 1 depth for speed rn -- Look downwards for file, can be nested. Limit to 1 depth for speed rn
-- TODO: Maybe not hardcode 1-depth but allow choice. -- TODO: Maybe not hardcode 1-depth but allow choice.
match = vim.fn.findfile("pyvenv.cfg", "**1") match = vim.fn.findfile("pyvenv.cfg", "**1")
@ -84,8 +79,8 @@ function T.get_python_venv_basefolder(workspace)
if obj.code ~= 0 then if obj.code ~= 0 then
return return
end end
match = obj.stdout:match("^%s*(.-)%s*$") local venv_base_folder = obj.stdout:match("^%s*(.-)%s*$")
venv_path_cached = match venv_path_cached = venv_base_folder
return venv_path_cached return venv_path_cached
end end
end end

View file

@ -171,7 +171,7 @@ return {
conflict = { suffix = "" }, -- disable to use git-conflict instead conflict = { suffix = "" }, -- disable to use git-conflict instead
diagnostic = { suffix = "d", options = {} }, diagnostic = { suffix = "d", options = {} },
file = { suffix = "", options = {} }, file = { suffix = "", options = {} },
indent = { suffix = "" }, -- disable since we use indentscope indent = { suffix = "" }, -- disable since we use indentscope above
jump = { suffix = "j", options = {} }, jump = { suffix = "j", options = {} },
location = { suffix = "l", options = {} }, location = { suffix = "l", options = {} },
oldfile = { suffix = "o", options = {} }, -- FIXME: overwritten by wrapping defaults currently oldfile = { suffix = "o", options = {} }, -- FIXME: overwritten by wrapping defaults currently
@ -201,34 +201,8 @@ return {
require("mini.indentscope").setup({ require("mini.indentscope").setup({
symbol = "", symbol = "",
draw = { animation = require("mini.indentscope").gen_animation.none() }, draw = { animation = require("mini.indentscope").gen_animation.none() },
options = { indent_at_cursor = false, n_lines = 2000 }, options = { indent_at_cursor = false },
}) })
-- disable indentlines for terminals
vim.api.nvim_create_autocmd("TermOpen", {
pattern = "*",
callback = function()
vim.b.miniindentscope_disable = true
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = {
"lazy",
"mason",
"help",
"lspinfo",
"packer",
"checkhealth",
"man",
"gitcommit",
"TelescopePrompt",
"TelescopeResults",
"trouble",
},
callback = function()
vim.b.miniindentscope_disable = true
end,
})
require("mini.map").setup() require("mini.map").setup()
require("mini.move").setup() require("mini.move").setup()
require("mini.operators").setup() require("mini.operators").setup()
@ -277,6 +251,4 @@ return {
{ "stevearc/stickybuf.nvim", config = true }, { "stevearc/stickybuf.nvim", config = true },
-- make it a little less painful to open really big (>2mb) files by disabling features -- make it a little less painful to open really big (>2mb) files by disabling features
-- { "LunarVim/bigfile.nvim", lazy = false }, -- { "LunarVim/bigfile.nvim", lazy = false },
-- set plenary to follow master branch here, but let individual plugins actually load it
{ "nvim-lua/plenary.nvim", version = false, optional = true },
} }

View file

@ -1,69 +1,270 @@
return { local completion_engine = {
-- full documentation here: https://cmp.saghen.dev/ {
"saghen/blink.cmp", "hrsh7th/nvim-cmp",
branch = "main",
version = false, -- new releases (>2022) are sadly not versioned
dependencies = {
-- TODO: Move to lsp
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lsp-signature-help",
"hrsh7th/cmp-path",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-calc",
"hrsh7th/cmp-cmdline",
-- TODO: Move me into a separate load?
"cbarrete/completion-vcard",
"f3fora/cmp-spell",
"jc-doyle/cmp-pandoc-references",
-- TODO: Decide: get rid or just enable in very specific circumstances
"lukas-reineke/cmp-rg",
-- TODO: Move to treesitter
{ "ray-x/cmp-treesitter", dependencies = { "nvim-treesitter/nvim-treesitter" } },
},
opts = function()
local cmp = require("cmp")
-- style 'ghosttext' which appears behind cursor, showing current completion
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
local has_words_before = function()
---@diagnostic disable-next-line:deprecated
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 kind_icons = {
Text = "",
Method = "",
Function = "󰊕",
Constructor = "",
Field = "",
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "V",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
}
-- `/` cmdline setup.
cmp.setup.cmdline("/", {
completion = { completeopt = "menu,menuone,noinsert,noselect" },
preselect = cmp.PreselectMode.None,
mapping = cmp.mapping.preset.cmdline(),
sources = { { name = "buffer" } },
})
-- `:` cmdline setup.
cmp.setup.cmdline(":", {
completion = { completeopt = "menu,menuone,noinsert,noselect" },
preselect = cmp.PreselectMode.None,
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ { name = "path" } }, {
{ name = "cmdline", option = { ignore_cmds = { "Man", "!" } } },
}),
})
return {
window = { documentation = cmp.config.window.bordered() },
-- add noselect to not automatically select first item
completion = { completeopt = "menu,menuone,noinsert" },
preselect = cmp.PreselectMode.Item, -- not sure what this changes diff than above?
experimental = {
ghost_text = {
hl_group = "CmpGhostText",
},
},
sources = {
{ name = "nvim_lsp" },
{ name = "nvim_lsp_signature_help" },
{ name = "pandoc_references" },
{ name = "calc" },
{ name = "path" },
{ name = "buffer", keyword_length = 3 },
{ name = "spell", keyword_length = 3 },
-- { name = 'rg', keyword_length = 5 },
{ name = "vCard" },
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<CR>"] = cmp.mapping({
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = false,
})
else
fallback()
end
end,
s = cmp.mapping.confirm({ select = true }),
c = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = false,
}), -- disable selection in cmd mode
}),
["<Tab>"] = cmp.mapping(function(fallback)
-- expand_or_jumpable() will always jump
-- expand_or_locally_jumpable() only jumps when still inside snippet region
if cmp.visible() then
cmp.select_next_item()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end, { "i", "s" }),
}),
formatting = {
expandable_indicator = true,
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
-- Kind icons, removing kind text leaving only icon
-- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind)
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
-- Source
vim_item.menu = ({
buffer = "",
calc = "󰃬",
digraphs = "",
latex_symbols = "𝓧",
luasnip = "",
nvim_lsp = "",
nvim_lua = "󰢱",
pandoc_references = "",
spell = "󰓆",
vCard = "󰛋",
})[entry.source.name]
return vim_item
end,
},
}
end,
event = { "InsertEnter", "CmdlineEnter" },
},
}
--
-- TODO: Enable more lazy loaded startup? And integrate into
-- cmp as insert source instead of in its setup config below.
local snippet_engine = {
"nvim-cmp",
dependencies = { dependencies = {
"saghen/blink.compat", "L3MON4D3/LuaSnip",
"rafamadriz/friendly-snippets", "rafamadriz/friendly-snippets",
"hrsh7th/cmp-calc", "saadparwaiz1/cmp_luasnip",
"f3fora/cmp-spell",
{ {
"aspeddro/cmp-pandoc.nvim", "benfowler/telescope-luasnip.nvim",
dependencies = { dependencies = { { "nvim-telescope/telescope.nvim", optional = true } },
"nvim-lua/plenary.nvim", config = function()
}, if require("core.util").is_available("telescope") then
opts = { require("telescope").load_extension("luasnip")
filetypes = { "pandoc", "markdown", "quarto", "rmd" }, end
}, end,
}, },
}, },
event = { "InsertEnter" }, event = { "InsertEnter" },
opts = { build = "make install_jsregexp",
keymap = { preset = "default" }, opts = function(_, opts)
local cmp = require("cmp")
local luasnip = require("luasnip")
appearance = { require("luasnip.loaders.from_vscode").lazy_load({ exclude = { "markdown", "quarto" } })
-- Sets the fallback highlight groups to nvim-cmp's highlight groups require("luasnip.loaders.from_snipmate").lazy_load()
-- Useful for when your theme doesn't support blink.cmp
-- Will be removed in a future release
use_nvim_cmp_as_default = true,
-- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- Adjusts spacing to ensure icons are aligned
nerd_font_variant = "mono",
},
completion = {
documentation = { auto_show = true, auto_show_delay_ms = 500 },
-- ghost_text = { enabled = true },
},
signature = {
enabled = true,
},
-- Default list of enabled providers defined so that you can extend it opts.snippet = {
-- elsewhere in your config, without redefining it, due to `opts_extend` expand = function(item)
sources = { require("luasnip").lsp_expand(item.body)
default = { end,
"pandoc", }
"calc", local has_words_before = function()
"lsp", ---@diagnostic disable-next-line:deprecated
"path", local line, col = unpack(vim.api.nvim_win_get_cursor(0))
"snippets", return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
"buffer", end
"spell",
}, table.insert(opts.sources, { name = "luasnip", keyword_length = 1 })
providers = {
calc = { opts.mapping["<Tab>"] = cmp.mapping(function(fallback) -- expand_or_jumpable() will always jump
name = "calc", -- expand_or_locally_jumpable() only jumps when still inside snippet region
module = "blink.compat.source", if luasnip.expand_or_locally_jumpable() then
}, luasnip.expand_or_jump()
spell = { elseif cmp.visible() then
name = "spell", cmp.select_next_item()
module = "blink.compat.source", elseif has_words_before() then
}, cmp.complete()
pandoc = { else
name = "cmp_pandoc", fallback()
module = "blink.compat.source", end
}, end, { "i", "s" })
}, opts.mapping["<S-Tab>"] = cmp.mapping(function(fallback)
}, if luasnip.locally_jumpable(-1) then
}, luasnip.jump(-1)
opts_extend = { "sources.default" }, elseif cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end, { "i", "s" })
end,
}
local beancount_cmp = {
"nvim-cmp",
dependencies = {
"crispgm/cmp-beancount",
},
ft = "beancount",
opts = function(_, opts)
vim.g.python3_host_prog = "/home/marty/.local/pipx/venvs/beancount/bin/python"
table.insert(opts.sources, {
name = "beancount",
-- option = {
-- -- TODO: implement dynamically
-- -- I believe if we don't supply this it automatically takes
-- -- from the open file which would be good enough
-- account = "/home/marty/documents/records/budget/main.beancount",
-- },
})
end,
}
local latex_cmp = {
"nvim-cmp",
dependencies = {
-- TODO: Needs better lazy loading
"kdheepak/cmp-latex-symbols",
},
event = "CursorHold",
opts = function(_, opts)
table.insert(opts.sources, { name = "latex_symbols" })
end,
}
return {
completion_engine,
snippet_engine,
beancount_cmp,
latex_cmp,
} }

View file

@ -1,4 +1,13 @@
return { return {
-- md tables to scim
{
"mipmip/vim-scimark",
lazy = false,
config = function()
vim.g.scimCommand = "/usr/bin/sc-im"
end,
ft = { "quarto", "markdown", "vimwiki" },
},
{ {
"jmbuhr/otter.nvim", "jmbuhr/otter.nvim",
config = function() config = function()
@ -15,6 +24,7 @@ return {
dependencies = { dependencies = {
"jmbuhr/otter.nvim", "jmbuhr/otter.nvim",
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
"hrsh7th/nvim-cmp",
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
{ "benlubas/molten-nvim", optional = true }, { "benlubas/molten-nvim", optional = true },
}, },
@ -40,11 +50,10 @@ return {
map("n", "<localleader>ca", require("quarto.runner").run_above, { desc = "run cells above" }) map("n", "<localleader>ca", require("quarto.runner").run_above, { desc = "run cells above" })
map("n", "<localleader>cb", require("quarto.runner").run_below, { desc = "run cells below" }) map("n", "<localleader>cb", require("quarto.runner").run_below, { desc = "run cells below" })
map("n", "<localleader>cA", require("quarto.runner").run_all, { desc = "run all similar cells" }) map("n", "<localleader>cA", require("quarto.runner").run_all, { desc = "run all similar cells" })
-- TODO: overwritten by other moves, i.e. comment?
map("n", "]c", "/^```{<cr>}:nohl<cr>", { desc = "Codecell forward" }) map("n", "]c", "/^```{<cr>}:nohl<cr>", { desc = "Codecell forward" })
map("n", "[c", "?^```<cr>n}:nohl<cr>", { desc = "Codecell last" }) map("n", "[c", "?^```<cr>n}:nohl<cr>", { desc = "Codecell last" })
map("n", "<localleader>co", "o```{python}<cr><cr>```<esc>k", { desc = "Insert code cell below" }) map("n", "<localleader>co", "o```{python}<cr><cr>```<esc>k", { desc = "Insert quarto cell below" })
map("n", "<localleader>cO", "O```{python}<cr><cr>```<esc>k", { desc = "Insert code cell above" }) map("n", "<localleader>cO", "O```{python}<cr><cr>```<esc>k", { desc = "Insert quarto cell above" })
if require("core.util").is_available("which-key") then if require("core.util").is_available("which-key") then
require("which-key").add({ "<localleader>c", group = "codecells" }) require("which-key").add({ "<localleader>c", group = "codecells" })
@ -53,58 +62,48 @@ return {
ft = { "quarto" }, ft = { "quarto" },
}, },
{
"vhyrro/luarocks.nvim",
priority = 1001, -- this plugin needs to run before anything else
opts = {
rocks = { "magick" },
},
},
-- image display -- image display
{ {
"3rd/image.nvim", "3rd/image.nvim",
version = false, dependencies = { "luarocks.nvim", { "nvim-treesitter/nvim-treesitter", optional = true } },
dependencies = { cond = vim.fn.executable("magick") == 1, -- only runs if imagemagick installed
{ config = function()
"vhyrro/luarocks.nvim", local integrations = {}
priority = 1001, -- this plugin needs to run before anything else if vim.treesitter.language.get_lang("markdown") then
opts = { integrations["markdown"] = {
rocks = { "magick" }, enabled = true,
}, clear_in_insert_mode = true,
}, download_remote_images = true,
{ "nvim-treesitter/nvim-treesitter", optional = true },
},
opts = {
backend = "kitty",
editor_only_render_when_focused = true,
-- TODO: Check that this works without TS md parser, norg or typst installed
-- If errors go back to commit before 87691932 when this check was still here
integrations = {
markdown = {
only_render_image_at_cursor = true, only_render_image_at_cursor = true,
filetypes = { "markdown", "vimwiki", "quarto" }, filetypes = { "markdown", "vimwiki", "quarto" },
}, }
neorg = { end
only_render_image_at_cursor = true, if vim.treesitter.language.get_lang("norg") then
}, integrations["neorg"] = {
typst = { enabled = true,
only_render_image_at_cursor = true, clear_in_insert_mode = true,
}, download_remote_images = true,
}, only_render_image_at_cursor = true,
}, filetypes = { "norg" },
config = function(_, opts) }
require("image").setup(opts) end
-- if Molten is running, we directly inject the option if next(integrations) ~= nil then -- only set up if we have at least 1 TS parser
if vim.fn.exists("MoltenDeinit") > 0 then require("image").setup({
pcall(vim.fn.MoltenUpdateOption, "molten_image_provider", "image.nvim") backend = "kitty",
else integrations = integrations,
vim.g.molten_image_provider = "image.nvim" })
vim.g.molten_image_provider = "image.nvim"
pcall(vim.fn.MoltenUpdateOption, "molten_image_provider", "image.nvim")
end end
vim.keymap.set("n", "<localleader>pi", function()
for k, v in pairs(opts.integrations) do
if v["only_render_image_at_cursor"] ~= nil then
v["only_render_image_at_cursor"] = not v["only_render_image_at_cursor"]
end
print(k, v)
end
require("image").setup(opts)
end, { desc = "toggle image rendering", silent = true })
end, end,
ft = { "markdown", "vimwiki", "quarto", "norg", "typst", "python" }, ft = { "markdown", "vimwiki", "quarto", "norg", "python" },
priority = 60, priority = 60,
}, },
-- REPL work -- REPL work
@ -115,7 +114,7 @@ return {
{ "3rd/image.nvim", optional = true }, { "3rd/image.nvim", optional = true },
}, },
build = ":UpdateRemotePlugins", build = ":UpdateRemotePlugins",
init = function() config = function()
vim.g.molten_image_provider = vim.g.molten_image_provider or "wezterm" vim.g.molten_image_provider = vim.g.molten_image_provider or "wezterm"
vim.g.molten_auto_open_output = false vim.g.molten_auto_open_output = false
vim.g.molten_virt_text_output = true vim.g.molten_virt_text_output = true
@ -140,7 +139,7 @@ return {
map( map(
"x", "x",
"<localleader>c", "<localleader>c",
":<C-u>MoltenEvaluateVisual<cr>gv", ":<C-u>MoltenEvaluateVisual<cr>",
{ desc = "evaluate visual", silent = true } { desc = "evaluate visual", silent = true }
) )
map( map(
@ -155,7 +154,7 @@ return {
":noautocmd :MoltenEnterOutput<cr>", ":noautocmd :MoltenEnterOutput<cr>",
{ silent = true, desc = "show output" } { silent = true, desc = "show output" }
) )
map("n", "<localleader>cx", function() map("n", "<localleader>cP", function()
vim.cmd("MoltenHideOutput") vim.cmd("MoltenHideOutput")
vim.cmd("MoltenDelete") vim.cmd("MoltenDelete")
end, { silent = true, desc = "hide output" }) end, { silent = true, desc = "hide output" })
@ -202,40 +201,64 @@ return {
ft = { "norg", "quarto", "python" }, ft = { "norg", "quarto", "python" },
keys = { keys = {
{ "<leader>vn", ":MoltenInfo<cr>" }, { "<leader>vn", ":MoltenInfo<cr>" },
{ "<localleader>cJ", ":JupyterStart<cr>", desc = "start jupyter", silent = true },
}, },
cmd = {
"MoltenInfo",
"MoltenInit",
"MoltenDeinit",
"MoltenGoto",
"MoltenNext",
"MoltenPrev",
"MoltenEvaluateLine",
"MoltenEvaluateVisual",
"MoltenEvaluateOperator",
"MoltenEvaluateArgument",
"MoltenReevaluateCell",
"MoltenDelete",
"MoltenShowOutput",
"MoltenHideOutput",
"MoltenEnterOutput",
"MoltenInterrupt",
"MoltenOpenInBrowser",
"MoltenImagePopup",
"MoltenRestart",
"MoltenSave",
"MoltenLoad",
"MoltenExportOutput",
"MoltenImportOutput",
},
lazy = false,
}, },
-- Edit code blocks in md/quarto using whatever language is -- Edit code blocks in md/quarto using whatever language is
{ {
"AckslD/nvim-FeMaco.lua", "AckslD/nvim-FeMaco.lua",
cmd = { "FeMaco" }, cmd = {
ft = { "markdown", "rmd", "quarto" }, "FeMaco",
opts = {
ensure_newline = function(base_ft)
if base_ft == "quarto" or base_ft == "markdown" then
return true
end
return false
end,
}, },
config = function(_, opts) ft = { "markdown", "quarto" },
vim.keymap.set("n", "<localleader>ce", ":FeMaco<cr>", { desc = "edit codecell" }) opts = {},
require("femaco").setup(opts)
end,
dependencies = { dependencies = {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
}, },
keys = {
{ "<localleader>ce", ":FeMaco<cr>", desc = "edit codecell" },
},
}, },
-- MARKDOWN ONLY -- MARKDOWN ONLY
-- Evaluate markdown code blocks -- Evaluate markdown code blocks
{ -- TODO: Have results appear as virtual text instead of real text? {
"jubnzv/mdeval.nvim", "jubnzv/mdeval.nvim",
cmd = { "MdEval" }, cmd = {
"MdEval",
},
ft = { "markdown" }, ft = { "markdown" },
opts = { opts = {
require_confirmation = false, require_confirmation = false,
eval_options = {}, eval_options = {},
}, },
lazy = false,
}, },
-- Open ipynb Jupyter notebooks as if they're quarto files -- Open ipynb Jupyter notebooks as if they're quarto files
@ -257,7 +280,7 @@ return {
}, },
}, },
}, },
cond = vim.fn.executable("jupytext") == 1, -- only runs if jupytext installed cond = vim.fn.executable("jupytext") == 1, -- only runs if imagemagick installed
lazy = false, -- does not work in lazy mode lazy = false, -- does not work in lazy mode
}, },
} }

View file

@ -13,8 +13,7 @@ local formatters = {
liquid = { "prettier" }, liquid = { "prettier" },
lua = { "stylua" }, lua = { "stylua" },
markdown = { "prettier", "injected" }, markdown = { "prettier", "injected" },
nim = { "nimpretty" }, python = { "ruff_fix", "ruff_format", "ruff_organize_imports" },
python = { "ruff_format", "ruff_organize_imports" },
quarto = { "prettier", "injected" }, quarto = { "prettier", "injected" },
sh = { "shfmt" }, sh = { "shfmt" },
sql = { "sleek" }, sql = { "sleek" },

View file

@ -1,54 +1,29 @@
return { return {
{
"julienvincent/hunk.nvim",
dependencies = {
"MunifTanjim/nui.nvim",
{ "nvim-tree/nvim-web-devicons", optional = true },
},
cmd = { "DiffEditor" },
config = function()
require("hunk").setup()
end,
},
{ {
"akinsho/git-conflict.nvim", "akinsho/git-conflict.nvim",
event = { "InsertEnter", "CursorHold", "VeryLazy" }, event = { "InsertEnter", "CursorHold" },
init = function() config = function()
require("git-conflict").setup({
default_mappings = false,
disable_diagnostics = true,
})
if require("core.util").is_available("which-key") then if require("core.util").is_available("which-key") then
require("which-key").add({ "<localleader>h", group = "git" }) require("which-key").add({ "<localleader>h", group = "git" })
end end
end,
config = function()
require("git-conflict").setup({
debug = false,
default_mappings = false, -- disable buffer local mapping created by this plugin
default_commands = true, -- disable commands created by this plugin
disable_diagnostics = false, -- This will disable the diagnostics in a buffer whilst it is conflicted
list_opener = "copen", -- command or function to open the conflicts list
highlights = { -- They must have background color, otherwise the default color will be used
incoming = "DiffAdd",
current = "DiffText",
},
})
local map = vim.keymap.set local map = vim.keymap.set
map("n", "<localleader>ho", "<Plug>(git-conflict-ours)", { desc = "Conflict use current" }) map("n", "<localleader>ho", "<Plug>(git-conflict-ours)", { desc = "Conflict use ours" })
map("n", "<localleader>hO", "<Plug>(git-conflict-theirs)", { desc = "Conflict use incoming" }) map("n", "<localleader>hO", "<Plug>(git-conflict-theirs)", { desc = "Conflict use theirs" })
map("n", "<localleader>hm", "<Plug>(git-conflict-both)", { desc = "Conflict use both" }) map("n", "<localleader>hm", "<Plug>(git-conflict-both)", { desc = "Conflict use both" })
map("n", "<localleader>hM", "<Plug>(git-conflict-none)", { desc = "Conflict use none" }) map("n", "<localleader>hM", "<Plug>(git-conflict-none)", { desc = "Conflict use none" })
map("n", "[H", "<Plug>(git-conflict-prev-conflict)", { desc = "git conflict backward" }) map("n", "[H", "<Plug>(git-conflict-prev-conflict)", { desc = "Prev git conflict" })
map("n", "]H", "<Plug>(git-conflict-next-conflict)", { desc = "git conflict forward" }) map("n", "]H", "<Plug>(git-conflict-next-conflict)", { desc = "Next git conflict" })
end, end,
lazy = false, -- TODO: needs to be force refreshed in lazy loaded mode unfortunately lazy = false, -- TODO needs to be force refreshed in lazy loaded mode unfortunately
}, },
{ {
"lewis6991/gitsigns.nvim", -- show vcs changes on left-hand gutter "lewis6991/gitsigns.nvim", -- show vcs changes on left-hand gutter
event = { "InsertEnter", "CursorHold", "VeryLazy" }, event = { "InsertEnter", "CursorHold" },
cmd = "Gitsigns", cmd = "Gitsigns",
init = function()
if require("core.util").is_available("which-key") then
require("which-key").add({ "<localleader>h", group = "git" })
end
end,
config = function() config = function()
require("gitsigns").setup({ require("gitsigns").setup({
numhl = true, numhl = true,
@ -71,7 +46,7 @@ return {
gs.next_hunk() gs.next_hunk()
end) end)
return "<Ignore>" return "<Ignore>"
end, { expr = true, desc = "git hunk forward" }) end, { expr = true, desc = "Next git hunk" })
map("n", "[h", function() map("n", "[h", function()
if vim.wo.diff then if vim.wo.diff then
@ -81,8 +56,12 @@ return {
gs.prev_hunk() gs.prev_hunk()
end) end)
return "<Ignore>" return "<Ignore>"
end, { expr = true, desc = "git hunk backward" }) end, { expr = true, desc = "Previous git hunk" })
-- Actions
if require("core.util").is_available("which-key") then
require("which-key").add({ "<localleader>h", group = "git" })
end
map({ "n", "v" }, "<localleader>hs", ":Gitsigns stage_hunk<CR>", { desc = "stage hunk" }) map({ "n", "v" }, "<localleader>hs", ":Gitsigns stage_hunk<CR>", { desc = "stage hunk" })
map({ "n", "v" }, "<localleader>hr", ":Gitsigns reset_hunk<CR>", { desc = "reset hunk" }) map({ "n", "v" }, "<localleader>hr", ":Gitsigns reset_hunk<CR>", { desc = "reset hunk" })
map("n", "<localleader>hS", gs.stage_buffer, { desc = "stage buffer" }) map("n", "<localleader>hS", gs.stage_buffer, { desc = "stage buffer" })

View file

@ -12,18 +12,17 @@ return {
}, },
dependencies = { dependencies = {
{ "Bilal2453/luvit-meta" }, -- optional `vim.uv` typings { "Bilal2453/luvit-meta" }, -- optional `vim.uv` typings
-- FIXME: Set up to work with blink.cmp { -- optional completion source for require statements and module annotations
-- { -- optional completion source for require statements and module annotations "hrsh7th/nvim-cmp",
-- "hrsh7th/nvim-cmp", opts = function(_, opts)
-- opts = function(_, opts) opts.sources = opts.sources or {}
-- opts.sources = opts.sources or {} table.insert(opts.sources, {
-- table.insert(opts.sources, { name = "lazydev",
-- name = "lazydev", group_index = 0, -- set group index to 0 to skip loading LuaLS completions
-- group_index = 0, -- set group index to 0 to skip loading LuaLS completions })
-- }) end,
-- end, optional = true,
-- optional = true, },
-- },
}, },
}, },
} }

View file

@ -22,7 +22,6 @@ return {
"mfussenegger/nvim-lint", "mfussenegger/nvim-lint",
config = function() config = function()
require("lint").linters_by_ft = linters require("lint").linters_by_ft = linters
require("lint").linters.markdownlint.args = { "--stdin", "--disable", "MD013", "--" }
vim.api.nvim_create_autocmd({ "BufWritePost", "InsertLeave" }, { vim.api.nvim_create_autocmd({ "BufWritePost", "InsertLeave" }, {
callback = function() callback = function()
if not vim.g.disable_autolint then if not vim.g.disable_autolint then

View file

@ -1,54 +0,0 @@
return {
-- TODO: Add completion w blink, see https://codecompanion.olimorris.dev/installation.html
{
"olimorris/codecompanion.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"github/copilot.vim",
},
init = function(_)
if require("core.util").is_available("which-key") then
require("which-key").add({ "<leader>a", group = "codecompanion" })
end
end,
opts = {
strategies = {
chat = { adapter = "groq" },
inline = { adapter = "groq" },
},
adapters = {
groq = function()
return require("codecompanion.adapters").extend("openai", {
env = {
api_key = "GROQ_API_KEY",
},
name = "Groq",
url = "https://api.groq.com/openai/v1/chat/completions",
schema = {
model = {
default = "llama-3.1-8b-instant",
choices = {
"llama-3.3-70b-versatile",
"mixtral-8x7b-32768",
},
},
},
max_tokens = {
default = 4096,
},
temperature = {
default = 1,
},
})
end,
},
},
keys = {
{ "<leader>aa", "<cmd>CodeCompanionActions<cr>", desc = "Actions", silent = true, mode = { "n", "v" } },
{ "<leader>ac", "<cmd>CodeCompanionChat Toggle<cr>", desc = "Toggle chat", silent = true },
{ "<leader>ac", "<cmd>CodeCompanionChat Add<cr>", desc = "Add to chat", silent = true, mode = "v" },
},
cmd = { "CodeCompanionActions", "CodeCompanionChat", "CodeCompanion", "CodeCompanionCmd" },
},
}

View file

@ -29,61 +29,188 @@ local servers = {
}, },
}, },
marksman = {}, marksman = {},
nim_langserver = {},
basedpyright = {}, basedpyright = {},
ruff = {}, ruff = {},
serve_d = {}, serve_d = {},
taplo = {}, taplo = {},
texlab = {}, texlab = {},
tinymist = { tinymist = {},
settings = { tsserver = {},
formatterMode = "typstyle",
},
},
ts_ls = {},
yamlls = {}, yamlls = {},
} }
local lsp = { return {
{ -- pretty lsp 'peek' menus -- lsp setup
"DNLHC/glance.nvim",
opts = { border = { enable = true }, theme = { enable = true, mode = "auto" } },
cmd = { "Glance" },
},
{ {
"neovim/nvim-lspconfig", "junnplus/lsp-setup.nvim",
dependencies = { dependencies = {
{ {
"williamboman/mason-lspconfig.nvim", "neovim/nvim-lspconfig",
opts = { automatic_installation = true }, -- will sometimes not keep up with lsp changes if set to stable
dependencies = { version = false,
"williamboman/mason.nvim", },
cmd = { {
"Mason", "williamboman/mason.nvim",
"MasonInstall", cmd = {
"MasonUninstall", "Mason",
"MasonUninstallAll", "MasonInstall",
"MasonLog", "MasonUninstall",
"MasonUpdate", "MasonUninstallAll",
}, "MasonLog",
opts = {}, "MasonUpdate",
build = ":MasonUpdate",
keys = {
{ "<leader>vm", ":Mason<cr>", desc = "Mason" },
},
}, },
build = ":MasonUpdate",
keys = {
{ "<leader>vm", ":Mason<cr>", desc = "Mason" },
},
},
{
"williamboman/mason-lspconfig.nvim",
cmd = { "LspInstall", "LspUninstall" }, cmd = { "LspInstall", "LspUninstall" },
}, },
{ "saghen/blink.cmp", optional = true },
}, },
event = { "BufReadPost", "BufNewFile", "BufWritePre" }, event = { "BufReadPost", "BufNewFile", "BufWritePre" },
opts = { servers = servers }, config = function()
config = function(_, lspconfig_opts) vim.diagnostic.config({ virtual_text = true })
local lspconfig = require("lspconfig") vim.fn.sign_define("DiagnosticSignError", { text = "", texthl = "DiagnosticSignError" })
vim.fn.sign_define("DiagnosticSignWarn", { text = "", texthl = "DiagnosticSignWarn" })
vim.fn.sign_define("DiagnosticSignInfo", { text = "", texthl = "DiagnosticSignInfo" })
vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
local lsp = require("lsp-setup")
local function on_attach(_, bufnr)
local map = vim.keymap.set
map(
"n",
"[d",
"<cmd>lua vim.diagnostic.goto_prev()<cr>",
{ buffer = bufnr, desc = "Previous diagnostic" }
)
map("n", "]d", "<cmd>lua vim.diagnostic.goto_next()<cr>", { buffer = bufnr, desc = "Next diagnostic" })
map(
"n",
"[D",
"<cmd>lua vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR})<cr>",
{ buffer = bufnr, desc = "Previous error" }
)
map(
"n",
"]D",
"<cmd>lua vim.diagnostic.goto_next({severity = vim.diagnostic.severity.ERROR})<cr>",
{ buffer = bufnr, desc = "Next error" }
)
if require("core.util").is_available("which-key") then
require("which-key").add({ "<localleader>l", group = "language" })
end
map(
"n",
"<localleader>ld",
"<cmd>lua vim.diagnostic.open_float()<cr>",
{ buffer = bufnr, desc = "Line diagnostics" }
)
map("n", "<localleader>li", function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end, { buffer = bufnr, desc = "Inlay hints" })
map(
"n",
"<localleader>la",
"<cmd>lua vim.lsp.buf.code_action()<cr>",
{ buffer = bufnr, desc = "Codeactions" }
)
map(
"n",
"<localleader>ln",
"<cmd>lua vim.lsp.buf.rename()<cr>",
{ buffer = bufnr, desc = "Rename element" }
)
if vim.fn.exists(":Glance") then
map("n", "<localleader>lr", "<cmd>Glance references<cr>", { buffer = bufnr, desc = "References" })
map("n", "<localleader>lf", "<cmd>Glance definitions<cr>", { buffer = bufnr, desc = "Definition" })
map(
"n",
"<localleader>lt",
"<cmd>Glance type_definitions<cr>",
{ buffer = bufnr, desc = "Type definition" }
)
map(
"n",
"<localleader>lm",
"<cmd>Glance implementations<cr>",
{ buffer = bufnr, desc = "Implementation" }
)
elseif vim.fn.exists(":Telescope") then
map(
"n",
"<localleader>lr",
"<cmd>Telescope lsp_references<cr>",
{ buffer = bufnr, desc = "References" }
)
map(
"n",
"<localleader>lf",
"<cmd>Telescope lsp_definitions<cr>",
{ buffer = bufnr, desc = "Definition" }
)
map(
"n",
"<localleader>lt",
"<cmd>Telescope lsp_type_definitions<cr>",
{ buffer = bufnr, desc = "Type definition" }
)
map(
"n",
"<localleader>lm",
"<cmd>Telescope lsp_implementations<cr>",
{ buffer = bufnr, desc = "Implementation" }
)
else
map(
"n",
"<localleader>lr",
"<cmd>lua vim.lsp.buf.references()<cr>",
{ buffer = bufnr, desc = "References" }
)
map(
"n",
"<localleader>lf",
"<cmd>lua vim.lsp.buf.definition()<cr>",
{ buffer = bufnr, desc = "Definition" }
)
map(
"n",
"<localleader>lt",
"<cmd>lua vim.lsp.buf.type_definition()<cr>",
{ buffer = bufnr, desc = "Type definition" }
)
map(
"n",
"<localleader>lm",
"<cmd>lua vim.lsp.buf.implementation()<cr>",
{ buffer = bufnr, desc = "Implementation" }
)
end
map("n", "K", "<cmd>lua vim.lsp.buf.hover()<cr>", { buffer = bufnr, desc = "Hover definition" })
map(
"n",
"<localleader>lc",
"<cmd>lua vim.lsp.buf.declaration()<cr>",
{ buffer = bufnr, desc = "Declaration" }
)
map(
"n",
"<localleader>ls",
"<cmd>lua vim.lsp.buf.signature_help()<cr>",
{ buffer = bufnr, desc = "Signature help" }
)
map("n", "<localleader>lo", function()
vim.diagnostic.enable(not vim.diagnostic.is_enabled())
end, { buffer = bufnr, desc = "Toggle Diagnostics" })
end
-- Display diagnostics as virtual text only if not in insert mode -- Display diagnostics as virtual text only if not in insert mode
-- /r/neovim/comments/12inp4c/disable_diagnostics_virtual_text_when_in_insert/jqqifwk/ -- /r/neovim/comments/12inp4c/disable_diagnostics_virtual_text_when_in_insert/jqqifwk/
vim.diagnostic.config({ virtual_text = true })
vim.api.nvim_create_autocmd("InsertEnter", { vim.api.nvim_create_autocmd("InsertEnter", {
callback = function() callback = function()
vim.diagnostic.config({ virtual_text = false }) vim.diagnostic.config({ virtual_text = false })
@ -95,61 +222,28 @@ local lsp = {
end, end,
}) })
vim.fn.sign_define("DiagnosticSignError", { text = "", texthl = "DiagnosticSignError" }) lsp.setup({
vim.fn.sign_define("DiagnosticSignWarn", { text = "", texthl = "DiagnosticSignWarn" }) default_mappings = false,
vim.fn.sign_define("DiagnosticSignInfo", { text = "", texthl = "DiagnosticSignInfo" }) servers = servers,
vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" }) on_attach = on_attach,
inlay_hints = {
for server, config in pairs(lspconfig_opts.servers) do enabled = vim.fn.has("nvim-0.10") == true and true or false,
-- TODO: Check if it actually can be ignored in Nvim 0.11+, see https://cmp.saghen.dev/installation.html#lazy-nvim },
if vim.fn.has("nvim-0.11") == false then })
config.capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities)
end
lspconfig[server].setup(config)
end
local lspconfig = require("lspconfig")
lspconfig.nushell.setup({}) lspconfig.nushell.setup({})
lspconfig.marksman.setup({ lspconfig.marksman.setup({
filetypes = { "markdown", "quarto" }, filetypes = { "markdown", "quarto" },
on_attach = function(client, _) on_attach = function(client, bufnr)
-- TODO: for some reason this stays true even after rootdir switch? -- TODO: for some reason this stays true even after rootdir switch?
if client.config.in_zk_notebook then if client.config.in_zk_notebook then
local default_handler = vim.diagnostic.handlers.virtual_text vim.defer_fn(function()
vim.diagnostic.handlers.virtual_text = { vim.lsp.buf_detach_client(bufnr, client.id)
show = function(namespace, bufnrr, diagnostics, opts) end, 1000)
for i, diagnostic in ipairs(diagnostics) do
if
diagnostic.source
== "Marksman" -- You need to check what the correct value should be here
then
table.remove(diagnostics, i)
end
end
default_handler.show(namespace, bufnrr, diagnostics, opts)
end,
hide = function(...)
default_handler.hide(...)
end,
}
default_handler = vim.diagnostic.handlers.signs
vim.diagnostic.handlers.signs = {
show = function(namespace, bufnrr, diagnostics, opts)
for i, diagnostic in ipairs(diagnostics) do
if
diagnostic.source
== "Marksman" -- You need to check what the correct value should be here
then
table.remove(diagnostics, i)
end
end
default_handler.show(namespace, bufnrr, diagnostics, opts)
end,
hide = function(...)
default_handler.hide(...)
end,
}
end end
on_attach(client, bufnr)
end, end,
on_new_config = function(conf, new_root) on_new_config = function(conf, new_root)
if require("lspconfig.util").root_pattern(".zk")(new_root) then if require("lspconfig.util").root_pattern(".zk")(new_root) then
@ -162,31 +256,32 @@ local lsp = {
local python_path local python_path
-- ensure python virtualenv is determined automatically on lsp start -- ensure python virtualenv is determined automatically on lsp start
-- we primarily use pyright for cmp lsp completion & hover info
lspconfig.basedpyright.setup({ lspconfig.basedpyright.setup({
on_attach = function(client, _) on_attach = function(client, bufnr)
on_attach(client, bufnr)
require("core.util").set_python_env() require("core.util").set_python_env()
if python_path == nil then if python_path == nil then
python_path, _ = vim.fn.expand(require("core.util").get_python_venv_bin(client.config.root_dir)) python_path, _ = vim.fn.expand(require("core.util").get_python_venv_bin(client.config.root_dir))
end end
-- print(string.format("[PYTHON VENV]: %s", vim.inspect(python_path)))
client.config.settings.python = {} or client.config.settings.python client.config.settings.python = {} or client.config.settings.python
client.config.settings.python.pythonPath = python_path client.config.settings.python.pythonPath = python_path
end, end,
settings = { settings = {
-- disable imports and linting since, using ruff for it -- disable imports and linting since, we use ruff for that
pyright = { pyright = {
disableOrganizeImports = true, disableOrganizeImports = true,
}, },
python = { python = {
analysis = { analysis = {
-- ignore all files, use ruff for linting
ignore = { "*" }, ignore = { "*" },
}, },
}, },
}, },
}) })
lspconfig.ruff.setup({ lspconfig.ruff.setup({
on_attach = function(client, _) on_attach = function(client, bufnr)
on_attach(client, bufnr)
require("core.util").set_python_env() require("core.util").set_python_env()
client.server_capabilities.hoverProvider = false -- we use pyright for hover info client.server_capabilities.hoverProvider = false -- we use pyright for hover info
if python_path == nil then if python_path == nil then
@ -209,7 +304,8 @@ local lsp = {
pattern = "SpellEnable", pattern = "SpellEnable",
callback = function() callback = function()
lspconfig.ltex.setup({ lspconfig.ltex.setup({
on_attach = function(_, _) on_attach = function(client, bufnr)
on_attach(client, bufnr)
if require("core.util").is_available("ltex_extra") then if require("core.util").is_available("ltex_extra") then
require("ltex_extra").setup() require("ltex_extra").setup()
end end
@ -226,98 +322,10 @@ local lsp = {
end, end,
keys = { { "<leader>vs", ":LspInfo<cr>", desc = "LspInfo" } }, keys = { { "<leader>vs", ":LspInfo<cr>", desc = "LspInfo" } },
}, },
-- pretty lsp 'peek' menus
{
"DNLHC/glance.nvim",
opts = { border = { enable = true }, theme = { enable = true, mode = "auto" } },
cmd = { "Glance" },
},
} }
vim.api.nvim_create_autocmd("LspAttach", {
desc = "LSP actions",
callback = function(event)
local o = function(add_opts)
return vim.tbl_extend("force", { buffer = event.buf }, add_opts)
end
local map = vim.keymap.set
map("n", "K", "<cmd>lua vim.lsp.buf.hover()<cr>", o({ desc = "Hover definition" }))
map("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<cr>", o({ desc = "Previous diagnostic" }))
map("n", "]d", "<cmd>lua vim.diagnostic.goto_next()<cr>", o({ desc = "Next diagnostic" }))
map(
"n",
"[D",
"<cmd>lua vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR})<cr>",
o({ desc = "Previous error" })
)
map(
"n",
"]D",
"<cmd>lua vim.diagnostic.goto_next({severity = vim.diagnostic.severity.ERROR})<cr>",
o({ desc = "Next error" })
)
if require("core.util").is_available("which-key") then
require("which-key").add({ "<localleader>l", group = "language" })
end
map("n", "<localleader>ld", "<cmd>lua vim.diagnostic.open_float()<cr>", o({ desc = "Show line diagnostics" }))
map("n", "<localleader>lI", function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end, o({ desc = "Toggle inlay hints" }))
map("n", "<localleader>la", "<cmd>lua vim.lsp.buf.code_action()<cr>", o({ desc = "Codeactions" }))
map("n", "<localleader>ln", "<cmd>lua vim.lsp.buf.rename()<cr>", o({ desc = "Rename element" }))
map("n", "<localleader>lc", "<cmd>lua vim.lsp.buf.declaration()<cr>", o({ desc = "Declaration" }))
map("n", "<localleader>ls", "<cmd>lua vim.lsp.buf.signature_help()<cr>", o({ desc = "Signature help" }))
map("n", "<localleader>lo", function()
vim.diagnostic.enable(not vim.diagnostic.is_enabled())
end, o({ desc = "Toggle Diagnostics" }))
local pref = function(glances, telescope, fallback)
if glances and vim.fn.exists(":Glance") > 0 then
return glances
elseif telescope and vim.fn.exists(":Telescope") > 0 then
return telescope
else
return fallback
end
end
map(
"n",
"<localleader>lr",
pref(
"<cmd>Glance references<cr>",
"<cmd>Telescope lsp_references<cr>",
"<cmd>lua vim.lsp.buf.references()<cr>"
),
o({ desc = "References" })
)
map(
"n",
"<localleader>lf",
pref(
"<cmd>Glance definitions<cr>",
"<cmd>Telescope lsp_definitions<cr>",
"<cmd>lua vim.lsp.buf.definition()<cr>"
),
o({ desc = "Definition" })
)
map(
"n",
"<localleader>lt",
pref(
"<cmd>Glance type_definitions<cr>",
"<cmd>Telescope lsp_type_definitions<cr>",
"<cmd>lua vim.lsp.buf.type_definition()<cr>"
),
o({ desc = "Type definition" })
)
map(
"n",
"<localleader>lm",
pref(
"<cmd>Glance implementations<cr>",
"<cmd>Telescope lsp_implementations<cr>",
"<cmd>lua vim.lsp.buf.implementation()<cr>"
),
o({ desc = "Implementation" })
)
end,
})
return lsp

View file

@ -1,4 +1,35 @@
return { return {
-- vista-like outline view for code
{
"stevearc/aerial.nvim",
config = true,
-- Optional dependencies
dependencies = {
"nvim-treesitter/nvim-treesitter",
"nvim-tree/nvim-web-devicons",
},
cmd = {
"AerialToggle",
"AerialOpen",
"AerialOpenAll",
"AerialClose",
"AerialCloseAll",
"AerialNext",
"AerialPrev",
"AerialGo",
"AerialInfo",
"AerialNavToggle",
"AerialNavOpen",
"AerialNavClose",
},
opts = {
backends = { "treesitter", "lsp", "markdown", "man" },
},
keys = {
{ "<leader>so", "<cmd>AerialNavToggle<cr>", silent = true, desc = "symbol navigator" },
{ "<leader>sO", "<cmd>AerialToggle<cr>", silent = true, desc = "symbol outline" },
},
},
-- useful quickfix-like buffer -- useful quickfix-like buffer
{ {
"folke/trouble.nvim", "folke/trouble.nvim",
@ -15,8 +46,6 @@ return {
silent = true, silent = true,
desc = "diagnostics document", desc = "diagnostics document",
}, },
{ "<leader>so", "<cmd>Trouble symbols toggle focus=true win.type=float<cr>", silent = true, desc = "symbol outline" },
{ "<leader>sO", "<cmd>Trouble symbols toggle focus=false win.position=right<cr>", silent = true, desc = "symbol outline" },
}, },
}, },
} }

View file

@ -1,4 +1,4 @@
return { -- file/item pickers and managers return {
{ {
"vifm/vifm.vim", "vifm/vifm.vim",
config = function() config = function()
@ -8,295 +8,176 @@ return { -- file/item pickers and managers
vim.g.vifm_exec_args = '-c "set vifminfo=" -c "set statusline=" -c "only"' vim.g.vifm_exec_args = '-c "set vifminfo=" -c "set statusline=" -c "only"'
end, end,
cmd = "Vifm", cmd = "Vifm",
keys = { { "<leader>E", "<cmd>Vifm<cr>", desc = "buffer file browser" } }, keys = {
{ "<leader>E", "<cmd>Vifm<cr>", desc = "buffer file browser" },
{ "<leader>vc", ":Vifm " .. vim.fn.stdpath("config") .. "<cr>", desc = "open config" },
},
event = { "BufEnter" }, event = { "BufEnter" },
}, -- integrate file manager }, -- integrate file manager
{ {
"nvim-neo-tree/neo-tree.nvim", "nvim-tree/nvim-tree.lua", -- integrate file tree
dependencies = { config = true,
"MunifTanjim/nui.nvim", dependencies = { "nvim-tree/nvim-web-devicons", config = true },
"nvim-lua/plenary.nvim", cmd = "NvimTreeToggle",
{ "nvim-tree/nvim-web-devicons", optional = true },
},
init = function()
-- ensure neo-tree gets loaded if we start vim with a directory
-- netrw-like. See https://github.com/nvim-neo-tree/neo-tree.nvim/discussions/1326
vim.api.nvim_create_autocmd("BufEnter", {
group = vim.api.nvim_create_augroup("load_neo_tree", {}),
desc = "Loads neo-tree when opening a directory",
callback = function(args)
local stats = vim.uv.fs_stat(args.file)
if not stats or stats.type ~= "directory" then
return
end
require("neo-tree")
return true
end,
})
end,
cmd = "Neotree",
opts = {
source_selector = { winbar = true },
},
keys = { keys = {
{ "<leader>se", "<cmd>Neotree toggle left<cr>", desc = "filetree", silent = true }, { "<leader>se", "<cmd>NvimTreeToggle<cr>", desc = "filetree", silent = true },
}, },
}, },
{ "MagicDuck/grug-far.nvim", opts = {}, cmd = "GrugFar" }, { "MagicDuck/grug-far.nvim", lazy = false, opts = {} },
-- fuzzy matching picker
{ {
"ibhagwan/fzf-lua", "nvim-telescope/telescope.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" }, dependencies = {
init = function() "nvim-lua/popup.nvim",
"nvim-lua/plenary.nvim",
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
},
cmd = "Telescope",
config = function()
if require("core.util").is_available("which-key") then if require("core.util").is_available("which-key") then
require("which-key").add({ "<leader>v", group = "vim" })
require("which-key").add({ "<leader>f", group = "find" }) require("which-key").add({ "<leader>f", group = "find" })
end end
end, -- Setup up telescope fuzzy finding settings
opts = { --
fzf_opts = { ["--select-1"] = false }, -- Makes use of optionally installed external programs to work fully:
keymap = { -- rg (ripgrep) for in-text searches
builtin = { -- fd for quicker directory structure searches
true, -- lsp for a variety of lsp queries
["<c-d>"] = "preview-page-down", local trouble_mappings = {}
["<c-u>"] = "preview-page-up", if require("core.util").is_available("trouble") then
trouble_mappings = {
i = { ["<c-t>"] = require("trouble.sources.telescope").open },
n = { ["<c-t>"] = require("trouble.sources.telescope").open },
}
end
require("telescope").setup({
defaults = {
vimgrep_arguments = {
"rg",
"--ignore-vcs",
"--hidden",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
generic_sorter = require("mini.fuzzy").get_telescope_sorter,
-- Appearance
prompt_prefix = "󰍉 ",
selection_caret = "󰳟 ",
color_devicons = true,
mappings = trouble_mappings or {},
}, },
fzf = { pickers = {
true, buffers = { theme = "ivy" },
["ctrl-q"] = "select-all+accept", oldfiles = { theme = "ivy" },
}, find_files = {
}, theme = "dropdown",
previewers = { -- nice minimal picker design
builtin = { borderchars = {
extensions = { { "", "", "", "", "", "", "", "" },
["png"] = { "chafa", "--format=symbols", "{file}" }, prompt = { "", "", " ", "", "", "", "", "" },
["jpg"] = { "chafa", "--format=symbols", "{file}" }, results = { "", "", "", "", "", "", "", "" },
["gif"] = { "chafa", "--format=symbols", "{file}" }, preview = { "", "", "", "", "", "", "", "" },
["svg"] = { "chafa", "--format=symbols", "{file}" }, },
width = 0.8,
previewer = false,
prompt_title = false,
}, },
}, },
}, })
}, -- FIXME: Does not seem to work with single result and still closes instantly? require("telescope").load_extension("fzf")
config = function(_, opts)
opts.actions = opts.actions or { true }
opts.actions["ctrl-q"] = require("fzf-lua").actions.file_sel_to_qf
require("fzf-lua").setup(opts)
end, end,
cmd = "FzfLua",
keys = { keys = {
{ {
"<leader>vh", "<leader>vh",
function() function()
require("fzf-lua").helptags() require("telescope.builtin").help_tags()
end, end,
desc = "help tags", desc = "help tags",
}, },
{ {
"<leader>vH", "<leader>vH",
function() function()
require("fzf-lua").manpages() require("telescope.builtin").man_pages()
end, end,
desc = "man pages", desc = "man pages",
}, },
{
"<leader>vt",
function()
require("fzf-lua").filetypes()
end,
desc = "filetype",
},
{
"<leader>vk",
function()
require("fzf-lua").keymaps()
end,
desc = "keymaps",
},
{
"<leader>vy",
function()
require("fzf-lua").search_history()
end,
desc = "search history",
},
{
"<leader>vc",
function()
require("fzf-lua").command_history()
end,
desc = "command history",
},
{ {
"<leader>vC", "<leader>vC",
function() function()
require("fzf-lua").colorschemes() require("telescope.builtin").colorscheme(require("telescope.themes").get_ivy())
end, end,
desc = "colorschemes", desc = "colorschemes",
}, },
{ -- exclude hidden files with <alt-h> in the search
"<leader>ff",
function()
require("fzf-lua").files()
end,
desc = "files",
},
{ {
"<leader>fb", "<leader>fb",
function() function()
require("fzf-lua").buffers() require("telescope.builtin").buffers(require("telescope.themes").get_ivy())
end, end,
desc = "buffers", desc = "list buffers",
}, },
{ {
"<leader>fo", "<leader>fo",
function() function()
require("fzf-lua").oldfiles() require("telescope.builtin").oldfiles(require("telescope.themes").get_ivy())
end, end,
desc = "old files", desc = "list old files",
}, },
{ {
"<leader>fp", "<leader>ff",
function() function()
require("fzf-lua").complete_path() require("telescope.builtin").find_files()
end, end,
desc = "path complete", desc = "find files",
},
{ -- TODO: Does it work reliably in various circumstances?
"<c-m>",
function()
require("fzf-lua").complete_path()
end,
mode = "i",
desc = "path complete",
}, },
{ {
"<leader>fP", "<leader>fh",
function() function()
require("fzf-lua").complete_file() require("telescope.builtin").find_files({ hidden = true })
end, end,
desc = "filepath complete", desc = "find hidden files",
}, },
{ {
"<leader>fw", "<leader>fw",
function() function()
require("fzf-lua").live_grep_native() require("telescope.builtin").live_grep()
end, end,
desc = "grep", desc = "grep search",
},
{
"<leader>fW",
function()
require("fzf-lua").live_grep_resume()
end,
desc = "grep resume",
},
{
"<leader>fw",
function()
require("fzf-lua").grep_cword()
end,
mode = "v",
desc = "grep word",
},
{
"<leader>fW",
function()
require("fzf-lua").grep_cWORD()
end,
mode = "v",
desc = "grep WORD",
}, },
{ {
"<leader>fg", "<leader>fg",
function() function()
require("fzf-lua").git_status() require("telescope.builtin").git_status()
end, end,
desc = "git status", desc = "git status",
}, },
{ {
"<leader>fc", "<leader>fc",
function() function()
require("fzf-lua").git_bcommits() require("telescope.builtin").git_bcommits()
end, end,
desc = "git buffer commits", desc = "git buffer commits",
}, },
{ {
"<leader>fl", "<leader>fl",
function() function()
require("fzf-lua").git_commits() require("telescope.builtin").git_commits()
end, end,
desc = "git log", desc = "git commit log",
},
{
"<leader>fr",
function()
require("fzf-lua").registers()
end,
desc = "registers",
},
{
"<leader>fr",
function()
require("fzf-lua").jumps()
end,
desc = "jumps",
},
{
"<leader>fq",
function()
require("fzf-lua").quickfix()
end,
desc = "quickfix",
},
{
"<leader>fi",
function()
require("fzf-lua").loclist()
end,
desc = "loclist",
}, },
{ {
"z=", "z=",
function() function()
require("fzf-lua").spell_suggest() require("telescope.builtin").spell_suggest(require("telescope.themes").get_ivy())
end, end,
desc = "spell suggest", desc = "spell suggest",
}, },
{
"<leader>fR",
function()
require("fzf-lua").resume()
end,
desc = "resume last query",
},
{
"<leader>fs",
function()
require("fzf-lua").lsp_finder()
end,
desc = "lsp symbol",
},
{
"<leader>fd",
function()
require("fzf-lua").diagnostics_workspace()
end,
desc = "diagnostics workspace",
},
{
"<leader>fD",
function()
require("fzf-lua").diagnostics_document()
end,
desc = "diagnostics document",
},
}, },
}, },
-- fuzzy matching picker
{ {
"jiaoshijie/undotree", "jiaoshijie/undotree",
dependencies = { dependencies = {

View file

@ -1,10 +1,8 @@
local md_like = { local md_like = {
"markdown", "markdown",
"djot",
"pandoc", "pandoc",
"quarto", "quarto",
"vimwiki", "vimwiki",
"codecompanion",
} }
local org_like = { local org_like = {
"norg", "norg",
@ -70,35 +68,20 @@ local prose_plugs = {
"MeanderingProgrammer/render-markdown.nvim", "MeanderingProgrammer/render-markdown.nvim",
main = "render-markdown", main = "render-markdown",
opts = { opts = {
render_modes = { "n", "c", "i" }, file_types = { unpack(md_like) },
code = { code = {
sign = false, sign = false,
width = "full", width = "block",
position = "right",
right_pad = 1, right_pad = 1,
}, },
checkbox = {
custom = {
todo = { raw = "[-]", rendered = "󰡖 ", highlight = "RenderMarkdownTodo" },
removed = { raw = "[_]", rendered = "󱋭 ", highlight = "RenderMarkdownTodo" },
},
},
html = {
comment = {
conceal = false,
},
},
}, },
name = "render-markdown", -- Only needed if you have another plugin named markdown.nvim name = "render-markdown", -- Only needed if you have another plugin named markdown.nvim
dependencies = { dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" }, -- if you prefer nvim-web-devicons
"nvim-treesitter/nvim-treesitter",
"nvim-tree/nvim-web-devicons",
},
ft = md_like, ft = md_like,
cmd = "RenderMarkdown", cmd = "RenderMarkdown",
keys = { keys = {
{ {
"<localleader>pm", "<leader>pp",
function() function()
require("render-markdown").toggle() require("render-markdown").toggle()
end, end,
@ -107,43 +90,29 @@ local prose_plugs = {
}, },
}, },
}, },
--- PREVIEW SECTION
-- generate an auto-updating html preview for md files -- generate an auto-updating html preview for md files
-- uses the very nice peek if deno is available, otherwise falls back to markdown-preview -- uses the very nice peek if deno is available, otherwise falls back to markdown-preview
{ {
"toppair/peek.nvim", "toppair/peek.nvim",
event = { "VeryLazy" },
cond = vim.fn.executable("deno") == 1, cond = vim.fn.executable("deno") == 1,
build = "deno task --quiet build:fast", build = "deno task --quiet build:fast",
ft = md_like, ft = md_like,
opts = {}, config = function()
require("peek").setup()
vim.api.nvim_create_user_command("PeekOpen", require("peek").open, {})
vim.api.nvim_create_user_command("PeekClose", require("peek").close, {})
end,
}, },
{ {
"iamcco/markdown-preview.nvim", "iamcco/markdown-preview.nvim",
event = { "VeryLazy" },
cond = vim.fn.executable("deno") == 0, cond = vim.fn.executable("deno") == 0,
build = function() build = function()
vim.fn["mkdp#util#install"]() vim.fn["mkdp#util#install"]()
end, end,
version = false,
ft = md_like, ft = md_like,
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
}, },
{
"chomosuke/typst-preview.nvim",
ft = { "typst" },
opts = { -- to use mason-managed binary
dependencies_bin = { ["tinymist"] = "tinymist" },
},
cmd = {
"TypstPreview",
"TypstPreviewUpdate",
"TypstPreviewStop",
"TypstPreviewToggle",
"TypstPreviewFollowCursor",
"TypstPreviewNoFollowCursor",
"TypstPreviewFollowCursorToggle",
},
},
--- END PREVIEW SECTION
-- easy copy paste of images into markup files -- easy copy paste of images into markup files
{ {
@ -160,14 +129,14 @@ local prose_plugs = {
}, },
cmd = { "PasteImage" }, cmd = { "PasteImage" },
keys = { keys = {
{ "<localleader>pp", "<cmd>PasteImage<cr>", desc = "Paste image from system clipboard" }, { "<leader>pi", "<cmd>PasteImage<cr>", desc = "Paste image from system clipboard" },
}, },
ft = prose_ft, ft = prose_ft,
}, },
-- bring zettelkasten commands -- bring zettelkasten commands
{ {
"zk-org/zk-nvim", "mickael-menu/zk-nvim",
config = function() config = function()
if require("core.util").is_available("which-key") then if require("core.util").is_available("which-key") then
require("which-key").add({ require("which-key").add({
@ -180,24 +149,6 @@ local prose_plugs = {
opts = vim.tbl_extend("force", { orphan = true }, opts or {}) opts = vim.tbl_extend("force", { orphan = true }, opts or {})
require("zk").edit(opts, { title = "Zk Orphans" }) require("zk").edit(opts, { title = "Zk Orphans" })
end) end)
require("zk.commands").add("ZkGrep", function(opts)
local collection = {}
local list_opts = { select = { "title", "path", "absPath" } }
require("zk.api").list(vim.env.ZK_NOTEBOOK_DIR, list_opts, function(_, notes)
for _, note in ipairs(notes) do
collection[note.absPath] = note.title or note.path
end
end)
local options = vim.tbl_deep_extend("force", {
prompt_title = "Notes",
search_dirs = { vim.env.ZK_NOTEBOOK_DIR },
disable_coordinates = true,
path_display = function(_, path)
return collection[path]
end,
}, opts or {})
require("telescope.builtin").live_grep(options)
end)
end end
require("zk").setup({ require("zk").setup({
picker = "telescope", picker = "telescope",
@ -238,7 +189,6 @@ local prose_plugs = {
desc = "note search", desc = "note search",
}, },
{ "<leader>nf", "<cmd>ZkMatch<cr>", desc = "find note from selection", mode = "v" }, { "<leader>nf", "<cmd>ZkMatch<cr>", desc = "find note from selection", mode = "v" },
{ "<leader>nw", "<cmd>ZkGrep<cr>", desc = "grep notes" },
{ "<leader>nt", "<cmd>ZkTags<cr>", desc = "note tags" }, { "<leader>nt", "<cmd>ZkTags<cr>", desc = "note tags" },
{ "<leader>nc", "<cmd>ZkCd<cr>", desc = "notedir cd" }, { "<leader>nc", "<cmd>ZkCd<cr>", desc = "notedir cd" },
{ "<leader>no", "<cmd>ZkOrphans { sort = { 'modified' } }<cr>", desc = "orphans list" }, { "<leader>no", "<cmd>ZkOrphans { sort = { 'modified' } }<cr>", desc = "orphans list" },
@ -257,6 +207,24 @@ local prose_plugs = {
config = true, config = true,
}, },
-- cite as you write from papis databases
-- ADDITIONAL DEPENDENCIES: papis and yq in shell env
-- {
-- "jghauser/papis.nvim",
-- dependencies = {
-- "kkharji/sqlite.lua",
-- "MunifTanjim/nui.nvim",
-- "pysan3/pathlib.nvim",
-- "nvim-neotest/nvim-nio",
-- "nvim-treesitter/nvim-treesitter",
-- },
-- cond = vim.fn.executable("papis") == 1 and vim.fn.executable("yq") == 1,
-- ft = writing_ft,
-- lazy = false,
-- config = function()
-- require("papis").setup({})
-- end,
-- },
{ {
"barreiroleo/ltex_extra.nvim", "barreiroleo/ltex_extra.nvim",
branch = "dev", branch = "dev",

View file

@ -5,8 +5,6 @@ return {
cond = true, cond = true,
dependencies = { { "nvim-tree/nvim-web-devicons", config = true } }, dependencies = { { "nvim-tree/nvim-web-devicons", config = true } },
config = function() config = function()
-- TODO: Should grab ft directly from molten lazy spec
local molten_ft = { "markdown", "rmd", "quarto" }
local has_pynvim = -1 local has_pynvim = -1
-- if molten exists, is initialized and connected to a kernel -- if molten exists, is initialized and connected to a kernel
-- show it in the statusline -- show it in the statusline
@ -15,9 +13,6 @@ return {
if has_pynvim == 0 then if has_pynvim == 0 then
return "" return ""
elseif has_pynvim == 1 then elseif has_pynvim == 1 then
if molten_ft[vim.bo.filetype] == nil then
return ""
end
local status_ok, res = pcall(function() local status_ok, res = pcall(function()
return require("molten.status").kernels() ~= "" return require("molten.status").kernels() ~= ""
end) end)
@ -27,11 +22,14 @@ return {
return "" return ""
-- we don't know if we have python yet, start a check -- we don't know if we have python yet, start a check
else else
if vim.fn.has("python3") == 1 then vim.system({ "poetry", "env", "info", "-p" }, { text = true }, function(obj)
has_pynvim = 1 if obj.code == 0 then
else has_pynvim = 1
has_pynvim = 0 else
end has_pynvim = 0
end
end)
has_pynvim = 0
end end
end end

View file

@ -1,54 +1,68 @@
return { -- simple programmable terminal toggling for nvim return {
-- simpler, programmable and multiple terminal toggling for nvim
{ {
"akinsho/nvim-toggleterm.lua", "akinsho/nvim-toggleterm.lua",
init = function(_)
if require("core.util").is_available("which-key") then
require("which-key").add({ "<leader>t", group = "terminal" })
end
end,
config = function() config = function()
require("toggleterm").setup({ require("toggleterm").setup({
open_mapping = [[<leader>tt]], open_mapping = [[<leader>=]],
insert_mappings = false, -- don't map the key in insert mode insert_mappings = false, -- don't map the key in insert mode
terminal_mappings = false, terminal_mappings = false,
}) })
local Terminal = require("toggleterm.terminal").Terminal local Terminal = require("toggleterm.terminal").Terminal
-- need to disable indentlines since they obscure first line of terminal
if require("core.util").is_available("mini.nvim") then
vim.api.nvim_create_autocmd({ "TermOpen" }, {
pattern = "*",
callback = function()
vim.b.miniindentscope_disable = true
end,
})
end
local function custom_term_set_toggle_key(term) local function custom_term_set_toggle_key(term)
vim.keymap.set("t", "<C-\\>", function() vim.keymap.set("t", "<C-\\>", function()
term:toggle() term:toggle()
end, { silent = true, buffer = true, desc = "terminal" }) end, { silent = true, buffer = true })
end end
local custom_term_default_style = function(cmd) -- create python window
return { local function get_python_cmd()
cmd = cmd, if vim.fn.executable("py") then
return "py"
end
if vim.fn.executable("ptipython") then
return "ptipython"
end
if vim.fn.executable("ipython") then
return "ipython"
end
if vim.fn.executable("ptpython") then
return "ptpython"
end
if vim.fn.executable("python") then
return "python"
end
end
local terms = {
lazygit = Terminal:new({
cmd = "lazygit",
hidden = true, hidden = true,
direction = "float", direction = "float",
float_opts = { border = "curved" }, float_opts = { border = "curved" },
on_open = custom_term_set_toggle_key, on_open = custom_term_set_toggle_key,
} }),
end python = Terminal:new({
local terms = { cmd = get_python_cmd(),
lazygit = Terminal:new(custom_term_default_style("lazygit")), hidden = true,
python = Terminal:new(custom_term_default_style(function() direction = "float",
for _, exec in pairs({ "py", "ptipython", "ipython", "ptpython", "python" }) do float_opts = { border = "curved" },
if vim.fn.executable(exec) > 0 then on_open = custom_term_set_toggle_key,
return exec }),
end
end
end)),
euporie = Terminal:new(custom_term_default_style(function()
local kernel = vim.b.sessionfile
if kernel then
return "euporie-console --connection-file '" .. kernel .. "'"
end
return "euporie-console"
end)),
} }
-- have user decide between floating or split -- create a lazygit window with the lazygit command
local function toggle_split_or_float(term, bang, vertsize) local function toggle_custom_term(term, bang, vertsize)
vertsize = vertsize or vim.o.columns * 0.4 vertsize = vertsize or vim.o.columns * 0.4
if not bang then if not bang then
term.direction = "float" term.direction = "float"
@ -60,25 +74,30 @@ return { -- simple programmable terminal toggling for nvim
end end
end end
vim.api.nvim_create_user_command("Lazygit", function(opts) local function _Pythonterm_toggle(opts)
toggle_split_or_float(terms.lazygit, opts.bang, vim.o.columns * 0.6) toggle_custom_term(terms.python, opts.bang)
end, { desc = "Toggle floating Lazygit terminal", bang = true }) end
vim.api.nvim_create_user_command("Pythonterm", function(opts) local function _Lazygit_toggle(opts)
toggle_split_or_float(terms.python, opts.bang) toggle_custom_term(terms.lazygit, opts.bang, vim.o.columns * 0.6)
end, { desc = "Toggle floating Python terminal", bang = true }) end
vim.api.nvim_create_user_command("Euporieterm", function(opts)
toggle_split_or_float(terms.euporie, opts.bang) vim.api.nvim_create_user_command(
end, { desc = "Toggle floating Euporie terminal", bang = true }) "Lazygit",
_Lazygit_toggle,
{ desc = "Toggle floating Lazygit terminal", bang = true }
)
vim.api.nvim_create_user_command(
"Pythonterm",
_Pythonterm_toggle,
{ desc = "Toggle floating Python terminal", bang = true }
)
end, end,
cmd = { "ToggleTerm", "TermExec", "Lazygit", "Pythonterm", "Euporieterm" }, cmd = { "ToggleTerm", "TermExec", "Lazygit", "Pythonterm" },
keys = { keys = {
{ "<leader>tt", ":ToggleTerm<cr>", desc = "terminal" }, { "<leader>sg", ":Lazygit<cr>", desc = "git floating" },
{ "<leader>tg", ":Lazygit<cr>", desc = "git floating" }, { "<leader>sG", ":Lazygit!<cr>", desc = "git buffer" },
{ "<leader>tG", ":Lazygit!<cr>", desc = "git buffer" }, { "<leader>sp", ":Pythonterm<cr>", desc = "python floating" },
{ "<leader>tp", ":Pythonterm<cr>", desc = "python floating" }, { "<leader>sP", ":Pythonterm!<cr>", desc = "python buffer" },
{ "<leader>tP", ":Pythonterm!<cr>", desc = "python buffer" },
{ "<leader>te", ":Euporieterm<cr>", desc = "euporie floating" },
{ "<leader>tE", ":Euporieterm!<cr>", desc = "euporie buffer" },
}, },
}, },
} }

View file

@ -92,11 +92,4 @@ return {
opts = {}, opts = {},
event = "VeryLazy", event = "VeryLazy",
}, },
{
"OXY2DEV/helpview.nvim",
ft = "help",
dependencies = {
"nvim-treesitter/nvim-treesitter",
},
},
} }

View file

@ -226,4 +226,3 @@ decarbonisation
Oportunidades Oportunidades
OECD OECD
NREGA NREGA
Oehme

View file

@ -5,5 +5,8 @@ if exist nvim; then
alias v="nvim" alias v="nvim"
alias vim="nvim" alias vim="nvim"
# open notes with my vim zettelkasten plugin
# TODO better implementation conditional on zk & zettelkasten existing
alias vn='nvim +"lua require \"zk.commands\".get(\"ZkCd\")()" +"edit ~/documents/notes/index.md"'
alias vs='nvim +"lua require \"personal.scratchpad\".create()"' alias vs='nvim +"lua require \"personal.scratchpad\".create()"'
fi fi

View file

@ -44,10 +44,10 @@ report.today.sort=urgency-
report.today.columns=id,project,priority,urgency,due,description,tags,scheduled,entry.age,recur report.today.columns=id,project,priority,urgency,due,description,tags,scheduled,entry.age,recur
report.today.labels=,Project,Pri,Urg,Due,Description,Tags,Sched,Age,Recur report.today.labels=,Project,Pri,Urg,Due,Description,Tags,Sched,Age,Recur
# report overview of tasks accomplished today # report overview of tasks accomplished today
report.donetoday.description=Tasks completed today report.today.completed.description=Tasks completed today
report.donetoday.filter=status:completed end.after:tod report.today.completed.filter=status:completed end.after:tod
report.donetoday.columns=id,project,priority,urgency,due,description,tags,scheduled,entry.age,recur report.today.completed.columns=id,project,priority,urgency,due,description,tags,scheduled,entry.age,recur
report.donetoday.labels=,Project,Pri,Urg,Due,Description,Tags,Sched,Age,Recur report.today.completed.labels=,Project,Pri,Urg,Due,Description,Tags,Sched,Age,Recur
# reorder priorities so that explicitly tagged 'Low' items are lower than normal # reorder priorities so that explicitly tagged 'Low' items are lower than normal
uda.priority.values=H,M,,L uda.priority.values=H,M,,L

View file

@ -3,18 +3,16 @@ from typing import cast
# pylint: disable=C0111 # pylint: disable=C0111
from qutebrowser.config.config import ConfigContainer # noqa: F401 from qutebrowser.config.config import ConfigContainer # noqa: F401
from qutebrowser.config.configfiles import ConfigAPI from qutebrowser.config.configfiles import ConfigAPI # noqa: F401
from freedirect.freedirect import Redirects
config: ConfigAPI = cast(ConfigAPI, config) # noqa: F821 pylint: disable=E0602,C0103 config: ConfigAPI = cast(ConfigAPI, config) # noqa: F821 pylint: disable=E0602,C0103
c: ConfigContainer = cast(ConfigContainer, c) # noqa: F821 pylint: disable=E0602,C0103 c: ConfigContainer = cast(ConfigContainer, c) # noqa: F821 pylint: disable=E0602,C0103
# Autogenerated config.py # Autogenerated config.py
# Documentation: # Documentation:
# qute://help/configuring.html # qute://help/configuring.html
# qute://help/settings.html # qute://help/settings.html
# load additional settings configured via autoconfig.yml # load additional settings configured via autoconfig.yml
_ = config.load_autoconfig() _ = config.load_autoconfig()
@ -61,9 +59,7 @@ config.source("alias.py")
config.source("maps.py") config.source("maps.py")
config.source("content.py") config.source("content.py")
config.source("searchengines.py") config.source("searchengines.py")
config.source("redirects.py")
_ = Redirects()
# Tab-Bar # Tab-Bar
# have tab bar on the right, not on the top # have tab bar on the right, not on the top

View file

@ -32,7 +32,6 @@ js_whitelist = [
"*://news.ycombinator.com/*", "*://news.ycombinator.com/*",
"*://old.reddit.com/*", "*://old.reddit.com/*",
"*://translate.google.com/*", "*://translate.google.com/*",
"*://hub.docker.com/*",
"chrome://*/*", "chrome://*/*",
"file://*", "file://*",
"qute://*/*", "qute://*/*",

View file

@ -1,203 +0,0 @@
import random
import re
from dataclasses import dataclass, field
from typing import Callable
from urllib import parse
from qutebrowser.api import interceptor
from qutebrowser.extensions.interceptors import QUrl, RedirectException
from qutebrowser.utils import message
@dataclass
class Service:
source: list[str] = field(default_factory=lambda: [])
target: list[str] = field(default_factory=lambda: [])
custom_targets: bool = False
preprocess: Callable[[QUrl], QUrl] | None = None
postprocess: Callable[[QUrl], QUrl] | None = None
def __contains__(self, item: str):
for source in self.source:
if re.search(source, item):
return True
return False
def scribe_global_identity(url: QUrl):
"""Fix external medium blog to scribe translation.
Some paths from medium will go through a 'global identity'
path which messes up the actual url path we want to go
to and puts it in queries. This puts it back on the path.
"""
path = parse.unquote(f"{url.path()}{url.query()}", encoding="ascii")
url.setQuery(None)
new_path = re.sub(r"m/global-identity-2redirectUrl=", "", path)
url.setPath(
parse.quote(new_path),
mode=QUrl.ParsingMode.StrictMode,
)
return url
def breezewiki_host_to_path(url: QUrl):
host = url.host()
if wiki := host[0 : host.find(".fandom.com")]:
url.setPath(f"/{wiki}{url.path()}")
return url
default_services = [
Service(source=["youtube.com"], target=["invidious"]),
Service(source=["stackoverflow.com"], target=["anonymousoverflow"]),
Service(source=["odysee.com"], target=["librarian"]),
Service(source=["reddit.com"], target=["redlib"]),
Service(source=["instagram.com"], target=["proxigram"]),
Service(source=["twitter.com"], target=["nitter"]),
Service(source=["imdb.com"], target=["libremdb"]),
Service(source=["tiktok.com"], target=["proxitok"]),
Service(source=["imgur.com"], target=["rimgo"]),
Service(
source=["medium.com"], target=["scribe"], postprocess=scribe_global_identity
),
Service(
source=["fandom.com"], target=["breezewiki"], preprocess=breezewiki_host_to_path
),
Service(source=["quora.com"], target=["quetre"]),
Service(source=["google.com"], target=["whoogle"]),
Service(source=["genius.com"], target=["dumb"]),
Service(source=["translate.google.com"], target=["lingva", "simplytranslate"]),
Service(source=["deepl.com"], target=["simplytranslate"]),
Service(source=["bandcamp.com"], target=["tent"]),
Service(
custom_targets=True,
source=["pinterest.com"],
target=[
"pain.thirtysix.pw",
"pt.bloat.cat",
"painterest.gitro.xyz",
],
),
Service(
custom_targets=True,
source=["tumblr.com"],
target=[
"pb.bloat.cat",
"tb.opnxng.com",
"priviblur.pussthecat.org",
"priviblur.thebunny.zone",
"priviblur.gitro.xyz",
"priviblur.canine.tools",
],
),
Service(
custom_targets=True,
source=["twitch.com"],
target=[
"safetwitch.drgns.space",
"safetwitch.projectsegfau.lt",
"stream.whateveritworks.org",
"safetwitch.datura.network",
"ttv.vern.cc",
"safetwitch.frontendfriendly.xyz",
"ttv.femboy.band",
"twitch.seitan-ayoub.lol",
"twitch.sudovanilla.org",
"safetwitch.r4fo.com",
"safetwitch.ducks.party",
"safetwitch.privacyredirect.com",
"st.ngn.tf",
"safetwitch.darkness.services",
"safetwitch.adminforge.de",
],
),
Service(
custom_targets=True,
source=["goodreads.com"],
target=[
"biblioreads.eu.org",
"biblioreads.vercel.app",
"biblioreads.mooo.com",
"bl.vern.cc",
"biblioreads.lunar.icu",
"read.whateveritworks.org",
"biblioreads.privacyfucking.rocks",
"read.seitan-ayoub.lol",
"read.freedit.eu",
"biblioreads.ducks.party",
"biblioreads.snine.nl",
"biblioreads.privacyredirect.com",
"reads.nezumi.party",
"br.bloat.cat",
"read.canine.tools",
],
),
]
@dataclass
class Redirects:
services: list[Service] = field(default_factory=lambda: default_services)
selector: Callable[[list[str]], str] = lambda c: c[
random.randint(0, len(c) - 1)
] # selection algorithm
farside_service: str = (
"farside.link" # Contains url for farside-like redirector (e.g. 'fastsi.de')
)
def __post_init__(self):
interceptor.register(self.intercept)
def intercept(self, request: interceptor.Request) -> None:
# TODO: Implement config check (maybe 'privacy.redirect = False?')
# if config.get(name="content.oss_redirects") is False:
# return
if (
request.resource_type != interceptor.ResourceType.main_frame
or request.request_url.scheme() in {"data", "blob"}
):
return
url = request.request_url
if url in self:
try:
request.redirect(self.get(url))
except RedirectException as e:
message.error(str(e))
def get(self, url: QUrl) -> QUrl:
service = self.get_service(url)
if not service:
return url
foss_host = self.selector(service.target)
if service.preprocess:
url = service.preprocess(url)
try:
if service.custom_targets:
url.setHost(foss_host)
else:
url.setHost(self.farside_service)
url.setPath(f"/{foss_host}{url.path()}")
except RedirectException as e:
message.error(str(e))
if service.postprocess:
url = service.postprocess(url)
return url
def get_service(self, url: QUrl) -> Service | None:
host = url.host()
for service in self.services:
if host in service:
return service
def __contains__(self, item: QUrl):
if self.get_service(item):
return True
return False
_ = Redirects()

View file

@ -0,0 +1,207 @@
import random
import re
from typing import Callable
from urllib import parse
from qutebrowser.api import interceptor
from qutebrowser.extensions.interceptors import QUrl, RedirectException
from qutebrowser.utils import message
def fixScribePath(url: QUrl):
"""Fix external medium blog to scribe translation.
Some paths from medium will go through a 'global identity'
path which messes up the actual url path we want to go
to and puts it in queries. This puts it back on the path.
"""
# double unquoting necessary!
# I suppose we double-wrap it earlier somewhere?
# unquoted = parse.unquote(
# url.path(options=QUrl.ComponentFormattingOption.FullyEncoded)
# )
path = parse.unquote(f"{url.path()}{url.query()}", encoding="ascii")
url.setQuery(None)
new_path = re.sub(r"m/global-identity-2redirectUrl=", "", path)
url.setPath(
parse.quote(new_path),
mode=QUrl.ParsingMode.StrictMode,
)
return url
type Service = dict[str, list[str]]
type Redirects = dict[str, Service]
redirects: Redirects = {
"youtube": {
"source": ["youtube.com"],
"farside": ["invidious"],
},
"stackoverflow": {
"source": ["stackoverflow.com", "askubuntu.com"],
"farside": ["anonymousoverflow"],
},
"lbry": {
"source": ["odysee.com"],
"farside": ["librarian"],
},
"reddit": {
"source": ["reddit.com"],
"farside": ["redlib"],
},
"instagram": {
"source": ["instagram.com"],
"farside": ["proxigram"],
},
"twitter": {
"source": ["twitter.com"],
"farside": ["nitter"],
},
"imdb": {
"source": ["imdb.com"],
"farside": ["libremdb"],
},
"translate": {
"source": ["translate.google.com"],
"farside": ["lingva"],
},
"tiktok": {
"source": ["tiktok.com"],
"farside": ["proxitok"],
},
"imgur": {
"source": ["imgur.com"],
"farside": ["rimgo"],
},
"medium": {
"source": ["medium.com"],
"farside": ["scribe"],
# "postprocess": fixScribePath
},
"fandom": {
"source": ["fandom.com"],
"farside": ["breezewiki"],
},
"quora": {
"source": ["quora.com"],
"farside": ["quetre"],
# "postprocess": lambda url: message.info(f"CALLING QUORA WITH {url}")
},
"google": {
"source": ["google.com"],
"target": [
"search.albony.xyz",
"search.garudalinux.org",
"search.dr460nf1r3.org",
"s.tokhmi.xyz",
"search.sethforprivacy.com",
"whoogle.dcs0.hu",
"gowogle.voring.me",
"whoogle.privacydev.net",
"wg.vern.cc",
"whoogle.hxvy0.gq",
"whoogle.hostux.net",
"whoogle.lunar.icu",
"wgl.frail.duckdns.org",
"whoogle.no-logs.com",
"whoogle.ftw.lol",
"whoogle-search--replitcomreside.repl.co",
"search.notrustverify.ch",
"whoogle.datura.network",
"whoogle.yepserver.xyz",
"search.nezumi.party",
],
},
"biblioreads": {
"source": ["goodreads.com"],
"target": [
"biblioreads.eu.org",
"biblioreads.vercel.app",
"biblioreads.mooo.com",
"bl.vern.cc",
"biblioreads.lunar.icu",
"read.whateveritworks.org",
"biblioreads.privacyfucking.rocks",
"read.seitan-ayoub.lol",
"read.freedit.eu",
"biblioreads.ducks.party",
"biblioreads.snine.nl",
"biblioreads.privacyredirect.com",
],
},
"safetwitch": {
"source": ["twitch.tv"],
"target": [
"safetwitch.drgns.space",
"safetwitch.projectsegfau.lt",
"stream.whateveritworks.org",
"safetwitch.datura.network",
"ttv.vern.cc",
"safetwitch.frontendfriendly.xyz",
"ttv.femboy.band",
"twitch.seitan-ayoub.lol",
"st.ggtyler.dev",
"safetwitch.lunar.icu",
"twitch.sudovanilla.com",
"safetwitch.r4fo.com",
"safetwitch.ducks.party",
"safetwitch.nogafam.fr",
"safetwitch.privacyredirect.com",
"st.ngn.tf",
],
},
}
def rewrite(request: interceptor.Request) -> None:
# if config.get(name="content.oss_redirects") is False:
# return
if (
request.resource_type != interceptor.ResourceType.main_frame
or request.request_url.scheme() in {"data", "blob"}
):
return
url = request.request_url
if service := _should_be_redirected(url.host()):
url = _farside_redirect(
url, _pick_random(service["farside" if "farside" in service else "target"])
)
try:
request.redirect(url)
except RedirectException as e:
message.error(str(e))
if "postprocess" in service and isinstance(service["postprocess"], Callable):
url = service["postprocess"](url)
def _farside_redirect(url: QUrl, service: str, use_fastside: bool = True) -> QUrl:
try:
url.setHost("fastside.link" if use_fastside else "farside.link")
url.setPath(f"/{service}{url.path()}")
except RedirectException as e:
message.error(str(e))
return url
def _pick_random[T](choices: list[T]) -> T:
return choices[random.randint(0, len(choices) - 1)]
def _should_be_redirected(
# TODO: Update to use typedefs/classes instead of this jumble
host: str,
redirects: Redirects = redirects,
) -> Service | None:
for service in redirects.values():
for source in service["source"]:
if re.search(source, host):
return service
return None
interceptor.register(rewrite)

View file

@ -18,7 +18,7 @@ c.url.searchengines = {
"l": "https://links.martyoeh.me/?searchterm={}&searchtags=", "l": "https://links.martyoeh.me/?searchterm={}&searchtags=",
"lib": "http://libgen.fun/search.php?req={}", "lib": "http://libgen.fun/search.php?req={}",
"man": "https://manned.org/browse/search?q={}", "man": "https://manned.org/browse/search?q={}",
"maps": "https://facilmap.org/#q={}", "maps": "https://www.qwant.com/maps/?q={}",
"pcw": "https://www.pcgamingwiki.com/w/index.php?search={}", "pcw": "https://www.pcgamingwiki.com/w/index.php?search={}",
"py": "https://pypi.org/search/?q={}", "py": "https://pypi.org/search/?q={}",
"r": "https://www.reddit.com/r/{}", "r": "https://www.reddit.com/r/{}",

View file

@ -7,11 +7,6 @@
#:bind o spawn --userscript /path/to/userscripts/qutedmenu open #:bind o spawn --userscript /path/to/userscripts/qutedmenu open
#:bind O spawn --userscript /path/to/userscripts/qutedmenu tab #:bind O spawn --userscript /path/to/userscripts/qutedmenu tab
warn() {
echo "$1" >&2
}
readonly confdir=${XDG_CONFIG_HOME:-$HOME/.config} readonly confdir=${XDG_CONFIG_HOME:-$HOME/.config}
readonly datadir=${XDG_DATA_HOME:-$HOME/.local/share} readonly datadir=${XDG_DATA_HOME:-$HOME/.local/share}
readonly optsfile=$confdir/dmenu/bemenucolors readonly optsfile=$confdir/dmenu/bemenucolors
@ -29,21 +24,8 @@ create_menu() {
printf -- '%s\n' "$url" printf -- '%s\n' "$url"
done <"$QUTE_CONFIG_DIR"/bookmarks/urls done <"$QUTE_CONFIG_DIR"/bookmarks/urls
# Saved sessions
if type yq >/dev/null 2>&1; then
while read -r url; do
printf -- '%s\n' "$url"
done < <(yq ".windows.[].tabs.[].history.[].url" "${QUTE_DATA_DIR}"/sessions/*.yml | sed -e 's/^"\(.*\)"$/\1/')
else
warn "Did not find yq executable, not searching saved sessions."
fi
# Finally history # Finally history
if type sqlite3 >/dev/null 2>&1; then printf -- '%s\n' "$(sqlite3 -separator ' ' "$QUTE_DATA_DIR/history.sqlite" 'select title, url from CompletionHistory')"
printf -- '%s\n' "$(sqlite3 -separator ' ' "$QUTE_DATA_DIR/history.sqlite" 'select title, url from CompletionHistory')"
else
warn "Did not find sqlite3 executable, not searching history."
fi
} }
get_selection() { get_selection() {
@ -74,6 +56,5 @@ url=${url/*http/http}
case $1 in case $1 in
open) printf '%s' "open $url" >>"$QUTE_FIFO" || qutebrowser "$url" ;; open) printf '%s' "open $url" >>"$QUTE_FIFO" || qutebrowser "$url" ;;
print) echo "$url" ;;
tab | *) printf '%s' "open -t $url" >>"$QUTE_FIFO" || qutebrowser "$url" ;; tab | *) printf '%s' "open -t $url" >>"$QUTE_FIFO" || qutebrowser "$url" ;;
esac esac

View file

@ -33,7 +33,7 @@ Options:
urls=("$@") urls=("$@")
while getopts "t:f:d:hcpP" opt; do while getopts "t:f:d:hcp" opt; do
case "$opt" in case "$opt" in
# v) verbose=1 # v) verbose=1
# ;; # ;;
@ -50,9 +50,6 @@ while getopts "t:f:d:hcpP" opt; do
ONLY_DO=clear ONLY_DO=clear
;; ;;
p) p)
ONLY_DO=status
;;
P)
ONLY_DO=remaining ONLY_DO=remaining
;; ;;
h | \? | *) h | \? | *)
@ -158,7 +155,6 @@ is_in_queue() { # 1=url
} }
add_to_queue() { # 1=url add_to_queue() { # 1=url
if is_in_queue "$1"; then return; fi if is_in_queue "$1"; then return; fi
echo "$1" >>"$queue_file" echo "$1" >>"$queue_file"
echo "added $url to queue." echo "added $url to queue."
@ -197,14 +193,6 @@ print_queue_remaining() {
wc -l "$queue_file" | cut -f1 -d' ' wc -l "$queue_file" | cut -f1 -d' '
} }
print_status() {
if is_only_instance; then
printf "stopped\n"
return
fi
printf "running\n"
}
main() { main() {
setup setup
if [ "$ONLY_DO" = "clear" ]; then if [ "$ONLY_DO" = "clear" ]; then
@ -213,9 +201,6 @@ main() {
elif [ "$ONLY_DO" = "remaining" ]; then elif [ "$ONLY_DO" = "remaining" ]; then
print_queue_remaining print_queue_remaining
exit exit
elif [ "$ONLY_DO" = "status" ]; then
print_status
exit
fi fi
for url in "$@"; do for url in "$@"; do

View file

@ -2,9 +2,7 @@
## Quickly bring up a file server for ## Quickly bring up a file server for
# the current directory. # the current directory.
if exist miniserve; then if exist sfz; then
alias serve="miniserve"
elif exist sfz; then
alias serve="sfz" alias serve="sfz"
elif exist gossa; then elif exist gossa; then
alias serve="gossa" alias serve="gossa"

View file

@ -1,21 +0,0 @@
#!/usr/bin/env sh
## Use the preferred system monitoring application
# when invoking top.
if exist btm; then
alias top="btm"
elif exist btop; then
alias top="btop"
elif exist gotop; then
alias top="gotop"
elif exist glances; then
alias top="glances"
elif exist bpytop; then
alias top="bpytop"
elif exist bashtop; then
alias top="bashtop"
elif exist htop; then
alias top="htop"
elif exist top; then
alias top="top"
fi

View file

@ -61,6 +61,7 @@ fi
export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc" export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc"
export SQLITE_HISTORY="$XDG_STATE_HOME/sqlite_history" export SQLITE_HISTORY="$XDG_STATE_HOME/sqlite_history"
export TEXMFVAR="$XDG_CACHE_HOME/texlive/texmf-var" export TEXMFVAR="$XDG_CACHE_HOME/texlive/texmf-var"
export TMUX_PLUGIN_MANAGER_PATH="$XDG_DATA_HOME/tmux"
export VAGRANT_HOME="$XDG_DATA_HOME/vagrant" export VAGRANT_HOME="$XDG_DATA_HOME/vagrant"
export WINEPREFIX="$XDG_DATA_HOME/wine" export WINEPREFIX="$XDG_DATA_HOME/wine"
export ZDOTDIR="$XDG_CONFIG_HOME/zsh" export ZDOTDIR="$XDG_CONFIG_HOME/zsh"

View file

@ -0,0 +1,57 @@
#!/usr/bin/env sh
exist() { type "$1" >/dev/null 2>&1; }
# alias tmux to follow xdg-specification
# shellcheck disable=2139
alias tmux="tmux -f ${XDG_CONFIG_HOME:-$HOME/.config}/tmux/tmux.conf"
# fzf
if exist fzf; then
# fzf select a tmux session to connect to, with pane preview
alias tm='_fzf_tmux_attach_start_session'
alias tl=tm
else
alias tm='tmux_attach_start'
# show a list of running tmux sessions
alias tl='tmux list-sessions -F "#{session_name}" 2>/dev/null '
fi
_fzf_tmux_list_sessions() {
tmux list-sessions -F "#{session_name}" 2>/dev/null | fzf \
--layout=reverse \
--height=50% \
--border \
--prompt="Session> " \
--preview="tmux_pane_tree {}" \
--preview-window=right:80% \
--print-query
}
_fzf_tmux_attach_start_session() {
if [ -z "$1" ]; then
result=$(_fzf_tmux_list_sessions)
case "$?" in
0)
# found a session, attaching
tmux_attach_start "$(echo "$result" | tail --lines=1)"
;;
1)
# did not find a session, creating
result=$(echo "$result" | head --lines=1)
# if . was only thing entered, create one for current dir
if [ "$result" = "." ]; then
tmux_attach_start
# create for query name
else
tmux_attach_start "$result"
fi
;;
esac
else
tmux_attach_start "$1"
fi
}
unset choice
unset -f exist

View file

@ -1,82 +0,0 @@
format = """
$sudo\
$username\
$directory\
$git_state\
$git_status\
$status\
$character
"""
right_format ="""
$cmd_duration\
$hostname\
$git_branch\
$fossil_branch\
$go\
$lua\
$nodejs\
$python\
$package
"""
[directory]
style = "blue"
fish_style_pwd_dir_length = 1
read_only = " "
read_only_style = "purple"
[character]
success_symbol = "[](purple)"
error_symbol = "[](red)"
vimcmd_symbol = "[](green)"
[git_branch]
format = "[$branch]($style) "
style = "bright-black"
[git_status]
format = "[[(*$conflicted$untracked$modified$staged$renamed$deleted)](218) ($ahead_behind$stashed)]($style) "
style = "cyan"
conflicted = ""
untracked = ""
modified = ""
staged = ""
renamed = ""
deleted = ""
stashed = "≡"
[git_state]
format = '\([$state( $progress_current/$progress_total)]($style)\) '
style = "bright-black"
[cmd_duration]
format = "[$duration]($style) "
style = "yellow"
[python]
format = "[$virtualenv]($style) "
style = "bright-black"
[fossil_branch]
[line_break]
disabled = true
[package]
symbol = ""
style = "blue"
[status]
disabled = false
symbol = " "
[sudo]
disabled = false
symbol = " 󱍔 "
style = 'bold yellow'
format = "[$symbol]($style)"
# TODO: Would be lovely to have jujutsu support here
# An example implementation: https://github.com/jj-vcs/jj/wiki/Starship
# But currently very slow. Can be added with e.g. '${custom.jj}\' in format above

View file

@ -0,0 +1,13 @@
rename-window dot-git
send-keys "cd ~/.dotfiles; while true; do [[ -z $(git status -s) ]] && { fd -t f --hidden | entr -cd tea issue ;} || { fd -t f --hidden | entr -cd git -c color.ui=always diff ;} ; done"
split-window -h "cd ~/.dotfiles; while true; do fd -t f --hidden --exclude .git/objects | entr -cd git -c color.ui=always status; done"
split-window -v
send-keys "cd ~/.dotfiles; clear" C-m L C-m
select-pane -t 1
split-window -v "cd ~/.dotfiles; while true; do fd -t f --hidden --exclude .git/objects | entr -cd git -c color.ui=always log --graph --date=short --decorate --oneline --all --remotes; done"
select-pane -t 4
new-window -n code
send-keys "cd ~/.dotfiles; v ." C-m zo
new-window -n test
select-window -t 1
attach-session -t . -c ~/.dotfiles

View file

@ -0,0 +1,9 @@
rename-window server
send-keys "mopidy" C-m
new-window -n player
send-keys "ncmpcpp" C-m
new-window -n mixer
send-keys "pulsemixer" C-m
new-window -n bluetooth
send-keys "bluetoothctl" C-m
select-window -t 2

View file

@ -0,0 +1,7 @@
rename-window notes
send-keys vm Space $WIKIROOT Space $LIBRARY C-m
new-window -n notepad
send-keys cd Space $WIKIROOT C-m
send-keys v C-m
send-keys Space w w
attach-session -t . -c $WIKIROOT

View file

@ -0,0 +1,10 @@
rename-window mail
send-keys "neomutt" C-m
new-window -n news
send-keys "newsboat" C-m
split-window -h
send-keys "tut" C-m
new-window -n matrix
send-keys "gomuks" C-m
new-window -n signal
send-keys "siggo" C-m

View file

@ -0,0 +1,4 @@
rename-window stats
send-keys "cd ~/documents/records; v workout.md" C-m
new-window -n routine
send-keys "cd ~/documents/records; sc-im workout.csv" C-m

View file

@ -0,0 +1,15 @@
rename-window focus
send-keys tasksh C-m "+TODAY" C-m
new-window -n dash
send-keys "cd ${XDG_DATA_HOME:-~/.local/share}/task/; fd . | entr -c task next" C-m
split-window -h -l 71
send-keys "cd ${XDG_DATA_HOME:-~/.local/share}/task/; fd . | entr -c task summary" C-m
split-window -v "cd ${XDG_DATA_HOME:-~/.local/share}/task/; fd . | entr -c task status:pending or +ACTIVE burndown"
select-pane -t 1
split-window -v -l 5
send-keys "t" Space
new-window -n journal
send-keys "calcurse" C-m
split-window -h -l 35% "ls ~/documents/records/jrnl.md | entr -c jrnl -5"
split-window -v -l 10%
select-window -t 2

View file

@ -0,0 +1,183 @@
# Layout of this conf file:
# 1. Global Settings
# 2. Plugins
# 3. Keybinds
# 4. Theme
# For rapid change prototyping, disabled normally:
# bind-key r source-file ~/.config/tmux/tmux.conf \; display-message "config reloaded."
######################
### 1. GLOBAL SETTINGS
######################
# show that activity happens but don't display a huge 'activity happening' notification
setw -g monitor-activity on
set -g visual-activity off
# Start counting windows and panes at 1
set -g base-index 1
setw -g pane-base-index 1
set -g renumber-windows on
# Terminal improvements
set-window-option -g automatic-rename on
set-option -g set-titles on
set -g mouse on
# allow truecolor support
set -g default-terminal 'xterm-256color'
set -ga terminal-overrides ',xterm-256color:Tc'
set -g status-keys vi
set-window-option -g mode-keys vi
set -g history-limit 10000
# Screen size is based on the smallest client looking at the current windows, not the smallest
# client connected to the overall session. If two clients are connected to the same session but not
# looking at the same window, why would they care about each others screen size?
setw -g aggressive-resize on
# No delay for escape key press
set -sg escape-time 0
# to enable autoread option in neovim
set-option -g focus-events on
####################
## 2. PLUGINS ##
####################
set -g @tpm_plugins ' \
tmux-plugins/tpm \
tmux-plugins/tmux-sensible \
christoomey/vim-tmux-navigator \
Morantron/tmux-fingers \
'
set -g @fingers-key F
# make sure tpm is installed
if-shell "test ! -d $TMUX_PLUGIN_MANAGER_PATH/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm $TMUX_PLUGIN_MANAGER_PATH/tpm && $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins'" \
# optinally add this to install plugins on each start -- adds small lag to startup
# "run-shell $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins"
#####################
## 3. KEYBINDINGS ##
#####################
# Unbind some defaults
unbind '"'
unbind %
# Custom modifier key
set -g prefix C-a
unbind-key C-b
bind-key -r C-a send-prefix
# Window Navigation - Prefix + Vim Keys
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
# Resize Panes
bind-key -r H resize-pane -L 3
bind-key -r J resize-pane -D 1
bind-key -r K resize-pane -U 1
bind-key -r L resize-pane -R 3
bind-key -r C-H resize-pane -L 10
bind-key -r C-J resize-pane -D 5
bind-key -r C-K resize-pane -U 5
bind-key -r C-L resize-pane -R 10
# Send Pane to a new window (but stay on current window), join it back into the current window
bind-key B break-pane -d
bind-key C-b command-prompt -p "join pane from: " "join-pane -h -s '%%'"
# Swap panes within the current window (swaps pane # entered with currently selected pane)
bind-key b display-panes\; command-prompt -p "pane #: " "swap-pane -t '%%'"
# Kill tabs quicker
bind-key x kill-pane
bind-key C-x kill-window
# Split Window into panes - automatically handled by plugin
bind-key '\' split-window -h -c '#{pane_current_path}'
bind-key '-' split-window -v -c '#{pane_current_path}'
# Open a sessions chooser
bind C-s split-window -v "tmux list-sessions | sed -E 's/:.*$//' | grep -v \"^$(tmux display-message -p '#S')\$\" | fzf --reverse | xargs tmux switch-client -t"
# Make visual selections act a little more like vim
bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi V send -X select-line
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel 'wl-copy' \; send -X rectangle-off
bind-key -T copy-mode-vi 'C-v' send -X begin-selection \; send -X rectangle-on
#####################
## 4. THEME ##
#####################
# Status update interval
set -g status-interval 1
# Clock mode
set -g clock-mode-colour colour24
set -g clock-mode-style 24
# This tmux statusbar config was created by tmuxline.vim
# on Wed, 13 Mar 2019
set -g message-command-style bg="#2e2e2e",fg="#c8c8c8"
set -g message-style bg="#2e2e2e",fg="#c8c8c8"
set -g pane-active-border-style fg="#2e2e2e"
set -g pane-border-style fg="#2e2e2e"
set -g status-justify "centre"
set -g status "on"
set -g status-style "none"
set -g status-style "none"
set -g status-left-length "100"
set -g status-right-length "100"
setw -g window-status-style fg="#c8c8c8",bg="#2e2e2e","none"
setw -g window-status-activity-style bg="#2e2e2e",fg="#c8c8c8","underscore"
setw -g window-status-separator ""
set -g status-left "#[fg=#c8c8c8,bg=#2e2e2e] #S #[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]#[fg=#c8c8c8,bg=#2e2e2e] #I:#P #[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]#[fg=#c8c8c8,bg=#2e2e2e] #[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]"
set -g status-right "#[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics] #[fg=#c8c8c8,bg=#2e2e2e] #{?client_prefix,#[fg=colour232]#[bg=brightblue],} #(whoami) #[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]#[fg=#c8c8c8,bg=#2e2e2e] %d-%b-%y #[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]#[fg=#c8c8c8,bg=#2e2e2e] #H "
setw -g window-status-format "#[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]#[default] #I #W #[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]"
setw -g window-status-current-format "#[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]#[fg=#c8c8c8,bg=#2e2e2e]  #I #W #[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]"
########################
## 5. Nested Sessions ##
########################
# from: https://github.com/samoshkin/tmux-config/blob/master/tmux/tmux.conf
# all credit to samoshkin
# Session is considered to be remote when we ssh into host
if-shell 'test -n "$SSH_CLIENT"' \
'source-file $XDG_CONFIG_HOME/tmux/tmux.remote.conf'
# We want to have single prefix key "C-a", usable both for local and remote session
# we don't want to "C-a" + "a" approach either
# Idea is to turn off all key bindings and prefix handling on local session,
# so that all keystrokes are passed to inner/remote session
# see: toggle on/off all keybindings · Issue #237 · tmux/tmux - https://github.com/tmux/tmux/issues/237
# Also, change some visual styles when window keys are off
bind -T root F12 \
set prefix None \;\
set key-table off \;\
set status-style fg="colour245",bg="colour238" \;\
set window-status-current-format "#[fg=$color_window_off_status_bg,bg=$color_window_off_status_current_bg]$separator_powerline_right#[default] #I:#W# #[fg=$color_window_off_status_current_bg,bg=$color_window_off_status_bg]$separator_powerline_right#[default]" \;\
set window-status-current-style fg="colour232",bg="colour254","bold" \;\
if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
refresh-client -S \;\
bind -T off F12 \
set -u prefix \;\
set -u key-table \;\
set -u status-style \;\
set -u window-status-current-style \;\
set -u window-status-current-format \;\
refresh-client -S
run -b "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm"

View file

@ -0,0 +1,10 @@
# show status bar at bottom for remote session,
set -g status-position bottom
# Set port of SSH remote tunnel, where tmux will pipe buffers to transfer on local machine for copy
set -g @copy_backend_remote_tunnel_port 11988
# In remote mode we don't show "clock" and "battery status" widgets
set -g status-left "#[fg=#c8c8c8,bg=#2e2e2e][SSH]#S #[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]#[fg=#c8c8c8,bg=#2e2e2e] #(whoami) #[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]#[fg=#c8c8c8,bg=#2e2e2e] #I:#P #[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]"
set -g status-right "#{prefix_highlight} $wg_is_keys_off $wg_is_zoomed #{sysstat_cpu} | #{sysstat_mem} | #{sysstat_loadavg} | $wg_user_host | #{online_status}"
set -g status-right "#[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]#{prefix_highlight} #H "

View file

@ -305,21 +305,16 @@ nnoremap <space>C :fzfcdhome<cr>
nnoremap <space>w :grep<space> nnoremap <space>w :grep<space>
" external commands " external commands
if executable('atool') " extract currently selected file(s)
" extract currently selected file(s) noremap ,xx :!atool -x %f<cr>
noremap ,xx :!atool -x %f<cr> " compress currently selected file(s)
" compress currently selected file(s) noremap ,xc :!atool -a %c:r.tar.gz %f<cr>
noremap ,xc :!atool -a %c:r.tar.gz %f<cr> " archive currently selected file(s)
" archive currently selected file(s) noremap ,xa :!atool -a %c:r.tar %f<cr>
noremap ,xa :!atool -a %c:r.tar %f<cr> " zip currently selected file(s)
" zip currently selected file(s) noremap ,xz :!atool -a %c:r.zip %f<cr>
noremap ,xz :!atool -a %c:r.zip %f<cr> " combine selected PDFs into single one (named output.pdf)
endif noremap ,pc :!pdftk %f cat output output.pdf
if executable('pdftk')
" combine selected PDFs into single one (named output.pdf)
noremap ,pc :!pdftk %f cat output output.pdf
endif
" preview thumbnails of current folder " preview thumbnails of current folder
" select thumbnails with m/M in nsxiv " select thumbnails with m/M in nsxiv
@ -328,27 +323,7 @@ nnoremap ,t :!vifm-thumbnailer -t %u %c<cr>
nnoremap ,T :!vifm-thumbnailer -r -t %u %c<cr> nnoremap ,T :!vifm-thumbnailer -r -t %u %c<cr>
" batch rename or delete files in current dir " batch rename or delete files in current dir
if executable('edir') nnoremap ,r :!vidir<cr>
nnoremap ,rr :!edir<cr>
nnoremap ,rf :!edir --files<cr>
nnoremap ,rd :!edir --dirs<cr>
nnoremap ,rR :!edir --all --depth=10<cr>
elseif executable('vidir')
nnoremap ,rr :!vidir<cr>
if executable('find')
nnoremap ,rf :!find . -maxdepth 1 -type f | vidir -<cr>
nnoremap ,rd :!find . -maxdepth 1 -type d | vidir -<cr>
nnoremap ,rR :!find . | vidir -<cr>
endif
endif
if executable('zoxide')
" integrate zoxide search and add any vifm-visited paths automatically
" adapted from https://q2a.vifm.info/949/how-can-i-integrate-zoxide-into-vifm
command! zoxide :set noquickview | :execute 'cd' fnameescape(system('zoxide query --interactive "%a" 2>/dev/tty')) '%IU' | redraw
nnoremap <space>z :zoxide<cr>
autocmd DirEnter * !zoxide add %d %i
endif
" allows preview to work for normal view and single pane view " allows preview to work for normal view and single pane view
noremap <silent> w : if layoutis('only') noremap <silent> w : if layoutis('only')
@ -466,8 +441,6 @@ fileviewer *.[1-8] man ./%c | col -b
" Images " Images
filextype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm filextype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm
\ {View in vimiv}
\ vimiv %f,
\ {View in imv} \ {View in imv}
\ imv %f %i, \ imv %f %i,
\ {View in viu} \ {View in viu}
@ -476,6 +449,8 @@ filextype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm
\ vifm-thumbnailer %c, \ vifm-thumbnailer %c,
\ {View in nsxiv} \ {View in nsxiv}
\ nsxiv %f, \ nsxiv %f,
\ {View in vimiv}
\ vimiv %f,
\ {View in sxiv} \ {View in sxiv}
\ sxiv %f, \ sxiv %f,
\ {View in feh} \ {View in feh}
@ -617,10 +592,9 @@ fileviewer */
\ tree -L 2, \ tree -L 2,
" markdown text " markdown text
fileviewer *.md,*.markdown,*.mkd,*.mdx,*.rmd,*.Rmd,*.quarto,*.mdwiki fileviewer *.md
\ bat --color=always --style=plain --language md | less -FRX \ [ "$TERM_DARK" = "true" ] && glow --style=dark %c || glow --style=light %c,
" glow has ceased to work w/ version 2.0.0 \ bat --color=always --style=plain
" \ [ "$TERM_DARK" = "true" ] && glow -p --style=dark %c || glow -p --style=light %c,
" use custom viewer script for rest " use custom viewer script for rest
fileviewer * vifm-default-viewer %c fileviewer * vifm-default-viewer %c
@ -628,6 +602,45 @@ fileviewer * vifm-default-viewer %c
" use our own custom opener " use our own custom opener
filetype * open filetype * open
" Syntax highlighting in preview
"
" Explicitly set highlight type for some extensions
"
" 256-color terminal
" fileviewer *.[ch],*.[ch]pp highlight -O xterm256 -s dante --syntax c %c
" fileviewer Makefile,Makefile.* highlight -O xterm256 -s dante --syntax make %c
"
" 16-color terminal
" fileviewer *.c,*.h highlight -O ansi -s dante %c
"
" Or leave it for automatic detection
"
" fileviewer *[^/] pygmentize -O style=monokai -f console256 -g
" Displaying pictures in terminal
"
" fileviewer *.jpg,*.png shellpic %c
" Open all other files with default system programs (you can also remove all
" :file[x]type commands above to ensure they don't interfere with system-wide
" settings). By default all unknown files are opened with 'vi[x]cmd'
" uncommenting one of lines below will result in ignoring 'vi[x]cmd' option
" for unknown file types.
" For *nix:
" filetype * xdg-open
" For OS X:
" filetype * open
" For Windows:
" filetype * start, explorer
" }}}
" Various customization examples
" Add additional place to look for executables
"
" let $PATH = $HOME.'/bin/fuse:'.$PATH
" Block particular shortcut " Block particular shortcut
" "
" nnoremap <left> <nop> " nnoremap <left> <nop>

View file

@ -0,0 +1,12 @@
#compdef _tmux_attach_start
#
# Requires tmux_attach_start script in path
#
# Enables completion for zsh of tmux_attach_start function
# with currently open sessions, or tmux options.
_tmux_attach_start() {
_alternative \
"sessions:user sessions:($(tmux list-sessions -F'#{session_name}' 2>/dev/null))"
}

View file

@ -0,0 +1,39 @@
setup() {
fut="$BATS_TEST_DIRNAME/../tmux_attach_start"
}
teardown() {
rm -rf $BATS_TMPDIR/xdg/*
}
@test "runs correctly if invoked without arguments" {
run $fut
echo "$BATS_TEST_DIRNAME/../tmux_attach_start"
[ "$status" -eq 0 ]
}
@test "Errors out if passed a non-existent session file (and some session name)" {
run $fut IDONT_EXIST_HERE.session sessionname
echo "STATUS: $output"
[ "$status" -eq 1 ]
echo "OUTPUT: $output"
[ "$output" = "can not source session file: 'IDONT_EXIST_HERE.session' does not exist." ]
}
@test "Runs without errors when session file exists in PWD" {
touch $PWD/exists.session
run $fut exists.session sessionname
rm $PWD/exists.session
[ "$status" -eq 0 ]
}
@test "Runs without errors when session file exists in XDG_CONFIG_HOME/tmux/sessions/" {
export XDG_CONFIG_HOME=$BATS_TMPDIR
mkdir -p $XDG_CONFIG_HOME/tmux/sessions
sesdir=$XDG_CONFIG_HOME/tmux/sessions
touch $sesdir/exists.session
run $fut exists.session sessionname
[ "$status" -eq 0 ]
}

View file

@ -0,0 +1,154 @@
#!/bin/sh
#
# Attach to a tmux session, or create it if it doesnt exist
if [ "$1" = '-h' ] || [ "$1" = '--help' ]; then
cat <<-EOF
Usage: $0 [FILE] [NAME]
Attach to an existing tmux session, or bootstrap a new session.
If no session exists which fits the criteria, this will create a new one and
load it up obeying the commands contained in the FILE argument passed in. It
must contain commands which are tmux-command compatible since they will be
passed to tmux unmodified. If a session exists and a valid configuration FILE is
passed, it will attach itself to the session and execute the session setup inside.
It will load the default tmux.conf in the following order:
- XDG_CONFIG_HOME/tmux/tmux.conf (usually ~/.config/tmux/tmux.conf)
- ~/.tmux.conf
- /etc/tmux.conf
Afterwards, it will apply the contents of the FILE argument passed into the command.
If no FILE argument is passed it will create an empty session, or attach itself to
the session specified.
If no NAME argument is passed it will automatically create a session name from the
FILE argument passed.
If creating a new session without passing in a FILE argument, and the current directory
contains a .tmux.session file, it will automatically use that to set up the session.
By default, it also looks for valid session files in XDG_CONFIG_HOME/tmux/sessions/
This path can be changed by setting the TM_SESSION_PATH environment variable.
EOF
exit 0
fi
# Make tmux obey the XDG specification on startup
if [ -e "$XDG_CONFIG_HOME/tmux/tmux.conf" ]; then
start="tmux -f $XDG_CONFIG_HOME/tmux/tmux.conf"
else
start=tmux
fi
_file_exists() {
if [ -f "$1" ]; then
true
else
false
fi
}
_not_in_tmux() {
[ -z "$TMUX" ]
}
_session_exists() {
if tmux has-session -t "$session_name" >/dev/null 2>&1; then
true
else
false
fi
}
_create_detached_session() {
($start new-session -d -s "$session_name")
}
_load_env_session_file() {
if [ -f ./.tmux.session ]; then
xargs -L1 tmux <./.tmux.session
fi
}
_load_session_file() {
if [ -f "$session_file" ]; then
xargs -L1 tmux <"$session_file"
fi
}
_set_session_file_path() {
# Prefer local dir if file exists there, fall back to root dir
if _file_exists "${1}"; then
session_file="${1}"
elif _file_exists "${session_dir}${1}"; then
session_file="${session_dir}${1}"
fi
}
_set_session_vars() {
session_dir=${TM_SESSION_DIR:-"$XDG_CONFIG_HOME/tmux/sessions/"}
# set up session name and config file - if passed in as arguments
if [ "$#" -eq 2 ]; then
if ! _file_exists "$1" && ! _file_exists "${session_dir}${1}"; then
echo >&2 "can not source session file: '${1}' does not exist."
exit 1
fi
_set_session_file_path "$1"
session_name=${2}
elif [ "$#" -eq 1 ]; then
_set_session_file_path "$1"
if ! _file_exists "$session_file"; then
session_name=${1}
fi
fi
# set default session name if none was passed
if [ -z "$session_name" ]; then
# only if we have a filename should we append it to the session name
if [ -n "$session_file" ]; then
fname=/$(basename "$session_file" .session)
fi
# default to parent directory name / config file name for the session
session_name=$(basename "$PWD" | sed 's/[^a-zA-Z0-9\-]//g' | tr . -)"$fname"
fi
}
_attach_or_create() {
# first create a new session if one doesn't exist
if ! _session_exists; then
_create_detached_session
# look for .tmux.session file if no file has been explicitly passed in
# session files always take precedence over environment files when specifically passed in
if ! _file_exists "$session_file"; then
_load_env_session_file
fi
fi
_load_session_file
# then attach or switch to the session
if _not_in_tmux; then
$start attach -t "$session_name"
else
$start switch-client -t "$session_name"
fi
_unset_functions
}
_unset_functions() {
unset _set_session_vars
unset _set_session_file_path
unset _attach_or_create
unset _load_session_file
unset _create_detached_session
unset _session_exists
unset _not_in_tmux
unset _file_exists
}
_set_session_vars "$@"
_attach_or_create
exit 0

View file

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# create a tree-style view
# of all open tmux panes
# and the command they are currently running
tmux ls -F'#{session_id}' | while read -r s; do
S=$(tmux ls -F'#{session_id}#{session_name}: #{T:tree_mode_format}' | grep ^"$s")
session_info=${S##$s}
session_name=$(echo "$session_info" | cut -d ':' -f 1)
if [[ -n "$1" ]] && [[ "$1" == "$session_name" ]]; then
echo -e "\033[1;34m$session_info\033[0m"
tmux lsw -t"$s" -F'#{window_id}' | while read -r w; do
W=$(tmux lsw -t"$s" -F'#{window_id}#{T:tree_mode_format} - #{pane_current_command}' | grep ^"$w")
H=$(tmux lsw -t"$s" -F'#{window_id}#H' | grep ^"$w")
echo " ﬌ ${W##$w}" | sed "s/\"${H##$w}\" //"
done
else
echo -e "\033[1m$session_info\033[0m"
fi
done

View file

@ -1,41 +0,0 @@
[user]
email = "marty.oehme@gmail.com"
name = "Marty Oehme"
[signing]
backend = "gpg"
key = "73BA40D5AFAF49C9"
[git]
sign-on-push = true
subprocess = true
private-commits = "description(glob:'wip:*') | description(glob:'private:*')" # refuse to push WIP commits
[ui]
diff-editor = ["nvim", "-c", "DiffEditor $left $right $output"]
pager = "delta"
[ui.diff]
format = "git" # for the time being to use delta well
[templates]
draft_commit_description = '''
concat(
description,
surround(
"\nJJ: This commit contains the following changes:\n", "",
indent("JJ: ", diff.stat(72)),
),
"\nJJ: ignore-rest\n",
diff.git(),
)
'''
[revsets]
log = "ancestors(@, 5) | ancestors(trunk()..(visible_heads() & mine()), 2) | trunk()"
[revset-aliases]
"bases" = "dev"
"downstream(x,y)" = "(x::y) & y"
"branches" = "downstream(trunk(), bookmarks()) & mine()"
"curbranch" = "latest(branches::@- & branches)"

View file

@ -1,71 +0,0 @@
#!/usr/bin/env sh
if ! exist jj; then
return 1
fi
alias j="jj"
if exist lazyjj; then
alias lj="lazyjj"
fi
alias jn="jj new"
alias jds="jj describe"
alias jc="jj commit"
# finding out the current snapshot
js() {
if [ "$#" -eq 0 ]; then
jj status
else
jj show "$*"
fi
}
alias jw="jj show"
alias jd="jj diff"
# for describe-and-edit workflows
# https://steveklabnik.github.io/jujutsu-tutorial/real-world-workflows/the-edit-workflow.html
alias je="jj edit"
alias jee="jj next --edit"
# for squash-and-go workflows
# https://steveklabnik.github.io/jujutsu-tutorial/real-world-workflows/the-squash-workflow.html
alias jss="jj squash"
alias jsi="jj squash --interactive"
# oops buttons
alias ju="jj undo"
# for damn,-forgot-to-split-this-commit workflow
# Creates a new commit before with your selected changes, lets you describe it and carry on
alias ji="jj new -B@ --no-edit && jj squash --interactive && jj edit '@-' && jj describe && jj edit '@+'"
# revset info
alias jl="jj log -T builtin_log_oneline"
alias jL="jj log -r 'all()'"
alias jlo="jj log --summary"
alias jLO="jj log --summary -r 'all()'"
alias jloo="jj log --patch"
alias jol="jj op log"
jlf() {
jj log -r "description($*)"
}
jlof() {
jj log --summary -r "description($*)"
}
jloof() {
jj log --patch -r "description($*)"
}
# show branches (i.e. head commits) w a couple previous commits
alias jh="jj log -r 'ancestors(heads(all()), 3)'"
alias jrb="jj rebase"
# 'branching' bookmark work
alias jb="jj bookmark"
alias jbm="jj bookmark set main"
# remote work
alias jrv="jj git remote list"
alias jp="jj git push"

View file

@ -13,7 +13,7 @@ journals:
default: default:
journal: ~/documents/records/jrnl.md journal: ~/documents/records/jrnl.md
linewrap: 79 linewrap: 79
tagsymbols: + tagsymbols: '+'
template: false template: false
timeformat: '%F %r' timeformat: '%F %r'
version: v4.2 version: v4.1

166
writing/.config/pubs/pubsrc Normal file
View file

@ -0,0 +1,166 @@
[main]
# Where the pubs repository files (bibtex, metadata, notes) are located
pubsdir = ~/documents/library
# Where the documents files are located (default: $(pubsdir)/doc/)
docsdir = ~/documents/library/doc
# Specify if a document should be copied or moved in the docdir, or only
# linked when adding a publication.
doc_add = copy
# the command to use when opening document files
open_cmd = open
# which editor to use when editing bibtex files.
# if using a graphical editor, use the --wait or --block option, i.e.:
# "atom --wait"
# "kate --block"
# If set to an empty string (default) pubs uses the value of the environment
# variable $EDITOR.
edit_cmd = ""
# Which default extension to use when creating a note file.
note_extension = md
# How many authors to display when displaying a citation. If there are more
# authors, only the first author is diplayed followed by 'et al.'.
max_authors = 3
# If true debug mode is on which means exceptions are not catched and
# the full python stack is printed.
debug = False
# If true the citekey is normalized using the 'citekey_format' on adding new publications.
normalize_citekey = False
# String specifying how to format the citekey. All strings of
# the form '{substitution:modifier}' and '{substitution}' will
# be substituted with their appropriate values. The following
# substitutions are used:
# author_last_name: last name of the first author
# year: year of publication
# short_title: first word of the title (excluding words such as "the", "an", ...)
# modifiers:
# l: converts the text to lowercase
# u: converts the text to uppercase
# examples:
# {author_last_name:l}{year} generates 'yang2020'
# {author_last_name}{year}{short_title} generates 'Yang2020Towards'
# {author_last_name:l}{year}{short_title:l} generates 'yang2020towards'
# {author_last_name:u}{year} generates 'YANG2020'
#
citekey_format = {author_last_name}{year}
# which bibliographic fields to exclude from bibtex files. By default, none.
# Please note that excluding critical fields such as `title` or `author`
# will break many commands of pubs.
exclude_bibtex_fields = ,
[formating]
# Enable bold formatting, if the terminal supports it.
bold = True
# Enable italics, if the terminal supports it.
italics = True
# Enable colors, if the terminal supports it.
color = True
[theme]
# Here you can define the color theme used by pubs, if enabled in the
# 'formating' section. Predefined theme are available at:
# https://github.com/pubs/pubs/blob/master/extra/themes.md
# Available colors are: 'black', 'red', 'green', 'yellow', 'blue', 'purple',
# 'cyan', and 'grey'. Bold colors are available by prefixing 'b' in front of
# the color name ('bblack', 'bred', etc.), italic colors by prefixing 'i',
# and bold italic by prefixing 'bi'. Finally, 'bold', 'italic' and
# 'bolditalic' can be used to apply formatting without changing the color.
# For no color, use an empty string ''
# messages
ok = green
warning = yellow
error = red
# ui elements
filepath = bold
citekey = purple
tag = cyan
# bibliographic fields
author = bold
title = ""
publisher = ""
year = bold
volume = bold
pages = ""
[plugins]
# Comma-separated list of the plugins to load.
# Currently pubs comes with built-in plugins alias and git.
active = alias,git
[[alias]]
# new subcommands can be defined, e.g.:
# print = open --with lp
# evince = open --with evince
# shell commands can also be defined, by prefixing them with a bang `!`, e.g:
# count = !pubs list -k | wc -l
# aliases can also be defined with descriptions using the following configobj
# subsectioning. NOTE: any aliases defined this way should come after all other
# aliases, otherwise simple aliases will be ignored.
# [[[count]]]
# command = !pubs list -k | wc -l
# description = lists number of pubs in repo
# new subcommands can be defined, e.g.:
# print = open --with lp
# evince = open --with evince
# shell commands can also be defined, by prefixing them with a bang `!`, e.g:
# count = !pubs list -k | wc -l
# aliases can also be defined with descriptions using the following configobj
# subsectioning. NOTE: any aliases defined this way should come after all other
# aliases, otherwise simple aliases will be ignored.
# [[[count]]]
# command = !pubs list -k | wc -l
# description = lists number of pubs in repo
# To use commas in the description, wrap them in a "" string. For example:
# description = "lists number of pubs in repo, greets the user afterward"
[[git]]
# The git plugin will commit changes to the repository in a git repository
# created at the root of the pubs directory. All detected changes will be
# commited every time a change is made by a pubs command.
# The plugin also propose the `pubs git` subcommand, to directly send git
# commands to the pubs repository. Therefore, `pubs git status` is equivalent
# to `git -C <pubsdir> status`, with the `-C` flag instructing
# to invoke git as if the current directory was <pubsdir>. Note that a
# limitation of the subcommand is that you cannot use git commands with the
# `-c` option (pubs will interpret it first.)
# if False, will display git output when automatic commit are made.
# Invocation of `pubs git` will always have output displayed.
quiet = True
# if True, git will not automatically commit changes
manual = False
# if True, color will be conserved from git output (this add `-c color:always`
# to the git invocation).
force_color = True
[internal]
# The version of this configuration file. Do not edit.
version = 0.9.0

View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
pubs() {
command pubs --config "$XDG_CONFIG_HOME/pubs/pubsrc" "${@}"
if [ -f "$BIBFILE" ]; then
command pubs export > "$BIBFILE"
fi
}

View file

@ -0,0 +1,10 @@
#!/usr/bin/env sh
#
n() {
if [ $# -eq 0 ]; then
zk edit -i
else
zk "${@}"
fi
}

View file

@ -0,0 +1,4 @@
#!/usr/bin/env sh
#
export ZK_NOTEBOOK_DIR="${WIKIROOT:-~/documents/notes/}/pinky"

147
writing/.local/bin/bib-due Executable file
View file

@ -0,0 +1,147 @@
#!/usr/bin/env sh
# shows due entries of bibtex file passed in
# HACK: brittle! will break on various bibfile abnormities (even just on due date w/o priority)
# FIXME: reimplementation with real library needed
#
OPTIND=1 # Reset in case getopts has been used previously in the shell.
fields="due|priority|\bauthor\b|\btitle\b"
filterby="due"
file="${BIBFILE}"
until=""
show_help() {
printf "%s\n" \
"" \
" bib-due Show due readings from bibtex file." \
"" \
" Usage: bib-due [-hv] -i input.bib -r 'due|priority|\bauthor|\btitle' -l 'due' -u '2020-05-12'" \
"" \
" Options:" \
"" \
" -i [bibtex-file] Input bibtex file to scrape and get items from." \
"" \
" -r [fields] Field values to read in file." \
"" \
" -l [filter] Field to use as filter entity." \
" This field is required for the scraper to pick entries up." \
"" \
" help | -h | --help Print out this help." \
"" \
" Invoked without arguments, bib-due will scrape the file defined in BIBFILE environment variable, " \
" filtering entries with the 'due' field, and getting the values for 'due', 'priority', 'author', " \
" and 'title' fields. It will then print the entries to stdout." \
"" \
" Example output line:" \
"" \
' 2020-06-25 (1): Sergei Gerasymchuk -- “Ze” time in Ukraine (Gerasymchuk2019) ' \
""
}
filter_until() {
# filter for dates, with line numbers
filtered=$(echo "$entries" | grep -noE '[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}')
# redirect entries to fifo pipe
mkfifo filteredentries
finish() {
rm filteredentries
}
trap finish EXIT
echo "$filtered" >filteredentries &
# find first date past until filter
lastline=""
while IFS= read -r line; do
cond=$(printf '%s' "$line" | cut -d: -f2)
cond=$(date -d "$cond" +%s)
if [ "$cond" -gt "$until" ]; then
lastline=$(printf '%s' "$line" | cut -d: -f1)
break
fi
done <filteredentries
# special cases all in filter, or none in filter
if [ -z "$lastline" ]; then
return
elif [ "$lastline" -eq 1 ]; then
entries=""
# filter
else
# remove lines below found
lastprinted="$((lastline - 1))"
entries=$(echo "$entries" | sed -n "1,${lastprinted}p;${lastline}q")
fi
}
filter_priority() {
priority="$1"
# filter for dates, with line numbers
# filtered=$(echo "$entries" | grep -noE '[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}')
filtered=""
while [ "$priority" -gt 0 ]; do
current=$(echo "$entries" | grep -E "\($priority\)")
# append found to filtered entries
filtered=$(printf "%s\n%s" "$filtered" "$current")
# go to next 'higher' priority
priority="$((priority - 1))"
done
# sort them chronologically again, remove empty lines
entries="$(echo "$filtered" | sed -e '/^$/d' | sort)"
}
main() {
if [ -z "$file" ]; then
echo "Requires a bibtex file as argument."
exit 1
fi
# filter all entries for those containing filterby field (default: due)
# retain values of all fields mentioned in fields variable
entries=$(grep -E "^@|$fields" "$file" | awk 1 ORS=' ' | sed -E 's/@\w+\{/\n/g' | grep "$filterby" | tail -n +2 | sed -E 's/(,\s+(\w+)\s+=\s+|,\s*$)/\t/g' | awk -F'\t' '{ print $4 "\t" $5 "\t" $2 "\t" $3 "\t" $1 }')
# prettify and sort the entries for display (remove {}, order by date,prio,author,title)
entries=$(echo "$entries" | awk -F'\t' '{ gsub(/{/,""); gsub(/}/,""); gsub(/prio/,"",$2) } { print $1 " (" $2 "): " $3 " -- " $4 " (" $5 ")"}' | sort)
if [ -n "$until" ]; then
filter_until
fi
if [ -n "$priority" ]; then
filter_priority "$priority"
fi
echo "$entries"
}
while getopts "h?i:u:r:l:p:" opt; do
case "$opt" in
h | \?)
show_help
exit 0
;;
# v) verbose=1
# ;;
r)
fields="$OPTARG"
;;
l)
filterby="$OPTARG"
;;
i)
file="$OPTARG"
;;
u)
until="$(date -d "$OPTARG" +%s)"
;;
p)
priority="$OPTARG"
;;
esac
done
shift $((OPTIND - 1))
[ "${1:-}" = "--" ] && shift
main "$@"

29
writing/.local/bin/rofi-bib-due Executable file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env sh
exist rofi normal
_rofi() {
rofi -dmenu -no-auto-select -i -theme themes/dropdown -p "papers" -l 25 -yoffset 20 -columns 1 -u "$urgent"
}
# call for whatever file is passed in
results="$(bib-due "$@")"
# mark priority 1 items as urgent in rofi
urgent="$(
# find all lines with priority 1, (marked as `(1):` );
# print them on 1 line, -1 since dmenu is 0 indexed
echo "$results" | grep -n '(1):' | cut -d: -f1 | awk '{ $0=$0-1; print $0 }' ORS=','
)"
# get user choice, exit if nothing selected
choice=$(echo "$results" | _rofi)
[ -z "$choice" ] && exit 0
key=$(echo "$choice" | sed -E 's/.*\((\w+)\)$/\1/')
# get library pdf folder (only searches for default ./pdf path)
library="$(dirname "$(realpath "$BIBFILE")")/pdf"
# find and open the key-associated pdf file
${FILEREADER:-open} "$(find "$library" -type f -name "$key *.pdf")"

View file

@ -1,15 +1,65 @@
# Writing module # Writing module
This module contains everything that is specific for me writing prose, journaling and pursuing academic work. [bibtex](https://en.wikipedia.org/wiki/BibTeX) - plain-text reference management
That means there are configurations for reference management (`papis`),
for daily journaling (`jrnl`),
for reading PDFs (`sioyek`, `zathura`)
and for general notetaking (`zk`).
[bibtex](https://en.wikipedia.org/wiki/BibTeX) - plain-text references
[papis](https://github.com/papis/papis) - yaml-driven and bibtex-compatible reference management
[jrnl](https://github.com/jrnl-org/jrnl) - journaling on the command line
[zk](https://github.com/zk-org/zk) - notetaking with a 'zettelkasten' principle
[zathura](git.pwmt.org) - keyboard-driven PDF reading [zathura](git.pwmt.org) - keyboard-driven PDF reading
[sioyek](http://sioyek.info/) - keyboard-driven PDF reading *and annotating* [sioyek](http://sioyek.info/) - keyboard-driven PDF reading *and annotating*
This readme is a little out of date, as are the scripts below.
They are old, I used them during my time as a student and they are probably written terribly.
But I still think there is value in them, hence not removing them from the repo just yet.
## bib-due
The `bib-due` script depends on (gnu) grep, awk, and sed, date if using date filtering capabilities. It is currently written in a rather haphazard way, and prone to breakage.
On the other hand, it does what it's supposed to do: list bibtex entries which have their due-date coming up.
The script needs bibtex entries to be marked with two fields: `due`, containing a due date (ideally in YYYY-MM-DD format, for easy sorting), and `priority` containing a read priority. It will also, by default attempt to grab the values of the fields `author` and `title`, as well as the name of the bibtex key of the entry.
It can be invoked with the path to a bibtex file `bib-due path/to/library.bib`, and will gather the entries from the respective file. It can be invoked without an argument if the environment variable `$BIBFILE` is declared (pointing to a bibtex file).
Example output looks as follows:
![bib-due example output](.assets/bibtex/list.png)
The output can then be filtered further through other programs.
Bib-due itself allows 2 filtering options: *until* a certain date (`-u`), and *at least* a certain priority (`-p`).
Using priority is relatively self-explanatory: 1 is the highest priority, 3 the lowest (technically, no priority is the lowest). Choosing `-p3` means priority 1, 2, and 3 will be displayed. Choosing `-p1` will only display the highest priority items.
Using the date works as a cut-off for the future, and it uses gnu `date` to calculate the correct date. That makes things like `-u 'fri this week'` possible, showing only upcoming items until the end of the week. Read the `date` manual for more information.
There will likely not be a new option for filtering dates *from* a certain point forward since I don't need it and before implementing more stuff what's there should be more solid. (and read your damn overdue texts!)
Again, this script will (for now[^time]) break when bibtex files are formatted in any way other than what it expects.
An example of a working entry:
[^time]: And probably for some time since I don't see myself sinking too much more time into this in the near future. I actually need to get some of the upcoming readings done that I can now list! 🙂
```
@InBook{Borhi2016,
author = {László Borhi},
chapter = {1956: Self-Liberation},
pages = {117--137},
publisher = {Indiana University Press},
title = {Dealing with dictators: the {United States}, {Hungary}, and {East Central Europe}, 1942-1989},
year = {2016},
due = {2020-05-07},
file = {:Borhi2016 - Dealing with Dictators_ the United States, Hungary, and East Central Europe, 1942 1989.pdf:PDF},
pagetotal = {564},
priority = {prio1},
timestamp = {2020-05-08},
}
```
Important fields are author, title, due, priority. These need to exist, and need to be ordered alphabetically. Otherwise there will probably be some breakage.
## rofi-bib-due
The `rofi-bib-due` script utilizes the `bib-due` script and depends on an existing installed `rofi` module (see [here](rofi/)).
On invocation, it creates a list of upcoming readings, and allows selecting one of the readings. The selected reading will be passed along to `$FILEREADER` if it is declared, falling back to `xdg-open` if not.
Currently, the path to the reading pdf is hard-coded to be `path/to/bibtex.bib/pdf`, and the name has to begin with the exact bibtex key; otherwise the script will not be able to find the pdf.
An example of the script in action: (window size has been reduced for the recording, cutting off most entry names)
![rofi-bib-due demonstration](.assets/bibtex/rofi.gif)

View file

@ -1,19 +0,0 @@
#!/usr/bin/env sh
#
n() {
if [ $# -eq 0 ]; then
zk edit -i
else
zk "${@}"
fi
}
# open notes with my vim zettelkasten plugin
# TODO better implementation conditional on zk.nvim & zettelkasten existing
# nvim +'lua pcall(require "zk.commands"') --headless +qa 2>&1 or similar to check - but slow
if command -v nvim >/dev/null 2>&1; then
alias ni='nvim +"lua require \"zk.commands\".get(\"ZkCd\")()" +"edit $WIKIROOT/index.md"'
fi
alias ncd='pushd $WIKIROOT'

View file

@ -1,4 +0,0 @@
#!/usr/bin/env sh
#
export ZK_NOTEBOOK_DIR="${WIKIROOT:-~/documents/notes/}"