vifmrc 15 KB

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