summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2020-12-03 13:09:09 +0100
committerRobert Günzler <r@gnzler.io>2020-12-07 19:28:05 +0100
commit30c3766736c191e224356084493c004740c27181 (patch)
tree5737bd6f2bf86e84fb27b94a538c3e273fa536ff
parenta81561f16b2a3d533e09a4e92a8f71efcf11ddbf (diff)
vifm: various changes
* add fileviewer for video
* extend fileviewers for images (mvi, gimp)
* add ssh/encfs handler
* swap ,<key> binds to ;<key>
* handle 7zip archives
-rw-r--r--.config/vifm/vifmrc62
1 files changed, 46 insertions, 16 deletions
diff --git a/.config/vifm/vifmrc b/.config/vifm/vifmrc
index 754875c..ee96750 100644
--- a/.config/vifm/vifmrc
+++ b/.config/vifm/vifmrc
@@ -1,4 +1,4 @@
-" vim: filetype=vifm :
+" vim: filetype=vim :
 
 colorscheme papercolor_dark
 
@@ -55,12 +55,6 @@ command! mkcd :mkdir %a | cd %a
 command! vgrep vi "+grep %a"
 command! reload :write | restart
 
-command ssh
-\ : let $SSH_FILE = system('mktemp /tmp/vifm-XXXX.ssh')
-\ | execute '!echo ''%a'' > $SSH_FILE; ls $SSH_FILE %%U'
-\ | execute 'normal l'
-\ | execute '!rm $SSH_FILE'
-
 " ------------------------------------------------------------------------------
 
 " Pdf
@@ -95,12 +89,19 @@ filextype *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,
          \*.as[fx]
         \ {View using mpv}
         \ mpv %f,
+        \ {View using mpv (muted)}
+        \ mpv --mute %f,
         \ {View using ffplay}
         \ ffplay -fs %f,
+
 fileviewer *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,
           \*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx,
           \*.as[fx]
-         \ ffprobe -pretty %c 2>&1
+        \ ffprobe -pretty %c 2>&1,
+
+fileviewer *.mp4,*.mkv,*.webm,
+          \*.m4a,*.mp3,*.opus,
+        \ mediainfo %c 2>&1,
 
 " Web
 filextype *.html,*.htm
@@ -118,10 +119,16 @@ fileviewer *.[1-8] man ./%c | col -b
 
 " Images
 filextype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm
+        \ {View in mvi}
+        \ mvi %c,
         \ {View in imv}
-        \ imv -d -n %c %d 2>/dev/null &,
+        \ imv -d %f 2>/dev/null &,
+        \ {View in terminal}
+        \ icat %c %pw %ph %pd,
+        \ {Edit with GIMP}
+        \ gimp %c &,
 fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm
-         \ convert -identify %f -verbose /dev/null
+         \  icat %c %pw %ph %pd || mediainfo %c 2>&1
 
 " MD5
 filetype *.md5
@@ -145,14 +152,17 @@ filetype *.asc
        \ !!gpg --verify %c,
 
 filetype *.zip,*.jar,*.war,*.ear,*.oxt,*.apkg
-       \ {View contents}
-       \ zip -sf %c | less,
        \ {Extract here}
        \ tar -xf %c,
 filetype *.zip
        \ {Extract ZIP}
        \ unzip %c
-fileviewer *.zip,*.jar,*.war,*.ear,*.oxt zip -sf %c
+fileviewer *.zip,*.jar,*.war,*.ear,*.oxt unzip -l %c
+
+filetype *.7z
+       \ {Extract 7z}
+       \ 7z x %c,
+fileviewer *.7z 7z l %c
 
 " ArchiveMount
 fileviewer *.tgz,*.tar.gz tar -tzf %c
@@ -161,6 +171,24 @@ fileviewer *.tar.txz,*.txz xz --list %c
 fileviewer *.tar tar -tf %c
 
 " ------------------------------------------------------------------------------
+" FUSE
+
+command ssh
+\ : let $SSH_FILE = system('mktemp /tmp/vifm-XXXX.ssh')
+\ | execute '!echo ''%a'' > $SSH_FILE; ls $SSH_FILE %%U'
+" \ | execute 'normal <cr>'
+" \ | execute '!rm $SSH_FILE'
+
+fileviewer *.ssh cat %c
+filetype *.ssh
+        \ {Mount with sshfs}
+        \ FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR,
+
+filetype *.encfs
+        \ {Mount with encfs}
+        \ FUSE_MOUNT2|encfs %PARAM %DESTINATION_DIR,
+
+" ------------------------------------------------------------------------------
 
 " What should be saved automatically between vifm runs
 " Like in previous versions of vifm
@@ -192,6 +220,8 @@ nnoremap S :sort<cr>
 nnoremap w :view<cr>
 vnoremap w :view<cr>gv
 
+" Choose fileviewer to use
+nnoremap gs :file<cr>
 " Open file in the background using its default program
 nnoremap gb :file &<cr>l
 
@@ -207,10 +237,10 @@ nnoremap cc cw<c-u>
 nnoremap A cw
 
 " Open console in current directory
-nnoremap ,t :!alacritty &<cr>
+nnoremap ;t :!swaymsg exec alacritty<cr>
 " Open editor to edit vifmrc and apply settings after returning to vifm
-nnoremap ,c :write | edit $MYVIFMRC | restart<cr>
+nnoremap ;c :write | edit $MYVIFMRC | restart<cr>
 " Toggle wrap setting on ,w key
-nnoremap ,w :set wrap!<cr>
+nnoremap ;w :if system(expand("awk 'BEGIN{print (%pw > %ph)}'")) | split! | else | vsplit! | endif<cr>
 
 nnoremap q :quit<cr>