dotfiles-ansible/roles/config/files/vifm/vifmrc

530 lines
16 KiB
Plaintext

" Command used to edit files in various contexts. The default is vim.
" If you would like to use another vi clone such as Elvis or Vile
" you will need to change this setting.
set vicmd=nvim
" Preview by default
set quickview
set previewoptions=graphicsdelay:50000,hardgraphicsclear
" This makes vifm perform file operations on its own instead of relying on
" standard utilities like `cp`. While using `cp` and alike is a more universal
" solution, it's also much slower when processing large amounts of files and
" doesn't support progress measuring.
set syscalls
" Position indicator on the left
set number
" 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
" files by deleting them and then using p to put the file in the new location.
" I recommend not changing this until you are familiar with vifm.
" This probably shouldn't be an option.
set trash
" This is how many directories to store in the directory history.
set history=1000
" Automatically resolve symbolic links on l or Enter (only for files).
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>).
set fastrun
" Natural sort of (version) numbers within text.
set sortnumbers
" Maximum number of changes that can be undone.
set undolevels=100
" Use Vim's format of help file (has highlighting and "hyperlinks").
" If you would rather use a plain text help file set novimhelp.
set vimhelp
" If you would like to run an executable file when you
" press return on the file name set this.
set norunexec
" Selected color scheme
colorscheme custom
" Format for displaying time in file list. For example:
" TIME_STAMP_FORMAT=%m/%d-%H:%M
" See man date or man strftime for details.
set timefmt=%Y-%m-%d\ %H:%M
" Show list of matches on tab completion in command-line mode
set wildmenu
" Display completions in a form of popup with descriptions of the matches
set wildstyle=popup
" Show dotfiles
set dotfiles
" No ../
set dotdirs=treeleafsparent
" Show number of sub-items
set dirsize=nitems
" Display suggestions in normal, visual and view modes for keys, marks and
" registers (at most 5 files). In other view, when available.
set suggestoptions=normal,visual,view,otherpane,keys,marks,registers
" Ignore case in search patterns unless it contains at least one uppercase letter
set ignorecase
set smartcase
" Case insensitive path completion
set caseoptions=p
" Don't highlight search results automatically
set nohlsearch
" Use increment searching (search while typing)
set incsearch
" Try to leave some space from cursor to upper/lower border in lists
set scrolloff=4
" Don't do too many requests to slow file systems
set slowfs=curlftpfs
" Miller mode
" set millerview
" set milleroptions=lsize:1,csize:3,rpreview:all
" Set custom status line look
set statusline=' %t%[ -> %T%]%= %A %10u:%-7g %5E %5a %20d '
" Set custom ruler line look
set rulerformat='%2l/%S%[ +%x%]'
" What should be saved automatically between vifm sessions
set vifminfo=state,dhistory,chistory,shistory,phistory,bookmarks,bmarks
" Use ripgrep instead of grep
set grepprg='rg --follow --hidden --color never --column --line-number --no-heading --smart-case %i %a %s'
" Use fd instead of find
set findprg='fd --follow --hidden --exclude .git --color never %p %s'
" ------------------------------------------------------------------------------
" :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 nvim -d %f %F
command! gzip tar -cvzf %a %f
command! xz bsdtar -cvJf %a %f
command! zstd zstd -zo %a %f
command! extract bsdtar -xvf %c
command! shred shred -fu %f
command! run !! ./%f
command! make !!make %a
command! mkcd :mkdir %a | cd %a
command! vgrep nvim "+grep %a"
command! reload :write | restart
command! exif exiftool -all= -overwrite_original %f
" fzf file
command! FZFfile : set noquickview
\| let $FZF_RES = term('fzf --prompt "File: " --no-multi --preview "$HOME/.local/libexec/preview {} 2>/dev/null" 2>&0')
\| if $FZF_RES != ''
\| execute 'goto' fnameescape($FZF_RES)
\| endif
\| set quickview
" fzf dir
command! FZFdir : set noquickview
\| let $FZF_RES = term('fd --type d --follow --hidden --exclude .git --color never | fzf --no-multi --prompt "Directory: " --preview "lsd -1FAL --group-dirs first --icon always --color always {} 2>/dev/null" 2> /dev/tty')
\| if $FZF_RES != ''
\| execute 'cd' fnameescape($FZF_RES)
\| endif
\| set quickview
" fzf zoxide
command! FZFzoxide : set noquickview
\| let $FZF_RES = term('zoxide query --list | fzf --no-multi --prompt "Zoxide: " --no-multi 2>&0')
\| if $FZF_RES != ''
\| execute 'cd' fnameescape($FZF_RES)
\| endif
\| set quickview
" ------------------------------------------------------------------------------
mark h ~/
mark C ~/Code
mark D ~/Downloads
mark P ~/Pictures
mark V ~/Videos
mark U ~/Music
mark f ~/.config
mark l ~/.local/share
mark e /etc
mark u /usr/share
mark o /opt
mark b /boot
mark m /media
mark M /mnt
mark A /run/media
mark v /var
mark t /tmp
mark d /dev
mark s /srv
mark r /
" ------------------------------------------------------------------------------
" Pdf
filextype {*.pdf},<application/pdf>
\ zathura %c %i,
" PostScript
filextype {*.ps,*.eps,*.ps.gz},<application/postscript>
\ zathura %f,
" Djvu, comics, epub
filextype {*.mobi,*.pdb}
\ ebook-viewer %f,
\ FBReader %f,
filextype {*.djvu,*.epub,*.cbr,*.cbz,*.cbt,*.cb7},<image/vnd.djvu>
\ zathura %f,
" Audio
filetype {*.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus},<audio/*>
\ ffplay -nodisp -autoexit %c,
\ mplayer %c,
\ mpv --no-video %c %s,
" 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/*>
\ mpv %c %f,
\ ffplay -fs -hide_banner -autoexit %f,
\ mplayer %f,
" Web
filetype {*.html,*.htm,*.xhtml},<text/html>
\ nvim %f,
filextype {*.html,*.htm,*.xhtml},<text/html>
\ firefox %f &,
\ qutebrowser %f %i &,
\ librewolf %f &,
\ chromium-browser %f,
\ vieb %f &,
" Object
filetype {*.o},<application/x-object> nm %f | less
" Man page
filetype {*.[1-8]},<text/troff> man ./%c
" Images
filextype {*.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm},<image/*>
\ qimgv %f,
\ vimiv %f,
\ imv %f,
filextype *.svg
\ inkscape %f,
" OpenRaster
filextype *.ora
\ krita %f,
" Mindmap
filextype *.vym
\ vym %f,
" MD5
filetype *.md5
\ md5sum -c %f %S,
" SHA1
filetype *.sha1
\ sha1sum -c %f %S,
" SHA256
filetype *.sha256
\ sha256sum -c %f %S,
" SHA512
filetype *.sha512
\ sha512sum -c %f %S,
" GPG signature
filetype {*.asc},<application/pgp-signature>
\ !!gpg --verify %c,
" Torrent
filetype {*.torrent},<application/x-bittorrent> rtorrent %f &
" 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}
\ tar -tf %f | less,
\ {Extract here}
\ tar -vxf %c,
" ArchiveMount
filetype {*.tar,*.tar.bz2,*.tbz2,*.tgz,*.tar.gz,*.tar.xz,*.txz,*.tar.zst,*.tzst},<application/x-tar>
\ {Mount with archivemount}
\ FUSE_MOUNT|archivemount %SOURCE_FILE %DESTINATION_DIR,
" Rar2FsMount and rar archives
filetype {*.rar},<application/x-rar>
\ {Mount with rar2fs}
\ FUSE_MOUNT|rar2fs %SOURCE_FILE %DESTINATION_DIR,
" IsoMount
filetype {*.iso},<application/x-iso9660-image>
\ {Mount with fuseiso}
\ FUSE_MOUNT|fuseiso %SOURCE_FILE %DESTINATION_DIR,
" 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,
" Office files
filextype {*.odt,*.doc,*.docx,*.sxw,*.xls,*.xlsx,*.ods,*.odp,*.pptx},
\<application/vnd.openxmlformats-officedocument.*,
\application/msword,
\application/vnd.ms-excel>
\ libreoffice %f &,
" TuDu files
filetype *.tudu tudu -f %c
" Qt projects
filextype *.pro qtcreator %f &
" mbox
filetype *.mbox aerc %f
" ------------------------------------------------------------------------------
" https://www.arewesixelyet.com/
if $TERM == 'alacritty'
let $GRAPHICS_PREVIEW_MODE = 'ansi'
else
let $GRAPHICS_PREVIEW_MODE = 'graphics'
endif
if $GRAPHICS_PREVIEW_MODE == 'graphics'
fileviewer <image/*>,<video/*>,<application/x-font*>,<font/*>
\ preview_graphics %c:p %pw %ph %pd %N 2>/dev/null
else
fileviewer <image/*>,<video/*>,<application/x-font*>,<font/*>
\ preview_graphics %c:p %pw %ph 2>/dev/null
endif
fileviewer <*> preview_vifm %c:p 2>/dev/null
" ------------------------------------------------------------------------------
" Easier to quit
nnoremap qq :quit!<cr>
nnoremap QQ :quit<cr>
nnoremap <C-q> :quit!<cr>
" Quick way to select all files in the view
nnoremap VV :%select<cr>
" Tag a file and move down to the next one
nmap <space> tj
" Start shell in current directory
nnoremap s :shell<cr>
" Display sorting dialog
nnoremap S :sort<cr>
" Toggle preview, and within preview toggle wrap
nnoremap w :view<cr>
vnoremap w :view<cr>gv
nnoremap W :set wrap!<cr>
" Grow/shrink window by 4 columns at a time
nnoremap < 4<c-w><
nnoremap > 4<c-w>>
" go to project root
nnoremap gr :cd $PWD<cr>
" Yank current directory path into the clipboard
nnoremap yd :!echo %d | wl-copy %i<cr>
" Yank current file path into the clipboard
nnoremap yf :!echo %c:p | wl-copy %i<cr>
" Mappings for faster renaming
nnoremap ci cw<c-a>
nnoremap cc cw<c-u>
" Open editor to edit vifmrc and apply settings after returning to vifm
nnoremap ,c :write | edit $MYVIFMRC | restart<cr>
" Mappings for useful commands
nnoremap E :edit<cr>
nnoremap F :mkdir<space>
nnoremap T :touch<space>
" Tabs
nnoremap <C-t> :tabnew<cr>
" Map for fzf commands
nnoremap ff :FZFfile<cr>
nnoremap fd :FZFdir<cr>
nnoremap fz :FZFzoxide<cr>
" Quickly see the file's metadata
nnoremap I :set noquickview | redraw | !exiftool %f %m<cr>
" Scroll in preview window
nnoremap <PageDown> <C-w>w5j<C-w>w
nnoremap <PageUp> <C-w>w5k<C-w>w
nnoremap J <C-w>w5j<C-w>w
nnoremap K <C-w>w5k<C-w>w
" ------------------------------------------------------------------------------
" Icons
set classify='󰝰 :dir:/, :exe:,| :fifo:, :reg:, :link:,? :?:, ::../::'
set classify+='=:sock:'
set classify+='-:char:'
set classify+='+:block:'
set classify+=' ::.Xdefaults,,.Xresources,,.bashprofile,,.bash_profile,,.bashrc,,.dmrc,,.d_store,,.fasd,,.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::'
set classify+=' ::.gitignore,,.gitconfig,,.gitattributes,,.gitmodules::'
set classify+=' ::.gitlab-ci.yml::'
set classify+=' ::VERSION::'
set classify+=' ::BUILD,,BUCK,,WORKSPACE,,*.bazel,,*.bzl::'
set classify+=' ::favicon.*,,README,,readme::'
set classify+=' ::*.vim,,.vimrc,,.gvimrc,,*.vifm::'
set classify+=' ::gruntfile.coffee,,gruntfile.js,,gruntfile.ls::'
set classify+=' ::gulpfile.coffee,,gulpfile.js,,gulpfile.ls::'
set classify+=' ::*.ledger,,*.hledger,,*.beancount::'
set classify+=' ::license,,copyright,,copying,,LICENSE,,COPYRIGHT,,COPYING::'
set classify+=' ::authors,,AUTHORS,,.mailmap::'
set classify+='󰡨 ::Dockerfile::'
set classify+=' ::Makefile,,Makefile.*,,*.mk::'
set classify+=' ::.editorconfig::'
set classify+='󱂅 ::*.log::'
set classify+='󰯄 ::*.kdbx::'
set classify+=' ::*.styl::'
set classify+='󰅍 ::*.txt::'
set classify+=' ::*.scss,,*.sass::'
set classify+='󰌜 ::*.css::'
set classify+=' ::*.py,,*.pyc,,*.pyd,,*.pyo,,*.ipynb::'
set classify+=' ::*.php::'
set classify+=' ::*.zig::'
set classify+=' ::*.markdown,,*.md,,*.mkd::'
set classify+=' ::*.jsonnet,,*.libsonnet::'
set classify+=' ::*.json,,*.yaml,,*.yml,,*.toml::'
set classify+=' ::yarn.lock::'
set classify+=' ::*.js::'
set classify+='󰜈 ::*.jsx::'
set classify+=' ::*.svelte::'
set classify+='󰡄 ::*.vue::'
set classify+=' ::*.ts::'
set classify+=' ::*.graphql::'
set classify+=' ::*.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,,*.srf,,*.srw,,*.tif,,*.x3f::'
set classify+=' ::*.ejs,,*.slim,,*.xml::'
set classify+=' ::*.htm,,*.html::'
set classify+=' ::*.mustasche::'
set classify+=' ::*.less,,*.bat,,*.conf,,*.ini,,*.rc,,*.cfg::'
set classify+=' ::*.rss::'
set classify+=' ::*.coffee::'
set classify+=' ::*.twig::'
set classify+=' ::*.c++,,*.cc,,*.[hc],,*.[hc]pp,,*.cxx::'
set classify+=' ::*.hs,,*.lhs::'
set classify+=' ::*.el::'
set classify+=' ::*.nix::'
set classify+=' ::*.org::'
set classify+=' ::*.kt::'
set classify+='󰢱 ::*.lua::'
set classify+=' ::*.tex::'
set classify+=' ::*.jl::'
set classify+=' ::*.go::'
set classify+='󰟓 ::go.mod::'
set classify+=' ::*.rs,,*.rlib::'
set classify+=' ::*.db,,*.dump,,*.sql::'
set classify+=' ::*.sln,,*.suo::'
set classify+=' ::*.exe::'
set classify+=' ::*.diff,,*.sum,,*.md5,,*.sha512,,*.sha256::'
set classify+=' ::*.scala::'
set classify+='󰬷 ::*.java,,*.jar::'
set classify+=' ::*.xul::'
set classify+=' ::*.clj,,*.cljc::'
set classify+=' ::*.pl,,*.pm,,*.t::'
set classify+=' ::*.mli,,*.ml::'
set classify+=' ::*.opam::'
set classify+=' ::*.cljs,,*.edn::'
set classify+=' ::*.rb::'
set classify+='󰌟 ::*.php::'
set classify+=' ::*.fish,,*.sh,,*.bash,,*.zsh,,*.nu::'
set classify+=' ::*.dart::'
set classify+=' ::*.f#,,*.fs,,*.fsi,,*.fsscript,,*.fsx::'
set classify+=' ::*.d::'
set classify+=' ::*.erl,,*.hrl::'
set classify+=' ::*.exs,,*.ex::'
set classify+=' ::*.ai::'
set classify+=' ::*.psb,,*.psd::'
set classify+=' ::*.aac,,*.anx,,*.asf,,*.au,,*.axa,,*.flac,,*.m2a,,*.m4a,,*.mid,,*.midi,,*.mp3,,*.mpc,,*.oga,,*.ogg,,*.ogx,,*.ra,,*.ram,,*.rm,,*.spx,,*.wav,,*.wma,,*.ac3::'
set classify+=' ::*.avi,,*.flv,,*.mkv,,*.mov,,*.mp4,,*.mpeg,,*.mpg,,*.webm::'
set classify+=' ::*.epub,,*.pdf,,*.fb2,,*.djvu::'
set classify+=' ::*.7z,,*.apk,,*.bz2,,*.cab,,*.cpio,,*.deb,,*.gem,,*.gz,,*.gzip,,*.lh,,*.lzh,,*.lzma,,*.rar,,*.rpm,,*.tar,,*.tgz,,*.xz,,*.zip,,*.zst::'
set classify+=' ::*.cbr,,*.cbz::'
set classify+=' ::*.doc,,*.docx,,*.adoc,,*.odt::'
set classify+=' ::*.xls,,*.xlsx,,*.xlsmx,,*.ods::'
set classify+=' ::*.pptx,,*.ppt,,*.odp::'
" special dir icons
set classify+=' ::.git/::/,
\  ::node_modules/::/,
\ 󰃨 ::.cache/::/,
\  ::.config/::/,
\  ::.local/::/,
\  ::.firefox/,,.librewolf/::/,
\  ::Android/::/,
\  ::Archives/::/,
\  ::Books/::/,
\  ::Code/::/,
\  ::Desktop/::/,
\  ::Documents/::/,
\  ::Downloads/::/,
\  ::Mail/::/,
\  ::Music/::/,
\  ::Notes/::/,
\  ::Pictures/::/,
\  ::Public/::/,
\  ::Template/::/,
\  ::Videos/::/'