dotfiles

andersuno dotfiles
git clone git://git.andersuno.nu/dotfiles.git
Log | Files | Refs | README

vifmrc (15200B)


      1 "  ____ _____
      2 " |  _ \_   _|  Derek Taylor (DistroTube)
      3 " | | | || |    http://www.youtube.com/c/DistroTube
      4 " | |_| || |    http://www.gitlab.com/dwt1/
      5 " |____/ |_|
      6 
      7 " vim: filetype=vifm :
      8 " Sample configuration file for vifm (last updated: 20 July, 2018)
      9 " You can edit this file by hand.
     10 " The " character at the beginning of a line comments out the line.
     11 " Blank lines are ignored.
     12 " The basic format for each item is shown with an example.
     13 
     14 " ------------------------------------------------------------------------------
     15 
     16 " This is the actual command used to start vi.  The default is vim.
     17 " If you would like to use another vi clone such as Elvis or Vile
     18 " you will need to change this setting.
     19 
     20 set vicmd=vim
     21 " set vicmd=elvis\ -G\ termcap
     22 " set vicmd=vile
     23 
     24 " This makes vifm perform file operations on its own instead of relying on
     25 " standard utilities like `cp`.  While using `cp` and alike is a more universal
     26 " solution, it's also much slower when processing large amounts of files and
     27 " doesn't support progress measuring.
     28 
     29 set syscalls
     30 
     31 " Trash Directory
     32 " The default is to move files that are deleted with dd or :d to
     33 " the trash directory.  If you change this you will not be able to move
     34 " files by deleting them and then using p to put the file in the new location.
     35 " I recommend not changing this until you are familiar with vifm.
     36 " This probably shouldn't be an option.
     37 
     38 set trash
     39 
     40 " This is how many directories to store in the directory history.
     41 
     42 set history=100
     43 
     44 " Automatically resolve symbolic links on l or Enter.
     45 
     46 set nofollowlinks
     47 
     48 " With this option turned on you can run partially entered commands with
     49 " unambiguous beginning using :! (e.g. :!Te instead of :!Terminal or :!Te<tab>).
     50 
     51 " set fastrun
     52 
     53 " Natural sort of (version) numbers within text.
     54 
     55 set sortnumbers
     56 
     57 " Maximum number of changes that can be undone.
     58 
     59 set undolevels=100
     60 
     61 " If you installed the vim.txt help file set vimhelp.
     62 " If would rather use a plain text help file set novimhelp.
     63 
     64 set novimhelp
     65 
     66 " If you would like to run an executable file when you
     67 " press return on the file name set this.
     68 
     69 set norunexec
     70 
     71 " Selected color scheme
     72 
     73 colorscheme Default
     74 
     75 " Format for displaying time in file list. For example:
     76 " TIME_STAMP_FORMAT=%m/%d-%H:%M
     77 " See man date or man strftime for details.
     78 
     79 set timefmt=%m/%d\ %H:%M
     80 
     81 " Show list of matches on tab completion in command-line mode
     82 
     83 set wildmenu
     84 
     85 " Display completions in a form of popup with descriptions of the matches
     86 
     87 set wildstyle=popup
     88 
     89 " Display suggestions in normal, visual and view modes for keys, marks and
     90 " registers (at most 5 files).  In other view, when available.
     91 
     92 set suggestoptions=normal,visual,view,otherpane,keys,marks,registers
     93 
     94 " Ignore case in search patterns unless it contains at least one uppercase
     95 " letter
     96 
     97 set ignorecase
     98 set smartcase
     99 
    100 " Don't highlight search results automatically
    101 
    102 set nohlsearch
    103 
    104 " Use increment searching (search while typing)
    105 set incsearch
    106 
    107 " Try to leave some space from cursor to upper/lower border in lists
    108 
    109 set scrolloff=4
    110 
    111 " Don't do too many requests to slow file systems
    112 
    113 if !has('win')
    114     set slowfs=curlftpfs
    115 endif
    116 
    117 " Set custom status line look
    118 
    119 set statusline="  Hint: %z%= %A %10u:%-7g %15s %20d  "
    120 
    121 " Set line numbers to show
    122 
    123 " ------------------------------------------------------------------------------
    124 
    125 " :mark mark /full/directory/path [filename]
    126 
    127 mark h ~/
    128 
    129 " ------------------------------------------------------------------------------
    130 
    131 " :com[mand][!] command_name action
    132 " The following macros can be used in a command
    133 " %a is replaced with the user arguments.
    134 " %c the current file under the cursor.
    135 " %C the current file under the cursor in the other directory.
    136 " %f the current selected file, or files.
    137 " %F the current selected file, or files in the other directory.
    138 " %b same as %f %F.
    139 " %d the current directory name.
    140 " %D the other window directory name.
    141 " %m run the command in a menu window
    142 
    143 command! df df -h %m 2> /dev/null
    144 command! diff vim -d %f %F
    145 command! zip zip -r %f.zip %f
    146 command! run !! ./%f
    147 command! make !!make %a
    148 command! mkcd :mkdir %a | cd %a
    149 command! vgrep vim "+grep %a"
    150 command! reload :write | restart
    151 
    152 " ------------------------------------------------------------------------------
    153 
    154 " The file type is for the default programs to be used with
    155 " a file extension.
    156 " :filetype pattern1,pattern2 defaultprogram,program2
    157 " :fileviewer pattern1,pattern2 consoleviewer
    158 " The other programs for the file type can be accessed with the :file command
    159 " The command macros %f, %F, %d, %F may be used in the commands.
    160 " The %a macro is ignored.  To use a % you must put %%.
    161 
    162 " For automated FUSE mounts, you must register an extension with :file[x]type
    163 " in one of following formats:
    164 "
    165 " :filetype extensions FUSE_MOUNT|some_mount_command using %SOURCE_FILE and %DESTINATION_DIR variables
    166 " %SOURCE_FILE and %DESTINATION_DIR are filled in by vifm at runtime.
    167 " A sample line might look like this:
    168 " :filetype *.zip,*.jar,*.war,*.ear FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR
    169 "
    170 " :filetype extensions FUSE_MOUNT2|some_mount_command using %PARAM and %DESTINATION_DIR variables
    171 " %PARAM and %DESTINATION_DIR are filled in by vifm at runtime.
    172 " A sample line might look like this:
    173 " :filetype *.ssh FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR
    174 " %PARAM value is filled from the first line of file (whole line).
    175 " Example first line for SshMount filetype: root@127.0.0.1:/
    176 "
    177 " You can also add %CLEAR if you want to clear screen before running FUSE
    178 " program.
    179 
    180 " Pdf
    181 filextype *.pdf zathura %c %i &, apvlv %c, xpdf %c
    182 fileviewer *.pdf
    183         \ vifmimg pdfpreview %px %py %pw %ph %c
    184         \ %pc
    185         \ vifmimg clear
    186         " \ pdftotext -nopgbrk %c -
    187 
    188 " PostScript
    189 filextype *.ps,*.eps,*.ps.gz
    190         \ {View in zathura}
    191         \ zathura %f,
    192         \ {View in gv}
    193         \ gv %c %i &,
    194 
    195 " Djvu
    196 filextype *.djvu
    197         \ {View in zathura}
    198         \ zathura %f,
    199         \ {View in apvlv}
    200         \ apvlv %f,
    201 
    202 " Audio
    203 filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus
    204        \ {Play using ffplay}
    205        \ ffplay -nodisp -autoexit %c,
    206        \ {Play using MPlayer}
    207        \ mplayer %f,
    208 fileviewer *.mp3 mp3info
    209 fileviewer *.flac soxi
    210 
    211 " Video
    212 filextype *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,
    213          \*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx,
    214          \*.as[fx]
    215         \ {View using ffplay}
    216         \ ffplay -fs -autoexit %f,
    217         \ {View using Dragon}
    218         \ dragon %f:p,
    219         \ {View using mplayer}
    220         \ mplayer %f,
    221 fileviewer *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,
    222           \*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx,
    223           \*.as[fx]
    224         \ vifmimg videopreview %px %py %pw %ph %c
    225         \ %pc
    226         \ vifmimg clear
    227         " \ ffprobe -pretty %c 2>&1
    228 
    229 " Web
    230 filextype *.html,*.htm
    231         \ {Open with dwb}
    232         \ dwb %f %i &,
    233         \ {Open with firefox}
    234         \ firefox %f &,
    235         \ {Open with uzbl}
    236         \ uzbl-browser %f %i &,
    237 filetype *.html,*.htm links, lynx
    238 
    239 " Object
    240 filetype *.o nm %f | less
    241 
    242 " Man page
    243 filetype *.[1-8] man ./%c
    244 fileviewer *.[1-8] man ./%c | col -b
    245 
    246 " Images
    247 filextype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm
    248         \ {View in sxiv}
    249         \ sxiv -ia %c %d &,
    250         \ {View in imv}
    251         \ imv -b 1D2330 -d %d &,
    252         \ {View in feh}
    253         \ feh %d &,
    254         \ {View in cacaview}
    255         \ cacaview %c &,
    256 fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.xpm
    257         \ vifmimg draw %px %py %pw %ph %c
    258         \ %pc
    259         \ vifmimg clear
    260         " Get w3m image previews inside vifm
    261 		" \ imgt %px %py %pw %ph %c
    262         " \ %pc
    263         " \ imgc %px %py %pw %ph   NOT NEEDED IN XTERM
    264 fileviewer *.gif
    265         \ vifmimg gifpreview %px %py %pw %ph %c
    266         \ %pc
    267         \ vifmimg clear
    268 
    269 " OpenRaster
    270 filextype *.ora
    271         \ {Edit in MyPaint}
    272         \ mypaint %f,
    273 
    274 " Mindmap
    275 filextype *.vym
    276         \ {Open with VYM}
    277         \ vym %f &,
    278 
    279 " MD5
    280 filetype *.md5
    281        \ {Check MD5 hash sum}
    282        \ md5sum -c %f %S,
    283 
    284 " SHA1
    285 filetype *.sha1
    286        \ {Check SHA1 hash sum}
    287        \ sha1sum -c %f %S,
    288 
    289 " SHA256
    290 filetype *.sha256
    291        \ {Check SHA256 hash sum}
    292        \ sha256sum -c %f %S,
    293 
    294 " SHA512
    295 filetype *.sha512
    296        \ {Check SHA512 hash sum}
    297        \ sha512sum -c %f %S,
    298 
    299 " GPG signature
    300 filetype *.asc
    301        \ {Check signature}
    302        \ !!gpg --verify %c,
    303 
    304 " Torrent
    305 filetype *.torrent ktorrent %f &
    306 fileviewer *.torrent dumptorrent -v %c
    307 
    308 " FuseZipMount
    309 filetype *.zip,*.jar,*.war,*.ear,*.oxt,*.apkg
    310        \ {Mount with fuse-zip}
    311        \ FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR,
    312        \ {View contents}
    313        \ zip -sf %c | less,
    314        \ {Extract here}
    315        \ tar -xf %c,
    316 fileviewer *.zip,*.jar,*.war,*.ear,*.oxt zip -sf %c
    317 
    318 " ArchiveMount
    319 filetype *.tar,*.tar.bz2,*.tbz2,*.tgz,*.tar.gz,*.tar.xz,*.txz
    320        \ {Mount with archivemount}
    321        \ FUSE_MOUNT|archivemount %SOURCE_FILE %DESTINATION_DIR,
    322 fileviewer *.tgz,*.tar.gz tar -tzf %c
    323 fileviewer *.tar.bz2,*.tbz2 tar -tjf %c
    324 fileviewer *.tar.txz,*.txz xz --list %c
    325 fileviewer *.tar tar -tf %c
    326 
    327 " Rar2FsMount and rar archives
    328 filetype *.rar
    329        \ {Mount with rar2fs}
    330        \ FUSE_MOUNT|rar2fs %SOURCE_FILE %DESTINATION_DIR,
    331 fileviewer *.rar unrar v %c
    332 
    333 " IsoMount
    334 filetype *.iso
    335        \ {Mount with fuseiso}
    336        \ FUSE_MOUNT|fuseiso %SOURCE_FILE %DESTINATION_DIR,
    337 
    338 " SshMount
    339 filetype *.ssh
    340        \ {Mount with sshfs}
    341        \ FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR %FOREGROUND,
    342 
    343 " FtpMount
    344 filetype *.ftp
    345        \ {Mount with curlftpfs}
    346        \ FUSE_MOUNT2|curlftpfs -o ftp_port=-,,disable_eprt %PARAM %DESTINATION_DIR %FOREGROUND,
    347 
    348 " Fuse7z and 7z archives
    349 filetype *.7z
    350        \ {Mount with fuse-7z}
    351        \ FUSE_MOUNT|fuse-7z %SOURCE_FILE %DESTINATION_DIR,
    352 fileviewer *.7z 7z l %c
    353 
    354 " Office files
    355 filextype *.odt,*.doc,*.docx,*.xls,*.xlsx,*.odp,*.pptx libreoffice %f &
    356 fileviewer *.doc catdoc %c
    357 fileviewer *.docx docx2txt.pl %f -
    358 
    359 " TuDu files
    360 filetype *.tudu tudu -f %c
    361 
    362 " Qt projects
    363 filextype *.pro qtcreator %f &
    364 
    365 " Directories
    366 filextype */
    367         \ {View in thunar}
    368         \ Thunar %f &,
    369 
    370 " Syntax highlighting in preview
    371 "
    372 " Explicitly set highlight type for some extensions
    373 "
    374 " 256-color terminal
    375 " fileviewer *.[ch],*.[ch]pp highlight -O xterm256 -s dante --syntax c %c
    376 " fileviewer Makefile,Makefile.* highlight -O xterm256 -s dante --syntax make %c
    377 "
    378 " 16-color terminal
    379 " fileviewer *.c,*.h highlight -O ansi -s dante %c
    380 "
    381 " Or leave it for automatic detection
    382 "
    383 " fileviewer *[^/] pygmentize -O style=monokai -f console256 -g
    384 
    385 " Displaying pictures in terminal
    386 "
    387 " fileviewer *.jpg,*.png shellpic %c
    388 
    389 " Open all other files with default system programs (you can also remove all
    390 " :file[x]type commands above to ensure they don't interfere with system-wide
    391 " settings).  By default all unknown files are opened with 'vi[x]cmd'
    392 " uncommenting one of lines below will result in ignoring 'vi[x]cmd' option
    393 " for unknown file types.
    394 " For *nix:
    395 " filetype * xdg-open
    396 " For OS X:
    397 " filetype * open
    398 " For Windows:
    399 " filetype * start, explorer
    400 
    401 " GETTING ICONS TO DISPLAY IN VIFM
    402 " You need the next 14 lines!
    403 
    404 "   ::*.sh::, ::*.[hc]pp::, ::*.[hc]::,
    405 
    406 " file types
    407 set classify=' :dir:/, :exe:, :reg:, :link:'
    408 " various file names
    409 set classify+=' ::../::, ::/^copying|license$/::, ::.git/,,*.git/::, ::*.epub,,*.fb2,,*.djvu::, ::*.pdf::, ::*.htm,,*.html,,**.[sx]html,,*.xml::'
    410 " archives
    411 set classify+=' ::*.7z,,*.ace,,*.arj,,*.bz2,,*.cpio,,*.deb,,*.dz,,*.gz,,*.jar,,*.lzh,,*.lzma,,*.rar,,*.rpm,,*.rz,,*.tar,,*.taz,,*.tb2,,*.tbz,,*.tbz2,,*.tgz,,*.tlz,,*.trz,,*.txz,,*.tz,,*.tz2,,*.xz,,*.z,,*.zip,,*.zoo::'
    412 " images
    413 set classify+=' ::*.bmp,,*.gif,,*.jpeg,,*.jpg,,*.ico,,*.png,,*.ppm,,*.svg,,*.svgz,,*.tga,,*.tif,,*.tiff,,*.xbm,,*.xcf,,*.xpm,,*.xspf,,*.xwd::'
    414 " audio
    415 set classify+=' ::*.aac,,*.anx,,*.asf,,*.au,,*.axa,,*.flac,,*.m2a,,*.m4a,,*.mid,,*.midi,,*.mp3,,*.mpc,,*.oga,,*.ogg,,*.ogx,,*.ra,,*.ram,,*.rm,,*.spx,,*.wav,,*.wma,,*.ac3::'
    416 " media
    417 set classify+=' ::*.avi,,*.ts,,*.axv,,*.divx,,*.m2v,,*.m4p,,*.m4v,,.mka,,*.mkv,,*.mov,,*.mp4,,*.flv,,*.mp4v,,*.mpeg,,*.mpg,,*.nuv,,*.ogv,,*.pbm,,*.pgm,,*.qt,,*.vob,,*.wmv,,*.xvid::'
    418 " office files
    419 set classify+=' ::*.doc,,*.docx::, ::*.xls,,*.xls[mx]::, ::*.pptx,,*.ppt::'
    420 
    421 " ------------------------------------------------------------------------------
    422 
    423 " What should be saved automatically between vifm runs
    424 " Like in previous versions of vifm
    425 " set vifminfo=options,filetypes,commands,bookmarks,dhistory,state,cs
    426 " Like in vi
    427 set vifminfo=dhistory,savedirs,chistory,state,tui,shistory,
    428     \phistory,fhistory,dirstack,registers,bookmarks,bmarks
    429 
    430 " ------------------------------------------------------------------------------
    431 
    432 " Examples of configuring both panels
    433 
    434 " Customize view columns a bit (enable ellipsis for truncated file names)
    435 "
    436 " set viewcolumns=-{name}..,6{}.
    437 
    438 " Filter-out build and temporary files
    439 "
    440 " filter! /^.*\.(lo|o|d|class|py[co])$|.*~$/
    441 
    442 " ------------------------------------------------------------------------------
    443 
    444 " Sample mappings
    445 
    446 " Start shell in current directory
    447 nnoremap s :shell<cr>
    448 
    449 " Display sorting dialog
    450 nnoremap S :sort<cr>
    451 
    452 " Toggle visibility of preview window
    453 nnoremap w :view<cr>
    454 vnoremap w :view<cr>gv
    455 
    456 " Open file in existing instance of gvim
    457 nnoremap o :!gvim --remote-tab-silent %f<cr>
    458 " Open file in new instance of gvim
    459 nnoremap O :!gvim %f<cr>
    460 
    461 " Open file in the background using its default program
    462 nnoremap gb :file &<cr>l
    463 
    464 " Goto home
    465 nnoremap gh :goto /home/anders/Documents/<cr>
    466 nnoremap gs :goto /home/anders/Scripts/.scriptmenu<cr>
    467 
    468 " Yank current directory path into the clipboard
    469 nnoremap yd :!echo %d | xclip %i<cr>
    470 
    471 " Yank current file path into the clipboard
    472 nnoremap yf :!echo %c:p | xclip %i<cr>
    473 
    474 " Mappings for faster renaming
    475 nnoremap I cw<c-a>
    476 nnoremap cc cw<c-u>
    477 nnoremap A cw
    478 
    479 " Open console in current directory
    480 nnoremap ,t :!xterm &<cr>
    481 
    482 " Open editor to edit vifmrc and apply settings after returning to vifm
    483 nnoremap ,c :write | edit $MYVIFMRC | restart<cr>
    484 " Open gvim to edit vifmrc
    485 nnoremap ,C :!gvim --remote-tab-silent $MYVIFMRC &<cr>
    486 
    487 " Toggle wrap setting on ,w key
    488 nnoremap ,w :set wrap!<cr>
    489 
    490 " Example of standard two-panel file managers mappings
    491 nnoremap <f3> :!less %f<cr>
    492 nnoremap <f4> :edit<cr>
    493 nnoremap <f5> :copy<cr>
    494 nnoremap <f6> :move<cr>
    495 nnoremap <f7> :mkdir<space>
    496 nnoremap <f8> :delete<cr>
    497 
    498 " Faster jk movement
    499 nnoremap J 3j
    500 nnoremap K 3k
    501 vnoremap J 3j
    502 vnoremap K 3k
    503 
    504 " ------------------------------------------------------------------------------
    505 
    506 " Various customization examples
    507 
    508 " Use ag (the silver searcher) instead of grep
    509 "
    510 " set grepprg='ag --line-numbers %i %a %s'
    511 
    512 " Add additional place to look for executables
    513 "
    514 " let $PATH = $HOME.'/bin/fuse:'.$PATH
    515 
    516 " Block particular shortcut
    517 "
    518 " nnoremap <left> <nop>
    519 
    520 " Export IPC name of current instance as environment variable and use it to
    521 " communicate with the instance later.
    522 "
    523 " It can be used in some shell script that gets run from inside vifm, for
    524 " example, like this:
    525 "     vifm --server-name "$VIFM_SERVER_NAME" --remote +"cd '$PWD'"
    526 "
    527 " let $VIFM_SERVER_NAME = v:servername