diff --git a/config/git/config b/config/git/config index 17cf9e4..606f040 100644 --- a/config/git/config +++ b/config/git/config @@ -7,7 +7,7 @@ [merge] conflictstyle = diff3 [push] - default = simple + default = current followTags = true [gpg] program = gpg @@ -18,11 +18,18 @@ [alias] pf = push --force-with-lease lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit - ff = merge --ff-only @{upstream} + ff = merge --ff-only jn = merge --no-ff --log --edit s = status -vv ce = commit -m '' --allow-empty-message + ap = add -p + claim = blame -M -C -C -C + nuke = !git rm --cached -r . && git reset --hard [rebase] autoSquash = true [rerere] enabled = true +[core] + hooksPath = /home/ninewise/.config/git/hooks +[init] + defaultBranch = development diff --git a/config/ncspot/config.toml b/config/ncspot/config.toml index 7af8bf0..181c6cb 100644 --- a/config/ncspot/config.toml +++ b/config/ncspot/config.toml @@ -1,3 +1,2 @@ audio_cache = false gapless = true -audio_backend = "pipe" diff --git a/config/qutebrowser/config.py b/config/qutebrowser/config.py index 467823d..fde38e1 100644 --- a/config/qutebrowser/config.py +++ b/config/qutebrowser/config.py @@ -7,6 +7,7 @@ config.backend = "webengine" config.load_autoconfig(False) c.completion.shrink = True c.confirm_quit = ["downloads"] +c.content.notifications.enabled = False c.downloads.location.directory = "/tmp" c.downloads.location.suggestion = "both" c.downloads.open_dispatcher = "rifle" @@ -22,8 +23,8 @@ c.session.default_name = "default" c.tabs.background = True c.tabs.last_close = "close" c.tabs.show = "multiple" -c.tabs.favicons.show = "never" -c.url.default_page = "about:blank" +c.tabs.favicons.show = "pinned" +c.url.default_page = "qute://bookmarks" c.url.start_pages = ["qute://bookmarks"] c.url.searchengines = { "startpage": "https://startpage.com/do/search?query={}" , "ecosia": "https://www.ecosia.org/search?q={}" diff --git a/config/vis/lexers/markdown.lua b/config/vis/lexers/markdown.lua deleted file mode 100644 index eb02000..0000000 --- a/config/vis/lexers/markdown.lua +++ /dev/null @@ -1,110 +0,0 @@ --- Copyright 2006-2017 Mitchell mitchell.att.foicica.com. See LICENSE. --- Markdown LPeg lexer. - -local l = require('lexer') -local token, word_match = l.token, l.word_match -local P, R, S = lpeg.P, lpeg.R, lpeg.S - -local M = {_NAME = 'markdown'} - --- Whitespace. -local ws = token(l.WHITESPACE, l.space^1) - --- Block elements. -local header = token('h6', l.starts_line('######') * l.nonnewline^0) + - token('h5', l.starts_line('#####') * l.nonnewline^0) + - token('h4', l.starts_line('####') * l.nonnewline^0) + - token('h3', l.starts_line('###') * l.nonnewline^0) + - token('h2', l.starts_line('##') * l.nonnewline^0) + - token('h1', l.starts_line('#') * l.nonnewline^0) - -local blockquote = token(l.STRING, - lpeg.Cmt(l.starts_line(S(' \t')^0 * '>'), - function(input, index) - local _, e = input:find('\n[ \t]*\r?\n', - index) - return (e or #input) + 1 - end)) - -local blockcode = token('code', l.starts_line(P(' ')^4 + P('\t')) * -P('<') * - l.nonnewline^0) - -local hr = token('hr', lpeg.Cmt(l.starts_line(S(' \t')^0 * lpeg.C(S('*-_'))), - function(input, index, c) - local line = input:match('[^\n]*', index) - line = line:gsub('[ \t]', '') - if line:find('[^'..c..']') or #line < 2 then - return nil - end - return (input:find('\n', index) or #input) + 1 - end)) - --- Span elements. -local dq_str = token(l.STRING, l.range('"', false, true)) -local sq_str = token(l.STRING, l.range("'", false, true)) -local paren_str = token(l.STRING, l.range('()')) -local link = token('link', P('!')^-1 * l.range('[]') * - (P('(') * (l.any - S(') \t'))^0 * - (S(' \t')^1 * - l.range('"', false, true))^-1 * ')' + - S(' \t')^0 * l.range('[]')) + - P('http://') * (l.any - l.space)^1) -local link_label = token('link_label', l.range('[]') * ':') * ws * - token('link_url', (l.any - l.space)^1) * - (ws * (dq_str + sq_str + paren_str))^-1 - -local strong = token('strong', (P('**') * (l.any - '**')^0 * P('**')^-1) + - (P('__') * (l.any - '__')^0 * P('__')^-1)) -local em = token('em', - l.range('*', true) + l.range('_', true)) -local code = token('code', (P('``') * (l.any - '``')^0 * P('``')^-1) + - l.range('`', true, true)) - -local escape = token(l.DEFAULT, P('\\') * 1) - -local list = token('list', - l.starts_line(S(' \t')^0 * (S('*+-') + R('09')^1 * '.')) * - S(' \t')) - -M._rules = { - {'header', header}, - {'blockquote', blockquote}, - {'blockcode', blockcode}, - {'hr', hr}, - {'list', list}, - {'whitespace', ws}, - {'link_label', link_label}, - {'escape', escape}, - {'link', link}, - {'strong', strong}, - {'em', em}, - {'code', code}, -} - -local font_size = 10 -local hstyle = 'fore:red' -M._tokenstyles = { - h6 = hstyle, - h5 = hstyle..',size:'..(font_size + 1), - h4 = hstyle..',size:'..(font_size + 2), - h3 = hstyle..',size:'..(font_size + 3), - h2 = hstyle..',size:'..(font_size + 4), - h1 = hstyle..',size:'..(font_size + 5), - -- code = l.STYLE_EMBEDDED..',eolfilled', - code = 'fore:blue'..',eolfilled', - hr = l.STYLE_DEFAULT..',bold', - link = 'underlined', - link_url = 'underlined', - link_label = l.STYLE_LABEL, - strong = 'bold', - em = 'italics', - list = l.STYLE_CONSTANT, -} - --- Embedded HTML. -local html = l.load('html') -local start_rule = token('tag', l.starts_line(S(' \t')^0 * '<')) -local end_rule = token(l.DEFAULT, P('\n')) -- TODO: l.WHITESPACE causes errors -l.embed_lexer(M, html, start_rule, end_rule) - -return M diff --git a/config/vis/visrc.lua b/config/vis/visrc.lua index 922d1b0..4c16405 100644 --- a/config/vis/visrc.lua +++ b/config/vis/visrc.lua @@ -5,30 +5,43 @@ require('vis') require('plugins/complete-word') require('plugins/myfiletype') -require('plugins/editorconfig/editorconfig') +require('plugins/editorconfig') vis.events.subscribe(vis.events.INIT, function() -- Your global configuration options vis:command('set escdelay 0') - vis:command('set tabwidth 4') vis:command('set autoindent on') - vis:command('set theme dark-16') + vis:command('set theme base-16') end) vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- Your per window configuration options - vis:command('set show-tabs on') + vis:command('set tabwidth 4') + vis:command('set showtabs on') vis:command('set number') end) -vis.events.subscribe(vis.events.FILE_SAVE_PRE, function(file, path) - if file.size ~= 0 and file:content(file.size - 1, 1) ~= "\n" then - file:insert(file.size, "\n") +vis.events.subscribe(vis.events.WIN_HIGHLIGHT, function(win) + if win.file.path and win.file.path:match('.*%.tsx') then + win:set_syntax('javascript') end - return true end) vis:map(vis.modes.NORMAL, ";;", "") +vis:map(vis.modes.NORMAL, '', '') + +-------------------------------------------------------------------------------- +-- Activate open-file-on-enter mode in this window +vis:map(vis.modes.NORMAL, ";e", function() + vis.win:map(vis.modes.NORMAL, "", function() + local line = vis.win.file.lines[vis.win.selection.line] + local filename = string.find(line, ':') + local linenumber = string.find(line, ':', filename + 1) + local column = string.find(line, ':', linenumber + 1) + vis:command(string.format('open "%s"', string.sub(line, 0, filename - 1))) + vis.win.selection:to(tonumber(string.sub(line, filename + 1, linenumber - 1)), tonumber(string.sub(line, linenumber + 1, column - 1))) + end) +end) -------------------------------------------------------------------------------- -- Escape removes counts @@ -41,15 +54,6 @@ vis:map(vis.modes.NORMAL, "", function() end end) --------------------------------------------------------------------------------- --- Fancy cd -vis:command_register("rcd", function(argv, force, cur_win, selection, range) - handle = io.popen('f=$(mktemp); st -e ranger --choosedir="$f" --show-only-dirs; cat "$f"') - local output = handle:read() - handle:close() - vis:command('cd '..output) -end) - -------------------------------------------------------------------------------- -- Fuzzy search filenames to open files @@ -90,12 +94,13 @@ end, 'fuzzy line copy') -- Fuzzy search lines to open files vis:command_register("rg", function(argv, force, cur_win, selection, range) - local out = io.popen("sk --ansi -i -c 'rg --color=always --line-number "..'"{}"'.."'"):read() + local out = io.popen("sk --ansi -i -c 'rg --color=always --line-number --column --colors column:fg:green "..'"{}"'.."'"):read() if out then local filename = string.find(out, ':') local linenumber = string.find(out, ':', filename + 1) + local column = string.find(out, ':', linenumber + 1) vis:command(string.format(argv[1]..' "%s"', string.sub(out, 0, filename - 1))) - vis.win.selection:to(tonumber(string.sub(out, filename + 1, linenumber - 1)), 0) + vis.win.selection:to(tonumber(string.sub(out, filename + 1, linenumber - 1)), tonumber(string.sub(out, linenumber + 1, column - 1))) vis:feedkeys("") end end, 'fuzzy grep open') @@ -198,3 +203,30 @@ vis:command_register("sts", function(argv, force, win, selection, range) end return true end, "Strip line trailing spaces") + +-------------------------------------------------------------------------------- +-- Git + +git_commands = { + ["add"] = function(argv, force, win, selection, range) + local output = io.popen('git add ' .. vis.win.file.path):read() + if (output) then + vis:message(output) + end + end, + ["status"] = function(argv, force, win, selection, range) + local output = io.popen('git status'):read() + if (output) then + vis:message(output) + end + end, +} + +vis:command_register("git", function(argv, force, win, selection, range) + local command = git_commands[argv[1]] + if (command) then + command(argv, force, win, selection, range) + else + vis:message("Unknown git command") + end +end, "Git commands") diff --git a/local/bin/.gitignore b/local/bin/.gitignore index 7a18d50..56a784f 100644 --- a/local/bin/.gitignore +++ b/local/bin/.gitignore @@ -2,14 +2,22 @@ # Some actual binary files alot cabal +chardetect +clirail ctags +dl_lines +dl_lines_colours +dl_stops +dl_stops_geojson dmenu dmenu_path dmenu_run +drank dvtm* dwm flask ghc +ghdl gloss-juicy-viewer hledger hlint @@ -18,6 +26,7 @@ jshon khal khald mfauth +mmemoji notmuch qmk qutebrowser @@ -28,6 +37,7 @@ shelltest shelltest snakeviz snakeviz +soup st stest stylish-haskell @@ -35,6 +45,7 @@ tox tox-quickstart unlit unpar +vdirsyncer vis vis-* wjt diff --git a/local/bin/gitlister b/local/bin/gitlister deleted file mode 120000 index a4fa5b1..0000000 --- a/local/bin/gitlister +++ /dev/null @@ -1 +0,0 @@ -gitfetcher \ No newline at end of file diff --git a/local/bin/macspoofer.sh b/local/bin/macspoofer.sh index 7f56425..22df863 100755 --- a/local/bin/macspoofer.sh +++ b/local/bin/macspoofer.sh @@ -1,22 +1,9 @@ #!/bin/sh - -# Reading our private mac -here="$(dirname "$0")" -mac="${1:-$(cat "$here/macaddress")}" +mac="${1:?Provide mac address as first argument}" +name="${2:-macvlan9000}" enp="$(basename /sys/class/net/enp*)" -wlp="$(basename /sys/class/net/wlp*)" -# Setting the MAC address for our wired -sudo ip link set "$enp" down -sudo ip link set "$enp" address "$mac" -sudo ip link set "$enp" up - -# No more wireless -if [ -e /var/service/iwd ]; then - sudo sv stop /var/service/iwd - sudo ip link set "$wlp" down -fi - -# Restart tor on network change -sudo sv restart tor +sudo ip link add link "$enp" address "$mac" name "$name" type macvlan +/bin/sh +sudo ip link del "$name" diff --git a/local/bin/ytsearch b/local/bin/ytsearch index 155ace1..e6206e3 100755 --- a/local/bin/ytsearch +++ b/local/bin/ytsearch @@ -3,8 +3,8 @@ from youtube_search import YoutubeSearch # pip install youtube-search from sys import argv -for result in YoutubeSearch(' '.join(argv[1:])).to_dict(): +for result in reversed(YoutubeSearch(' '.join(argv[1:])).to_dict()): print(result['duration'], - f"https://www.youtube.com{result['url_suffix']}", + f"https://www.youtube.com{result['url_suffix'].split('&')[0]}", f"{result['title']} -- {result['channel']}", sep='\t') diff --git a/services/mailsync/run b/services/mailsync/run index a08d76b..a458fc9 100755 --- a/services/mailsync/run +++ b/services/mailsync/run @@ -14,6 +14,12 @@ ip route ls | grep -q '.' # check if the gpg-agent is running pgrep gpg-agent > /dev/null +# Don't sync mails while composing +! pgrep -f mcom > /dev/null +! pgrep -f mfwd > /dev/null +! pgrep -f mbnc > /dev/null +! pgrep -f mrep > /dev/null + # Sync email mbsync -a -q || true diff --git a/zshrc b/zshrc index 63d1c5f..7067b1d 100644 --- a/zshrc +++ b/zshrc @@ -69,9 +69,7 @@ alias minbox="mdirs /data/mail | mlist -ndt | mpick -t 'flagged || ! seen' | mso export MBLAZE_PAGER='less -RF' # There is only one vis -alias vim="vis" alias vi="vis" -alias nano="vis" # Ready for ssh'ing alias agent='eval "$(ssh-agent)" && ssh-add' @@ -79,12 +77,12 @@ alias unlock='gpg-connect-agent <<