From 017668792ccb105c7d1416b9e5061144fb02e12d Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 26 Jul 2024 10:56:36 +0200 Subject: [PATCH 01/20] waybar: Improve vpn block icon rendering This is a change which is very much hardcoded for my setup, but the vpn block will now give preference to displaying individual VPN types from top to bottom: If privateinternetaccess is connected, it will display its icon. If proton is connected, it will display its icon. If netbird is connected it will display its icon. If nothing is connected it will display nothing. It is still quite a hacky solution and should also be replaced by a signal-driven system instead of the recurrent polling it does currently (it only polls once a minute atm, to keep system load/battery drain low but since it invokes a lot of external commands, e.g. piactl and netbird, it should really only be invoked on vpn changes). --- desktop/.config/waybar/config | 7 ++++-- desktop/.config/waybar/modules/wireguard | 28 ++++++++++++++++++------ 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/desktop/.config/waybar/config b/desktop/.config/waybar/config index e0d7ca1..6946a07 100644 --- a/desktop/.config/waybar/config +++ b/desktop/.config/waybar/config @@ -145,7 +145,7 @@ "format": "{} ", }, "river/window": { - "format": " {}", + "format": " {}", "max-length": 70 }, "temperature": { @@ -166,8 +166,11 @@ "interval": 3600 }, "custom/wireguard": { + "format": "{icon}", "format-icons": { - "default": "󰖂" + "default": "", + "pia": "󰖂", + "netbird": "󱗆" }, "exec": "~/.config/waybar/modules/wireguard json", "exec-if": "command -v nmcli >/dev/null 2>&1", diff --git a/desktop/.config/waybar/modules/wireguard b/desktop/.config/waybar/modules/wireguard index fcdca46..db27acf 100755 --- a/desktop/.config/waybar/modules/wireguard +++ b/desktop/.config/waybar/modules/wireguard @@ -41,9 +41,8 @@ connected=() available=() function print_as_json() { - text="󰖂" # only prints a single icon when connected - # text="${1}" # use this line to show all output in text - alt="${1}" + text="${1%% |*}" # prints out name of first vpn it finds + alt="${1%%:*}" tooltip="${1}" [ -n "$1" ] && class="connected" || class="disconnected" printf "{\"text\": \"%s\", \"alt\": \"%s\", \"tooltip\": \"%s\", \"class\": \"%s\"}" \ @@ -79,7 +78,19 @@ function get_pia { status=$(piactl get connectionstate) if [[ $status = "Connected" ]]; then - connected+=("$(piactl get region): $(piactl get vpnip)") + connected+=("pia: $(piactl get vpnip)") + fi +} + +function get_netbird { + if ! command -v netbird >/dev/null 2>&1 || [ "$(systemctl is-active netbird)" == "inactive" ]; then + return 1 + fi + + status="$(netbird status)" + + if echo "$status" | grep -q "^Signal: Connected"; then + connected+=("netbird:$(echo "$status" | grep "^NetBird IP:" | cut -d':' -f2)") fi } @@ -122,19 +133,22 @@ function array_contains { } if [[ $nargs == 0 ]] || [[ $printjson = "yes" ]]; then - get_conns "$wgactive" get_pia + get_netbird + get_conns "$wgactive" print_conns connected elif [[ $showmenu == "yes" ]]; then - get_conns "$wgconns" get_pia + get_netbird + get_conns "$wgconns" print_conns connected "list" print_conns available "list" elif [[ $dotoggle == "yes" ]]; then - get_conns "$wgconns" get_pia + get_netbird + get_conns "$wgconns" if [[ "$(array_contains connected "$conn")" == "yes" ]]; then $nmclicmd down "$conn" From 2fcaad5c1c9e59a2e4deca67bcda9f5cff9357c8 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 26 Jul 2024 10:57:21 +0200 Subject: [PATCH 02/20] vidl: Slightly improve url ingestion and error output --- scripts/.local/bin/vidl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/.local/bin/vidl b/scripts/.local/bin/vidl index 0349ac7..0cdca44 100755 --- a/scripts/.local/bin/vidl +++ b/scripts/.local/bin/vidl @@ -124,7 +124,7 @@ download() { # 1=url elif _should_archive; then archive_file=$(_findfile "$ARCHIVE_FOLDER" "$yt_dl_fname") echo "$archive_file" | while read -r file; do - echo "file $file exists, not downloading duplicate" + printf "File %s exists, not downloading duplicate.\n" "$file" _call_archive "$file" "$DL_FOLDER" done fi @@ -132,8 +132,8 @@ download() { # 1=url setup() { TEMP_FOLDER="${TEMP_FOLDER:-${HOME}/downloads}" - DL_FOLDER="${DL_FOLDER:-${XDG_VIDEOS_DIR:-$HOME/media/videos}/inbox}" - ARCHIVE_FOLDER="${ARCHIVE_FOLDER:-${XDG_VIDEOS_DIR:-$HOME/media/videos}/archive}" + DL_FOLDER="${DL_FOLDER:-${XDG_VIDEOS_DIR:-$HOME/videos}/inbox}" + ARCHIVE_FOLDER="${ARCHIVE_FOLDER:-${XDG_VIDEOS_DIR:-$HOME/videos}/archive}" YT_DL_CMD="${YT_DL_CMD:-yt-dlp}" yt_default_opts=(-f "best[height\<=1080]" --retries 15 --embed-chapters --embed-subs --sub-lang "en,de,es,fr") declare -a YT_DL_OPTS=${YT_DL_OPTS:-( "${yt_default_opts[@]}" )} @@ -160,6 +160,7 @@ add_to_queue() { # 1=url } remove_from_queue() { # 1=url + printf "Removing url %s from queue.\n" "$1" sed -i.bak -e "\|$1|d" "$queue_file" } @@ -201,7 +202,7 @@ main() { exit fi - for url in $*; do + for url in "$@"; do add_to_queue "$url" done if is_only_instance; then From 575e17a924ded89a43f936886c21b58eedf1d7df Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 26 Jul 2024 11:42:42 +0200 Subject: [PATCH 03/20] vimiv: Add batch marking images Use `V` in the library or thumbnail view to mark contiguous images, mimicking vim visual selection mode. --- .gitmodules | 3 +++ multimedia/.config/vimiv/keys.conf | 2 ++ multimedia/.config/vimiv/vimiv.conf | 3 ++- multimedia/.local/share/vimiv/plugins/.gitkeep | 0 4 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 multimedia/.local/share/vimiv/plugins/.gitkeep diff --git a/.gitmodules b/.gitmodules index 7779f2e..4eb890c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "scripts/.local/share/uoeia"] path = scripts/.local/share/uoeia url = https://git.martyoeh.me/Marty/uoeia.git +[submodule "multimedia/.local/share/vimiv/plugins/batchmark"] + path = multimedia/.local/share/vimiv/plugins/batchmark + url = https://github.com/jcjgraf/BatchMark diff --git a/multimedia/.config/vimiv/keys.conf b/multimedia/.config/vimiv/keys.conf index 7bd15a9..ac527df 100644 --- a/multimedia/.config/vimiv/keys.conf +++ b/multimedia/.config/vimiv/keys.conf @@ -31,6 +31,7 @@ b : set statusbar.show! tl : toggle library tm : toggle manipulate tt : toggle thumbnail +V : batchmark-toggle [IMAGE] M : center @@ -85,6 +86,7 @@ H : set library.width -0.05 $ : end-of-line : enter library ^ : first-of-line +0 : first-of-line d : scroll half-page-down u : scroll half-page-up : scroll left diff --git a/multimedia/.config/vimiv/vimiv.conf b/multimedia/.config/vimiv/vimiv.conf index 572a63a..9a29602 100644 --- a/multimedia/.config/vimiv/vimiv.conf +++ b/multimedia/.config/vimiv/vimiv.conf @@ -43,7 +43,7 @@ left_thumbnail = {thumbnail-index}/{thumbnail-total} {thumbnail-basename}{read-o left_manipulate = {basename} {image-size} Modified: {modified} {processing} center_thumbnail = {thumbnail-size} center = {slideshow-indicator} {slideshow-delay} {transformation-info} -right = {keys} {mark-count} {mode} +right = {keys} {batchmark} {mark-count} {mode} right_image = {keys} {mark-indicator} {mark-count} {mode} [KEYHINT] @@ -71,6 +71,7 @@ shuffle = False [PLUGINS] print = default metadata = default +batchmark = [ALIASES] diff --git a/multimedia/.local/share/vimiv/plugins/.gitkeep b/multimedia/.local/share/vimiv/plugins/.gitkeep new file mode 100644 index 0000000..e69de29 From 32e743edba13d58c626b446bac12eeabd0aa6ab7 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 26 Jul 2024 11:49:00 +0200 Subject: [PATCH 04/20] vimiv: Add scale keys a and s Like in zathura, like in sioyek, we use a to view the image in 1:1 scale, or s to fit it to the screen (or S to specifically fit its width to the screen). --- multimedia/.config/vimiv/keys.conf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/multimedia/.config/vimiv/keys.conf b/multimedia/.config/vimiv/keys.conf index ac527df..29da20e 100644 --- a/multimedia/.config/vimiv/keys.conf +++ b/multimedia/.config/vimiv/keys.conf @@ -26,12 +26,15 @@ k : scroll up ? : search --reverse N : search-next P : search-prev -zh : set library.show_hidden! +za : set library.show_hidden! b : set statusbar.show! tl : toggle library tm : toggle manipulate tt : toggle thumbnail V : batchmark-toggle +a : scale --level 1.0 +s : scale --level fit +S : scale --level fit-width [IMAGE] M : center From 7af5fca62a7c8ca581e1777d5273356260e92750 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 26 Jul 2024 15:33:43 +0200 Subject: [PATCH 05/20] nvim: Exchange headlines plugin for markdown.nvim To render markdown highlights and a few other things (list items, code blocks, callouts, etc) we switched from headlines.nvim to markdown.nvim (internally ralled render-markdown). This now also enables quick switching between showing the rendered output and raw markdown (`pp`). --- nvim/.config/nvim/lazy-lock.json | 4 ++-- nvim/.config/nvim/lua/plugins/prose.lua | 23 ++++++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 90e03e5..d2cd311 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -33,7 +33,6 @@ "git-conflict.nvim": { "branch": "main", "commit": "bfd9fe6fba9a161fc199771d85996236a0d0faad" }, "gitsigns.nvim": { "branch": "main", "commit": "0b04035bb7b3c83e999b9676e2fb46fd0aa9f910" }, "glance.nvim": { "branch": "master", "commit": "51059bcf21016387b6233c89eed220cf47fca752" }, - "headlines.nvim": { "branch": "master", "commit": "618ef1b2502c565c82254ef7d5b04402194d9ce3" }, "image.nvim": { "branch": "master", "commit": "da64ce69598875c9af028afe129f916b02ccc42e" }, "img-clip.nvim": { "branch": "main", "commit": "fc30500c35663aa1762697f5aba31d43b86028f0" }, "jupytext.nvim": { "branch": "main", "commit": "c8baf3ad344c59b3abd461ecc17fc16ec44d0f7b" }, @@ -76,6 +75,7 @@ "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, "quarto-nvim": { "branch": "main", "commit": "09fabb62d414e56ee3245c558aaedbdc662b6493" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "12b1a1e095d968887a17ef791c2edb78d7595d46" }, + "render-markdown": { "branch": "main", "commit": "3578523f497a8ad3b4a356d1e54e609838ce0922" }, "smartcolumn.nvim": { "branch": "main", "commit": "d01b99355c7fab13233f48d0f28dc097e68a03f7" }, "stickybuf.nvim": { "branch": "master", "commit": "2160fcd536d81f5fa43f7167dba6634e814e3154" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, @@ -95,4 +95,4 @@ "wrapping.nvim": { "branch": "master", "commit": "3a823200c297885b70515fa8d974e1763c578e26" }, "zen-mode.nvim": { "branch": "main", "commit": "04b52674b8c800f8b7d4609e8bd8d0212e3ffa79" }, "zk-nvim": { "branch": "main", "commit": "66b9b490e930fb77f93a2a0c64e0da9a5144fd0a" } -} \ No newline at end of file +} diff --git a/nvim/.config/nvim/lua/plugins/prose.lua b/nvim/.config/nvim/lua/plugins/prose.lua index 8be45c7..6b3d398 100644 --- a/nvim/.config/nvim/lua/plugins/prose.lua +++ b/nvim/.config/nvim/lua/plugins/prose.lua @@ -40,12 +40,24 @@ local prose_plugs = { }, }, }, - -- displays prettier headlines mimicking the ones in emacs orgmode + -- displays prettier md rendering { - "lukas-reineke/headlines.nvim", - dependencies = "nvim-treesitter/nvim-treesitter", - config = true, + "MeanderingProgrammer/markdown.nvim", + main = "render-markdown", + opts = {}, + name = "render-markdown", -- Only needed if you have another plugin named markdown.nvim + dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" }, -- if you prefer nvim-web-devicons ft = writing_ft, + keys = { + { + "pp", + function() + require("render-markdown").toggle() + end, + silent = true, + desc = "toggle md rendering", + }, + }, }, -- generate an auto-updating html preview for md files -- uses the very nice peek if deno is available, otherwise falls back to markdown-preview @@ -84,7 +96,7 @@ local prose_plugs = { }, cmd = { "PasteImage" }, keys = { - { "pp", "PasteImage", desc = "Paste image from system clipboard" }, + { "pi", "PasteImage", desc = "Paste image from system clipboard" }, }, ft = writing_ft, }, @@ -184,6 +196,7 @@ local prose_plugs = { "barreiroleo/ltex_extra.nvim", branch = "dev", }, + { "let-def/texpresso.vim", ft = { "tex" } }, } return prose_plugs From 63cc63bb70c179fac1930556036995b6bfe841bb Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 29 Jul 2024 22:54:58 +0200 Subject: [PATCH 06/20] river: Add quick emergency clipboard clear shortcut Use `Mod+Shift+Control + Space` to clear all. Basically is the same shortcut as *showing* the clipboard, only with control pressed on additionally. --- desktop/.config/river/init | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/desktop/.config/river/init b/desktop/.config/river/init index 51d7f17..30bdc38 100755 --- a/desktop/.config/river/init +++ b/desktop/.config/river/init @@ -58,8 +58,9 @@ riverctl map normal $mod backspace spawn "powermenu" riverctl map normal None XF86Search spawn "qutedmenu" riverctl map normal $mod+Shift O spawn "qutedmenu" -# Open clipboard history +# Clipboard history riverctl map normal $mod+Shift Space spawn "clipman pick --tool=bemenu" +riverctl map normal $mod+Shift+Control Space spawn "clipman clear --all" # Open floating calculator riverctl map normal $mod+Shift R spawn "$term -e --class float qalc" From 7b9abab298e0624b615d5c9b3879d7c3fca76242 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 29 Jul 2024 23:03:02 +0200 Subject: [PATCH 07/20] nvim: Improve quarto syntax rendering Removed the standalone vim-pandoc-syntax plugin since I have not really been using its functionality for a long time. Additionally, set reduce conceallevel in markdown and quarto files to 2 for the time being to prevent some rendering errors (especially on headlines) when interacting with the markdown.nvim (render-markdown) plugin. --- nvim/.config/nvim/lua/plugins/data_analysis.lua | 1 - nvim/.config/nvim/lua/plugins/prose.lua | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/nvim/.config/nvim/lua/plugins/data_analysis.lua b/nvim/.config/nvim/lua/plugins/data_analysis.lua index 5088b87..c922aaa 100644 --- a/nvim/.config/nvim/lua/plugins/data_analysis.lua +++ b/nvim/.config/nvim/lua/plugins/data_analysis.lua @@ -15,7 +15,6 @@ return { dependencies = { "jmbuhr/otter.nvim", "neovim/nvim-lspconfig", - "vim-pandoc/vim-pandoc-syntax", "hrsh7th/nvim-cmp", "nvim-treesitter/nvim-treesitter", { "benlubas/molten-nvim", optional = true }, diff --git a/nvim/.config/nvim/lua/plugins/prose.lua b/nvim/.config/nvim/lua/plugins/prose.lua index 6b3d398..997a651 100644 --- a/nvim/.config/nvim/lua/plugins/prose.lua +++ b/nvim/.config/nvim/lua/plugins/prose.lua @@ -1,4 +1,4 @@ -local writing_ft = { "quarto", "pandoc", "markdown", "text", "tex", "typst", "bib", "context", "rst" } +local writing_ft = { "quarto", "pandoc", "markdown", "text", "tex", "typst", "bib", "context", "rst", "vimwiki" } local prose_plugs = { -- UI improvements @@ -44,7 +44,17 @@ local prose_plugs = { { "MeanderingProgrammer/markdown.nvim", main = "render-markdown", - opts = {}, + opts = { + file_types = { "markdown", "quarto", "pandoc", "vimwiki" }, + win_options = { + conceallevel = { + rendered = 2, + }, + }, + heading = { + width = "block", + }, + }, name = "render-markdown", -- Only needed if you have another plugin named markdown.nvim dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" }, -- if you prefer nvim-web-devicons ft = writing_ft, From 95de192924f48a0e44259df2a9638b8c6936d572 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 30 Jul 2024 07:55:07 +0200 Subject: [PATCH 08/20] nvim: Update plugins --- nvim/.config/nvim/lazy-lock.json | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index d2cd311..0d582c8 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -23,7 +23,7 @@ "cmp-treesitter": { "branch": "master", "commit": "958fcfa0d8ce46d215e19cc3992c542f576c4123" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "completion-vcard": { "branch": "master", "commit": "2220fd517a985ececed1adcf0e5be8f2815564c7" }, - "conform.nvim": { "branch": "master", "commit": "ae213f5169d5d0c6abbe76e1438d932772fc1657" }, + "conform.nvim": { "branch": "master", "commit": "acc7337cfd24ddfa3109bfc8c258c09c88c5c450" }, "dial.nvim": { "branch": "master", "commit": "54b503f906bc9e5ab85288414840a1b86d40769f" }, "dressing.nvim": { "branch": "master", "commit": "71349f24c6e07b39f33600985843c289ca735308" }, "fidget.nvim": { "branch": "main", "commit": "ef99df04a1c53a453602421bc0f756997edc8289" }, @@ -36,7 +36,7 @@ "image.nvim": { "branch": "master", "commit": "da64ce69598875c9af028afe129f916b02ccc42e" }, "img-clip.nvim": { "branch": "main", "commit": "fc30500c35663aa1762697f5aba31d43b86028f0" }, "jupytext.nvim": { "branch": "main", "commit": "c8baf3ad344c59b3abd461ecc17fc16ec44d0f7b" }, - "lazy.nvim": { "branch": "main", "commit": "839f9e78e78dc935b1188fb16583365991739c51" }, + "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, "lsp-setup.nvim": { "branch": "main", "commit": "6e4e977512ce426d8b52c27f3b6e6aefc73e1452" }, "ltex_extra.nvim": { "branch": "dev", "commit": "57192d7ae5ba8cef3c10e90f2cd62d4a7cdaab69" }, "lualine.nvim": { "branch": "master", "commit": "544dd1583f9bb27b393f598475c89809c4d5e86b" }, @@ -49,15 +49,15 @@ "mdeval.nvim": { "branch": "master", "commit": "2c32e2f3e7d8f222e7a4724989f218d036e1081d" }, "mini.nvim": { "branch": "main", "commit": "19e1584124cda35388d4fdb911eab7124014e541" }, "molten-nvim": { "branch": "main", "commit": "eb6d0fe33e14989b0f1fbe25d9732889ee57bd1a" }, - "neogen": { "branch": "main", "commit": "0daffcec249bf42275e322361fe55b89a05ff278" }, + "neogen": { "branch": "main", "commit": "7545cdc8cdfa46b17040968e5aaa3e49e29fdf3f" }, "neotest": { "branch": "master", "commit": "32ff2ac21135a372a42b38ae131e531e64833bd3" }, "neotest-python": { "branch": "master", "commit": "81d2265efac717bb567bc15cc652ae10801286b3" }, "nvim-FeMaco.lua": { "branch": "main", "commit": "96bbf843595dbe865838b3f2484b73557f34700c" }, "nvim-cmp": { "branch": "main", "commit": "d818fd0624205b34e14888358037fb6f5dc51234" }, - "nvim-colorizer.lua": { "branch": "master", "commit": "08bd34bf0ed79723f62764c7f9ca70516d461d0d" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "194ec600488f7c7229668d0e80bd197f3a2b84ff" }, "nvim-coverage": { "branch": "main", "commit": "aa4b4400588e2259e87e372b1e4e90ae13cf5a39" }, "nvim-lint": { "branch": "master", "commit": "efc6fc83f0772283e064c53a8f9fb5645bde0bc0" }, - "nvim-lspconfig": { "branch": "master", "commit": "fa6c2a64100c6f692bbec29bbbc8ec2663c9e869" }, + "nvim-lspconfig": { "branch": "master", "commit": "f95d371c1a274f60392edfd8ea5121b42dca736e" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" }, "nvim-toggleterm.lua": { "branch": "main", "commit": "48be57eaba817f038d61bbf64d2c597f578c0827" }, @@ -66,7 +66,7 @@ "nvim-treesitter-context": { "branch": "master", "commit": "5efba33af0f39942e426340da7bc15d7dec16474" }, "nvim-treesitter-endwise": { "branch": "master", "commit": "8b34305ffc28bd75a22f5a0a9928ee726a85c9a6" }, "nvim-treesitter-textsubjects": { "branch": "master", "commit": "a8d2844bba925d9450ef7ab215f3b054028288ca" }, - "nvim-ts-autotag": { "branch": "main", "commit": "1624866a1379fc1861797f0ed05899a9c1d2ff61" }, + "nvim-ts-autotag": { "branch": "main", "commit": "dc5e1687ab76ee02e0f11c5ce137f530b36e98b3" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "6b5f95aa4d24f2c629a74f2c935c702b08dbde62" }, "nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" }, "otter.nvim": { "branch": "main", "commit": "837f258040d0174ff8495584088046f98499b1ac" }, @@ -75,7 +75,7 @@ "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, "quarto-nvim": { "branch": "main", "commit": "09fabb62d414e56ee3245c558aaedbdc662b6493" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "12b1a1e095d968887a17ef791c2edb78d7595d46" }, - "render-markdown": { "branch": "main", "commit": "3578523f497a8ad3b4a356d1e54e609838ce0922" }, + "render-markdown": { "branch": "main", "commit": "35f8bd24809e21219c66e2a58f1b9f5d547cc2c3" }, "smartcolumn.nvim": { "branch": "main", "commit": "d01b99355c7fab13233f48d0f28dc097e68a03f7" }, "stickybuf.nvim": { "branch": "master", "commit": "2160fcd536d81f5fa43f7167dba6634e814e3154" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, @@ -88,10 +88,9 @@ "vifm.vim": { "branch": "master", "commit": "a8130c37d144b51d84bee19f0532abcd3583383f" }, "vim-criticmarkup": { "branch": "master", "commit": "d15dc134eb177a170c79f6377f81eb02a9d20b02" }, "vim-numbertoggle": { "branch": "main", "commit": "df9b1fe616507340718716204ba7f434125bdf7a" }, - "vim-pandoc-syntax": { "branch": "master", "commit": "16939cda184ff555938cc895cc62477c172997f9" }, "vim-spellsync": { "branch": "master", "commit": "3d6dd50de9c4d953cc16638112a6ae196df41463" }, "wezterm.nvim": { "branch": "main", "commit": "f73bba23ab4becd146fa2d0a3a16a84b987eeaca" }, - "which-key.nvim": { "branch": "main", "commit": "48cdaaab93a4c85cac8eb271bb48307ed337787f" }, + "which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" }, "wrapping.nvim": { "branch": "master", "commit": "3a823200c297885b70515fa8d974e1763c578e26" }, "zen-mode.nvim": { "branch": "main", "commit": "04b52674b8c800f8b7d4609e8bd8d0212e3ffa79" }, "zk-nvim": { "branch": "main", "commit": "66b9b490e930fb77f93a2a0c64e0da9a5144fd0a" } From 2ddf69c2449e9f5a4f360b00852083a816d54dd0 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 30 Jul 2024 14:37:20 +0200 Subject: [PATCH 09/20] nvim: Refactor lsp, linting and outliners away from ide Start splitting up ide plugin module by splitting out individual modules. --- nvim/.config/nvim/lua/plugins/ide.lua | 125 +------ nvim/.config/nvim/lua/plugins/linting.lua | 38 +++ nvim/.config/nvim/lua/plugins/lsp.lua | 357 ++++++++++++++++++++ nvim/.config/nvim/lua/plugins/outliners.lua | 51 +++ 4 files changed, 447 insertions(+), 124 deletions(-) create mode 100644 nvim/.config/nvim/lua/plugins/linting.lua create mode 100644 nvim/.config/nvim/lua/plugins/lsp.lua create mode 100644 nvim/.config/nvim/lua/plugins/outliners.lua diff --git a/nvim/.config/nvim/lua/plugins/ide.lua b/nvim/.config/nvim/lua/plugins/ide.lua index 40bb8f1..e82bd18 100644 --- a/nvim/.config/nvim/lua/plugins/ide.lua +++ b/nvim/.config/nvim/lua/plugins/ide.lua @@ -1,15 +1,3 @@ -local linters = { - astro = { "eslint_d" }, - bash = { "shellcheck" }, - javascript = { "eslint_d" }, - javascriptreact = { "eslint_d" }, - markdown = { "markdownlint" }, - quarto = { "markdownlint" }, - sh = { "shellcheck" }, - svelte = { "eslint_d" }, - text = {}, - typescript = { "eslint_d" }, - typescriptreact = { "eslint_d" }, } local formatters = { angular = { { "prettierd", "prettier" } }, @@ -36,102 +24,8 @@ local formatters = { } 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 = { - { "so", "AerialNavToggle", silent = true, desc = "symbol navigator" }, - { "sO", "AerialToggle", silent = true, desc = "symbol outline" }, - }, - }, - -- lsp setup - { - "junnplus/lsp-setup.nvim", - dependencies = { - { - "neovim/nvim-lspconfig", - -- will sometimes not keep up with lsp changes if set to stable - version = false, - }, - { - "williamboman/mason.nvim", - cmd = { - "Mason", - "MasonInstall", - "MasonUninstall", - "MasonUninstallAll", - "MasonLog", - "MasonUpdate", - }, - build = ":MasonUpdate", - keys = { - { "vm", ":Mason", desc = "Mason" }, - }, - }, - { - "williamboman/mason-lspconfig.nvim", - cmd = { "LspInstall", "LspUninstall" }, - }, - }, - event = { "BufReadPost", "BufNewFile", "BufWritePre" }, - config = function() - require("plugins.config.lsp") - end, - keys = { { "vs", ":LspInfo", desc = "LspInfo" } }, - }, - -- pretty lsp 'peek' menus - { - "DNLHC/glance.nvim", - opts = { border = { enable = true }, theme = { enable = true, mode = "auto" } }, - cmd = { "Glance" }, - }, - -- linting setup - { - "rshkarin/mason-nvim-lint", - dependencies = { - { - "mfussenegger/nvim-lint", - config = function() - require("lint").linters_by_ft = linters - vim.api.nvim_create_autocmd({ "BufWritePost", "InsertLeave" }, { - callback = function() - if not vim.g.disable_autolint then - require("lint").try_lint() - end - end, - }) - end, - dependencies = { "williamboman/mason.nvim" }, - }, - }, - event = { "BufReadPost", "BufNewFile", "BufWritePre" }, - opts = {}, - }, -- formatting setup { @@ -177,6 +71,7 @@ return { function() require("conform").format({ async = true, lsp_fallback = true }) end, + mode = { "n", "v" }, desc = "Format buffer", }, { @@ -202,24 +97,6 @@ return { opts = {}, }, - -- useful quickfix-like buffer - { - "folke/trouble.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - opts = {}, - cmd = { - "Trouble", - }, - keys = { - { "sd", "Trouble diagnostics toggle", silent = true, desc = "diagnostics workspace" }, - { - "sD", - "Trouble diagnostics toggle filter.buf=0", - silent = true, - desc = "diagnostics document", - }, - }, - }, -- automatic docstring creation for a variety of languages { diff --git a/nvim/.config/nvim/lua/plugins/linting.lua b/nvim/.config/nvim/lua/plugins/linting.lua new file mode 100644 index 0000000..89af1e8 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/linting.lua @@ -0,0 +1,38 @@ +local linters = { + astro = { "eslint_d" }, + bash = { "shellcheck" }, + javascript = { "eslint_d" }, + javascriptreact = { "eslint_d" }, + markdown = { "markdownlint" }, + quarto = { "markdownlint" }, + sh = { "shellcheck" }, + svelte = { "eslint_d" }, + text = {}, + typescript = { "eslint_d" }, + typescriptreact = { "eslint_d" }, +} + +return { + -- linting setup + { + "rshkarin/mason-nvim-lint", + dependencies = { + { + "mfussenegger/nvim-lint", + config = function() + require("lint").linters_by_ft = linters + vim.api.nvim_create_autocmd({ "BufWritePost", "InsertLeave" }, { + callback = function() + if not vim.g.disable_autolint then + require("lint").try_lint() + end + end, + }) + end, + dependencies = { "williamboman/mason.nvim" }, + }, + }, + event = { "BufReadPost", "BufNewFile", "BufWritePre" }, + opts = {}, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/lsp.lua b/nvim/.config/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..41a4f4f --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/lsp.lua @@ -0,0 +1,357 @@ +local servers = { + ansiblels = {}, + arduino_language_server = {}, + astro = {}, + bashls = {}, + beancount = {}, + clangd = {}, + cssls = {}, + docker_compose_language_service = {}, + dockerls = {}, + emmet_ls = {}, + eslint = {}, + gopls = {}, + harper_ls = {}, + julials = {}, + jsonls = {}, + ltex = { autostart = false }, + lua_ls = { + settings = { + Lua = { + diagnostics = { globals = { "vim" } }, + -- enable when working on neovim stuff. Takes *long* to load + -- workspace = { library = vim.api.nvim_get_runtime_file("", true) }, + telemetry = { enable = false }, + hint = { + enable = true, + setType = true, + }, + }, + }, + }, + marksman = {}, + basedpyright = {}, + ruff = {}, + serve_d = {}, + taplo = {}, + texlab = {}, + tsserver = {}, + yamlls = {}, +} + +return { + -- lsp setup + { + "junnplus/lsp-setup.nvim", + dependencies = { + { + "neovim/nvim-lspconfig", + -- will sometimes not keep up with lsp changes if set to stable + version = false, + }, + { + "williamboman/mason.nvim", + cmd = { + "Mason", + "MasonInstall", + "MasonUninstall", + "MasonUninstallAll", + "MasonLog", + "MasonUpdate", + }, + build = ":MasonUpdate", + keys = { + { "vm", ":Mason", desc = "Mason" }, + }, + }, + { + "williamboman/mason-lspconfig.nvim", + cmd = { "LspInstall", "LspUninstall" }, + }, + }, + event = { "BufReadPost", "BufNewFile", "BufWritePre" }, + config = function() + vim.diagnostic.config({ virtual_text = true }) + 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", + "lua vim.diagnostic.goto_prev()", + { buffer = bufnr, desc = "Previous diagnostic" } + ) + map("n", "]d", "lua vim.diagnostic.goto_next()", { buffer = bufnr, desc = "Next diagnostic" }) + map( + "n", + "[D", + "lua vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR})", + { buffer = bufnr, desc = "Previous error" } + ) + map( + "n", + "]D", + "lua vim.diagnostic.goto_next({severity = vim.diagnostic.severity.ERROR})", + { buffer = bufnr, desc = "Next error" } + ) + + if require("core.util").is_available("which-key") then + require("which-key").add({ "l", group = "language" }) + end + map( + "n", + "ld", + "lua vim.diagnostic.open_float()", + { buffer = bufnr, desc = "Line diagnostics" } + ) + map("n", "li", function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) + end, { buffer = bufnr, desc = "Inlay hints" }) + map( + "n", + "la", + "lua vim.lsp.buf.code_action()", + { buffer = bufnr, desc = "Codeactions" } + ) + map( + "n", + "ln", + "lua vim.lsp.buf.rename()", + { buffer = bufnr, desc = "Rename element" } + ) + if vim.fn.exists(":Glance") then + map("n", "lr", "Glance references", { buffer = bufnr, desc = "References" }) + map("n", "lf", "Glance definitions", { buffer = bufnr, desc = "Definition" }) + map( + "n", + "lt", + "Glance type_definitions", + { buffer = bufnr, desc = "Type definition" } + ) + map( + "n", + "lm", + "Glance implementations", + { buffer = bufnr, desc = "Implementation" } + ) + elseif vim.fn.exists(":Telescope") then + map( + "n", + "lr", + "Telescope lsp_references", + { buffer = bufnr, desc = "References" } + ) + map( + "n", + "lf", + "Telescope lsp_definitions", + { buffer = bufnr, desc = "Definition" } + ) + map( + "n", + "lt", + "Telescope lsp_type_definitions", + { buffer = bufnr, desc = "Type definition" } + ) + map( + "n", + "lm", + "Telescope lsp_implementations", + { buffer = bufnr, desc = "Implementation" } + ) + else + map( + "n", + "lr", + "lua vim.lsp.buf.references()", + { buffer = bufnr, desc = "References" } + ) + map( + "n", + "lf", + "lua vim.lsp.buf.definition()", + { buffer = bufnr, desc = "Definition" } + ) + map( + "n", + "lt", + "lua vim.lsp.buf.type_definition()", + { buffer = bufnr, desc = "Type definition" } + ) + map( + "n", + "lm", + "lua vim.lsp.buf.implementation()", + { buffer = bufnr, desc = "Implementation" } + ) + end + map("n", "K", "lua vim.lsp.buf.hover()", { buffer = bufnr, desc = "Hover definition" }) + map( + "n", + "lc", + "lua vim.lsp.buf.declaration()", + { buffer = bufnr, desc = "Declaration" } + ) + map( + "n", + "ls", + "lua vim.lsp.buf.signature_help()", + { buffer = bufnr, desc = "Signature help" } + ) + map("n", "lo", function() + if vim.diagnostic.is_disabled(0) then + vim.diagnostic.enable(0) + else + vim.diagnostic.disable(0) + end + end, { buffer = bufnr, desc = "Toggle Diagnostics" }) + end + + -- Display diagnostics as virtual text only if not in insert mode + -- /r/neovim/comments/12inp4c/disable_diagnostics_virtual_text_when_in_insert/jqqifwk/ + vim.api.nvim_create_autocmd("InsertEnter", { + callback = function() + vim.diagnostic.config({ virtual_text = false }) + end, + }) + vim.api.nvim_create_autocmd("InsertLeave", { + callback = function() + vim.diagnostic.config({ virtual_text = true }) + end, + }) + + lsp.setup({ + default_mappings = false, + servers = servers, + on_attach = on_attach, + inlay_hints = { + enabled = vim.fn.has("nvim-0.10") == true and true or false, + }, + }) + + local lspconfig = require("lspconfig") + lspconfig.nushell.setup({}) + + lspconfig.marksman.setup({ + filetypes = { "markdown", "quarto" }, + on_attach = function(client, bufnr) + -- TODO: for some reason this stays true even after rootdir switch? + if client.config.in_zk_notebook then + vim.defer_fn(function() + vim.lsp.buf_detach_client(bufnr, client.id) + end, 1000) + end + on_attach(client, bufnr) + end, + on_new_config = function(conf, new_root) + if require("lspconfig.util").root_pattern(".zk")(new_root) then + conf.in_zk_notebook = true + else + conf.in_zk_notebook = false + end + end, + }) + lspconfig.harper_ls.setup({ + filetypes = { -- standard filetypes plus quarto + "c", + "cpp", + "csharp", + "gitcommit", + "go", + "html", + "java", + "javascript", + "lua", + "markdown", + "python", + "quarto", + "ruby", + "rust", + "swift", + "toml", + "typescript", + "typescriptreact", + }, + }) + + local python_path + -- ensure python virtualenv is determined automatically on lsp start + lspconfig.basedpyright.setup({ + on_attach = function(client, bufnr) + on_attach(client, bufnr) + require("core.util").set_python_env() + if python_path == nil then + python_path, _ = vim.fn.expand(require("core.util").get_python_venv_bin(client.config.root_dir)) + end + -- print(string.format("[PYTHON VENV]: %s", vim.inspect(python_path))) + client.config.settings.python = {} or client.config.settings.python + client.config.settings.python.pythonPath = python_path + end, + settings = { + -- disable imports and linting since, we use ruff for that + pyright = { + disableOrganizeImports = true, + }, + python = { + analysis = { + ignore = { "*" }, + }, + }, + }, + }) + lspconfig.ruff.setup({ + on_attach = function(client, bufnr) + on_attach(client, bufnr) + require("core.util").set_python_env() + client.server_capabilities.hoverProvider = false -- we use pyright for hover info + if python_path == nil then + python_path, _ = vim.fn.expand(require("core.util").get_python_venv_bin(client.config.root_dir)) + end + client.config.settings.python = {} or client.config.settings.python + client.config.settings.python.pythonPath = python_path + end, + }) + + -- set up arduino with the help of arduino.nvim plugin + if require("core.util").is_available("arduino") then + lspconfig.arduino_language_server.setup({ + on_new_config = require("arduino").on_new_config, + }) + end + + -- attach ltex for fitting ft only when spell checking becomes enabled + vim.api.nvim_create_autocmd("User", { + pattern = "SpellEnable", + callback = function() + lspconfig.ltex.setup({ + on_attach = function(client, bufnr) + on_attach(client, bufnr) + if require("core.util").is_available("ltex_extra") then + require("ltex_extra").setup() + end + end, + settings = { + ltex = { + language = vim.opt.spelllang:get(), + }, + }, + }) + vim.cmd("LspStart ltex") + end, + }) + end, + keys = { { "vs", ":LspInfo", desc = "LspInfo" } }, + }, + -- pretty lsp 'peek' menus + { + "DNLHC/glance.nvim", + opts = { border = { enable = true }, theme = { enable = true, mode = "auto" } }, + cmd = { "Glance" }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/outliners.lua b/nvim/.config/nvim/lua/plugins/outliners.lua new file mode 100644 index 0000000..86a3129 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/outliners.lua @@ -0,0 +1,51 @@ +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 = { + { "so", "AerialNavToggle", silent = true, desc = "symbol navigator" }, + { "sO", "AerialToggle", silent = true, desc = "symbol outline" }, + }, + }, + -- useful quickfix-like buffer + { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + opts = {}, + cmd = { + "Trouble", + }, + keys = { + { "sd", "Trouble diagnostics toggle", silent = true, desc = "diagnostics workspace" }, + { + "sD", + "Trouble diagnostics toggle filter.buf=0", + silent = true, + desc = "diagnostics document", + }, + }, + }, +} From d9779ba966baaa2c196c62d58c6f72fdac135955 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 7 Aug 2024 20:02:13 +0200 Subject: [PATCH 10/20] papis: Remove test journal csv --- desktop/.config/river/init | 14 +++-- .../.config/papis/scripts/test-journal.csv | 55 ------------------- 2 files changed, 9 insertions(+), 60 deletions(-) delete mode 100644 writing/.config/papis/scripts/test-journal.csv diff --git a/desktop/.config/river/init b/desktop/.config/river/init index 30bdc38..000e921 100755 --- a/desktop/.config/river/init +++ b/desktop/.config/river/init @@ -3,7 +3,7 @@ mod="Mod4" modemod="Mod1" term=${TERMINAL:-foot} -layout="rivercarro" +layout="filtile" time_to_lockscreen=300 time_to_screendim=600 time_to_suspend=900 @@ -129,8 +129,8 @@ riverctl map normal $mod F toggle-fullscreen # Make all connected outputs show the desktop and no windows at all riverctl map normal $mod+Shift M spawn 'for i in $(wlopm | wc -l); do riverctl set-focused-tags $((1 << 10)); riverctl focus-output next; done; riverctl set-focused-tags $((1 << 10)); riverctl focus-output next' -riverctl map normal $mod+Shift F10 spawn "riverctl send-layout-cmd $layout 'gaps 0'" -riverctl map normal $mod F10 spawn "riverctl send-layout-cmd $layout 'gaps 6'" +riverctl map normal $mod+Shift F10 spawn "riverctl send-layout-cmd $layout '--tags all --output all view-padding 0'" +riverctl map normal $mod F10 spawn "riverctl send-layout-cmd $layout '--tags all --output all view-padding 6'" # toggle float riverctl map normal $mod+Shift v toggle-float @@ -292,8 +292,12 @@ riverctl spawn "wl-paste -t text --watch clipman store" # /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & # start layouting engine killall $layout -riverctl spawn "$layout -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 outer-padding 0,\ + --tags all --output all smart-padding on,\ + --tags all --output all smart-padding 0" # River will send the process group of the init executable SIGTERM on exit. riverctl default-layout $layout -# exec $layout -main-ratio 0.65 -view-padding 6 -outer-padding 6 & # -> does not work with current rivercarro version (0.1.4) brightnessctl set 70% diff --git a/writing/.config/papis/scripts/test-journal.csv b/writing/.config/papis/scripts/test-journal.csv deleted file mode 100644 index 3d0ea86..0000000 --- a/writing/.config/papis/scripts/test-journal.csv +++ /dev/null @@ -1,55 +0,0 @@ -ID,Type,Colour,Title,Author,Date,Created,Updated,Starred,Latitude,Longitude,Address,City,State,Country,HasPhoto,PhotoDate,PhotoLatitude,PhotoLongitude,EntryText,HighlightText -"48A3008B-7B60-4371-9FCB-EC79875E5255","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-21T05:48:33Z","2020-04-21T05:48:33Z","2020-04-21T05:48:33Z","0","51.33312987755212","12.40349975672389","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","In 2016, a zoo in the Gaza Strip had to be abandoned due to war and the Israeli blockade. As the animals died one by one, they mummified in the dry, hot air. Pictures from inside the ghost zoo show eerily preserved lions, tigers, hyenas, monkeys, and crocodiles." -"B0F64CB1-CE3F-4120-A71B-73A4B42342A9","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-21T06:04:00Z","2020-04-21T06:04:00Z","2020-04-21T06:04:00Z","0","51.33326651467173","12.40350059326559","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","Livor mortis is the pooling of blood in lower areas of the corpse, usually a person’s back. (Again, thanks, gravity.) The pools tend to be purple in color. In Latin, the phrase means “the bluish color of death.”" -"E7ED8055-408C-45D9-A337-EDF79FCDA1E4","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-21T06:05:33Z","2020-04-21T06:05:33Z","2020-04-21T06:05:33Z","0","51.33313899677364","12.40373946824236","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","If the livor mortis is bright cherry red, that might mean the person died in the cold, or by inhaling carbon monoxide (maybe smoke from a fire). If the livor mortis is deep purple or pink, that might mean the person suffocated, or died of heart failure. Finally, if a person has lost a lot of blood, you might not find any livor mortis at all." -"4C32D32A-26D9-4A6B-B09D-10A6AF05373F","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-21T06:07:06Z","2020-04-21T06:07:06Z","2020-04-21T06:07:06Z","0","51.33336017226236","12.40364873927894","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","putrefaction. This is when the famous green color of death comes into its own. It’s more of a greenish-brown, actually. With some turquoise" -"CE8B72C5-A72D-4409-B8AE-5AD66C092F8D","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-21T06:07:13Z","2020-04-21T06:07:13Z","2020-04-21T06:07:13Z","0","51.33322495992609","12.40351477567372","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","even after you die there are still fun things happening inside your flesh case? Well, bacteria are the most important guests at the party. Gut bacteria go wild, digesting you from the inside." -"9D60E884-E395-44F9-8A8E-1B1EC6F88108","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-21T06:10:14Z","2020-04-21T06:10:14Z","2020-04-21T06:10:14Z","0","51.33334809067811","12.40355910032729","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","In a corpse, this marbling is the visible sign of blood vessels decaying and hemoglobin separating from the blood. The hemoglobin stains the skin, producing delicate color schemes in shades of red, dark purple, green, and black. The hemoglobin ring breaks down into bilirubin (turning you yellow) and biliverdin (turning you green)." -"C2C62195-156F-45D3-A6DD-F93558CE2400","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-21T06:16:02Z","2020-04-21T06:16:02Z","2020-04-21T06:16:02Z","0","51.33307523642424","12.40368739009483","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","It’s more height than weight that determines how much ash is in that doves-and-roses urn. Women tend to be shorter—less bone—so their ashes usually weigh around four pounds. Men tend to be taller, and have ashes that weigh around six pounds" -"DE2BC341-686E-426E-BC9D-40720FDF1960","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-21T06:27:21Z","2020-04-21T06:27:21Z","2020-04-21T06:27:21Z","0","51.33315269318479","12.40353550840357","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","The muscles in your body need ATP (adenosine triphosphate) in order to relax. But ATP requires oxygen. No more breathing means no more oxygen, which means no more ATP, which means the muscles seize up and can’t relax. This chemical change, collectively called rigor mortis, starts around your eyelids and jaw and spreads through every muscle in the body, even the organs" -"15A77BF7-A426-483D-B872-1C6B31C0487D","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-21T06:28:29Z","2020-04-21T06:28:29Z","2020-04-21T06:28:29Z","0","51.33320752344045","12.40346894462138","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","Unfortunately, rigor mortis eventually goes away. Every dead body is different, and the environment plays a big role in the timing, but after about seventy-two hours your muscles will go all floppy again—along with your duck-face lips." -"CAAB37BE-FBEC-40E9-9EBE-30446DA255C7","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-21T06:28:56Z","2020-04-21T06:28:56Z","2020-04-21T06:28:56Z","0","51.33321627423378","12.40351308014501","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","cadaveric spasm, also known as instantaneous rigor. Instantaneous rigor is exactly what it sounds like. When someone dies, they skip right over the floppy muscle relaxation stage and go straight into rigor mortis" -"DFD27A7C-5989-4856-A1AF-3FB94441D4B2","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T05:42:23Z","2020-04-22T05:42:23Z","2020-04-22T05:42:23Z","0","51.33315890745651","12.40386766229344","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","extreme taphophobia, or the fear of being buried alive" -"70630E8A-074E-4EF4-A90D-C09C904E1A30","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T05:42:35Z","2020-04-22T05:42:35Z","2020-04-22T05:42:35Z","0","51.33347725283606","12.4038111028164","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","Matthew Wall, a man living (yes, living) in Braughing, England, in the sixteenth century. Matthew was thought to be dead, but was lucky enough to have his pallbearers slip on wet leaves and drop the coffin on the way to his burial. As the story goes, when the coffin was dropped, Matthew awakened and knocked on the lid to be released. To this day, every October 2nd is celebrated as Old Man’s Day to commemorate Matthew’s revival. He lived, by the way, for twenty-four more years." -"C263EF5F-6EE6-45A7-8636-ADF854F783E2","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T05:44:16Z","2020-04-22T05:44:16Z","2020-04-22T05:44:16Z","0","51.33333234385331","12.40393275864894","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","1937 is not quite Ye Olden Times, but at least it’s way before you were born—Angelo Hays of France was in a motorcycle accident. When doctors couldn’t find his pulse, he was pronounced dead. He was buried quickly and his own parents were not allowed to see his disfigured body. Angelo would have remained buried if it wasn’t for the life insurance company’s suspicions of foul play. -Two days after Angelo was buried, he was exhumed for an investigation. Upon inspecting the “corpse,” examiners found that it was still warm, and that Angelo was alive. -The theory is that Angelo had been in a very deep coma which slowed his breathing way, way down. It was that slow breathing that allowed him to stay alive while buried.*" -"694640C9-8B5B-4A17-8CA5-F28A36154426","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T06:04:37Z","2020-04-22T06:04:37Z","2020-04-22T06:04:37Z","0","51.3329970518616","12.40360202980954","Eilenburger Straße 19, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","As the soldiers slowly decompose below ground, their bodies mix with the soil, releasing arsenic. As rain and floodwater move through the soil, concentrated clumps of arsenic are washed into the local water supply. Any amount of arsenic in your water is too much arsenic, frankly—but in trace amounts it’s safe to drink. Still, a study at a Civil War cemetery in Iowa City found that nearby water contained arsenic at three times the safe limit." -"C74E1470-3A59-48E7-86D6-487A0CDD699D","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T06:04:55Z","2020-04-22T06:04:55Z","2020-04-22T06:04:55Z","0","51.33303741650271","12.40377726073955","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","most families couldn’t afford the expensive iron coffins that the train companies would allow. So enterprising men, called embalmers, started following the armies around, setting up tents, and chemically preserving the soldiers killed in battle so that they wouldn’t decompose on the journey back home. The embalmers, who were still experimenting with their craft, used everything from sawdust to arsenic. The problem with arsenic is that it’s toxic to living humans. Extremely, wildly toxic" -"C6CED978-ACE6-4CA0-A049-BE020E554A8B","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T06:28:23Z","2020-04-22T06:28:23Z","2020-04-22T06:28:23Z","0","51.33344123900376","12.40378955575635","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","Eating a dead human may be horrifying to you, but humans throughout history have practiced mortuary cannibalism. Mortuary cannibalism is when the relatives, neighbors, or community members consume the flesh, or ashes, or both, of a dead person" -"6F8A02E9-B3C1-43BC-A4E3-9F9C3800D065","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T06:32:59Z","2020-04-22T06:32:59Z","2020-04-22T06:32:59Z","0","51.33306930550049","12.40362377979757","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","cannibalism is not against the law. It’s not criminal to eat human flesh, but acquiring the human flesh (even if the dead person wanted you to eat them) is breaking the law. The laws you’re breaking are . . . wait for it. . . . remember these? Welcome back, abuse of corpse laws! It’s considered desecration and mutilation to eat a dead body" -"D927ECD5-A0B4-4392-9FF9-CE2DFA411767","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T06:33:47Z","2020-04-22T06:33:47Z","2020-04-22T06:33:47Z","0","51.33313436525666","12.40359640790111","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","In 1945 and 1956, two researchers analyzed the donated bodies of four adult males, and estimated that the average male offers about 125,822 calories from protein and fat. That number is far below what other red meats like beef or boar can offer. -(Yes, you heard me, humans are red meat.)" -"67A56CE3-9EA9-4734-AD27-CB36E2C30B59","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T06:34:55Z","2020-04-22T06:34:55Z","2020-04-22T06:34:55Z","0","51.33317946718154","12.4036723669615","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","Neanderthals or Homo erectus, had cannibalistic tendencies. But if they ate their own kind, it was for ritual purposes, not dietary purposes. Again, humans just don’t provide enough calories to compete with something like a mammoth, which would have provided a (totally worth it) 3.6 million calories" -"7CD9FA34-B80B-4A89-8711-CF6F920D89D5","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T06:36:02Z","2020-04-22T06:36:02Z","2020-04-22T06:36:02Z","0","51.33311117236514","12.40366741139765","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","hákarl or fermented shark, which is a beloved national dish in Iceland. The shark is buried, fermented, and hung to dry for months until its debut as a pungent, rotten treat.)" -"7965FF25-0FC2-440D-BA14-5B5BD0F578C8","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T06:37:07Z","2020-04-22T06:37:07Z","2020-04-22T06:37:07Z","0","51.33326414731066","12.40334296907688","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","Even if the animal you ate had some sort of disease, most diseases are not zoonotic. That is to say, a human can’t get an animal disease by eating that animal. (Ebola is one of the rare exceptions.) -But if you’re going to eat a human corpse it’s a different story. It is possible to contract blood-borne viruses such hepatitis B or HIV. Unlike when you eat animals, if you eat diseased human flesh, you could end up suffering from the same illness." -"3C65AE85-D644-4FF8-AA39-876F39770A83","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T06:38:16Z","2020-04-22T06:38:16Z","2020-04-22T06:38:16Z","0","51.33313684399542","12.40356420725142","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","Humans can have abnormal proteins called prions. These proteins have lost their shape and proper function, and infect other, normal proteins. Unlike a virus or an infection, prions don’t have DNA or RNA, so they can’t be killed by heat or radiation. They’re tough little suckers that like to hang out in the brain and spinal column, spreading lesions and chaos. -When talking about prions, scientists often point to the Fore people of Papua New Guinea. As late as the 1950s, anthropologists documented an epidemic of a neurological disease called kuru that was killing members of the tribe. Kuru is a disease caused by prions in the brain. The spread of kuru was traced to the tribe’s ritual of eating of human brains after death. The infected suffer from muscle spasms, dementia, and uncontrollable laughing or crying. The end result is a brain literally full of holes—and then death" -"85C5809D-269E-4A79-A636-7CBCD399A026","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T06:40:16Z","2020-04-22T06:40:16Z","2020-04-22T06:40:16Z","0","51.33324531314521","12.40348109026645","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","The Yarkon Cemetery in Israel has started adding burial towers that will ultimately hold 250,000 graves. The towers even respect Jewish custom by filling the burial columns with dirt so that the graves are connected to the earth. At the moment, the world’s tallest cemetery is in Brazil. Memorial Necrópole Ecumênica III contains thirty-two stories of graves, and also has a restaurant, concert hall, and gardens filled with exotic birds. When I was in Tokyo, Japan, I visited a multistory building that houses thousands of cremated remains (delivered to personal visiting rooms by automatic conveyors that locate and fetch the correct urn)" -"F514887D-EBBE-476A-A925-349956DBB1F8","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T06:42:42Z","2020-04-22T06:42:42Z","2020-04-22T06:42:42Z","0","51.33321134404212","12.40346390338805","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","In Singapore, for every square mile there are more than 18,000 people. Every. Square. Mile. 18,000. People. In the United States, for every square mile there are only 92 people." -"485B0E2D-E873-49CA-AB58-F3E6E094D4AF","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T06:44:44Z","2020-04-22T06:44:44Z","2020-04-22T06:44:44Z","0","51.3332780072871","12.40335988533181","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","not all near-death experiences are created equal. Not everyone finds themselves walking into a sparkling white light while scenes of childhood pets and awkward job interviews pass before their eyes. In one study, about half of the people who had a near-death experience said they were fully aware they were dead (which could be good or bad, depending on how chill with death you are). One in four people said they had an out-of-body experience. Only one in three actually moved through the good ol’ tunnel. Also, some bad news: we imagine NDEs as being positive and blissful, but that was only true about half the time. Turns out they can be pretty terrifying, too." -"48DF4E17-A72C-4932-A5E8-2404E40589E0","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T06:49:59Z","2020-04-22T06:49:59Z","2020-04-22T06:49:59Z","0","51.33340826907205","12.40373781249704","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","Religious folks may see the light as a supernatural gateway to the afterlife; scientists may see the light as caused by oxygen deprivation in the brain" -"A4BF96D3-4D3E-4A05-9FA7-7C1431247092","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T06:50:29Z","2020-04-22T06:50:29Z","2020-04-22T06:50:29Z","0","51.33313187386248","12.40360474920343","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","Scientists believe that seeing this light at the end of the tunnel is the result of retinal ischemia, which happens when there isn’t enough blood reaching the eye. As less blood flows to the eyes, vision is reduced. Being in a state of extreme fear can also cause retinal ischemia. Both fear and decrease in oxygen are associated with dying. In this context, the extreme white tunnel vision characteristic of NDEs starts to make much more sense." -"CCE34C40-F2A7-4B9D-8FB8-C6E680DC32AF","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T06:51:35Z","2020-04-22T06:51:35Z","2020-04-22T06:51:35Z","0","51.33329482285431","12.40364259648123","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","necrophages, the unsung heroes of the natural world. They are the death eaters, the organisms that fuel up by consuming dead and rotting things" -"0CCE3637-107E-4D26-8464-91FF655F18FF","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T06:54:31Z","2020-04-22T06:54:31Z","2020-04-22T06:54:31Z","0","51.33293946208754","12.40374112690689","Eilenburger Straße 19, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","why don’t they eat bones, too? The simple answer is that eating bones is hard work. Not only that, but bones are not nutritionally useful to insects. Bones are mostly made of calcium, something insects just don’t need a lot of. Since they don’t need much calcium, insects like dermestids haven’t evolved to consume it or desire it" -"D670B3E4-D54B-4E4E-B8A1-71C7801AD636","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T06:55:35Z","2020-04-22T06:55:35Z","2020-04-22T06:55:35Z","0","51.33322607376345","12.40368501492717","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","So, while dermestids and other flesh-eating bugs do not usually eat bone, if they get hungry enough, they will. Humans behave the same way. When Paris was under siege in the late sixteenth century, the city was starving. When people inside the city ran out of cats and dogs and rats to eat, they began disinterring bodies from the mass graves in the cemetery. They took the bones and ground them into flour to make what became known as Madame de Montpensier’s bread. Bone appetit! (Actually, maybe don’t bone appetit, as many who ate the bone bread died themselves.)" -"88349039-88D4-454E-B8D9-94C65DC27E84","2","2","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T06:56:52Z","2020-04-22T06:56:52Z","2020-04-22T06:56:52Z","0","51.33330624333909","12.40354514751025","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","There is strong evidence that bone worms have been eating giant marine reptiles since the time of the dinosaurs. That means the whale eaters are older than whales themselves." -"949FED16-150A-4200-8C75-BED6C1BB6E84","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-22T06:59:55Z","2020-04-22T06:59:55Z","2020-04-22T06:59:55Z","0","51.33326913673976","12.40356814886445","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","Other cultures gave up on burial entirely. High in the mountains of Tibet, where the ground is often too rocky and frozen for burial, and where not enough trees grow to perform cremations, a different kind of death ritual developed. To this day, bodies are laid out in an open area for a sky burial, a lovely name for the dead body being consumed by vultures. Your cat might eat you after you die, but a vulture can’t wait to rip you to pieces and carry you off into the sky." -"F530E5B8-3E18-4089-898F-22C3756BBD34","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-23T06:16:09Z","2020-04-23T06:16:09Z","2020-04-23T06:16:09Z","0","51.33337047680838","12.4034332761469","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","As they break down their brand-new food source—your dead body—the microbes give off gas made of VOCs, or volatile organic compounds. The prime stinkers here tend to be sulfur-containing compounds, which makes sense if you’ve ever experienced an especially potent and sulfuric eggy fart. Sulfur is the culprit in many a stink." -"85A7852B-FB64-4740-9F5E-E6663499F602","2","0","Will My Cat Eat My Eyeballs?","Caitlin Doughty","2020-04-23T06:33:14Z","2020-04-23T06:33:14Z","2020-04-23T06:33:14Z","0","51.33342240539643","12.40362916382752","Lene-Voigt-Park, 04317 Leipzig, Germany","Leipzig","Saxony","Germany","0","","","","","Sometimes, larger bones, like thigh bones, require two people to pick up the bone at once. And sometimes the family will pass bone fragments to one another, chopsticks to chopsticks. This is the only time passing something between chopsticks is not considered rude. If you were to do this in public, with, say, a pork sparerib at a restaurant, it would be like bringing a funeral ritual to the dinner table. Total faux pas." -"ED307F41-88BE-411B-A557-1157CE856DE8","2","0","Babel","R. F. Kuang","2023-02-07T14:56:10Z","2023-02-07T14:56:10Z","2023-02-07T14:56:10Z","0","45.10420249850454","5.742597241511231","226 Chemin des Pérouses, 38560 Jarrie, France","Jarrie","Auvergne-Rhône-Alpes","France","0","","","","","The abolitionist movement you know is a load of pomp. Rhetoric only. Pitt first raised the motion because he saw the need to cut off the slave trade to France. And Parliament got on board with the abolitionists because they were so very afraid of Black insurrection in the West Indies.’ -‘So you think it’s purely risk and economics.’ -‘Well, not necessarily. You brother likes to argue that the Jamaican slave revolt, failed though it was, is what impelled the British to legislate abolition. He’s right, but only half right. See, the revolt won British sympathy because the leaders were part of the Baptist church, and when it failed, proslavery whites in Jamaica started destroying chapels and threatening missionaries. Those Baptists went back to England and drummed up support on the grounds of religion, not natural rights. My point being, abolition happened because white people found reasons to care – whether those be economic or religious. You just have to make them think they came up with the idea themselves. You can’t appeal to their inner goodness. I have never met an Englishman I trusted to do the right thing out of sympathy.’" -"D5EC6BE7-58DB-4E7E-8717-31ECBE11F8FE","2","0","Babel","R. F. Kuang","2023-02-08T07:58:12Z","2023-02-08T07:58:12Z","2023-02-08T07:58:12Z","0","45.10420267773596","5.74259767871893","226 Chemin des Pérouses, 38560 Jarrie, France","Jarrie","Auvergne-Rhône-Alpes","France","0","","","","","Strikers in this country never won broad public support, for the public merely wanted all the conveniences of modern life without the guilt of knowing how those conveniences were procured." -"70FC0FBF-8BF3-4C03-AD90-864B8CD028FE","2","0","Babel","R. F. Kuang","2023-02-08T08:27:23Z","2023-02-08T08:27:23Z","2023-02-08T08:27:23Z","0","45.10420148905155","5.742597357615256","226 Chemin des Pérouses, 38560 Jarrie, France","Jarrie","Auvergne-Rhône-Alpes","France","0","","","","","The tactics of revolt spread fast. The British textile workers picked up these techniques of barricade from the 1831 and 1834 Canut revolts by silk workers in Lyon. Those revolts had been brutally repressed – but, crucially, they did not hold the backbone of the entire nation hostage" -"10E7ED24-7F91-4DF2-B852-4AE6D5336111","2","0","Babel","R. F. Kuang","2023-02-09T20:45:43Z","2023-02-09T20:45:43Z","2023-02-09T20:45:43Z","0","45.10420123431852","5.742597001332137","226 Chemin des Pérouses, 38560 Jarrie, France","Jarrie","Auvergne-Rhône-Alpes","France","0","","","","","‘It’s like I’ve known you forever.’ -‘Me too,’ Ramy said. -‘And that makes no sense,’ said Robin, drunk already, though there was no alcohol in the cordial. ‘Because I’ve known you for less than a day, and yet . . .’ -‘I think,’ said Ramy, ‘it’s because when I speak, you listen.’ -‘Because you’re fascinating.’ -‘Because you’re a good translator.’ Ramy leaned back on his elbows. ‘That’s just what translation is, I think. That’s all speaking is. Listening to the other and trying to see past your own biases to glimpse what they’re trying to say. Showing yourself to the world, and hoping someone else understands" -"DAFA053F-19A9-4AA5-9A7D-22CF569281DA","2","0","Babel","R. F. Kuang","2023-02-09T20:59:12Z","2023-02-09T20:59:12Z","2023-02-09T20:59:12Z","0","45.10418836497428","5.742602536574182","226 Chemin des Pérouses, 38560 Jarrie, France","Jarrie","Auvergne-Rhône-Alpes","France","0","","","","","Victoire knows better. -Victory is not assured. Victory may be in the portents, but it must be urged there by violence, by suffering, by martyrs, by blood. Victory is wrought by ingenuity, persistence, and sacrifice. Victory is a game of inches, of historical contingencies where everything goes right because they have made it go right." -"0EBECEC5-9E72-4625-922A-C068BD4EE6BC","2","0","Totalitarianism","Hannah Arendt","2023-02-11T10:12:17Z","2023-02-11T10:12:17Z","2023-02-11T10:12:17Z","0","45.10421600393487","5.742588003722739","226 Chemin des Pérouses, 38560 Jarrie, France","Jarrie","Auvergne-Rhône-Alpes","France","0","","","","","In other words, while it has always been known that official Soviet publications served propaganda purposes and were utterly unreliable, it now appears that reliable source and statistical material probably never existed anywhere" -"A1AFD977-E93D-4760-AC61-7E8ACC568D96","2","0","Totalitarianism","Hannah Arendt","2023-02-11T10:21:12Z","2023-02-11T10:21:12Z","2023-02-11T10:21:12Z","0","45.10420096244634","5.742582390092738","226 Chemin des Pérouses, 38560 Jarrie, France","Jarrie","Auvergne-Rhône-Alpes","France","0","","","","","Absolute monarchy, no doubt, was a very different affair in Spain, in France, in England, in Prussia; still it was everywhere the same form of government. Decisive in our context is that totalitarian government is different from dictatorships and tyrannies; the ability to distinguish between them is by no means an academic issue which could be safely left to the ""theoreticians,"" for total domination is the only form of government with which coexistence is not possible" From ea2ba7f0ada8c475a6f2e778fa746eb8ed79457d Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 7 Aug 2024 20:02:41 +0200 Subject: [PATCH 11/20] scripts: Add printout of vidl moving files --- scripts/.local/bin/vidl | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/.local/bin/vidl b/scripts/.local/bin/vidl index 0cdca44..5192922 100755 --- a/scripts/.local/bin/vidl +++ b/scripts/.local/bin/vidl @@ -112,6 +112,7 @@ download() { # 1=url if ! _alreadyexists "$yt_dl_fname" || ! _should_archive; then _download_cmd "$*" file=$(_findfile "$TEMP_FOLDER" "$yt_dl_fname") + printf "Moving file %s to dir: %s\n" "$file" "$DL_FOLDER" mv "$file" "$DL_FOLDER" if _should_archive; then From 490aadc433bbf64bcf9ce68d7842c00777bd8945 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 7 Aug 2024 20:05:42 +0200 Subject: [PATCH 12/20] nvim: Add spelling and abbreviations --- nvim/.config/nvim/abbrev.vim | 1 + nvim/.config/nvim/spell/en.utf-8.add | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/nvim/.config/nvim/abbrev.vim b/nvim/.config/nvim/abbrev.vim index 14bf2e7..743d4ce 100644 --- a/nvim/.config/nvim/abbrev.vim +++ b/nvim/.config/nvim/abbrev.vim @@ -8,6 +8,7 @@ iabbrev grwoth growth iabbrev Grwoth Growth iabbrev teh the iabbrev projcets projects +iabbrev midex mixed " Text expansion iabbrev mo@ marty.oehme@gmail.com diff --git a/nvim/.config/nvim/spell/en.utf-8.add b/nvim/.config/nvim/spell/en.utf-8.add index 833d215..481a27d 100644 --- a/nvim/.config/nvim/spell/en.utf-8.add +++ b/nvim/.config/nvim/spell/en.utf-8.add @@ -218,3 +218,11 @@ quantifiability seaborn matplotlib. polars +UBI +villagization +automobiles +automobile +decarbonisation +Oportunidades +OECD +NREGA From 4f2acad60d734637d52fb27a835a0da1b477ca1a Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 7 Aug 2024 20:06:51 +0200 Subject: [PATCH 13/20] nvim: Add todo comment highlighting plugin Added todo-comments.nvim plugin by folke, which will automatically highlight (in a sane color) all the `TODO:`, `FIXME:`, `WARN:`, and more comments within code. --- nvim/.config/nvim/lazy-lock.json | 1 + nvim/.config/nvim/lua/plugins/ui.lua | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 0d582c8..bbc40c9 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -82,6 +82,7 @@ "telescope-luasnip.nvim": { "branch": "master", "commit": "11668478677de360dea45cf2b090d34f21b8ae07" }, "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" }, "undotree": { "branch": "main", "commit": "eab459ab87dd249617b5f7187bb69e614a083047" }, diff --git a/nvim/.config/nvim/lua/plugins/ui.lua b/nvim/.config/nvim/lua/plugins/ui.lua index 9e829c3..bdc2974 100644 --- a/nvim/.config/nvim/lua/plugins/ui.lua +++ b/nvim/.config/nvim/lua/plugins/ui.lua @@ -30,8 +30,8 @@ return { return "" end - -- count number of selected lines and characters - -- stolen: https://github.com/chrisgrieser/.config/blob/8af1841ba24f7c81c513e12f853b52f530ef5b37/nvim/lua/plugins/lualine.lua#L80C1-L87C4 + -- count number of selected lines and characters + -- stolen: https://github.com/chrisgrieser/.config/blob/8af1841ba24f7c81c513e12f853b52f530ef5b37/nvim/lua/plugins/lualine.lua#L80C1-L87C4 local function selectionCount() local isVisualMode = vim.fn.mode():find("[Vv]") if not isVisualMode then @@ -149,6 +149,12 @@ return { }, }, }, + { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = {}, + event = "VeryLazy", + }, { "jiaoshijie/undotree", dependencies = { From 1e44ef4c11028b5915e0aabf5152f415673de8fa Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 7 Aug 2024 20:19:09 +0200 Subject: [PATCH 14/20] nvim: Remove harper lsp For the time being remove harper (code spellcheck) lsp from the automatically loaded LSPs. It's not *bad* per se but also requires way more setup for me to be useful and throws up false positives all over the place. Worst of all though it does not seem to actually stop producing diagnostics when it is stopped (with `LspStop `) like all the other LSPs do, so there is no way to get rid of its results. --- nvim/.config/nvim/lua/plugins/lsp.lua | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/nvim/.config/nvim/lua/plugins/lsp.lua b/nvim/.config/nvim/lua/plugins/lsp.lua index 41a4f4f..760a51d 100644 --- a/nvim/.config/nvim/lua/plugins/lsp.lua +++ b/nvim/.config/nvim/lua/plugins/lsp.lua @@ -11,7 +11,6 @@ local servers = { emmet_ls = {}, eslint = {}, gopls = {}, - harper_ls = {}, julials = {}, jsonls = {}, ltex = { autostart = false }, @@ -257,28 +256,6 @@ return { end end, }) - lspconfig.harper_ls.setup({ - filetypes = { -- standard filetypes plus quarto - "c", - "cpp", - "csharp", - "gitcommit", - "go", - "html", - "java", - "javascript", - "lua", - "markdown", - "python", - "quarto", - "ruby", - "rust", - "swift", - "toml", - "typescript", - "typescriptreact", - }, - }) local python_path -- ensure python virtualenv is determined automatically on lsp start From 6a7385ed266e20790f4472796980c45c72bb8e6b Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 7 Aug 2024 21:11:37 +0200 Subject: [PATCH 15/20] nvim: Split formatting off ide plugins --- nvim/.config/nvim/lua/plugins/config/lsp.lua | 242 ------------------- nvim/.config/nvim/lua/plugins/formatting.lua | 121 ++++++++++ nvim/.config/nvim/lua/plugins/ide.lua | 99 -------- 3 files changed, 121 insertions(+), 341 deletions(-) delete mode 100644 nvim/.config/nvim/lua/plugins/config/lsp.lua create mode 100644 nvim/.config/nvim/lua/plugins/formatting.lua diff --git a/nvim/.config/nvim/lua/plugins/config/lsp.lua b/nvim/.config/nvim/lua/plugins/config/lsp.lua deleted file mode 100644 index 94dee61..0000000 --- a/nvim/.config/nvim/lua/plugins/config/lsp.lua +++ /dev/null @@ -1,242 +0,0 @@ -vim.diagnostic.config({ virtual_text = true }) -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 servers = { - ansiblels = {}, - arduino_language_server = {}, - astro = {}, - bashls = {}, - beancount = {}, - clangd = {}, - cssls = {}, - docker_compose_language_service = {}, - dockerls = {}, - emmet_ls = {}, - eslint = {}, - gopls = {}, - julials = {}, - jsonls = {}, - ltex = { autostart = false }, - lua_ls = { - settings = { - Lua = { - diagnostics = { globals = { "vim" } }, - -- enable when working on neovim stuff. Takes *long* to load - -- workspace = { library = vim.api.nvim_get_runtime_file("", true) }, - telemetry = { enable = false }, - hint = { - enable = true, - setType = true, - }, - }, - }, - }, - marksman = {}, - basedpyright = {}, - ruff = {}, - serve_d = {}, - taplo = {}, - texlab = {}, - tsserver = {}, - yamlls = {}, -} - -local function on_attach(_, bufnr) - local map = vim.keymap.set - map("n", "[d", "lua vim.diagnostic.goto_prev()", { buffer = bufnr, desc = "Previous diagnostic" }) - map("n", "]d", "lua vim.diagnostic.goto_next()", { buffer = bufnr, desc = "Next diagnostic" }) - map( - "n", - "[D", - "lua vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR})", - { buffer = bufnr, desc = "Previous error" } - ) - map( - "n", - "]D", - "lua vim.diagnostic.goto_next({severity = vim.diagnostic.severity.ERROR})", - { buffer = bufnr, desc = "Next error" } - ) - - if require("core.util").is_available("which-key") then - require("which-key").add({ "l", group = "language" }) - end - map( - "n", - "ld", - "lua vim.diagnostic.open_float()", - { buffer = bufnr, desc = "Line diagnostics" } - ) - map("n", "li", function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) - end, { buffer = bufnr, desc = "Inlay hints" }) - map("n", "la", "lua vim.lsp.buf.code_action()", { buffer = bufnr, desc = "Codeactions" }) - map("n", "ln", "lua vim.lsp.buf.rename()", { buffer = bufnr, desc = "Rename element" }) - if vim.fn.exists(":Glance") then - map("n", "lr", "Glance references", { buffer = bufnr, desc = "References" }) - map("n", "lf", "Glance definitions", { buffer = bufnr, desc = "Definition" }) - map("n", "lt", "Glance type_definitions", { buffer = bufnr, desc = "Type definition" }) - map("n", "lm", "Glance implementations", { buffer = bufnr, desc = "Implementation" }) - elseif vim.fn.exists(":Telescope") then - map("n", "lr", "Telescope lsp_references", { buffer = bufnr, desc = "References" }) - map("n", "lf", "Telescope lsp_definitions", { buffer = bufnr, desc = "Definition" }) - map( - "n", - "lt", - "Telescope lsp_type_definitions", - { buffer = bufnr, desc = "Type definition" } - ) - map( - "n", - "lm", - "Telescope lsp_implementations", - { buffer = bufnr, desc = "Implementation" } - ) - else - map("n", "lr", "lua vim.lsp.buf.references()", { buffer = bufnr, desc = "References" }) - map("n", "lf", "lua vim.lsp.buf.definition()", { buffer = bufnr, desc = "Definition" }) - map( - "n", - "lt", - "lua vim.lsp.buf.type_definition()", - { buffer = bufnr, desc = "Type definition" } - ) - map( - "n", - "lm", - "lua vim.lsp.buf.implementation()", - { buffer = bufnr, desc = "Implementation" } - ) - end - map("n", "K", "lua vim.lsp.buf.hover()", { buffer = bufnr, desc = "Hover definition" }) - map("n", "lc", "lua vim.lsp.buf.declaration()", { buffer = bufnr, desc = "Declaration" }) - map( - "n", - "ls", - "lua vim.lsp.buf.signature_help()", - { buffer = bufnr, desc = "Signature help" } - ) - map("n", "lo", function() - if vim.diagnostic.is_disabled(0) then - vim.diagnostic.enable(0) - else - vim.diagnostic.disable(0) - end - end, { buffer = bufnr, desc = "Toggle Diagnostics" }) -end - --- Display diagnostics as virtual text only if not in insert mode --- /r/neovim/comments/12inp4c/disable_diagnostics_virtual_text_when_in_insert/jqqifwk/ -vim.api.nvim_create_autocmd("InsertEnter", { - callback = function() - vim.diagnostic.config({ virtual_text = false }) - end, -}) -vim.api.nvim_create_autocmd("InsertLeave", { - callback = function() - vim.diagnostic.config({ virtual_text = true }) - end, -}) - -lsp.setup({ - default_mappings = false, - servers = servers, - on_attach = on_attach, - inlay_hints = { - enabled = vim.fn.has("nvim-0.10") == true and true or false, - }, -}) - -local lspconfig = require("lspconfig") -lspconfig.nushell.setup({}) - -lspconfig.marksman.setup({ - filetypes = { "markdown", "quarto" }, - on_attach = function(client, bufnr) - -- TODO: for some reason this stays true even after rootdir switch? - if client.config.in_zk_notebook then - vim.defer_fn(function() - vim.lsp.buf_detach_client(bufnr, client.id) - end, 1000) - end - on_attach(client, bufnr) - end, - on_new_config = function(conf, new_root) - if require("lspconfig.util").root_pattern(".zk")(new_root) then - conf.in_zk_notebook = true - else - conf.in_zk_notebook = false - end - end, -}) - -local python_path --- ensure python virtualenv is determined automatically on lsp start -lspconfig.basedpyright.setup({ - on_attach = function(client, bufnr) - on_attach(client, bufnr) - require("core.util").set_python_env() - if python_path == nil then - python_path, _ = vim.fn.expand(require("core.util").get_python_venv_bin(client.config.root_dir)) - end - -- print(string.format("[PYTHON VENV]: %s", vim.inspect(python_path))) - client.config.settings.python = {} or client.config.settings.python - client.config.settings.python.pythonPath = python_path - end, - settings = { - -- disable imports and linting since, we use ruff for that - pyright = { - disableOrganizeImports = true, - }, - python = { - analysis = { - ignore = { "*" }, - }, - }, - }, -}) -lspconfig.ruff.setup({ - on_attach = function(client, bufnr) - on_attach(client, bufnr) - require("core.util").set_python_env() - client.server_capabilities.hoverProvider = false -- we use pyright for hover info - if python_path == nil then - python_path, _ = vim.fn.expand(require("core.util").get_python_venv_bin(client.config.root_dir)) - end - client.config.settings.python = {} or client.config.settings.python - client.config.settings.python.pythonPath = python_path - end, -}) - --- set up arduino with the help of arduino.nvim plugin -if require("core.util").is_available("arduino") then - lspconfig.arduino_language_server.setup({ - on_new_config = require("arduino").on_new_config, - }) -end - --- attach ltex for fitting ft only when spell checking becomes enabled -vim.api.nvim_create_autocmd("User", { - pattern = "SpellEnable", - callback = function() - lspconfig.ltex.setup({ - on_attach = function(client, bufnr) - on_attach(client, bufnr) - if require("core.util").is_available("ltex_extra") then - require("ltex_extra").setup() - end - end, - settings = { - ltex = { - language = vim.opt.spelllang:get(), - }, - }, - }) - vim.cmd("LspStart ltex") - end, -}) diff --git a/nvim/.config/nvim/lua/plugins/formatting.lua b/nvim/.config/nvim/lua/plugins/formatting.lua new file mode 100644 index 0000000..77f610d --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/formatting.lua @@ -0,0 +1,121 @@ +---@param bufnr integer +---@param ... string +---@return string +local function first(bufnr, ...) + local conform = require("conform") + for i = 1, select("#", ...) do + local formatter = select(i, ...) + if conform.get_formatter_info(formatter, bufnr).available then + return formatter + end + end + return select(1, ...) +end +local formatters = { + angular = { "prettierd", "prettier", stop_after_first = true }, + astro = { "prettierd", "prettier", stop_after_first = true }, + bash = { "shfmt" }, + bib = { "bibtex-tidy" }, + css = function(bufnr) + return { first(bufnr, "prettierd", "prettier"), "rustywind" } + end, + graphql = { "prettierd", "prettier", stop_after_first = true }, + html = function(bufnr) + return { first(bufnr, "prettierd", "prettier"), "rustywind" } + end, + javascript = { "prettierd", "prettier", stop_after_first = true }, + javascriptreact = { "prettierd", "prettier", stop_after_first = true }, + json = { "jq" }, + liquid = { "prettierd", "prettier", stop_after_first = true }, + lua = { "stylua" }, + markdown = function(bufnr) + return { first(bufnr, "prettierd", "prettier"), "injected" } + end, + python = { "ruff_fix", "ruff_format", "ruff_organize_imports" }, + quarto = function(bufnr) + return { first(bufnr, "prettierd", "prettier"), "injected" } + end, + sh = { "shfmt" }, + sql = { "sleek" }, + svelte = { "prettierd", "prettier", stop_after_first = true }, + typescript = { "prettierd", "prettier", stop_after_first = true }, + typescriptreact = { "prettierd", "prettier", stop_after_first = true }, + vue = function(bufnr) + return { first(bufnr, "prettierd", "prettier"), "rustywind" } + end, + yaml = { "prettierd", "prettier", stop_after_first = true }, + zsh = { "shfmt" }, +} + +return { + + -- formatting setup + { + "zapling/mason-conform.nvim", + dependencies = { + { + "stevearc/conform.nvim", + config = function() + require("conform").setup({ + + lsp_format = "fallback", + + format_after_save = function(bufnr) + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + return { lsp_fallback = true } + end, + formatters_by_ft = formatters, + }) + vim.api.nvim_create_user_command("FormatDisable", function(args) + if args.bang then + vim.g.disable_autoformat = true + else + -- FormatDisable! will disable formatting globally + vim.b.disable_autoformat = true + end + end, { + desc = "Disable formatting on save", + bang = true, + }) + vim.api.nvim_create_user_command("FormatEnable", function() + vim.b.disable_autoformat = false + vim.g.disable_autoformat = false + end, { + desc = "Enable formatting on save", + }) + end, + cmd = { "ConformInfo" }, + keys = { + { + "ll", + function() + require("conform").format({ async = true, lsp_fallback = true }) + end, + mode = { "n", "v" }, + desc = "Format buffer", + }, + { + "lL", + function() + vim.g.disable_autoformat = not vim.g.disable_autoformat + end, + desc = "Toggle AutoFormat", + }, + { + "vf", + ":ConformInfo", + desc = "ConformInfo", + }, + }, + init = function() + -- If you want the formatexpr, here is the place to set it + vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" + end, + }, + }, + event = { "BufWritePre" }, + opts = {}, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/ide.lua b/nvim/.config/nvim/lua/plugins/ide.lua index e82bd18..5d24fe5 100644 --- a/nvim/.config/nvim/lua/plugins/ide.lua +++ b/nvim/.config/nvim/lua/plugins/ide.lua @@ -1,103 +1,4 @@ -} -local formatters = { - angular = { { "prettierd", "prettier" } }, - astro = { { "prettierd", "prettier" } }, - bash = { "shfmt" }, - bib = { "bibtex-tidy" }, - css = { { "prettierd", "prettier" }, "rustywind" }, - graphql = { { "prettierd", "prettier" } }, - html = { { "prettierd", "prettier" }, "rustywind" }, - javascript = { { "prettierd", "prettier" } }, - javascriptreact = { { "prettierd", "prettier" } }, - json = { "jq" }, - liquid = { { "prettierd", "prettier" } }, - lua = { "stylua" }, - markdown = { { "prettierd", "prettier" } }, - python = { "ruff_fix", "ruff_format", "ruff_organize_imports" }, - sh = { "shfmt" }, - svelte = { { "prettierd", "prettier" } }, - typescript = { { "prettierd", "prettier" } }, - typescriptreact = { { "prettierd", "prettier" } }, - vue = { { "prettierd", "prettier" }, "rustywind" }, - yaml = { { "prettierd", "prettier" } }, - zsh = { "shfmt" }, -} - return { - - - - -- formatting setup - { - "zapling/mason-conform.nvim", - dependencies = { - { - "stevearc/conform.nvim", - config = function() - require("conform").setup({ - - lsp_format = "fallback", - - format_after_save = function(bufnr) - if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then - return - end - return { lsp_fallback = true } - end, - formatters_by_ft = formatters, - }) - vim.api.nvim_create_user_command("FormatDisable", function(args) - if args.bang then - vim.g.disable_autoformat = true - else - -- FormatDisable! will disable formatting globally - vim.b.disable_autoformat = true - end - end, { - desc = "Disable formatting on save", - bang = true, - }) - vim.api.nvim_create_user_command("FormatEnable", function() - vim.b.disable_autoformat = false - vim.g.disable_autoformat = false - end, { - desc = "Enable formatting on save", - }) - end, - cmd = { "ConformInfo" }, - keys = { - { - "ll", - function() - require("conform").format({ async = true, lsp_fallback = true }) - end, - mode = { "n", "v" }, - desc = "Format buffer", - }, - { - "lL", - function() - vim.g.disable_autoformat = not vim.g.disable_autoformat - end, - desc = "Toggle AutoFormat", - }, - { - "vf", - ":ConformInfo", - desc = "ConformInfo", - }, - }, - init = function() - -- If you want the formatexpr, here is the place to set it - vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" - end, - }, - }, - event = { "BufWritePre" }, - opts = {}, - }, - - -- automatic docstring creation for a variety of languages { "danymat/neogen", From 41d2b5b628543bf1ef4de2b85e31e5c58fa1a9b1 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 7 Aug 2024 21:17:32 +0200 Subject: [PATCH 16/20] nvim: Rename ide to testing plugins --- nvim/.config/nvim/lua/plugins/{ide.lua => testing.lua} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename nvim/.config/nvim/lua/plugins/{ide.lua => testing.lua} (100%) diff --git a/nvim/.config/nvim/lua/plugins/ide.lua b/nvim/.config/nvim/lua/plugins/testing.lua similarity index 100% rename from nvim/.config/nvim/lua/plugins/ide.lua rename to nvim/.config/nvim/lua/plugins/testing.lua From 38bdf7495442a87048f866937f07cc07fe64b5e0 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 7 Aug 2024 22:21:27 +0200 Subject: [PATCH 17/20] bootstrap: Update package list --- bootstrap/packages_stable.tsv | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bootstrap/packages_stable.tsv b/bootstrap/packages_stable.tsv index fe0a1fd..3d77a6e 100644 --- a/bootstrap/packages_stable.tsv +++ b/bootstrap/packages_stable.tsv @@ -1,5 +1,6 @@ Name Description Source Target Injections aaxtomp3 Convert Audible's .aax filetype to MP3, FLAC, M4A, or OPUS A +abduco Tool for session {at,de}tach support which allows a process to run independently from its controlling terminal R acpid A daemon for delivering ACPI power management events with netlink support R afew Initial tagging script for notmuch mail R alias-tips-git An oh-my-zsh plugin to help remembering those aliases you defined once A @@ -18,6 +19,7 @@ aspell-en English dictionary for aspell R atool A script for managing file archives of various types R atuin Magical shell history R aubio A tool for extracting annotations from audio signals R +auto-cpufreq Automatic CPU speed & power optimizer A autofs A kernel-based automounter for Linux A barrier Open-source KVM software based on Synergy (GUI) R base Minimal package set to define a basic Arch Linux installation R @@ -236,12 +238,15 @@ python-adblock Brave's adblock library in Python R python-dictcc commandline tool for dict.cc A python-docs Set of HTML documentation for python R python-html2text A HTML to markdown-structured text converter R +python-jupytext Jupyter notebooks as Markdown documents, Julia, Python or R scripts A python-openpyxl A Python library to read/write Excel 2007 xlsx/xlsm files R python-pagelabels Python library to manipulate PDF page numbers and labels. A python-pancritic CriticMarkdup parser with optional pandoc backend A python-pdfminer Python PDF Parser R python-pip The PyPA recommended tool for installing Python packages R python-pipx Install and Run Python Applications in Isolated Environments R +python-poethepoet A task runner that works well with poetry A +python-polars-bin Blazingly fast DataFrames library using Apache Arrow Columnar Format as memory model A python-pybluez Python wrapper for the BlueZ Bluetooth stack R python-pybtex A BibTeX-compatible bibliography processor written in Python R python-pynvim Python client for Neovim R @@ -272,6 +277,7 @@ rivercarro A slightly modified version of rivertile layout generator for river. rng-tools Random number generator related utilities R sc-im A spreadsheet program based on SC A scc Sloc, Cloc and Code: a very fast accurate code counter with complexity calculations and COCOMO estimates written in pure Go A +scc-bin Sloc, Cloc and Code: scc is a very fast accurate code counter with complexity calculations and COCOMO estimates written in pure Go A scrcpy Display and control your Android device R screen Full-screen window manager that multiplexes a physical terminal R sd Intuitive find & replace R @@ -290,8 +296,7 @@ sudo Give certain users the ability to run some commands as root R surfraw Shell Users' Revolutionary Front Rage Against the Web R swaybg Wallpaper tool for Wayland compositors R swayidle Idle management daemon for Wayland R -swww A Solution to your Wayland Wallpaper Woes A -swww Efficient animated wallpaper daemon for wayland, controlled at runtime. A +swww A Solution to your Wayland Wallpaper Woes R task-spooler Queue up tasks from the shell for batch execution A taskopen Script for taking notes and open urls with taskwarrior A tasksh A shell command that wraps Taskwarrior commands A @@ -300,6 +305,7 @@ tectonic Modernized, complete, self-contained TeX/LaTeX engine, powered by XeTeX termdown Countdown timer and stopwatch in your terminal R tex-gyre-fonts Substitute PostScript fonts in OpenType format R texlab A cross-platform implementation of the Language Server Protocol for LaTeX. R +tgpt-bin ChatGPT in terminal without needing API keys A thermald The Linux Thermal Daemon program from 01.org R tidy-viewer CLI csv pretty printer that uses column styling A timew Timewarrior, A command line time tracking application R @@ -349,6 +355,7 @@ wf-recorder Screen recorder for wlroots-based compositors such as sway R wget Network utility to retrieve files from the Web R wireguard-tools next generation secure network tunnel - tools for configuration R wireless_tools Tools allowing to manipulate the Wireless Extensions R +wl-mirror a simple Wayland output mirror client R wlopm Wayland output power management. A wlsunset Day/night gamma adjustments for Wayland compositors A wlsunset Day/night gamma adjustments for Wayland compositors R From be842ce622b386a10e0a1846820946530fb936b6 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 12 Aug 2024 11:27:31 +0200 Subject: [PATCH 18/20] nvim: Simplify molten statusline function Instead of doing all kinds of security checks beforehand, we simply wrap the molten kernel check into a lua protected call and return an empty result if we would error. We only return the symbol if we don't error and we have an active kernel. --- nvim/.config/nvim/lua/plugins/ui.lua | 36 +++++++++++++++------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/nvim/.config/nvim/lua/plugins/ui.lua b/nvim/.config/nvim/lua/plugins/ui.lua index bdc2974..75da4b5 100644 --- a/nvim/.config/nvim/lua/plugins/ui.lua +++ b/nvim/.config/nvim/lua/plugins/ui.lua @@ -8,26 +8,28 @@ return { -- if molten exists, is initialized and connected to a kernel -- show it in the statusline local function molten() - local function checked_pynvim(_, exitcode) - if exitcode == 0 then - has_pynvim = 1 - else - has_pynvim = 0 - end - end + -- we don't have access to python, disregard element if has_pynvim == 0 then return "" - elseif has_pynvim == -1 then - vim.fn.jobstart({ "python", "-c", "from neovim import VERSION" }, { on_exit = checked_pynvim }) + elseif has_pynvim == 1 then + local status_ok, res = pcall(function() + return require("molten.status").kernels() ~= "" + end) + if status_ok and res then + return "󱪄" + end + return "" + -- we don't know if we have python yet, start a check + else + vim.system({ "poetry", "env", "info", "-p" }, { text = true }, function(_, exitcode) + if exitcode == 0 then + has_pynvim = 1 + else + has_pynvim = 0 + end + end) + has_pynvim = 0 end - if - has_pynvim == 1 - and require("core.util").is_available("molten.status") - and require("molten.status").kernels() ~= "" - then - return "󱪄" - end - return "" end -- count number of selected lines and characters From 4be3a42ffa9af1dddcabf784d19c8d2c2c2d3c2e Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 12 Aug 2024 11:29:33 +0200 Subject: [PATCH 19/20] nvim: Simplify formatter loading Since we use Mason to automatically install any formatter we need, there is (currently) no need for the more complicated logic of deciding between multiple formatters (since the one we prefer should always be available). This also fixes an issue that we can set 'prettier' specific options in conform.nvim but those do not apply to 'prettierd' the same way - we now just use prettier and ignore prettierd. --- nvim/.config/nvim/lua/plugins/formatting.lua | 64 +++++++------------- 1 file changed, 23 insertions(+), 41 deletions(-) diff --git a/nvim/.config/nvim/lua/plugins/formatting.lua b/nvim/.config/nvim/lua/plugins/formatting.lua index 77f610d..7f0d92b 100644 --- a/nvim/.config/nvim/lua/plugins/formatting.lua +++ b/nvim/.config/nvim/lua/plugins/formatting.lua @@ -1,49 +1,26 @@ ----@param bufnr integer ----@param ... string ----@return string -local function first(bufnr, ...) - local conform = require("conform") - for i = 1, select("#", ...) do - local formatter = select(i, ...) - if conform.get_formatter_info(formatter, bufnr).available then - return formatter - end - end - return select(1, ...) -end local formatters = { - angular = { "prettierd", "prettier", stop_after_first = true }, - astro = { "prettierd", "prettier", stop_after_first = true }, + angular = { "prettier" }, + astro = { "prettier" }, bash = { "shfmt" }, bib = { "bibtex-tidy" }, - css = function(bufnr) - return { first(bufnr, "prettierd", "prettier"), "rustywind" } - end, - graphql = { "prettierd", "prettier", stop_after_first = true }, - html = function(bufnr) - return { first(bufnr, "prettierd", "prettier"), "rustywind" } - end, - javascript = { "prettierd", "prettier", stop_after_first = true }, - javascriptreact = { "prettierd", "prettier", stop_after_first = true }, + css = { "prettier", "rustywind" }, + graphql = { "prettier" }, + html = { "prettier", "rustywind" }, + javascript = { "prettier" }, + javascriptreact = { "prettier" }, json = { "jq" }, - liquid = { "prettierd", "prettier", stop_after_first = true }, + liquid = { "prettier" }, lua = { "stylua" }, - markdown = function(bufnr) - return { first(bufnr, "prettierd", "prettier"), "injected" } - end, + markdown = { "prettier", "injected" }, python = { "ruff_fix", "ruff_format", "ruff_organize_imports" }, - quarto = function(bufnr) - return { first(bufnr, "prettierd", "prettier"), "injected" } - end, + quarto = { "prettier", "injected" }, sh = { "shfmt" }, sql = { "sleek" }, - svelte = { "prettierd", "prettier", stop_after_first = true }, - typescript = { "prettierd", "prettier", stop_after_first = true }, - typescriptreact = { "prettierd", "prettier", stop_after_first = true }, - vue = function(bufnr) - return { first(bufnr, "prettierd", "prettier"), "rustywind" } - end, - yaml = { "prettierd", "prettier", stop_after_first = true }, + svelte = { "prettier" }, + typescript = { "prettier" }, + typescriptreact = { "prettier" }, + vue = { "prettier", "rustywind" }, + yaml = { "prettier" }, zsh = { "shfmt" }, } @@ -57,17 +34,22 @@ return { "stevearc/conform.nvim", config = function() require("conform").setup({ - + formatters_by_ft = formatters, lsp_format = "fallback", - format_after_save = function(bufnr) if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then return end return { lsp_fallback = true } end, - formatters_by_ft = formatters, }) + require("conform").formatters.prettier = { + options = { + ext_parsers = { + qmd = "markdown", + }, + }, + } vim.api.nvim_create_user_command("FormatDisable", function(args) if args.bang then vim.g.disable_autoformat = true From 15afe9a85a437c0e3ca556e12e8fb306743fcd4e Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 12 Aug 2024 20:03:54 +0200 Subject: [PATCH 20/20] nvim: Switch to lazydev lua lsp setup Much easier lua development setup. --- nvim/.config/nvim/lua/plugins/completion.lua | 2 -- nvim/.config/nvim/lua/plugins/languages.lua | 25 +++++++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/nvim/.config/nvim/lua/plugins/completion.lua b/nvim/.config/nvim/lua/plugins/completion.lua index c86b02d..c49e23d 100644 --- a/nvim/.config/nvim/lua/plugins/completion.lua +++ b/nvim/.config/nvim/lua/plugins/completion.lua @@ -13,7 +13,6 @@ return { "hrsh7th/cmp-buffer", "hrsh7th/cmp-calc", "hrsh7th/cmp-cmdline", - "hrsh7th/cmp-nvim-lua", "hrsh7th/cmp-nvim-lsp-signature-help", "dmitmel/cmp-digraphs", "jc-doyle/cmp-pandoc-references", @@ -93,7 +92,6 @@ return { end, }, sources = { - { name = "nvim_lua" }, { name = "beancount", option = { diff --git a/nvim/.config/nvim/lua/plugins/languages.lua b/nvim/.config/nvim/lua/plugins/languages.lua index 073ef4d..c24cc38 100644 --- a/nvim/.config/nvim/lua/plugins/languages.lua +++ b/nvim/.config/nvim/lua/plugins/languages.lua @@ -1,5 +1,28 @@ return { { "edKotinsky/Arduino.nvim", ft = "arduino", config = true }, -- statusline - { "euclidianAce/BetterLua.vim", ft = "lua" }, -- better syntax highlighting for lua { "aliou/bats.vim", ft = { "bash", "sh", "zsh", "bats" } }, -- enable syntax for bats shell-code testing library + { + "folke/lazydev.nvim", + ft = "lua", + opts = { + library = { + -- Load luvit types when the `vim.uv` word is found + { path = "luvit-meta/library", words = { "vim%.uv" } }, + }, + }, + dependencies = { + { "Bilal2453/luvit-meta" }, -- optional `vim.uv` typings + { -- optional completion source for require statements and module annotations + "hrsh7th/nvim-cmp", + opts = function(_, opts) + opts.sources = opts.sources or {} + table.insert(opts.sources, { + name = "lazydev", + group_index = 0, -- set group index to 0 to skip loading LuaLS completions + }) + end, + optional = true, + }, + }, + }, }