"" VIFM Config file / 2023-03-16 / Jan Andrle "" #region B – Bookmarks if !has('win') :bmark! "~/" home :bmark! "~/Stažené/" downloads :bmark! "~/Dokumenty/" documents :bmark! "~/Dokumenty/Projekty/" projects :bmark! "~/Vzdálené/GitHub/" git github :bmark! "~/Vzdálené/ftp/" ftp :bmark! "~/Vzdálené/OneDrive" onedrive :bmark! "~/.config/vifm/" vifm :bmark! "~/.chatgpt/notes" chatgpt-notes :bmark! "/media/jaandrle/" volumes else :bmark! "~/" home :bmark! "C:/Projekty/" projects cordova :bmark! "~/Documents/GitHub/" projects git github :bmark! "y:/" qnap :bmark! "y:/DHL/" qnap dhl :bmark! "~/Downloads/" downloads :bmark! "~/Downloads/FTPtemp/" ftp temp :bmark! "~/AppData/Roaming/Vifm/" vifm endif mark b ~/bin/ mark h ~/ "" #endregion B "" #region G – General " set vicmd=elvis\ -G\ termcap | " set vicmd=vile set vicmd=vim "set vimhelp command! README :!vim ~/Dokumenty/GitHub/dotfiles/vifm/README.md command! Help :!vim ~/.config/vifm/vifm-help.txt map :Help cabbrev help Help if !has('win') set fusehome=/tmp/vifm_FUSE set slowfs=curlftpfs endif set syscalls norunexec " Automatically resolve symbolic links on l or Enter. set nofollowlinks set trash nmap dd :!trash %"f nmap d? :exe "!clear && echo 'Native system trash (`trash-cli`): use `trash`|`trash-empty`|`trash-list`|`trash-put`|`trash-restore`|`trash-rm`' && trash-list | sort -r" | shell set history=100 undolevels=100 " 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 cmap  cmap  nmap ; : nmap š nnoremap :history nnoremap \= :filter !{} " Open console in current directory if !has('win') nnoremap Ot :!(exo-open --launch TerminalEmulator --working-directory %d > /dev/null 2>&1) & nnoremap Ov :!(exo-open --launch TerminalEmulator --working-directory %d -- -e "vifm ." > /dev/null 2>&1) & nnoremap OV :!vim else nnoremap Ot :!start "[Vifm] PowerShell %d" powershell.exe -c "powershell.exe -NoExit -Command Set-Location -LiteralPath '%d'" endif "" #endregion G "" #region AD – Apperance/Default set quickview command! SetView :view set dotfiles colorscheme codedark set wildmenu wildstyle=popup set suggestoptions=normal,visual,view,otherpane,keys,foldsubkeys,marks,registers set ignorecase smartcase incsearch set scrolloff=4 highlight User1 cterm=italic set statusline=" %-E %-d %-A %1*»%-z«%* %= %{&sort} " " hide side borders + use Unicode ellipsis set tuioptions-=s if $TERM != 'linux' | set tuioptions+=u | endif " change appearance of middle border " set fillchars=vborder:· if has('win') set columns=97 nnoremap c :set columns=97 map 1 33| map 2 49| map 3 66| endif "" #endregion AD "" #region AT – Apperance/Texts " Use KiB, MiB, ... instead of KB, MB, ... set noiec set tabstop=2 set timefmt=%y-%m-%dT%H:%M " Customize view columns a bit (enable ellipsis for truncated file names) set viewcolumns=-{root}..,5.4{ext},-6{} command! SetViewColumnsDefault :set viewcolumns=-{root}..,5.4{ext},-6{} command! SetViewColumnsShort :set viewcolumns=-{name}..,{} command! SetWrap :set wrap! "" #endregion AT "" #region AS – Apperance/Sorting+Numbers set sortnumbers sort=+iname command! SetSortAll :sort command! SetSort \ :if &sort == '-size,+name' \ | set sort=-mtime \ | echo 'Sorted by modification date (from latest)' \ |elseif &sort == '-size,+iname' \ | set sort=-mtime \ | echo 'Sorted by modification date (from latest)' \ |elseif &sort == '+iname' \ | set sort=-size \ | echo 'Sorted by size' \ |else \ | set sort=+iname \ | echo 'Sorted by name' \ |endif set number command! SetNumber \ :if &relativenumber \ | set norelativenumber \ | set number \ | echo 'Numbers showned' \ |elseif &number \ | set nonumber \ | echo 'No Numbers' \ |else \ | set relativenumber \ | echo 'Relative numbers showned' \ |endif "" #endregion AS "" #region C – Commands cnoremap cnoremap cnoremap <> <> cnoremap () () cnoremap {} {} cnoremap "" "" cnoremap '' '' " #region :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 " #endregion if has('win') command! meld "C:\Program Files (x86)\Meld\Meld.exe" %"f %"F & command! zipAll powershell Compress-Archive -Path %"c/* -CompressionLevel Fastest -DestinationPath %c:r.zip command! isrunnig %m tasklist /FI "IMAGENAME eq %a" 2>NUL | find /I /N "%a" else command! onedrive xfce4-terminal -x bash -c 'echo Microsoft Onedrive Log:; onedrive --synchronize & command! meld meld %"f %"F 2> /dev/null & command! zipAll zip -r "%c:r.zip" ./* command! terminal !(exo-open --launch TerminalEmulator > /dev/null 2>&1) & nmap \t :terminal endif if !has('win') command! volumes :cd /media/jaandrle/ endif command! df df -h %m 2> /dev/null command! diff vim -d %f %F command! vim vim %"f command! make !!make %a command! mkcd :mkdir %a | cd %a command! vgrep vim "+grep %a" command! reload :write | restart command! run !! ./%f command! runGUI !! ./%f & nmap or :runGUI nmap oR :run "" #endregion C " #region F – Filetypes nnoremap ov :!vim %"f nnoremap oo :file &l nnoremap oO :file &/[#$]l nnoremap on :file &/xdg-openl " #region Farch – Archives if has('win') fileviewer *.zip,*.jar,*.war,*.ear,*.oxt, \*.docx,*.pptx,*.xmlx,*.epub \ tar -tf %c else fileviewer *.zip,*.jar,*.war,*.ear,*.oxt, \*.docx,*.pptx,*.xmlx,*.epub \ zip -sf %c endif filetype *.zip,*.jar,*.war,*.ear,*.oxt,*.apkg, \*.docx,*.pptx,*.xmlx, \*.epub,*.eml \ {Mount with fuse-zip} \ FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR, \ {View contents} \ zip -sf %c | less, \ {Extract here} \ §extract %"f filetype *.tar,*.tar.bz2,*.tbz2,*.tgz,*.tar.gz,*.tar.xz,*.txz \ {Mount with archivemount} \ FUSE_MOUNT|archivemount %SOURCE_FILE %DESTINATION_DIR, \ {Extract here} \ §extract %"f fileviewer *.tgz,*.tar.gz tar -tzf %c fileviewer *.tar.bz2,*.tbz2 tar -tjf %c fileviewer *.tar.txz,*.txz xz --list %c fileviewer *.tar tar -tf %c filetype *.rar {Mount with rar2fs} \ FUSE_MOUNT|rar2fs %SOURCE_FILE %DESTINATION_DIR, \ {Extract here} \ §extract %"f fileviewer *.rar unrar v %c filetype *.iso {Mount with fuseiso} \ FUSE_MOUNT|fuseiso %SOURCE_FILE %DESTINATION_DIR, \ {Extract here} \ §extract %"f filetype *.7z {Mount with fuse-7z} \ FUSE_MOUNT|fuse-7z %SOURCE_FILE %DESTINATION_DIR, \ {Extract here} \ §extract %"f fileviewer *.7z 7z l %c " #endregion Farch filetype *.ftp {Mount with curlftpfs} \ FUSE_MOUNT2|curlftpfs -o disable_eprt %PARAM %DESTINATION_DIR %FOREGROUND %CLEAR, "\ FUSE_MOUNT2|curlftpfs -o ftp_port=-,,disable_eprt %PARAM %DESTINATION_DIR %FOREGROUND %CLEAR, filetype *.ssh {Mount with sshfs} \ FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR %FOREGROUND, if has('win') " filetype * start, explorer filetype * \ {File Explorer} \ explorer %"c:p &, \ {Total Commander} \ "C:\Program Files (x86)\totalcmd\TOTALCMD.EXE" /O %"c:p &, \ {Notepad++} \ "C:\Program Files\Notepad++\notepad++.exe" %"c:p & filextype *.txt {Open with Notepad} start notepad.exe %f else filetype * {Native Open} xdg-open > /dev/null 2>&1 & endif " #region Futils – Utils (eg. hashs checks) filetype *.torrent ktorrent %f & fileviewer *.torrent dumptorrent -v %c " Object filetype *.o nm %f | less " Man page filetype *.[1-8] man ./%c fileviewer *.[1-8] man ./%c | col -b " MD5 SHA1 SHA256 SHA512 GPG signature filetype *.md5 {Check MD5 hash sum} \ md5sum -c %f %S, filetype *.sha1 {Check SHA1 hash sum} \ sha1sum -c %f %S, filetype *.sha256 {Check SHA256 hash sum} \ sha256sum -c %f %S, filetype *.sha512 {Check SHA512 hash sum} \ sha512sum -c %f %S, filetype *.asc {Check signature} \ !!gpg --verify %c, " #endregion Futils " #region FmediaBin if has('win') fileviewer \*.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm, \*.exe,*.epub,*.doc,*.docx \*.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus, \*.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob, \*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx, \*.as[fx] " \ powershell New-Object System.IO.FileInfo(\"%c:p\") \ forfiles /M %"c /C "cmd /c (echo @path && echo . . . && echo Last modification: @fdate @ftime)" && echo . . . && type %"c else fileviewer \*.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm, \ env -u COLORTERM viu-image-viewer.viu %"c -w %pw -t && \ echo $(file -b %f) \ %pc fileviewer \*.exe,*.doc, \*.svg, \ echo $(file -b %f) && echo — && echo $(ls -lh %f)&& echo — && echo $(head %f | tr -d '\0') fileviewer *.pdf pdftotext -nopgbrk %c - fileviewer