vifmrc.newer 15 KB

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