"------------------------------------------------------------------------------
source /home/michal/.config/vifm/favicons.vifm
set vicmd=nvim
set syscalls
set trash
" This is how many directories to store in the directory history.
set history=100
" Automatically resolve symbolic links on l or Enter.
set nofollowlinks
" With this option turned on you can run partially entered commands with
" unambiguous beginning using :! (e.g. :!Te instead of :!Terminal or :!Te<tab>).
" Natural sort of (version) numbers within text.
set sortnumbers
set sort+=iname
" Maximum number of changes that can be undone.
set undolevels=100
set vimhelp
set norunexec
colorscheme gruvbox
set timefmt=%Y-%m-%d\ %H:%M
set wildmenu
set wildstyle=bar
set suggestoptions=normal,visual,view,otherpane,keys,marks,registers
set ignorecase
set hlsearch
set incsearch
set scrolloff=4
" Don't do too many requests to slow file systems
if !has('win')
set slowfs=curlftpfs
endif
set statusline=" %T%= %A %8u:%-7g Free Space:%a %20d "
" ------------------------------------------------------------------------------
" :mark mark /full/directory/path [filename]
mark b ~/bin/
mark h ~/
" ------------------------------------------------------------------------------
" :com[mand][!] command_name action
" The following macros can be used in a command
" %a is replaced with the user arguments.
" %c the current file under the cursor.
" %C the current file under the cursor in the other directory.
" %f the current selected file, or files.
" %F the current selected file, or files in the other directory.
" %b same as %f %F.
" %d the current directory name.
" %D the other window directory name.
" %m run the command in a menu window
command! df df -h %m 2> /dev/null
command! diff vim -d %f %F
command! zip zip -r %f.zip %f
command! run !! ./%f
command! make !!make %a
command! mkcd :mkdir %a | cd %a
command! vgrep vim "+grep %a"
command! link ln -s %d/%f %D
command! reload :write | restart full
command! wlcopy wl-copy < %f
command! pcman pcmanfm &
command! du du -sh %f %S
command! allp imv *
command! fallp fbv *
command! allm mpv *
command! fallm mpv -vo drm *
" ------------------------------------------------------------------------------
filextype {*.pdf},<application/pdf> foxitreader
fileviewer {*.pdf},<application/pdf> pdftotext -nopgbrk %c -
" PostScript
filextype {*.ps,*.eps,*.ps.gz},<application/postscript>
\ {View in zathura}
\ zathura %f,
\ {View in gv}
\ gv %c %i &,
" Djvu
filextype {*.djvu},<image/vnd.djvu>
\ {View in zathura}
\ zathura %f,
\ {View in apvlv}
\ foxitreader %f,
" Audio
filetype {*.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus},
\<audio/*>
\ mpv %f,
fileviewer {*.mp3},<audio/mpeg> mediainfo
fileviewer {*.m4a},<audio/mpeg> mediainfo
fileviewer {*.flac},<audio/flac> soxi
fileviewer {*.xnb},<file/xnb> mediainfo
fileviewer {*.exe,*.deb,*.msi} mediainfo
fileviewer {*.msi} file
" Video
filextype {*.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,
\*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx,
\*.as[fx]},
\<video/*>
\ {View using ffplay}
\ ffplay -fs -autoexit %f,
\ {View using Dragon}
\ mpv -vo drm %f,
\ {View using mpv}
\ mpv %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]},
\<video/*>
\ mediainfo %c
" Web
filextype {*.html,*.htm},<text/html>
\ chromium %f
\ w3m %f
" Object
filetype {*.o},<application/x-object> nm %f | less
" Man page
filetype {*.[1-8]},<text/troff> man ./%c
fileviewer {*.[1-8]},<text/troff> man ./%c | col -b
" Images
filextype {*.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm},<image/*>
\ imv %f,
\ fbv %f,
fileviewer {*.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm},<image/*>
\ mediainfo %f
" OpenRaster
filextype *.ora
\ {Edit in MyPaint}
\ mypaint %f,
" Mindmap
filextype *.vym
\ {Open with VYM}
\ vym %f &,
" MD5
filetype *.md5
\ {Check MD5 hash sum}
\ md5sum -c %f %S,
" SHA1
filetype *.sha1
\ {Check SHA1 hash sum}
\ sha1sum -c %f %S,
" SHA256
filetype *.sha256
\ {Check SHA256 hash sum}
\ sha256sum -c %f %S,
" SHA512
filetype *.sha512
\ {Check SHA512 hash sum}
\ sha512sum -c %f %S,
" GPG signature
filetype {*.asc},<application/pgp-signature>
\ {Check signature}
\ !!gpg --verify %c,
" Torrent
filetype {*.torrent},<application/x-bittorrent> ktorrent %f &
fileviewer {*.torrent},<application/x-bittorrent> dumptorrent -v %c
" FuseZipMount
filetype {*.zip,*.jar,*.war,*.ear,*.oxt,*.apkg},
\<application/zip,application/java-archive>
\ {Mount with fuse-zip}
\ FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR,
\ {View contents}
\ zip -sf %c | less,
\ {Extract here}
\ tar -xf %c,
fileviewer *.zip,*.jar,*.war,*.ear,*.oxt zip -sf %c
" ArchiveMount
filetype {*.tar,*.tar.bz2,*.tbz2,*.tgz,*.tar.gz,*.tar.xz,*.txz},
\<application/x-tar>
\ {Mount with archivemount}
\ FUSE_MOUNT|archivemount %SOURCE_FILE %DESTINATION_DIR,
fileviewer *.tgz,*.tar.gz tar -tzf %c
fileviewer *.tar.bz2,*.tbz2 tar -tjf %c
fileviewer *.tar.txz,*.txz xz --list %c
fileviewer {*.tar},<application/x-tar> tar -tf %c
" Rar2FsMount and rar archives
filetype {*.rar},<application/x-rar>
\ {Mount with rar2fs}
\ FUSE_MOUNT|rar2fs %SOURCE_FILE %DESTINATION_DIR,
fileviewer {*.rar},<application/x-rar> unrar l %c
" IsoMount
filetype {*.iso},<application/x-iso9660-image>
\ {Mount with fuseiso}
\ FUSE_MOUNT|fuseiso %SOURCE_FILE %DESTINATION_DIR,
fileviewer {*.iso} iso-info -d -i %f
" SshMount
filetype *.ssh
\ {Mount with sshfs}
\ FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR %FOREGROUND,
" FtpMount
filetype *.ftp
\ {Mount with curlftpfs}
\ FUSE_MOUNT2|curlftpfs -o ftp_port=-,,disable_eprt %PARAM %DESTINATION_DIR %FOREGROUND,
" Fuse7z and 7z archives
filetype {*.7z},<application/x-7z-compressed>
\ {Mount with fuse-7z}
\ FUSE_MOUNT|fuse-7z %SOURCE_FILE %DESTINATION_DIR,
fileviewer {*.7z},<application/x-7z-compressed> 7z l %c
" Office files
filextype {*.odt,*.doc,*.docx,*.xls,*.xlsx,*.odp,*.pptx,*.ppt},
\<application/vnd.openxmlformats-officedocument.*,
\application/msword,
\application/vnd.ms-excel>
\ libreoffice %f &
fileviewer {*.odt,*.doc,*.docx,*.xls,*.xlsx,*.odp,*.pptx,*.ppt},<application/msword> mediainfo
" TuDu files
filetype *.tudu tudu -f %c
" Qt projects
filextype *.pro qtcreator %f &
" Directories
filextype */
" Syntax highlighting in preview
"
" Explicitly set highlight type for some extensions
"
" 256-color terminal
" fileviewer *.[ch],*.[ch]pp highlight -O xterm256 -s dante --syntax c %c
" fileviewer Makefile,Makefile.* highlight -O xterm256 -s dante --syntax make %c
"
" 16-color terminal
" fileviewer *.c,*.h highlight -O ansi -s dante %c
"
" Or leave it for automatic detection
"
" fileviewer *[^/] pygmentize -O style=monokai -f console256 -g
" Displaying pictures in terminal
"
" fileviewer *.jpg,*.png fbv %c
" ------------------------------------------------------------------------------
" What should be saved automatically between vifm sessions. Drop "savedirs"
" value if you don't want vifm to remember last visited directories for you.
set vifminfo=dhistory,savedirs,chistory,state,tui,shistory,
\phistory,fhistory,dirstack,registers,bookmarks,bmarks
" ------------------------------------------------------------------------------
" Sample mappings
" Start shell in current directory
nnoremap s :shell<cr>
" Display sorting dialog
nnoremap S :sort<cr>
" Toggle visibility of preview window
nnoremap w :view<cr>
vnoremap w :view<cr>gv
" Open directory in other pane
nnoremap o :sync %c<cr>
" Open file in new instance of nvim
nnoremap O :!nvim %f<cr>
" Open file in the background using its default program
nnoremap gb :file &<cr>l
nnoremap qq :quit<cr>
" Mappings for faster renaming
nnoremap cc cw<c-u>
nnoremap A cw
" Open console in current directory
nnoremap ,t :!alacritty &<cr>
" Open editor to edit vifmrc and apply settings after returning to vifm
nnoremap ,c :write | edit $MYVIFMRC | restart full<cr>
" Toggle wrap setting on ,w key
nnoremap ,w :set wrap!<cr>
" Show summary file or directory size
map i :!du -sh %c %S<cr>
map I :!du -ch %f %m<cr>
map <c-c> :!wl-copy < %c<cr>
" Example of standard two-panel file managers mappings
" ------------------------------------------------------------------------------