Add vifm (terminal filemgr)

This commit is contained in:
ItsDrike 2024-04-05 01:25:59 +02:00
parent 239c5e956c
commit c5296ed6f8
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0
10 changed files with 420 additions and 0 deletions

View file

@ -1,7 +1,12 @@
# Note: Pretty much all of these configurations were copied from
# https://git.notashelf.dev/NotAShelf/nyx, there may be some small
# adjustments made to them but the majority of the credit goes to
# notashelf.
_: {
imports = [
./yazi
./xplr
./vifm
];
}

View file

@ -0,0 +1,4 @@
" vim:ft=vim
cabbrev t touch
cabbrev mk mkdir

View file

@ -0,0 +1,26 @@
" vim:ft=vim
" :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
" more information: https://vifm.info/vimdoc.shtml#vifm-macros
command! df df -h %m 2> /dev/null
command! diff nvim -d %f %F
command! run !! ./%f
command! make !!make %a
command! mkcd :mkdir %a | cd %a
command! vgrep vim "+grep %a"
command! reload :write | restart
command! dragon dragon-drop -a -x %f
command! clear vifmimg clear
command! print lp -n 1 -o sides=two-sided-long-edge %f
command! sudoedit sudoedit %c

View file

@ -0,0 +1,70 @@
" vim:ft=vim
" Filetypes/directories
set classify=' :dir:/, :exe:, :reg:, :link:,? :?:, ::../::'
" Specific files
set classify+=' ::.Xdefaults,,.Xresources,,.bashprofile,,.bash_profile,,.bashrc,,.dmrc,,.d_store,,.fasd,,.gitconfig,,.gitignore,,.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+=' ::dropbox::'
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::'
set classify+=' ::license,,copyright,,copying,,LICENSE,,COPYRIGHT,,COPYING::'
set classify+=' ::node_modules::'
set classify+=' ::react.jsx::'
" File extensions
set classify+='λ ::*.ml,,*.mli::'
set classify+=' ::*.styl::'
set classify+=' ::*.scss::'
set classify+=' ::*.py,,*.pyc,,*.pyd,,*.pyo::'
set classify+=' ::*.php::'
set classify+=' ::*.markdown,,*.md::'
set classify+=' ::*.json::'
set classify+=' ::*.js::'
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,,*.htm,,*.html,,*.slim,,*.xml::'
set classify+=' ::*.mustasche::'
set classify+=' ::*.css,,*.less,,*.bat,,*.conf,,*.ini,,*.rc,,*.yml,,*.cfg,,*.rc::'
set classify+=' ::*.rss::'
set classify+=' ::*.coffee::'
set classify+=' ::*.twig::'
set classify+=' ::*.c++,,*.cc,,*.cpp,,*.cxx,,*.h::'
set classify+=' ::*.c::'
set classify+=' ::*.hs,,*.lhs::'
set classify+=' ::*.lua::'
set classify+=' ::*.jl::'
set classify+=' ::*.go::'
set classify+=' ::*.ts::'
set classify+=' ::*.db,,*.dump,,*.sql::'
set classify+=' ::*.sln,,*.suo::'
set classify+=' ::*.exe::'
set classify+=' ::*.diff,,*.sum,,*.md5,,*.sha512::'
set classify+=' ::*.scala::'
set classify+=' ::*.java,,*.jar::'
set classify+=' ::*.xul::'
set classify+=' ::*.clj,,*.cljc::'
set classify+=' ::*.pl,,*.pm,,*.t::'
set classify+=' ::*.cljs,,*.edn::'
set classify+=' ::*.rb::'
set classify+=' ::*.fish,,*.sh,,*.bash::'
set classify+=' ::*.dart::'
set classify+=' ::*.f#,,*.fs,,*.fsi,,*.fsscript,,*.fsx::'
set classify+=' ::*.rlib,,*.rs::'
set classify+=' ::*.d::'
set classify+=' ::*.erl,,*.hrl::'
set classify+=' ::*.ai::'
set classify+=' ::*.psb,,*.psd::'
set classify+=' ::*.jsx::'
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,,*.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::'
set classify+=' ::*.cbr,,*.cbz::'
set classify+=' ::*.log::'
set classify+=' ::*.doc,,*.docx,,*.adoc::'
set classify+=' ::*.xls,,*.xls,,*.xlsmx::'
set classify+=' ::*.pptx,,*.ppt::'

View file

