diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 4f256ff..1bb892d 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -18,28 +18,28 @@ set cleaner ctpvclear # cmds/functions cmd open ${{ case $(file --mime-type "$(readlink -f $f)" -b) in - application/vnd.oasis.opendocument.text) lowriter $fs ;; - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;; - image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;; - text/*|application/json|application/javascript|inode/x-empty) $EDITOR $fx;; - image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;; - image/svg+xml) display -- $f ;; - image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" | - setsid -f sxiv -aio 2>/dev/null | while read -r file; do - [ -z "$file" ] && continue - lf -remote "send select \"$file\"" - lf -remote "send toggle" - done & - ;; - audio/*) mpv --audio-display=no $f ;; - video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; - application/pdf|application/vnd*|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;; - application/pgp-encrypted) $EDITOR $fx ;; + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;; + image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;; + text/*|application/json|inode/x-empty|application/x-subrip) $EDITOR $fx;; + image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;; + image/svg+xml) display -- $f ;; + image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|avif\|tif\|ico\)\(_large\)*$" | + setsid -f nsxiv -aio 2>/dev/null | while read -r file; do + [ -z "$file" ] && continue + lf -remote "send select \"$file\"" + lf -remote "send toggle" + done & + ;; + audio/*|video/x-ms-asf) mpv --audio-display=no $f ;; + video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; + application/pdf|application/vnd.djvu|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;; + application/pgp-encrypted) $EDITOR $fx ;; + application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/octet-stream|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template|application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint|application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template|application/vnd.oasis.opendocument.formula|application/vnd.oasis.opendocument.database) setsid -f libreoffice $fx >/dev/null 2>&1 ;; *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;; esac }} -cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')" +cmd mkdir $mkdir -p "$@" cmd extract ${{ clear; tput cup $(($(tput lines)/3)); tput bold @@ -47,7 +47,22 @@ cmd extract ${{ printf "%s\n\t" "$fx" printf "extract?[y/N]" read ans - [ $ans = "y" ] && aunpack $fx + [ $ans = "y" ] && { + case $fx in + *.tar.bz2) tar xjf $fx ;; + *.tar.gz) tar xzf $fx ;; + *.bz2) bunzip2 $fx ;; + *.rar) unrar e $fx ;; + *.gz) gunzip $fx ;; + *.tar) tar xf $fx ;; + *.tbz2) tar xjf $fx ;; + *.tgz) tar xzf $fx ;; + *.zip) unzip $fx ;; + *.Z) uncompress $fx ;; + *.7z) 7z x $fx ;; + *.tar.xz) tar xf $fx ;; + esac + } }} cmd delete ${{ diff --git a/.config/lf/scope b/.config/lf/scope index 6155a54..8265a87 100755 --- a/.config/lf/scope +++ b/.config/lf/scope @@ -13,20 +13,27 @@ image() { fi } -ifub() { - [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1 -} - # Note that the cache file name is a function of file information, meaning if # an image appears in multiple places across the machine, it will not have to # be regenerated once seen. case "$(file --dereference --brief --mime-type -- "$1")" in + image/avif) CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE" ] && convert "$1" "$CACHE.jpg" + image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;; + image/vnd.djvu) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE" ] && djvused "$1" -e 'select 1; save-page-with /dev/stdout' | convert -density 200 - "$CACHE.jpg" > /dev/null 2>&1 + image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;; +image/svg+xml) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE" ] && inkscape --convert-dpi-method=none -o "$CACHE.png" --export-overwrite -D --export-png-color-mode=RGBA_16 "$1" + image "$CACHE.png" "$2" "$3" "$4" "$5" "$1" + ;; image/*) image "$1" "$2" "$3" "$4" "$5" "$1" ;; - #text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;; + text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;; text/troff) man ./ "$1" | col -b ;; - text/* | */xml | application/json) bat --terminal-width "$(($4-2))" -f "$1" ;; - application/zip) atool --list -- "$1" ;; + text/* | */xml | application/json | application/x-ndjson) bat -p --theme ansi --terminal-width "$(($4-2))" -f "$1" ;; audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;; video/* ) CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" @@ -38,6 +45,12 @@ case "$(file --dereference --brief --mime-type -- "$1")" in [ ! -f "$CACHE.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE" image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;; + */epub+zip|*/mobi*) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE.jpg" ] && gnome-epub-thumbnailer "$1" "$CACHE.jpg" + image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" + ;; + application/*zip) atool --list -- "$1" ;; *opendocument*) odt2txt "$1" ;; application/pgp-encrypted) gpg -d -- "$1" ;; esac diff --git a/.config/nvim/lua/lazyvim/config/autocmd.lua b/.config/nvim/lua/lazyvim/config/autocmd.lua deleted file mode 100644 index 8264002..0000000 --- a/.config/nvim/lua/lazyvim/config/autocmd.lua +++ /dev/null @@ -1,96 +0,0 @@ -vim.api.nvim_create_autocmd({ "User" }, { - pattern = { "AlphaReady" }, - callback = function() - vim.cmd([[ - set laststatus=0 | autocmd BufUnload set laststatus=3 - ]]) - end, -}) - -vim.api.nvim_create_autocmd({ "VimResized" }, { - callback = function() - vim.cmd("tabdo wincmd =") - end, -}) - -vim.api.nvim_create_autocmd({ "CmdWinEnter" }, { - callback = function() - vim.cmd("quit") - end, -}) - -vim.api.nvim_create_autocmd({ "BufWinEnter" }, { - callback = function() - vim.cmd("set formatoptions-=cro") - end, -}) - --- highlight on yank -vim.api.nvim_create_autocmd({ "TextYankPost" }, { - callback = function() - vim.highlight.on_yank() - end, -}) - -vim.api.nvim_create_autocmd({ "VimEnter" }, { - callback = function() - vim.cmd("hi link illuminatedWord LspReferenceText") - end, -}) - --- go to last loc when opening a buffer -vim.api.nvim_create_autocmd("BufReadPost", { - callback = function() - local mark = vim.api.nvim_buf_get_mark(0, '"') - local lcount = vim.api.nvim_buf_line_count(0) - if mark[1] > 0 and mark[1] <= lcount then - pcall(vim.api.nvim_win_set_cursor, 0, mark) - end - end, -}) - --- close some filetypes with -vim.api.nvim_create_autocmd("FileType", { - pattern = { - "qf", - "help", - "man", - "notify", - "lspinfo", - "spectre_panel", - "startuptime", - "tsplayground", - "PlenaryTestPopup", - }, - callback = function(event) - vim.bo[event.buf].buflisted = false - vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true }) - end, -}) - --- add spellcheck and wrapping to some file types -vim.api.nvim_create_autocmd("FileType", { - pattern = { "gitcommit", "markdown" }, - callback = function() - vim.opt_local.wrap = true - vim.opt_local.spell = true - end, -}) - --- Prevent auto comment on next line -vim.cmd([[autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o]]) - --- Set filetype to tex for .tex files? -vim.cmd([[autocmd BufRead,BufNewFile *.tex set filetype=tex]]) - --- Trim whitespace from files on save -vim.cmd([[ -autocmd BufWritePre * let currPos = getpos(".") -autocmd BufWritePre * %s/\s\+$//e -autocmd BufWritePre * %s/\n\+\%$//e -autocmd BufWritePre *.[ch] %s/\%$/\r/e -autocmd BufWritePre * cal cursor(currPos[1], currPos[2]) -]]) - --- Run custom textclear command when exiting a .tex file (cleanup files) -vim.cmd([[autocmd VimLeave *.tex !texclear %]]) diff --git a/.config/nvim/lua/lazyvim/config/keymaps.lua b/.config/nvim/lua/lazyvim/config/keymaps.lua index 4f198e4..ee1fb3b 100644 --- a/.config/nvim/lua/lazyvim/config/keymaps.lua +++ b/.config/nvim/lua/lazyvim/config/keymaps.lua @@ -30,10 +30,6 @@ map("n", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result map("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) map("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) --- Copy/Paste -map("n", "", '"+y', opts) -map("n", "", '"+p', opts) - -- Save map("n", "", ":w", opts) map("i", "", ":w", opts) @@ -52,3 +48,7 @@ map("i", "jk", "", opts) -- Indenting map("v", "<", "", ">gv", opts) + +-- move through quickfix list +map("n", "", ":cnext", opts) +map("n", "", ":cprev", opts) diff --git a/.config/nvim/lua/lazyvim/plugins/cmp.lua b/.config/nvim/lua/lazyvim/plugins/cmp.lua index 370f8a2..b6a010f 100644 --- a/.config/nvim/lua/lazyvim/plugins/cmp.lua +++ b/.config/nvim/lua/lazyvim/plugins/cmp.lua @@ -8,22 +8,22 @@ return { "hrsh7th/cmp-emoji", "hrsh7th/cmp-buffer", "saadparwaiz1/cmp_luasnip", - { - "zbirenbaum/copilot-cmp", - dependencies = "copilot.lua", - opts = {}, - config = function(_, opts) - local copilot_cmp = require("copilot_cmp") - copilot_cmp.setup(opts) - -- attach cmp source whenever copilot attaches - -- fixes lazy-loading issues with the copilot cmp source - require("lazyvim.utils").on_attach(function(client) - if client.name == "copilot" then - copilot_cmp._on_insert_enter({}) - end - end) - end, - }, + -- { + -- "zbirenbaum/copilot-cmp", + -- dependencies = "copilot.lua", + -- opts = {}, + -- config = function(_, opts) + -- local copilot_cmp = require("copilot_cmp") + -- copilot_cmp.setup(opts) + -- -- attach cmp source whenever copilot attaches + -- -- fixes lazy-loading issues with the copilot cmp source + -- require("lazyvim.utils").on_attach(function(client) + -- if client.name == "copilot" then + -- copilot_cmp._on_insert_enter({}) + -- end + -- end) + -- end, + -- }, }, config = function() local cmp = require("cmp") @@ -51,7 +51,7 @@ return { { name = "path" }, { name = "emoji" }, { name = "buffer" }, - { name = "copilot" }, + -- { name = "copilot" }, }), formatting = { format = function(_, item) @@ -70,20 +70,20 @@ return { }) end, }, - { - "zbirenbaum/copilot-cmp", - dependencies = "copilot.lua", - opts = {}, - config = function(_, opts) - local copilot_cmp = require("copilot_cmp") - copilot_cmp.setup(opts) - -- attach cmp source whenever copilot attaches - -- fixes lazy-loading issues with the copilot cmp source - require("lazyvim.utils").on_attach(function(client) - if client.name == "copilot" then - copilot_cmp._on_insert_enter({}) - end - end) - end, - } + -- { + -- "zbirenbaum/copilot-cmp", + -- dependencies = "copilot.lua", + -- opts = {}, + -- config = function(_, opts) + -- local copilot_cmp = require("copilot_cmp") + -- copilot_cmp.setup(opts) + -- -- attach cmp source whenever copilot attaches + -- -- fixes lazy-loading issues with the copilot cmp source + -- require("lazyvim.utils").on_attach(function(client) + -- if client.name == "copilot" then + -- copilot_cmp._on_insert_enter({}) + -- end + -- end) + -- end, + -- } } diff --git a/.config/nvim/lua/lazyvim/plugins/telescope.lua b/.config/nvim/lua/lazyvim/plugins/telescope.lua index f8e1bd2..f80e704 100644 --- a/.config/nvim/lua/lazyvim/plugins/telescope.lua +++ b/.config/nvim/lua/lazyvim/plugins/telescope.lua @@ -1,87 +1,84 @@ local util = require("lazyvim.utils") return { - { - "nvim-telescope/telescope.nvim", - event = "VeryLazy", - keys = { - { "/", util.telescope("live_grep"), desc = "Find in Files (Grep)" }, - { "", util.telescope("find_files"), desc = "Find Files (root dir)" }, - { "fb", "Telescope buffers", desc = "Buffers" }, - { "ff", util.telescope("find_files"), desc = "Find Files (root dir)" }, - { "fF", util.telescope("find_files", { cwd = false }), desc = "Find Files (cwd)" }, - { "fr", "Telescope oldfiles", desc = "Recent" }, - { "fp", "Telescope projects", desc = "Find Projects" }, - { "gc", "Telescope git_commits", desc = "commits" }, - { "gs", "Telescope git_status", desc = "status" }, - { "gb", "Telescope git_branches", desc = "branches" }, - { "ha", "Telescope autocommands", desc = "Auto Commands" }, - { "hc", "Telescope commands", desc = "Commands" }, - { "hf", "Telescope filetypes", desc = "File Types" }, - { "hh", "Telescope help_tags", desc = "Help Pages" }, - { "hk", "Telescope keymaps", desc = "Key Maps" }, - { "hm", "Telescope man_pages", desc = "Man Pages" }, - { "ho", "Telescope vim_options", desc = "Options" }, - { "hs", "Telescope highlights", desc = "Search Highlight Groups" }, - { "ht", "Telescope builtin", desc = "Telescope" }, - { "sb", "Telescope current_buffer_fuzzy_find", desc = "Buffer" }, - { "sc", "Telescope command_history", desc = "Command History" }, - { "sg", util.telescope("live_grep"), desc = "Grep (root dir)" }, - { "sG", util.telescope("live_grep", { cwd = false }), desc = "Grep (cwd)" }, - { "sm", "Telescope marks", desc = "Jump to Mark" }, - { "so", "Telescope resume", desc = "Resume last search" }, - { "sC", "Telescope colorscheme", desc = "Colorscheme" }, - { - "ss", - util.telescope("lsp_document_symbols", { - symbols = { - "Class", - "Function", - "Method", - "Constructor", - "Interface", - "Module", - "Struct", - "Trait", - "Field", - "Property", - }, - }), - desc = "Goto Symbol", - }, - { ",", "Telescope buffers show_all_buffers=true", desc = "Switch Buffer" }, - { ":", "Telescope command_history", desc = "Command History" }, - }, - opts = { - defaults = { - prompt_prefix = " ", - selection_caret = " ", - mappings = { - i = { - [""] = function(...) - return require("telescope.actions").move_selection_next(...) - end, - [""] = function(...) - require("telescope.actions").move_selection_previous(...) - end, - [""] = function(...) - return require("trouble.providers.telescope").open_with_trouble(...) - end, - [""] = function() - util.telescope("find_files", { no_ignore = true })() - end, - [""] = function() - util.telescope("find_files", { hidden = true })() - end, - [""] = function(...) - return require("telescope.actions").cycle_history_next(...) - end, - [""] = function(...) - return require("telescope.actions").cycle_history_prev(...) - end, - }, - }, - }, - }, - }, + { + "nvim-telescope/telescope.nvim", + event = "VeryLazy", + keys = { + { "/", util.telescope("live_grep"), desc = "Find in Files (Grep)" }, + { "", util.telescope("find_files"), desc = "Find Files (root dir)" }, + { "ff", util.telescope("find_files"), desc = "Find Files (root dir)" }, + { "fF", util.telescope("find_files", { cwd = false }), desc = "Find Files (cwd)" }, + { "fr", "Telescope oldfiles", desc = "Recent" }, + { "gc", "Telescope git_commits", desc = "commits" }, + { "gs", "Telescope git_status", desc = "status" }, + { "gb", "Telescope git_branches", desc = "branches" }, + { "ha", "Telescope autocommands", desc = "Auto Commands" }, + { "hc", "Telescope commands", desc = "Commands" }, + { "hf", "Telescope filetypes", desc = "File Types" }, + { "hh", "Telescope help_tags", desc = "Help Pages" }, + { "hk", "Telescope keymaps", desc = "Key Maps" }, + { "hm", "Telescope man_pages", desc = "Man Pages" }, + { "ho", "Telescope vim_options", desc = "Options" }, + { "hs", "Telescope highlights", desc = "Search Highlight Groups" }, + { "ht", "Telescope builtin", desc = "Telescope" }, + { "sb", "Telescope current_buffer_fuzzy_find", desc = "Buffer" }, + { "sc", "Telescope command_history", desc = "Command History" }, + { "sG", util.telescope("live_grep"), desc = "Grep (root dir)" }, + { "sg", util.telescope("live_grep", { cwd = false }), desc = "Grep (cwd)" }, + { "sm", "Telescope marks", desc = "Jump to Mark" }, + { "so", "Telescope resume", desc = "Resume last search" }, + { + "ss", + util.telescope("lsp_document_symbols", { + symbols = { + "Class", + "Function", + "Method", + "Constructor", + "Interface", + "Module", + "Struct", + "Trait", + "Field", + "Property", + }, + }), + desc = "Goto Symbol", + }, + { ",", "Telescope buffers show_all_buffers=true", desc = "Switch Buffer" }, + { ":", "Telescope command_history", desc = "Command History" }, + }, + opts = { + defaults = { + prompt_prefix = " ", + selection_caret = " ", + mappings = { + i = { + [""] = function(...) + return require("telescope.actions").move_selection_next(...) + end, + [""] = function(...) + require("telescope.actions").move_selection_previous(...) + end, + [""] = function(...) + return require("trouble.providers.telescope").open_with_trouble(...) + end, + [""] = function() + util.telescope("find_files", { no_ignore = true })() + end, + [""] = function() + util.telescope("find_files", { hidden = true })() + end, + [""] = function(...) + return require("telescope.actions").cycle_history_next(...) + end, + [""] = function(...) + return require("telescope.actions").cycle_history_prev(...) + end, + }, + }, + }, + }, + }, } diff --git a/.config/nvim/lua/lazyvim/plugins/whichkey.lua b/.config/nvim/lua/lazyvim/plugins/whichkey.lua index 66893fe..ae4bf99 100644 --- a/.config/nvim/lua/lazyvim/plugins/whichkey.lua +++ b/.config/nvim/lua/lazyvim/plugins/whichkey.lua @@ -74,12 +74,12 @@ return { u = { "UndotreeToggle", "Undo Tree" }, ["'"] = { "close", "Close split" }, - c = { - name = "+copilot", - c = { "Copilot enable", "Enable Copilot" }, - d = { "Copilot disable", "Disable Copilot" }, - t = { "Copilot toggle", "Toggle Copilot" }, - }, + -- c = { + -- name = "+copilot", + -- c = { "Copilot enable", "Enable Copilot" }, + -- d = { "Copilot disable", "Disable Copilot" }, + -- t = { "Copilot toggle", "Toggle Copilot" }, + -- }, n = { name = "+neorg", @@ -95,11 +95,6 @@ return { }, }, - f = { - name = "+file", - n = { "enew", "New File" }, - }, - q = { name = "+quit", q = { "wq", "Save and Quit Current" }, diff --git a/.local/bin/compiler b/.local/bin/compiler index 1bad671..8420e25 100755 --- a/.local/bin/compiler +++ b/.local/bin/compiler @@ -17,43 +17,43 @@ ext="${file##*.}" cd "$dir" || exit 1 textype() { \ - textarget="$(getcomproot "$file" || echo "$file")" - echo "$textarget" - command="pdflatex" - ( head -n5 "$textarget" | grep -qi 'xelatex' ) && command="xelatex" - $command --output-directory="${textarget%/*}" "${textarget%.*}" - grep -qi addbibresource "$textarget" && - biber --input-directory "${textarget%/*}" "${textarget%.*}" && - $command --output-directory="${textarget%/*}" "${textarget%.*}" && - $command --output-directory="${textarget%/*}" "${textarget%.*}" + textarget="$(getcomproot "$file" || echo "$file")" + echo "$textarget" + command="pdflatex" + ( head -n5 "$textarget" | grep -qi 'xelatex' ) && command="xelatex" + $command --output-directory="${textarget%/*}" "${textarget%.*}" + grep -qi addbibresource "$textarget" && + biber --input-directory "${textarget%/*}" "${textarget%.*}" && + $command --output-directory="${textarget%/*}" "${textarget%.*}" && + $command --output-directory="${textarget%/*}" "${textarget%.*}" } case "$ext" in - # Try to keep these cases in alphabetical order. - [0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf > "$base".pdf ;; - c) cc "$file" -o "$base" && "$base" ;; - cpp) g++ "$file" -o "$base" && "$base" ;; - cs) mcs "$file" && mono "$base".exe ;; - go) go run "$file" ;; - h) sudo make install ;; - java) javac -d classes "$file" && java -cp classes "${1%.*}" ;; - m) octave "$file" ;; - md) if [ -x "$(command -v lowdown)" ]; then - lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept -T pdf > "$base".pdf - elif [ -x "$(command -v groffdown)" ]; then - groffdown -i "$file" | groff -T pdf > "$base".pdf - else - pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file" - fi ; ;; - mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf > "$base".pdf ;; - ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf > "$base".pdf ;; - org) emacs "$file" --batch -u "$USER" -f org-latex-export-to-pdf ;; - py) python "$file" ;; - [rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;; - rs) cargo build ;; - sass) sassc -a "$file" "$base".css ;; - scad) openscad -o "$base".stl "$file" ;; - sent) setsid -f sent "$file" 2>/dev/null ;; - tex) textype "$file" ;; - *) sed -n '/^#!/s/^#!//p; q' "$file" | xargs -r -I % "$file" ;; + # Try to keep these cases in alphabetical order. + [0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf > "$base".pdf ;; + c) cc "$file" -o "$base" && "$base" ;; + cpp) g++ "$file" -o "$base" && "$base" ;; + cs) mcs "$file" && mono "$base".exe ;; + go) go run "$file" ;; + h) sudo make install ;; + java) javac -d classes "$file" && java -cp classes "${1%.*}" ;; + m) octave "$file" ;; + md) if [ -x "$(command -v lowdown)" ]; then + lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept -T pdf > "$base".pdf + elif [ -x "$(command -v groffdown)" ]; then + groffdown -i "$file" | groff -T pdf > "$base".pdf + else + pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file" + fi ; ;; + mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf > "$base".pdf ;; + ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf > "$base".pdf ;; + org) emacs "$file" --batch -u "$USER" -f org-latex-export-to-pdf ;; + py) python "$file" ;; + [rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;; + rs) cargo build ;; + sass) sassc -a "$file" "$base".css ;; + scad) openscad -o "$base".stl "$file" ;; + sent) setsid -f sent "$file" 2>/dev/null ;; + tex) textype "$file" ;; + *) sed -n '/^#!/s/^#!//p; q' "$file" | xargs -r -I % "$file" ;; esac diff --git a/.local/bin/cron/checkup b/.local/bin/cron/checkup index cae1011..bd3c634 100755 --- a/.local/bin/cron/checkup +++ b/.local/bin/cron/checkup @@ -1,19 +1,17 @@ #!/bin/sh # Syncs repositories and downloads updates, meant to be run as a cronjob. -# make sure you have set up passwordless sudo in SUDOERS file for this script -notify-send "Repository Sync" "Checking for package updates..." +notify-send "📦 Repository Sync" "Checking for package updates..." sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates. Check your internet connection, if pacman is already running, or run update manually to see errors." - pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}" if pacman -Qu | grep -v "\[ignored\]" then - notify-send "Repository Sync" "Sync comelete. You have updates $(pacman -Qu | grep -vc "\[ignored\]") available." + notify-send "🎁 Repository Sync" "Updates available. Click statusbar icon (📦) for update." else - notify-send "Repository Sync" "Sync complete. No new packages for update." + notify-send "📦 Repository Sync" "Sync complete. No new packages for update." fi diff --git a/.local/bin/cron/crontog b/.local/bin/cron/crontog index 2da5d8c..c9a640f 100755 --- a/.local/bin/cron/crontog +++ b/.local/bin/cron/crontog @@ -3,4 +3,4 @@ # Toggles all cronjobs off/on. # Stores disabled crontabs in ~/.config/cronsaved until restored. -([ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved ] && crontab - < "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && rm "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && notify-send "Cronjobs re-enabled.") || ( crontab -l > "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && crontab -r && notify-send "Cronjobs saved and disabled.") +([ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved ] && crontab - < "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && rm "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && notify-send "🕓 Cronjobs re-enabled.") || ( crontab -l > "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && crontab -r && notify-send "🕓 Cronjobs saved and disabled.") diff --git a/.local/bin/maimpick b/.local/bin/maimpick index 8ea9f5e..5de26c1 100755 --- a/.local/bin/maimpick +++ b/.local/bin/maimpick @@ -9,10 +9,10 @@ output="$(date '+%y%m%d-%H%M-%S').png" xclip_cmd="xclip -sel clip -t image/png" case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in - "a selected area") maim -s pic-selected-"${output}" ;; + "a selected area") maim -u -s pic-selected-"${output}" ;; "current window") maim -q -d 0.2 -i "$(xdotool getactivewindow)" pic-window-"${output}" ;; "full screen") maim -q -d 0.2 pic-full-"${output}" ;; - "a selected area (copy)") maim -s | ${xclip_cmd} ;; + "a selected area (copy)") maim -u -s | ${xclip_cmd} ;; "current window (copy)") maim -q -d 0.2 -i "$(xdotool getactivewindow)" | ${xclip_cmd} ;; "full screen (copy)") maim -q -d 0.2 | ${xclip_cmd} ;; esac diff --git a/.local/bin/mounter b/.local/bin/mounter index b532e08..756d04d 100755 --- a/.local/bin/mounter +++ b/.local/bin/mounter @@ -36,7 +36,7 @@ filter() { sed "s/ /:/g" | awk -F':' '$7==""{printf "%s%s (%s) %s\n",$1,$3,$5,$6 unopenedluks="$(for drive in $allluks; do uuid="${drive%% *}" uuid="${uuid//-}" # This is a bashism. - for open in $decrypted; do + [ -n "$decrypted" ] && for open in $decrypted; do [ "$uuid" = "$open" ] && break 1 done && continue 1 echo "🔒 $drive" diff --git a/.local/bin/opout b/.local/bin/opout index 24d75de..d2b447a 100755 --- a/.local/bin/opout +++ b/.local/bin/opout @@ -7,7 +7,7 @@ basename="${1%.*}" case "${*}" in - *.tex|*.sil|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) target="$(getcomproot "$1" || echo "$1")" ; setsid -f xdg-open "${target%.*}".pdf >/dev/null 2>&1 ;; - *.html) setsid -f "$BROWSER" "$basename".html >/dev/null 2>&1 ;; - *.sent) setsid -f sent "$1" >/dev/null 2>&1 ;; + *.tex|*.sil|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) target="$(getcomproot "$1" || echo "$1")" ; setsid -f xdg-open "${target%.*}".pdf >/dev/null 2>&1 ;; + *.html) setsid -f "$BROWSER" "$basename".html >/dev/null 2>&1 ;; + *.sent) setsid -f sent "$1" >/dev/null 2>&1 ;; esac diff --git a/.local/bin/rotdir b/.local/bin/rotdir index 86da6db..d171f29 100755 --- a/.local/bin/rotdir +++ b/.local/bin/rotdir @@ -1,11 +1,11 @@ #!/bin/sh -# When I open an image from the file manager in sxiv (the image viewer), I want +# When I open an image from the file manager in nsxiv (the image viewer), I want # to be able to press the next/previous keys to key through the rest of the # images in the same directory. This script "rotates" the content of a # directory based on the first chosen file, so that if I open the 15th image, # if I press next, it will go to the 16th etc. Autistic, I know, but this is -# one of the reasons that sxiv is great for being able to read standard input. +# one of the reasons that nsxiv is great for being able to read standard input. [ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1 base="$(basename "$1")" diff --git a/.local/share/applications/img.desktop b/.local/share/applications/img.desktop index 42aa81e..5783107 100644 --- a/.local/share/applications/img.desktop +++ b/.local/share/applications/img.desktop @@ -1,4 +1,4 @@ [Desktop Entry] Type=Application Name=Image viewer -Exec=/usr/bin/sxiv -a %f +Exec=/usr/bin/nsxiv -a %f