dotfiles/.config/vifm/vifmrc

374 lines
13 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"" 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 <f1> :Help<cr>
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<cr>
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<cr>
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  <c-b>
cmap  <c-f>
nmap ; :
nmap š <tab>
nnoremap <c-h> :history<cr>
nnoremap \= :filter !{}<left><left>
" Open console in current directory
if !has('win')
nnoremap Ot :!(exo-open --launch TerminalEmulator --working-directory %d > /dev/null 2>&1) &<cr>
nnoremap Ov :!(exo-open --launch TerminalEmulator --working-directory %d -- -e "vifm ." > /dev/null 2>&1) &<cr>
nnoremap OV :!vim<cr>
else
nnoremap Ot :!start "[Vifm] PowerShell %d" powershell.exe -c "powershell.exe -NoExit -Command Set-Location -LiteralPath '%d'"<cr>
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-L>c :set columns=97<cr>
map <c-L>1 33<c-W>|
map <c-L>2 49<c-W>|
map <c-L>3 66<c-W>|
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 <c-b> <a-b>
cnoremap <c-f> <a-f>
cnoremap <> <><left>
cnoremap () ()<left>
cnoremap {} {}<left>
cnoremap "" ""<left>
cnoremap '' ''<left>
" #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<cr>
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<cr>
nmap oR :run<cr>
"" #endregion C
" #region F Filetypes
nnoremap ov :!vim %"f<cr>
nnoremap oo :file &<cr>l
nnoremap oO :file &<cr>/[#$]<cr>l
nnoremap on :file &<cr>/xdg-open<cr>l
" #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 <video/*>,<audio/*> mediainfo %c
endif
" #endregion FmediaBin
fileviewer .*/,*/ tree %c -L 3 &
fileviewer ../ tree %c -L 1 &
fileviewer *.js,*.mjs,*.ts,*.sh,
\*.css,*.scss,
\*.php,
\*.md,*.html,
\*.json,*.xml
\ env -uCOLORTERM batcat --color always --theme 'Visual Studio Dark+' --wrap never --pager never --tabs 2 %c -p
fileviewer <text/x-*>,<application/*> env -uCOLORTERM batcat --color always --theme 'Visual Studio Dark+' --wrap never --pager never --tabs 2 %c -p
" #endregion F
" #region S sS keys
nnoremap sf :file &
nnoremap sjj :cd ./
nnoremap sjh :cd ~/
nnoremap sjg :cd ~/Vzdálené/GitHub/
nnoremap sjp :cd ~/Dokumenty/Projekty/
nnoremap sb :bmg
nnoremap sS :Set
nnoremap SS :<up><cr>
" #endregion S
" #region Y Copy files/names/…
nmap ycc :clone <cr>
" copy/move files to the opposite pane
nmap yp :copy <cr>
nmap yP :move <cr>
" Interaction with system clipboard (yank directory path/curr.file path/filename)
if has('win')
nnoremap ycp :!echo %"d:gs!\!/! %i | clip<cr>:echo expand('%"d') "is yanked to clipboard"<cr>
nnoremap ycf :!echo %"c:gs!\!/! %i | clip<cr>:echo expand('%"c:p') "is yanked to clipboard"<cr>
nnoremap ycn :!echo %"c %i | clip<cr>:echo expand('%"c') "is yanked to clipboard"<cr>
elseif executable('xclip')
nnoremap ycd :!echo -n %d | xclip -selection clipboard %i<cr>:echo expand('%"d') "is yanked to clipboard"<cr>
nnoremap ycf :!echo -n %c:p | xclip -selection clipboard %i<cr>:echo expand('%"c:p') "is yanked to clipboard"<cr>
nnoremap ycn :!echo -n %c | xclip -selection clipboard %i<cr>:echo expand('%"c') "is yanked to clipboard"<cr>
elseif executable('xsel')
nnoremap ycd :!echo -n %d | xsel --input --primary %i && echo -n %d | xsel --clipboard --input %i<cr>:echo expand('%"d') "is yanked to clipboard"<cr>
nnoremap ycf :!echo -n %c:p | xsel --input --primary %i && echo -n %c:p | xsel --clipboard --input %i<cr>:echo expand('%"c:p') "is yanked to clipboard"<cr>
nnoremap ycn :!echo -n %c | xsel --input --primary %i && echo -n %c | xsel --clipboard --input %i<cr>:echo expand('%"c') "is yanked to clipboard"<cr>
endif
" #endregion Y
"" #region N Notes
"Filter-out build and temporary files
" windo filter! /^.*\.(lo|o|d|class|py[co])$|.*~$/
" Example of standard two-panel file managers mappings
" nnoremap <f3> :!less %f<cr>
" nnoremap <f4> :edit<cr>
" nnoremap <f5> :copy<cr>
" nnoremap <f6> :move<cr>
" nnoremap <f7> :mkdir<space>
" nnoremap <f8> :delete<cr>
" ------------------------------------------------------------------------------
" Various customization examples
" Use ag (the silver searcher) instead of grep
"
" set grepprg=ag\ --line-numbers\ %i\ %a\ %s
" Add additional place to look for executables
"
" let $PATH = $HOME.'/bin/fuse:'.$PATH
" Block particular shortcut
"
" nnoremap <left> <nop>
" Export IPC name of current instance as environment variable and use it to
" communicate with the instance later.
"
" It can be used in some shell script that gets run from inside vifm, for
" example, like this:
" vifm --server-name "$VIFM_SERVER_NAME" --remote +"cd '$PWD'"
"
" let $VIFM_SERVER_NAME = v:servername
" #endregion N
" vim: set filetype=vifm tabstop=4 shiftwidth=4 textwidth=250 noexpandtab :
" vim>60: set foldmethod=marker foldmarker=#region,#endregion :