From 4cc03a611a20d17f43b8bb7d6f2af3341ef02ad4 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 4 Dec 2023 08:26:59 +0100 Subject: [PATCH 1/8] sh: Add default open script Simple wrapper for xdg-open functionality. Simply refers to xdg-open except if there exists mimeo on the system which it will refer to instead. So, a simple preference modificator for mimeo over xdg-open since that is my preference too. Also gave it a short name so I can do open whenever I want and don't have to tax my left hand with tying xdg. --- office/.config/task/taskopenrc | 4 ++-- office/.config/urlview/config | 2 +- qutebrowser/scripts/recently-downloaded | 12 ++++++---- sh/.config/sh/alias | 29 +++++++++---------------- sh/.local/bin/open | 8 +++++++ terminal/.config/vifm/vifmrc | 3 +++ writing/.config/pubs/pubsrc | 2 +- writing/.local/bin/rofi-bib-due | 2 +- 8 files changed, 34 insertions(+), 28 deletions(-) create mode 100755 sh/.local/bin/open diff --git a/office/.config/task/taskopenrc b/office/.config/task/taskopenrc index d78ee56..9fea550 100644 --- a/office/.config/task/taskopenrc +++ b/office/.config/task/taskopenrc @@ -4,14 +4,14 @@ taskbin = task path_ext = /usr/share/taskopen/scripts [Actions] -note_custom_ext.regex = "^Note\\.(.*)" +note_custom_ext.regex = "^Note\\.?(.*)?" note_custom_ext.command = "$EDITOR ${XDG_DATA_HOME:-$HOME/.local/share}/task/notes/$UUID.$LAST_MATCH" notes.regex = "^Note" notes.command = "$EDITOR ${XDG_DATA_HOME:-$HOME/.local/share}/task/notes/$UUID.md" links.regex = "^https?://" -links.command = "xdg-open $FILE" +links.command = "open $FILE" mail.regex = "^<.*@.*>$" mail.command = "notmuch show mid:${FILE:1:-1}" diff --git a/office/.config/urlview/config b/office/.config/urlview/config index e13370a..c351d87 100644 --- a/office/.config/urlview/config +++ b/office/.config/urlview/config @@ -1 +1 @@ -COMMAND xdg-open +COMMAND open diff --git a/qutebrowser/scripts/recently-downloaded b/qutebrowser/scripts/recently-downloaded index b2a1c18..19dd925 100755 --- a/qutebrowser/scripts/recently-downloaded +++ b/qutebrowser/scripts/recently-downloaded @@ -93,9 +93,9 @@ if [ "${#entries[@]}" -eq 0 ]; then die "Download directory »${DOWNLOAD_DIR}« empty" fi -line=$(printf '%s\n' "${entries[@]}" \ - | crop-first-column \ - | $ROFI_CMD "${ROFI_ARGS[@]}") || true +line=$(printf '%s\n' "${entries[@]}" | + crop-first-column | + $ROFI_CMD "${ROFI_ARGS[@]}") || true if [ -z "$line" ]; then exit 0 fi @@ -111,4 +111,8 @@ fi msg info "Opening »$line« (of type $filetype) with ${application%.desktop}" -xdg-open "$path" & +if type open >/dev/null 2>&1; then + open "$path" & +else + xdg-open "$path" & +fi diff --git a/sh/.config/sh/alias b/sh/.config/sh/alias index 42dda26..bc94a82 100644 --- a/sh/.config/sh/alias +++ b/sh/.config/sh/alias @@ -57,31 +57,15 @@ alias myip="curl -s icanhazip.com" if exist fzf; then # Display fuzzy-searchable history alias fzfhistory="history -l -E -D 0 | fzf --tac --height 20" - fzfman() { + fzman() { man "$(apropos --long "$1" | fzf | awk '{print $2, $1}' | tr -d '()')" } - # Fuzzy search packages to install - if exist yay; then - fzf_pkg_tool=yay - elif exist paru; then - fzf_pkg_tool=paru - elif exist pacman; then - fzf_pkg_tool=pacman - fi - # shellcheck disable=2139 # we *want* this to be done at shell startup instead of dynamically - if [ -n "$fzf_pkg_tool" ]; then - alias fzfyay="$fzf_pkg_tool -Slq | fzf -m --preview '$fzf_pkg_tool -Si {1}' | xargs -ro $fzf_pkg_tool -S" - # Fuzzy uninstall packages - alias fzfyayrns="$fzf_pkg_tool -Qeq | fzf -m --preview '$fzf_pkg_tool -Qi {1}' | xargs -ro $fzf_pkg_tool -Rns" - fi - unset fzf_pkg_tool - # ripgrep-all to fzf search through any documents if exist rga; then - fzfrga() { + fzrga() { RG_PREFIX="rga --files-with-matches" - xdg-open "$( + open "$( FZF_DEFAULT_COMMAND="$RG_PREFIX '$1'" \ fzf --sort --preview="[[ ! -z {} ]] && rga --pretty --context 5 {q} {}" \ --phony -q "$1" \ @@ -90,6 +74,13 @@ if exist fzf; then )" } fi + + # quickly fzy search a sqlite database result + if exist sqlite3; then + fzql() { + sqlite3 -header "$1" "$2" | fzf --header-lines=1 --layout=reverse --multi --prompt='fzql> ' + } + fi fi # vifm diff --git a/sh/.local/bin/open b/sh/.local/bin/open new file mode 100755 index 0000000..e3bed8f --- /dev/null +++ b/sh/.local/bin/open @@ -0,0 +1,8 @@ +#!/usr/bin/env sh +# file opener using your preferred applications + +if exist mimeo; then + mimeo "$1" +elif exist xdg-open; then + xdg-open "$1" +fi diff --git a/terminal/.config/vifm/vifmrc b/terminal/.config/vifm/vifmrc index a55a795..eef9d3c 100644 --- a/terminal/.config/vifm/vifmrc +++ b/terminal/.config/vifm/vifmrc @@ -576,6 +576,9 @@ fileviewer *.md " use custom viewer script for rest fileviewer * vifm-default-viewer %c +" use our own custom opener +filetype * open + " Syntax highlighting in preview " " Explicitly set highlight type for some extensions diff --git a/writing/.config/pubs/pubsrc b/writing/.config/pubs/pubsrc index 018dddd..a47a201 100644 --- a/writing/.config/pubs/pubsrc +++ b/writing/.config/pubs/pubsrc @@ -12,7 +12,7 @@ docsdir = ~/documents/library/doc doc_add = copy # the command to use when opening document files -open_cmd = xdg-open +open_cmd = open # which editor to use when editing bibtex files. # if using a graphical editor, use the --wait or --block option, i.e.: diff --git a/writing/.local/bin/rofi-bib-due b/writing/.local/bin/rofi-bib-due index 2577832..47406e1 100755 --- a/writing/.local/bin/rofi-bib-due +++ b/writing/.local/bin/rofi-bib-due @@ -26,4 +26,4 @@ key=$(echo "$choice" | sed -E 's/.*\((\w+)\)$/\1/') library="$(dirname "$(realpath "$BIBFILE")")/pdf" # find and open the key-associated pdf file -${FILEREADER:-xdg-open} "$(find "$library" -type f -name "$key *.pdf")" +${FILEREADER:-open} "$(find "$library" -type f -name "$key *.pdf")" From b712d456dd06306d3cfe9c8008e25bfc8d708b5e Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 4 Dec 2023 08:29:33 +0100 Subject: [PATCH 2/8] vifm: Move devicon classify setting into separate file Will be sourced on startup and provide basically the same icon prefix as before. Made sure to not invoke 'classify+=' too often since each invocation slows down vifm startup a little. (see: https://github.com/vifm/vifm/issues/542) With it being sourced externally we can now do fun things with classify itself and it is easier to update from the rest of our settings. --- terminal/.config/vifm/favicons.vifm | 88 +++++++++++++++++++++++++++++ terminal/.config/vifm/vifmrc | 20 +------ 2 files changed, 91 insertions(+), 17 deletions(-) create mode 100644 terminal/.config/vifm/favicons.vifm diff --git a/terminal/.config/vifm/favicons.vifm b/terminal/.config/vifm/favicons.vifm new file mode 100644 index 0000000..41664ab --- /dev/null +++ b/terminal/.config/vifm/favicons.vifm @@ -0,0 +1,88 @@ +" Ranger devicons for ViFM +" https://github.com/cirala/vifm_devicons +" +" Filetypes/directories + +" Specific directories +set classify+=' :dir:/, :exe:, :reg:, :link:,? :?:, ::../::/, + \  ::.git/::/, + \  ::.config/,,Makefile::/, + \  ::Desktop/::/, + \  ::Documents/::/, + \  ::Development/::/, + \  ::Downloads/::/, + \  ::Dropbox/::/, + \  ::Nextcloud/::/, + \  ::Google\ Drive/::/, + \  ::gitrepos/::/, + \  ::Music/::/, + \  ::Pictures/::/, + \  ::Public/::/, + \  ::Templates/::/, + \  ::Videos/::/, + \  ::Zotero/::/, + \  ::node_modules/::/' + +" Specific files +set classify+=' ::.Xdefaults,,.Xresources,,.bashprofile,,.bash_profile,,.bashrc,,.dmrc,,.d_store,,.fasd,,.gitconfig,,.gitignore,,.jack-settings,,.mime.types,,.nvidia-settings-rc,,.pam_environment,,.profile,,.recently-used,,.selected_editor,,.xinitpurc,,.zprofile,,.yarnc,,.snclirc,,.tmux.conf,,.urlview,,.config,,.ini,,.user-dirs.dirs,,.mimeapps.list,,.offlineimaprc,,.msmtprc,,.Xauthority,,config::/, + \  ::favicon.*,,README,,readme::/, + \  ::.vim,,.vimrc,,.gvimrc,,.vifm::/, + \  ::gruntfile.coffee,,gruntfile.js,,gruntfile.ls::/, + \  ::gulpfile.coffee,,gulpfile.js,,gulpfile.ls::/, + \  ::ledger,,*.beancount::/, + \  ::license,,copyright,,copying,,LICENSE,,COPYRIGHT,,COPYING::/, + \  ::react.jsx::' + +" File extensions +set classify+='λ ::*.ml,,*.mli::/, + \  ::*.styl::/, + \  ::*.scss::/, + \  ::*.py,,*.pyc,,*.pyd,,*.pyo::/, + \  ::*.php::/, + \  ::*.markdown,,*.md::/, + \  ::*.json::/, + \  ::*.js::/, + \  ::*.bmp,,*.gif,,*.ico,,*.jpeg,,*.jpg,,*.png,,*.svg,,*.svgz,,*.tga,,*.tiff,,*.xmb,,*.xcf,,*.xpm,,*.xspf,,*.xwd,,*.cr2,,*.dng,,*.3fr,,*.ari,,*.arw,,*.bay,,*.crw,,*.cr3,,*.cap,,*.data,,*.dcs,,*.dcr,,*.drf,,*.eip,,*.erf,,*.fff,,*.gpr,,*.iiq,,*.k25,,*.kdc,,*.mdc,,*.mef,,*.mos,,*.mrw,,*.obm,,*.orf,,*.pef,,*.ptx,,*.pxn,,*.r3d,,*.raf,,*.raw,,*.rwl,,*.rw2,,*.rwz,,*.sr2,,*.srf,,*.srw,,*.tif,,*.x3f,,*.webp,,*.avif,,*.jxl::/, + \  ::*.ejs,,*.htm,,*.html,,*.slim,,*.xml::/, + \  ::*.mustasche::/, + \  ::*.css,,*.less,,*.bat,,*.conf,,*.ini,,*.rc,,*.yml,,*.cfg::/, + \  ::*.rss::/, + \  ::*.coffee::/, + \  ::*.twig::/, + \  ::*.c++,,*.cpp,,*.cxx,,*.h::/, + \  ::*.cc,,*.c::/, + \  ::*.hs,,*.lhs::/, + \  ::*.lua::/, + \  ::*.jl::/, + \  ::*.go::/, + \  ::*.ts::/, + \  ::*.db,,*.dump,,*.sql::/, + \  ::*.sln,,*.suo::/, + \  ::*.exe::/, + \  ::*.diff,,*.sum,,*.md5,,*.sha512::/, + \  ::*.scala::/, + \  ::*.java,,*.jar::/, + \  ::*.xul::/, + \  ::*.clj,,*.cljc::/, + \  ::*.pl,,*.pm,,*.t::/, + \  ::*.cljs,,*.edn::/, + \  ::*.rb::/, + \  ::*.fish,,*.sh,,*.bash::/, + \  ::*.dart::/, + \  ::*.f#,,*.fs,,*.fsi,,*.fsscript,,*.fsx::/, + \  ::*.rlib,,*.rs::/, + \  ::*.d::/, + \  ::*.erl,,*.hrl::/, + \  ::*.ai::/, + \  ::*.psb,,*.psd::/, + \  ::*.jsx::/, + \  ::*.aac,,*.anx,,*.asf,,*.au,,*.axa,,*.flac,,*.m2a,,*.m4a,,*.mid,,*.midi,,*.mp3,,*.mpc,,*.oga,,*.ogg,,*.ogx,,*.ra,,*.ram,,*.rm,,*.spx,,*.wav,,*.wma,,*.ac3::/, + \  ::*.avi,,*.flv,,*.mkv,,*.mov,,*.mp4,,*.mpeg,,*.mpg,,*.webm,,*.av1::/, + \  ::*.epub,,*.pdf,,*.fb2,,*.djvu::/, + \  ::*.7z,,*.apk,,*.bz2,,*.cab,,*.cpio,,*.deb,,*.gem,,*.gz,,*.gzip,,*.lh,,*.lzh,,*.lzma,,*.rar,,*.rpm,,*.tar,,*.tgz,,*.xz,,*.zip,,*.zst::/, + \  ::*.cbr,,*.cbz::/, + \  ::*.log::/, + \  ::*.doc,,*.docx,,*.adoc::/, + \  ::*.xls,,*.xlsmx::/, + \  ::*.pptx,,*.ppt::/, + \  ::*.sqlite,,*.db::' diff --git a/terminal/.config/vifm/vifmrc b/terminal/.config/vifm/vifmrc index eef9d3c..7c51e5a 100644 --- a/terminal/.config/vifm/vifmrc +++ b/terminal/.config/vifm/vifmrc @@ -307,28 +307,14 @@ noremap w : if layoutis('only') \| " }}} -" Classify (Icons) {{{ -" file types -set classify=' :dir:/, :exe:, :reg:, :link:' -" various file names -set classify+=' ::../::, ::*.sh::, ::*.[hc]pp::, ::*.[hc]::, ::/^copying|license$/::, ::.git/,,*.git/::, ::*.epub,,*.fb2,,*.djvu::, ::*.pdf::, ::*.htm,,*.html,,**.[sx]html,,*.xml::' -" archives -set classify+=' ::*.7z,,*.ace,,*.arj,,*.bz2,,*.cpio,,*.deb,,*.dz,,*.gz,,*.jar,,*.lzh,,*.lzma,,*.rar,,*.rpm,,*.rz,,*.tar,,*.taz,,*.tb2,,*.tbz,,*.tbz2,,*.tgz,,*.tlz,,*.trz,,*.txz,,*.tz,,*.tz2,,*.xz,,*.z,,*.zip,,*.zoo::' -" images -set classify+=' ::*.bmp,,*.gif,,*.jpeg,,*.jpg,,*.ico,,*.png,,*.ppm,,*.svg,,*.svgz,,*.tga,,*.tif,,*.tiff,,*.xbm,,*.xcf,,*.xpm,,*.xspf,,*.xwd::' -" audio -set classify+=' ::*.aac,,*.anx,,*.asf,,*.au,,*.axa,,*.flac,,*.m2a,,*.m4a,,*.mid,,*.midi,,*.mp3,,*.mpc,,*.oga,,*.ogg,,*.ogx,,*.ra,,*.ram,,*.rm,,*.spx,,*.wav,,*.wma,,*.ac3::' -" media -set classify+=' ::*.avi,,*.ts,,*.axv,,*.divx,,*.m2v,,*.m4p,,*.m4v,,*.mka,,*.mkv,,*.mov,,*.mp4,,*.flv,,*.mp4v,,*.mpeg,,*.mpg,,*.nuv,,*.ogv,,*.pbm,,*.pgm,,*.qt,,*.vob,,*.wmv,,*.xvid::' -" office files -set classify+=' ::*.doc,,*.docx::, ::*.xls,,*.xls[mx]::, ::*.pptx,,*.ppt::' -" }}} -" " ------------------------------------------------------------------------------ " Filetypes {{{ " ------------------------------------------------------------------------------ +" give pretty nerdfont-devicon icons to most files +source $VIFM/favicons.vifm + " The file type is for the default programs to be used with " a file extension. " :filetype pattern1,pattern2 defaultprogram,program2 From 3bd67eab3de50fcbc881cef14c2b17591802f767 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 4 Dec 2023 08:31:01 +0100 Subject: [PATCH 3/8] vifm: Add toggle icon mapping 'ti' Added mapping to toggle classify prefix icons on or off quickly using my semi-established 'toggle' submenu with the mapping `ti` (for toggle icon). --- terminal/.config/vifm/vifmrc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/terminal/.config/vifm/vifmrc b/terminal/.config/vifm/vifmrc index 7c51e5a..b69eb05 100644 --- a/terminal/.config/vifm/vifmrc +++ b/terminal/.config/vifm/vifmrc @@ -172,6 +172,13 @@ command! fzfcd : set noquickview \| if $FZF_PICK != '' \| execute 'cd' fnameescape($FZF_PICK) \| endif +" show or hide the devicon prefix for files +command! toggleicons : + \| if &classify == '' + \| source $VIFM/favicons.vifm + \| else + \| set classify='' + \| endif " }}} " vifminfo {{{ " ------------------------------------------------------------------------------ @@ -269,10 +276,7 @@ nnoremap tN :windo toggle number nnoremap tR :windo toggle relativenumber nnoremap te :execute ':tree! | echo ":tree"' nnoremap tt t - -" zo shows hidden files, mimicking fold open in vim -- why does zc not close -" again? -nnoremap zc zm +nnoremap ti :toggleicons " external commands " extract currently selected file(s) From eeca1f3817551325c40e9d7af3fec528e5717a0d Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 4 Dec 2023 08:32:49 +0100 Subject: [PATCH 4/8] zsh: Remove path deduplication Aside from some more needed things, the path deduplication function is the most time-consuming invocation on zsh startup, taking almost 100ms on my system. Perhaps it would be reasonable to re-introduce when the first invocation from path is occurring but it is simply too much time taken for each time I start a new shell instance for now. --- terminal/.config/zsh/.zshrc | 8 -------- 1 file changed, 8 deletions(-) diff --git a/terminal/.config/zsh/.zshrc b/terminal/.config/zsh/.zshrc index 180def1..35d5659 100644 --- a/terminal/.config/zsh/.zshrc +++ b/terminal/.config/zsh/.zshrc @@ -192,14 +192,6 @@ get_var() { set_var() { eval "$1=\"\$2\"" } -dedup_pathvar() { - pathvar_name="$1" - pathvar_value="$(get_var "$pathvar_name")" - deduped_path="$(perl -e 'print join(":",grep { not $seen{$_}++ } split(/:/, $ARGV[0]))' "$pathvar_value")" - set_var "$pathvar_name" "$deduped_path" -} -dedup_pathvar PATH -dedup_pathvar MANPATH unset CONFDIR unset ZSHCONFDIR From e90d1c9c39d567c854dde7a588478668e56fddd0 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 4 Dec 2023 08:36:43 +0100 Subject: [PATCH 5/8] vifm: Remove compatibility options Removed the compatibility options set by default in vifm, which has 2 large effects: Will remove the default tab mapping to switch panes. I re-enabled it for now since it has become somewhat part of my muscle memory but I believe it is better to have it as an explicit mapping which I can change than hunting for this option somewhere down the road. Second, it makes dd/DD/yy behave very differently, *only* working on the currently highlighted file. To operate on the currently selected files like previously one uses ds/Ds/ys instead. I want to re-train my muscle memory for this instead since it will make my usage more flexible in the future. There is also dS/DS/yS for operating on non-selected files instead which is even more flexible. --- terminal/.config/vifm/vifmrc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/terminal/.config/vifm/vifmrc b/terminal/.config/vifm/vifmrc index b69eb05..7d7cffe 100644 --- a/terminal/.config/vifm/vifmrc +++ b/terminal/.config/vifm/vifmrc @@ -23,6 +23,15 @@ set vicmd=nvim " doesn't support progress measuring. set syscalls +" disable 'compatibility' options, by default kept for legacy I suppose? +" Turning it off: +" Makes dd/DD/yy only work on currently highlighted file, use ds/Ds/ys for +" working on selected files (or dS, DS, yS for inversion). +" Makes tab not automatically switch panels. +" Makes permanent filter commands act differently, no clue haven't really made +" use of them yet. +set cpoptions= + " Trash Directory " The default is to move files that are deleted with dd or :d to " the trash directory. If you change this you will not be able to move @@ -31,6 +40,7 @@ set syscalls " This probably shouldn't be an option. set trash set trashdir=$XDG_DATA_HOME/Trash +set confirm-=delete " This is how many directories to store in the directory history. set history=100 @@ -215,8 +225,9 @@ nmap Q :q "nnoremap nnoremap -" quick find mirroring my vim filefinder -nnoremap f :FZFfind +" switch pane with tab, like cpoption did +nnoremap w + " Start shell in current directory nnoremap s :shell @@ -237,8 +248,8 @@ nnoremap gb :file &l " create a tab nnoremap t :tabnew -" yank current directory path into the clipboard " clip is universal clipper from `sh` module +" yank current directory path into the clipboard nnoremap yd :!echo -n %d | clip %i " yank current file path into the clipboard nnoremap yf :!echo -n %c:p | clip %i @@ -255,9 +266,6 @@ nnoremap A cw nnoremap cw cW nnoremap cW cw -" Open editor to edit vifmrc and apply settings after returning to vifm -nnoremap V :write | edit $MYVIFMRC | restart - " esc quits out of preview mode (it does in vim, why not here?) qnoremap q From 9bd4a80be85e8d26f2a7dbb99b037a32efa7419a Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 4 Dec 2023 08:38:35 +0100 Subject: [PATCH 6/8] qutebrowser: Update reddit redirects Updated reddit redirects once again. Will soon have to figure out a different way of approaching the lib- redirections with so many services blocking/throttling/shutting down the FOSS frontends. For now, I will bear with it. --- qutebrowser/config/redirects.py | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/qutebrowser/config/redirects.py b/qutebrowser/config/redirects.py index 417e36c..1eb8ef0 100644 --- a/qutebrowser/config/redirects.py +++ b/qutebrowser/config/redirects.py @@ -46,6 +46,7 @@ redirects = { "yewtu.be", "iv.melmac.space", "iv.datura.network", + "piped.kavin.rocks", ], }, "lbry": { @@ -61,15 +62,28 @@ redirects = { "reddit": { "source": ["reddit.com"], "target": [ - "td.vern.cc", - "teddit.artemislena.eu", - "teddit.bus-hit.me", - "teddit.hostux.net", - "teddit.namazso.eu", - "teddit.net", - "teddit.pussthecat.org", - "teddit.sethforprivacy.com", + "teddit.ggc-project.de", + "teddit.kavin.rocks", "teddit.zaggy.nl", + "teddit.namazso.eu", + "teddit.nautolan.racing", + "teddit.tinfoil-hat.net", + "teddit.domain.glass", + "libreddit.kavin.rocks", + "safereddit.com", + "reddit.invak.id", + "reddit.simo.sh", + "libreddit.strongthany.cc", + "libreddit.domain.glass", + "libreddit.pussthecat.org", + "libreddit.kylrth.com", + "libreddit.privacydev.net", + "l.opnxng.com", + "libreddit.oxymagnesium.com", + "reddit.utsav2.dev", + "libreddit.freedit.eu", + "lr.artemislena.eu", + "snoo.habedieeh.re", ], }, "twitter": { From 5941f6f77adffcd410a4876b68b8dcf648f1d9db Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 4 Dec 2023 08:39:19 +0100 Subject: [PATCH 7/8] vifm: Extend fzf mapping functionality Extended functionality to work in current directory with lower-case letters and from home directory using upper-case. So, f will search files in current dir, F in home dir. Same for d/D and w/W. HACK Also made it use fd instead of find by default for the speedup. This should probably only be done after detecting if fd is even installed on the system but I do not have time for this right now. --- terminal/.config/vifm/vifmrc | 15 +++++++++++---- terminal/.config/wezterm/maps.lua | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/terminal/.config/vifm/vifmrc b/terminal/.config/vifm/vifmrc index 7d7cffe..54bb2c1 100644 --- a/terminal/.config/vifm/vifmrc +++ b/terminal/.config/vifm/vifmrc @@ -168,17 +168,22 @@ command! mkcd :mkdir %a | cd %a command! syncme :cd %D command! fzfhome : set noquickview - \| let $FZF_PICK = term('locate $HOME | fzf 2>/dev/tty') + \| let $FZF_PICK = term('fd . $HOME | fzf 2>/dev/tty') \| if $FZF_PICK != '' \| execute 'goto' fnameescape($FZF_PICK) \| endif command! fzf : set noquickview - \| let $FZF_PICK = term('find | fzf 2>/dev/tty') + \| let $FZF_PICK = term('fd | fzf 2>/dev/tty') \| if $FZF_PICK != '' \| execute 'goto' fnameescape($FZF_PICK) \| endif +command! fzfcdhome : set noquickview + \| let $FZF_PICK = term('fd -td . $HOME | fzf 2>/dev/tty') + \| if $FZF_PICK != '' + \| execute 'cd' fnameescape($FZF_PICK) + \| endif command! fzfcd : set noquickview - \| let $FZF_PICK = term('find -type d | fzf 2>/dev/tty') + \| let $FZF_PICK = term('fd -td | fzf 2>/dev/tty') \| if $FZF_PICK != '' \| execute 'cd' fnameescape($FZF_PICK) \| endif @@ -300,8 +305,10 @@ noremap ,pc :!pdftk %f cat output output.pdf " fzf movements nnoremap f :fzf +nnoremap F :fzfhome nnoremap c :fzfcd -nnoremap F :grep +nnoremap C :fzfcdhome +nnoremap w :grep " preview thumbnails of current folder " select thumbnails with m/M in nsxiv diff --git a/terminal/.config/wezterm/maps.lua b/terminal/.config/wezterm/maps.lua index 4f749ed..74cc6bd 100644 --- a/terminal/.config/wezterm/maps.lua +++ b/terminal/.config/wezterm/maps.lua @@ -65,6 +65,7 @@ local keys = { }), }, { key = "f", mods = "LEADER", action = act.QuickSelect }, + -- open web link { key = "F", mods = "LEADER", From 80f2afb1cfa798d4fe05bb649f5980f154130a9e Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 4 Dec 2023 08:42:56 +0100 Subject: [PATCH 8/8] vifm: Add alt file opening, option cycling mappings Added cycling through (command mode) options with C-p/C-n since I am used to doing this. Added a quick short mapping to `o` to show all file openers defined for the current file and be able to select one. --- terminal/.config/vifm/vifmrc | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/terminal/.config/vifm/vifmrc b/terminal/.config/vifm/vifmrc index 54bb2c1..0375b97 100644 --- a/terminal/.config/vifm/vifmrc +++ b/terminal/.config/vifm/vifmrc @@ -1,4 +1,4 @@ -" vim: filetype=vifm : set foldmethod=marker foldlevel=0 nomodeline: +" vim: filetype=vim : set foldmethod=marker foldlevel=0 nomodeline: " Sample configuration file for vifm (last updated: 20 July, 2018) " You can edit this file by hand. " The " character at the beginning of a line comments out the line. @@ -227,12 +227,15 @@ nmap Q :q " Sample mappings " for now they use space for my leader key - so we can't switch panels with " space, use tab for that -"nnoremap -nnoremap +nmap +nnoremap " switch pane with tab, like cpoption did nnoremap w +" scroll through command-line options with C-p/C-n +cnoremap +cnoremap " Start shell in current directory nnoremap s :shell @@ -274,6 +277,9 @@ nnoremap cW cw " esc quits out of preview mode (it does in vim, why not here?) qnoremap q +" quickly show alternative file opening applications +nnoremap o :file + " Select file and jump in the indicated direction nnoremap J tj nnoremap K tk @@ -361,12 +367,13 @@ source $VIFM/favicons.vifm " program. " Pdf -filextype *.pdf +filextype ,*.pdf \ { view as rich file } \ sioyek %c %i, zathura %c %i &, apvlv %c, xpdf %c, \ { edit text content } \ pdftotext -nopgbrk %c - | nvim -fileviewer *.pdf pdftotext -nopgbrk %c - +filextype ,*.pdf + \ pdftotext -nopgbrk %c - " PostScript filextype *.ps,*.eps,*.ps.gz @@ -458,6 +465,11 @@ filextype *.ora \ {Edit in MyPaint} \ mypaint %f, +" OpenRaster +filetype *.sqlite,*.db + \ {Edit in sqlite3} + \ sqlite3 %f, + " tabular data filextype *.csv \ {Open with visidata}