Compare commits

...

8 Commits

Author SHA1 Message Date
Marty Oehme 80f2afb1cf
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.
2023-12-04 08:42:56 +01:00
Marty Oehme 5941f6f77a
vifm: Extend fzf mapping functionality
Extended functionality to work in current directory with lower-case
letters and from home directory using upper-case. So, <leader>f
will search files in current dir, <leader>F in home dir.
Same for <leader>d/D and <leader>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.
2023-12-04 08:41:24 +01:00
Marty Oehme 9bd4a80be8
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.
2023-12-04 08:38:35 +01:00
Marty Oehme e90d1c9c39
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.
2023-12-04 08:36:43 +01:00
Marty Oehme eeca1f3817
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.
2023-12-04 08:32:49 +01:00
Marty Oehme 3bd67eab3d
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).
2023-12-04 08:31:01 +01:00
Marty Oehme b712d456dd
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.
2023-12-04 08:29:33 +01:00
Marty Oehme 4cc03a611a
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.
2023-12-04 08:26:59 +01:00
12 changed files with 199 additions and 81 deletions

View File

@ -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}"

View File

@ -1 +1 @@
COMMAND xdg-open
COMMAND open

View File

@ -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": {

View File

@ -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

View File

@ -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

8
sh/.local/bin/open Executable file
View File

@ -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

View File

@ -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::'

View File

@ -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.
@ -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
@ -158,20 +168,32 @@ 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! fzfcd : set noquickview
\| let $FZF_PICK = term('find -type d | fzf 2>/dev/tty')
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('fd -td | fzf 2>/dev/tty')
\| 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 {{{
" ------------------------------------------------------------------------------
@ -205,11 +227,15 @@ nmap Q :q<cr>
" Sample mappings
" for now they use space for my leader key - so we can't switch panels with
" space, use tab for that
"nnoremap <space> <nop>
nnoremap <space><space> <space>
nmap <space> <nop>
nnoremap <space><space> <nop>
" quick find mirroring my vim filefinder
nnoremap <space>f :FZFfind<cr>
" switch pane with tab, like cpoption did
nnoremap <tab> <c-w>w
" scroll through command-line options with C-p/C-n
cnoremap <c-p> <s-tab>
cnoremap <c-n> <tab>
" Start shell in current directory
nnoremap s :shell<cr>
@ -230,8 +256,8 @@ nnoremap gb :file &<cr>l
" create a tab
nnoremap <space>t :tabnew<cr>
" 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<cr>
" yank current file path into the clipboard
nnoremap yf :!echo -n %c:p | clip %i<cr>
@ -248,12 +274,12 @@ nnoremap A cw
nnoremap cw cW
nnoremap cW cw
" Open editor to edit vifmrc and apply settings after returning to vifm
nnoremap <space>V :write | edit $MYVIFMRC | restart<cr>
" esc quits out of preview mode (it does in vim, why not here?)
qnoremap <esc> q
" quickly show alternative file opening applications
nnoremap o :file <tab>
" Select file and jump in the indicated direction
nnoremap J tj
nnoremap K tk
@ -269,10 +295,7 @@ nnoremap tN :windo toggle number<cr>
nnoremap tR :windo toggle relativenumber<cr>
nnoremap te :execute ':tree! | echo ":tree"'<cr>
nnoremap tt t
" zo shows hidden files, mimicking fold open in vim -- why does zc not close
" again?
nnoremap zc zm
nnoremap ti :toggleicons<cr>
" external commands
" extract currently selected file(s)
@ -288,8 +311,10 @@ noremap ,pc :!pdftk %f cat output output.pdf
" fzf movements
nnoremap <space>f :fzf<cr>
nnoremap <space>F :fzfhome<cr>
nnoremap <space>c :fzfcd<cr>
nnoremap <space>F :grep<space>
nnoremap <space>C :fzfcdhome<cr>
nnoremap <space>w :grep<space>
" preview thumbnails of current folder
" select thumbnails with m/M in nsxiv
@ -307,28 +332,14 @@ noremap <silent> w : if layoutis('only')
\| <cr>
" }}}
" 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
@ -356,12 +367,13 @@ set classify+=' ::*.doc,,*.docx::, ::*.xls,,*.xls[mx]::, ::*.pptx,,*.pp
" program.
" Pdf
filextype *.pdf
filextype <application/pdf>,*.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 <application/pdf>,*.pdf
\ pdftotext -nopgbrk %c -
" PostScript
filextype *.ps,*.eps,*.ps.gz
@ -453,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}
@ -576,6 +593,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

View File

@ -65,6 +65,7 @@ local keys = {
}),
},
{ key = "f", mods = "LEADER", action = act.QuickSelect },
-- open web link
{
key = "F",
mods = "LEADER",

View File

@ -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

View File

@ -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.:

View File

@ -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")"