@ -0,0 +1,136 @@
" vim:ft=vim
" filextype: What should it do (which program should it use), when you want to open it
" fileviewer: What should it do for the prievew?
filextype *.pdf zathura %c &
filextype *.ps,*.eps,*.ps.gz
\ {View in sioyek}
\ sioyek %f &
filextype *.xml,*.ipe ipe %c &
filextype *.djvu
\ {View in sioyek}
\ sioyek %f & ,
\ {View in apvlv}
\ apvlv %f,
filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus,*.MOD
\ {Play using ffplay}
\ ffplay -nodisp -autoexit %c &,
\ {Play using MPlayer}
\ mplayer %f &,
fileviewer *.mp3 mp3info
fileviewer *.flac soxi
filextype *.avi,*.mp4,*.wmv,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,
\*.fl[icv],*.m2v,*.mov,*.webm,*.mts,*.m4v,*.r[am],*.qt,*.divx,
\*.as[fx]
\ {View using ffplay}
\ ffplay -fs -autoexit -volume 100 %f &,
filextype *.html,*.htm
\ firefox %f &,
filetype *.html,*.htm links, lynx
fileviewer *.html
\ w3m %c
filetype *.o,*.out objdump -d %f | less
fileviewer *.o,*.out objdump -d %f
filetype *.[1-8] man ./%c
fileviewer *.[1-8] man ./%c | col -b
filextype *.bmp,*.jpg,*.jpeg,*.png,*.xpm,*.svg,*.ico,*.gif
"\ viewnior %c &
" \ vimiv --log-level info --debug vimico %c &
\ vimiv %c &
filextype *.ora
\ {Edit in MyPaint}
\ mypaint %f,
filextype *.vym
\ {Open with VYM}
\ vym %f &,
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,
filetype *.torrent ktorrent %f &
fileviewer *.torrent dumptorrent -v %c
filetype *.zip,*.jar,*.war,*.ear,*.oxt,*.apkg
\ {Mount with fuse-zip}
\ FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR,
\ {View contents}
\ zip -sf %c | less,
\ {Extract here}
\ tar -xf %c
filetype *.zip unzip %f
filetype *.tar.gz tar -xvf %f
fileviewer *.zip,*.jar,*.war,*.ear,*.oxt zip -sf %c
filetype *.tar,*.tar.bz2,*.tbz2,*.tgz,*.tar.gz,*.tar.xz,*.txz
\ {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 tar -tf %c
filetype *.rar
\ {Mount with rar2fs}
\ FUSE_MOUNT|rar2fs %SOURCE_FILE %DESTINATION_DIR,
fileviewer *.rar unrar v %c
filetype *.iso
\ {Mount with fuseiso}
\ FUSE_MOUNT|fuseiso %SOURCE_FILE %DESTINATION_DIR,
filetype *.ssh
\ {Mount with sshfs}
\ FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR %FOREGROUND,
filetype *.ftp
\ {Mount with curlftpfs}
\ FUSE_MOUNT2|curlftpfs -o ftp_port=-,,disable_eprt %PARAM %DESTINATION_DIR %FOREGROUND,
filetype *.7z
\ {Mount with fuse-7z}
\ FUSE_MOUNT|fuse-7z %SOURCE_FILE %DESTINATION_DIR,
fileviewer *.7z 7z l %c
filextype *.odt,*.doc,*.docx,*.xls,*.xlsx,*.odp,*.pptx libreoffice %f &
fileviewer *.odt odt2txt %f
fileviewer *.docx docx2txt %f -
filetype *.tudu tudu -f %c
filextype *.pro qtcreator %f &
filextype */
\ pacmanfm %f &,
fileviewer *.md glow %c
filetype *.xopp xournalpp %f &

View file

@ -0,0 +1,3 @@
" vim:ft=vim
fileviewer *.* bat --color=always --decorations=never %c

View file

@ -0,0 +1,38 @@
" vim:ft=vim
" Editing / Do something with the files
nnoremap cd :cd
nnoremap cD :diff<CR>
vnoremap cD :diff<CR>
" start shell
nmap S :shell<Cr>
" Display sorting dialog
nnoremap s :sort<cr>
" preview window
" Toggle visibility of preview window
nnoremap w :view<cr>
vnoremap w :view<cr>gv
" panel resize
nnoremap < <C-w>5<
nnoremap > <C-w>5>
" tabs
nnoremap <C-t> :tabnew<CR>
" drag and drop
nmap <C-h> :dragon<CR>
vmap <C-h> :dragon<CR>
" Yank current directory path into the clipboard
nnoremap yd :!echo -n %d | wl-copy %i<cr>:echo expand('%"d') "is yanked to clipboard"<cr>
" Yank current file path into the clipboard
nnoremap yf :!echo -n %c:p | wl-copy %i<cr>:echo expand('%"c:p') "is yanked to clipboard"<cr>
nnoremap q :q<cr>
"nnoremap ö q

View file

@ -0,0 +1,114 @@
" vim:ft=vim
" editor
set vicmd="nvim"
" 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
" miller view
set millerview
set milleroptions="lsize:1,csize:2,rsize:0,rpreview:all"
set sizefmt=units:si,precision:2,space
" The display on the bottom left
set rulerformat="%2l/%2S %[MAX: %2L%]"
set findprg="fd %A"
set grepprg="rg -n -H %i %a %s"
" set fillchars=vborder:│
" execute files
set runexec
set tuioptions="pu"
" controls details of file operations
set iooptions=fastfilecloning
" 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
set trashdir="~/.local/share/Trash/files"
" This is how many directories to store in the directory history.
set history=100
" number of spaces of a tab"
set tabstop=4
" 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
" If you installed the vim.txt help file set vimhelp.
" If 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
set rnu
set dotdirs=
" 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=%d.%m.%Y\ \ %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
" 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,delay:0
" Ignore case in search patterns unless it contains at least one uppercase
" letter
set ignorecase
set smartcase
" 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
if !has('win')
set slowfs=curlftpfs
endif
set statusline=" %A %10u:%-7g %20d Free Space: %a"
set vifminfo=dhistory,chistory,state,tui,shistory,
\phistory,fhistory,dirstack,registers,bookmarks,bmarks
" ------------
" panels
" ------------
set viewcolumns=-{name},{size}

View file

@ -0,0 +1,23 @@
{
self,
pkgs,
...
}: {
imports = [self.homeManagerModules.vifm];
config = {
programs.vifm = {
enable = true;
package = pkgs.vifm-full;
config = builtins.readFile "${./config/vifmrc}";
extraConfigFiles = [
"${./config/settings/abbr.vifm}"
"${./config/settings/commands.vifm}"
"${./config/settings/favicons.vifm}"
"${./config/settings/ft.vifm}"
"${./config/settings/fv.vifm}"
"${./config/settings/mappings.vifm}"
];
};
};
}