From bef798418e4445ea9a805d4764cccd248959f1c7 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sat, 5 Mar 2022 20:15:52 +0100 Subject: [PATCH 1/7] qutebrowser: Update wallabag userscript Updated wallabag userscript to be able to both use the current page when called from qutebrowser or any arbitrary url passed as an argument. --- qutebrowser/.config/qutebrowser/maps.py | 37 ++++++++++--------- .../qutebrowser/userscripts/wallabag_add.sh | 23 +++++++++--- 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/qutebrowser/.config/qutebrowser/maps.py b/qutebrowser/.config/qutebrowser/maps.py index 9aabbb1..e3daae5 100644 --- a/qutebrowser/.config/qutebrowser/maps.py +++ b/qutebrowser/.config/qutebrowser/maps.py @@ -17,28 +17,28 @@ config.bind("", "command-history-next", mode="command") config.bind("", "command-history-prev", mode="command") config.bind("", "completion-item-focus prev", mode="command") config.bind("", "completion-item-focus next", mode="command") -config.bind('', 'rl-backward-kill-word', mode='command') -config.bind('', 'rl-kill-word', mode='command') -config.bind('', 'rl-forward-word', mode='command') -config.bind('', 'rl-delete-char', mode='command') -config.bind('', 'rl-beginning-of-line', mode='command') -config.bind('', 'rl-backward-char', mode='command') -config.bind('', 'completion-item-yank', mode='command') -config.bind('', 'completion-item-del', mode='command') -config.bind('', 'rl-end-of-line', mode='command') -config.bind('', 'rl-forward-char', mode='command') -config.bind('', 'rl-backward-delete-char', mode='command') -config.bind('', 'completion-item-focus prev-category', mode='command') -config.bind('', 'completion-item-focus next-category', mode='command') -config.bind('', 'rl-unix-line-discard', mode='command') -config.bind('', 'rl-unix-word-rubout', mode='command') -config.bind('', 'rl-yank', mode='command') +config.bind("", "rl-backward-kill-word", mode="command") +config.bind("", "rl-kill-word", mode="command") +config.bind("", "rl-forward-word", mode="command") +config.bind("", "rl-delete-char", mode="command") +config.bind("", "rl-beginning-of-line", mode="command") +config.bind("", "rl-backward-char", mode="command") +config.bind("", "completion-item-yank", mode="command") +config.bind("", "completion-item-del", mode="command") +config.bind("", "rl-end-of-line", mode="command") +config.bind("", "rl-forward-char", mode="command") +config.bind("", "rl-backward-delete-char", mode="command") +config.bind("", "completion-item-focus prev-category", mode="command") +config.bind("", "completion-item-focus next-category", mode="command") +config.bind("", "rl-unix-line-discard", mode="command") +config.bind("", "rl-unix-word-rubout", mode="command") +config.bind("", "rl-yank", mode="command") ## ADDED # toggles ('cycles') between tabs always showing, or only when switching between them config.bind( leader + "tt", - "config-cycle -t tabs.show always switching ;; config-cycle -t statusbar.show in-mode always", + "config-cycle -t tabs.show always switching ;; config-cycle -t statusbar.show always in-mode", ) config.bind(leader + "th", "set tabs.position bottom") config.bind(leader + "tH", "set tabs.position top") @@ -63,7 +63,8 @@ config.bind(lleader + "dp", "save_to_pdf", mode="normal") # open last download config.bind("gD", "spawn --userscript open_download") -config.bind('"w', "add-wallabag", mode="normal") +config.bind('"w', "add-wallabag", mode="normal") # add current page to wallabag +config.bind(";w", "hint links userscript wallabag_add.sh") # add link to wallabag config.bind('"s', "add-shaarli", mode="normal") config.bind('"a', "send-to-archive", mode="normal") diff --git a/qutebrowser/.local/share/qutebrowser/userscripts/wallabag_add.sh b/qutebrowser/.local/share/qutebrowser/userscripts/wallabag_add.sh index 7b04ff3..18c373f 100755 --- a/qutebrowser/.local/share/qutebrowser/userscripts/wallabag_add.sh +++ b/qutebrowser/.local/share/qutebrowser/userscripts/wallabag_add.sh @@ -1,7 +1,20 @@ #! /usr/bin/bash +# +# Send current page/link to a wallabag instance. +# +# Can be used for sending the current page via: +# :spawn --userscript wallabag_add.sh +# for sending an arbitrary page passed as argument: +# :spawn --userscript wallabag_add.sh https://myinterestingtext.com +# or for sending a hinted link: +# :hint links userscript wallabag_add.sh +# +# Configure your wallabag instance with this: +WALLABAG_INSTANCE="https://read.martyoeh.me" -# from swalladge: -# https://github.com/swalladge/dotfiles/blob/master/local/share/qutebrowser/userscripts/wallabag_add.sh - -# v2.* -echo "open https://read.martyoeh.me/bookmarklet?url=$QUTE_URL" >>"$QUTE_FIFO" +# only works for wallabag v2.* +if [ "$#" -gt 0 ]; then + echo "open -b -r $WALLABAG_INSTANCE/bookmarklet?url=$*" >>"$QUTE_FIFO" +else + echo "open -b -r $WALLABAG_INSTANCE/bookmarklet?url=$QUTE_URL" >>"$QUTE_FIFO" +fi From 9a1efff30cffceb15f240ec6389eeca200d47552 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 7 Mar 2022 21:58:37 +0100 Subject: [PATCH 2/7] nvim: Fix vim-slime temp file, cmp float window Fixed hidden file creation in home directory by vim-slime. It will now rather ask nvim to create a temporary file using that as its paste source. Also disabled cmp completion in 'guihua' floating windows, as per the recommendation for navigator.lua. --- nvim/.config/nvim/lua/plug/_lsp.lua | 2 ++ nvim/.config/nvim/lua/plugins.lua | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/nvim/.config/nvim/lua/plug/_lsp.lua b/nvim/.config/nvim/lua/plug/_lsp.lua index c54a510..ce2acaa 100644 --- a/nvim/.config/nvim/lua/plug/_lsp.lua +++ b/nvim/.config/nvim/lua/plug/_lsp.lua @@ -72,6 +72,8 @@ cmp.setup({ {name = 'pandoc_references'}, {name = 'vCard'} }, {{name = 'buffer'}, {name = 'spell'}}) }) +if vim.o.ft == 'clap_input' and vim.o.ft == 'guihua' and vim.o.ft == + 'guihua_rust' then require'cmp'.setup.buffer {completion = {enable = false}} end -- Use buffer source for `/` search cmp.setup.cmdline('/', {sources = {{name = 'buffer'}}}) diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua index d77650e..b49c7c8 100644 --- a/nvim/.config/nvim/lua/plugins.lua +++ b/nvim/.config/nvim/lua/plugins.lua @@ -122,9 +122,9 @@ require("packer").startup(function() -- REPL work use { 'jpalardy/vim-slime', -- send arbitrary code chunks to REPLs - ft = "python", config = function() vim.g.slime_target = 'tmux' + vim.g.slime_paste_file = vim.fn.tempname() vim.g.slime_default_config = { socket_name = "default", target_pane = "{last}" From a49e49bbd490eb2d44fd0705d266e3200c3173cf Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 7 Mar 2022 22:02:06 +0100 Subject: [PATCH 3/7] nvim: Change path copy mapping Changed mapping to copy path from `yf` to `yp`/`yP`. Two reasons: I might be better able to remember 'yank-path' when saying it in my head as a mnemonic, and with the `yf` mapping set I could only yank things *to* some letter `yt` not including some letter `yf` and it has been very subtly annoying me ever since I introduced the mapping. Fixed now. Also added two variations: `yp` will yank the whole path into the `p` register, and `yP` will only yank the filename itself. Here's to remembering the new mapping! --- nvim/.config/nvim/lua/maps.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nvim/.config/nvim/lua/maps.lua b/nvim/.config/nvim/lua/maps.lua index d4ee163..6f99ae9 100644 --- a/nvim/.config/nvim/lua/maps.lua +++ b/nvim/.config/nvim/lua/maps.lua @@ -56,8 +56,9 @@ map.i.nore[''] = 'guiw`]a' map.c.nore['w!!'] = [[execute 'silent! write !sudo tee % >/dev/null' edit!]] --- yank filename to f buffer -map.n.nore['yf'] = ':let @f = expand("%")' +-- yank current filename/filepath to f buffer +map.n.nore['yp'] = ':let @p = expand("%")' +map.n.nore['yP'] = ':let @p = expand("%:p")' -- repeat the last substitute command with all its flags preserved map.n.nore['&'] = ':&&' From 645248e83aadf4cdd755b05ec89b8d396cc36010 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 8 Mar 2022 09:26:24 +0100 Subject: [PATCH 4/7] ssh: Add host fingerprint matching Added fingerprint matching to host functionality replacing the old matching on ip with nc idea. Functions essentially the same, only that now if another host randomly/or targeted replaces the original checking target you will still not try to be connected since the ssh fingerprint will not match. Should make it a teensy bit more secure. --- ssh/.ssh/conf/config.ssh | 5 ----- ssh/.ssh/config | 9 +++++++-- ssh/.ssh/scripts/check-fingerprint | 21 +++++++++++++++++++++ 3 files changed, 28 insertions(+), 7 deletions(-) delete mode 100644 ssh/.ssh/conf/config.ssh create mode 100755 ssh/.ssh/scripts/check-fingerprint diff --git a/ssh/.ssh/conf/config.ssh b/ssh/.ssh/conf/config.ssh deleted file mode 100644 index 1768d6c..0000000 --- a/ssh/.ssh/conf/config.ssh +++ /dev/null @@ -1,5 +0,0 @@ -# Send a keepalive package every 15 seconds without data -ServerAliveInterval 15 - -# conserve some bandwidth at the cost of processing power -Compression yes diff --git a/ssh/.ssh/config b/ssh/.ssh/config index 2d4b429..628ec7c 100644 --- a/ssh/.ssh/config +++ b/ssh/.ssh/config @@ -1,2 +1,7 @@ -Include ~/.ssh/conf/config.ssh -Include ~/.ssh/conf/hosts.ssh +# Send a keepalive package every 15 seconds without data +ServerAliveInterval 15 + +# conserve some bandwidth at the cost of processing power +Compression yes + +Include ~/.ssh/hosts diff --git a/ssh/.ssh/scripts/check-fingerprint b/ssh/.ssh/scripts/check-fingerprint new file mode 100755 index 0000000..fcbdf4a --- /dev/null +++ b/ssh/.ssh/scripts/check-fingerprint @@ -0,0 +1,21 @@ +#!/bin/bash +# from: https://awbmilne.github.io/blog/SSH-Host-Fallback/ +# Takes 2 arguments: a hostname and an ssh fingerprint +# Retrieves all fingerprints from hostname and compares +# to see if the fingerprint passed in is part of them. +# If it is, returns true; if not, false. +# Can be used for more secure matching on hostname availability +# in sshconfig than e.g. nc ip matching. +# +# To find your keys fingerprint, one option is just connecting +# via `ssh -v` and looking for the fingerprint there. + +fingerprints=$(ssh-keygen -lf <(ssh-keyscan "$1" 2>/dev/null)) + +for fingerprint in $fingerprints; do + if [ "$fingerprint" == "$2" ]; then + exit 0 + fi +done + +exit 1 From eb1dabc44fe9f1cab0bc4cda77f108838cc66156 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 8 Mar 2022 09:33:58 +0100 Subject: [PATCH 5/7] nvim: Fix signcolumn jumping When lsp or gitsigns would show me a symbol in the signcolumn the whole editor page would jump ever so slightly to the right (one symbol, to be precise). This fixes it to show numbers in the signcolumn and just exchange number for sign when something should be shown. Makes numbers a little less readable but editing experience a whole lot smoother. --- nvim/.config/nvim/lua/settings.lua | 41 +++++++++++++----------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/nvim/.config/nvim/lua/settings.lua b/nvim/.config/nvim/lua/settings.lua index 253f4c0..31b7ca5 100644 --- a/nvim/.config/nvim/lua/settings.lua +++ b/nvim/.config/nvim/lua/settings.lua @@ -1,19 +1,12 @@ require("helpers.vimoptions") -local default_builtins_disabled = { - "netrw", - "netrwPlugin" -} +local default_builtins_disabled = {"netrw", "netrwPlugin"} local disable_builtins = function(builtins) - for _, plugin in pairs(builtins) do - vim.g["loaded_" .. plugin] = 1 - end + for _, plugin in pairs(builtins) do vim.g["loaded_" .. plugin] = 1 end end local apply_options = function(opts) - for k, v in pairs(opts) do - vim.opt[k] = v - end + for k, v in pairs(opts) do vim.opt[k] = v end end local o = { @@ -37,43 +30,45 @@ local o = { -- shows linenumbers relative to the one you are on, for easy movement and -- dNUMBERd deletions - number = true, - relativenumber = true, + number = true, + relativenumber = true, + -- puts the numbers into the signcolumn so when git/lsp show signs there's no jump + signcolumn = 'number', -- keeps an undofile next to files so that you can even undo if vim is closed -- in between - undofile = true, + undofile = true, -- TODO o.undodir = '~/.cache/nvim/undodir' -- ignores case by default but will use case when search is specifically not -- all lowercased - ignorecase = true, - smartcase = true, + ignorecase = true, + smartcase = true, -- shows previews of what substitute command will do (and a couple others) - inccommand = 'split', + inccommand = 'split', -- disables showing us the current mode in the command line since airline takes -- care of it - showmode = false, + showmode = false, -- turn off modeline, to ensure security observation - modeline = false, + modeline = false, -- i feel foldlevel 2 is generally pretty usable, for headlines and similar - foldlevel = 2, - conceallevel = 2, + foldlevel = 2, + conceallevel = 2, -- enable mouse, doesn't bug me and might come in useful at some point - mouse = 'a', + mouse = 'a', -- pump all clippings into the system clipboard - clipboard='unnamedplus', + clipboard = 'unnamedplus', -- turn of automatic resizing of individual splits equalalways = false, -- make sure there's always *some* context below cursor - scrolloff=4, + scrolloff = 4 } From 11c1383f01086bdffc672d4fc11badc87ea01cf1 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 8 Mar 2022 09:59:49 +0100 Subject: [PATCH 6/7] nvim: Remove thesaurus mappings, Update spell map Updated enabling spellchecker from Z to ZZ. ZE and ZG for language specific checking stays the same as before. Removed some dangling mappings referring to thesaurus_query plugin which has long been removed. --- nvim/.config/nvim/lua/maps.lua | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/nvim/.config/nvim/lua/maps.lua b/nvim/.config/nvim/lua/maps.lua index 6f99ae9..5c4f83b 100644 --- a/nvim/.config/nvim/lua/maps.lua +++ b/nvim/.config/nvim/lua/maps.lua @@ -188,16 +188,11 @@ map.i.nore.silent['@@'] = 'u:CiteRef' -- Spell check set to O, 'o' for 'orthography': -- Move to the prev/next spelling error with [S ]S -- Move to the prev/next spelling error or suggestion with [s ]s -map.n.nore['Z'] = ':setlocal spell! spelllang=en_us,de_de' +map.n.nore['ZZ'] = ':setlocal spell! spelllang=en_us,de_de' map.n.nore['ZE'] = ':setlocal spell! spelllang=en_us' map.n.nore['ZG'] = ':setlocal spell! spelllang=en_us' map.n.nore['zz'] = '1z=' --- PLUGIN: tq thesaurus_query.vim --- nnoremap zt :ThesaurusQueryReplaceCurrentWord -map.n.nore['zt'] = ':ThesaurusQueryReplaceCurrentWord' -map.v.nore['zt'] = '"ky:ThesaurusQueryReplace k' - -- pp to comPile a document (or file, works for some languages like go/python/c) -- o to open the resulting document (mostly for pdfs) -- po to comPile *and* open a doc From 363f4ac5e61784671bb1464d7293647c6fffe167 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 8 Mar 2022 10:01:40 +0100 Subject: [PATCH 7/7] nvim: Add telescope digraph search MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added plugin for digraph search through telescope. When you want to enter a digraph, you can do so through the usual method, pressing and then entering the digraph shortcut (e.g. `OK` for ✓, or `n?` for ñ) OR you simply double press which opens a quick telescope window to select the digraph you want. --- nvim/.config/nvim/lua/maps.lua | 4 ++++ nvim/.config/nvim/lua/plugins.lua | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/nvim/.config/nvim/lua/maps.lua b/nvim/.config/nvim/lua/maps.lua index 5c4f83b..562a1b3 100644 --- a/nvim/.config/nvim/lua/maps.lua +++ b/nvim/.config/nvim/lua/maps.lua @@ -261,3 +261,7 @@ map.n.nore['[c'] = ':IPythonCellPrevCell' -- insert cell header above/below map.n.nore['cO'] = ':IPythonCellInsertAbovea' map.n.nore['co'] = ':IPythonCellInsertBelowa' + +-- PLUGIN: betterdigraphs +-- allow normal digraph insertion on c-k, search on c-k c-k +map.i.nore[''] = 'lua require "betterdigraphs".digraphs("i")' diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua index b49c7c8..a13364c 100644 --- a/nvim/.config/nvim/lua/plugins.lua +++ b/nvim/.config/nvim/lua/plugins.lua @@ -165,6 +165,10 @@ require("packer").startup(function() }, config = function() require('plug._telescope') end } + use { + 'protex/better-digraphs.nvim', + requires = {{"nvim-telescope/telescope.nvim"}} + } -- snippeting use {"hrsh7th/vim-vsnip", event = "InsertEnter"} -- snippet engine