vifmrc 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. " vim: filetype=vifm :
  2. " Sample configuration file for vifm (last updated: 9 September, 2020)
  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=nvim
  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. " With this option turned on you can run partially entered commands with
  31. " unambiguous beginning using :! (e.g. :!Te instead of :!Terminal or :!Te<tab>).
  32. " set fastrun
  33. " Natural sort of (version) numbers within text.
  34. set sortnumbers
  35. " Maximum number of changes that can be undone.
  36. set undolevels=100
  37. " Use Vim's format of help file (has highlighting and "hyperlinks").
  38. " If you would rather use a plain text help file set novimhelp.
  39. set vimhelp
  40. " If you would like to run an executable file when you
  41. " press Enter, l or Right Arrow, set this.
  42. set runexec
  43. " List of color schemes to try (picks the first one supported by the terminal)
  44. colorscheme gruvbox Default-256 Default
  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=%m/%d\ %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. " ------------------------------------------------------------------------------
  73. " :mark mark /full/directory/path [filename]
  74. mark h ~/
  75. mark d ~/Documents
  76. mark D ~/Downloads
  77. mark m ~/Music
  78. mark s ~/Scripts
  79. mark f ~/Movies
  80. mark g ~/Games
  81. mark v ~/Videos
  82. mark p ~/Pictures
  83. " ------------------------------------------------------------------------------
  84. " :com[mand][!] command_name action
  85. " The following macros can be used in a command
  86. " %a is replaced with the user arguments.
  87. " %c the current file under the cursor.
  88. " %C the current file under the cursor in the other directory.
  89. " %f the current selected file, or files.
  90. " %F the current selected file, or files in the other directory.
  91. " %b same as %f %F.
  92. " %d the current directory name.
  93. " %D the other window directory name.
  94. " %m run the command in a menu window
  95. command! df df -h %m 2> /dev/null
  96. command! diff vim -d %f %F
  97. command! zip zip -r %f.zip %f
  98. command! run !! ./%f
  99. command! make !!make %a
  100. command! mkcd :mkdir %a | cd %a
  101. command! vgrep vim "+grep %a"
  102. command! reload :write | restart full
  103. command! unarchive !!aunpack %f
  104. " ------------------------------------------------------------------------------
  105. fileviewer {*.torrent},<application/x-bittorrent> transmission-show %c
  106. fileviewer {*.tar*}, tar -tvf %c
  107. fileviewer {*.doc},<application/msword> catdoc %c
  108. fileviewer {*.docx},
  109. \<application/
  110. \vnd.openxmlformats-officedocument.wordprocessingml.document>
  111. \ docx2txt.pl %f -
  112. fileviewer {*.xpi,*.7z,*.iso}, 7z l %c
  113. filetype <image/*> sxiv -a %f
  114. filetype <video/*> mpv %f
  115. filetype <audio/*> mpv %f --volume=50
  116. filetype {*.cbz,*.cbr,*.djvu} zathura %f
  117. filetype <application/pdf> zathura %f
  118. filetype <application/vnd.appimage> chmod +x %f && sh %f
  119. filetype {*.exe,*.msi} wine %f
  120. filetype {*.html} xdg-open %f &>/dev/null
  121. filetype {*.xcf} gimp %f
  122. filetype <text/*> nvim %f
  123. " filetype <text/*> emacsclient -a '' -c %f
  124. filetype {*.docx,*.xlsx,*.rtf,*.odt} libreoffice %f
  125. filetype {*.7z,*.rar,*.zip,*.tar*} emacsclient -a '' -c %f
  126. " Syntax highlighting in preview
  127. " Explicitly set highlight type for some extensions
  128. " 256-color terminal
  129. " fileviewer *.[ch],*.[ch]pp highlight -O xterm256 -s dante --syntax c %c
  130. " fileviewer Makefile,Makefile.* highlight -O xterm256 -s dante --syntax make %c
  131. " 16-color terminal
  132. " fileviewer *.c,*.h highlight -O ansi -s dante %c
  133. " Or leave it for automatic detection
  134. " fileviewer *[^/] pygmentize -O style=monokai -f console256 -g
  135. " Open all other files with default system programs (you can also remove all
  136. " :file[x]type commands above to ensure they don't interfere with system-wide
  137. " settings). By default all unknown files are opened with 'vi[x]cmd'
  138. " uncommenting one of lines below will result in ignoring 'vi[x]cmd' option
  139. " for unknown file types.
  140. " For *nix:
  141. filetype * xdg-open
  142. " For OS X:
  143. " filetype * open
  144. " For Windows:
  145. " filetype * start, explorer
  146. " ------------------------------------------------------------------------------
  147. " What should be saved automatically between vifm sessions. Drop "savedirs"
  148. " value if you don't want vifm to remember last visited directories for you.
  149. set vifminfo=dhistory,savedirs,chistory,state,tui,shistory,
  150. \phistory,fhistory,dirstack,registers,bookmarks,bmarks
  151. " ------------------------------------------------------------------------------
  152. " Examples of configuring both panels
  153. " Customize view columns a bit (enable ellipsis for truncated file names)
  154. " set viewcolumns=-{name}..,6{}.
  155. " Filter-out build and temporary files
  156. filter {*.aux,*.bbl,*.bcf,*.blg,*.run.xml,*.lo,*.o,*.d,*.pyc,*.pyo,.*~}
  157. " ------------------------------------------------------------------------------
  158. " MY BINDINGS
  159. nnoremap xx :!detach.sh xdg-open %f &<cr>
  160. nnoremap xr :!detach.sh rox &<cr>
  161. nnoremap xi :!detach.sh inkscape %f &<cr>
  162. nnoremap xG :!detach.sh gimp %f &<cr>
  163. nnoremap xE :!detach.sh nvim-qt --no-ext-tabline %f &<cr>
  164. nnoremap xe :!detach.sh emacsclient -a "" -c %f &<cr>
  165. nnoremap xM :!detach.sh mypaint %f &<cr>
  166. nnoremap xu :!detach.sh aunpack %f &<cr>
  167. nnoremap xU :!aunpack %f<cr>
  168. nnoremap xb :!detach.sh xdg-open %f &<cr>
  169. nnoremap xcq :!cmus-remote -q %f &<cr>
  170. " nnoremap xga :!git --git-dir=~/.dotfiles --work-tree=~/ %f &<cr>
  171. nnoremap xga :!link-to-dotfiles.sh %f &<cr>
  172. nnoremap xgA :!git-dotfiles.sh -a %f &<cr>
  173. " Sample mappings
  174. " Start shell in current directory
  175. nnoremap s :shell<cr>
  176. " Display sorting dialog
  177. nnoremap S :sort<cr>
  178. " Toggle visibility of preview window
  179. nnoremap w :view<cr>
  180. vnoremap w :view<cr>gv
  181. " Open file in new instance of nvim
  182. nnoremap o :!nvim %f<cr>
  183. " Open file in existing instance of neovim-qt
  184. nnoremap O :!detach.sh nvim-qt --no-ext-tabline %f<cr>
  185. " Open file in the background using its default program
  186. nnoremap gb :file &<cr>l
  187. " Interaction with system clipboard
  188. if has('win')
  189. " Yank current directory path to Windows clipboard with forward slashes
  190. nnoremap yp :!echo %"d:gs!\!/! %i | clip<cr>
  191. " Yank path to current file to Windows clipboard with forward slashes
  192. nnoremap yf :!echo %"c:gs!\!/! %i | clip<cr>
  193. elseif executable('xclip')
  194. " Yank current directory path into the clipboard
  195. nnoremap yd :!echo %d | xclip %i<cr>
  196. " Yank current file path into the clipboard
  197. nnoremap yf :!echo %c:p | xclip %i<cr>
  198. elseif executable('xsel')
  199. " Yank current directory path into primary and selection clipboards
  200. nnoremap yd :!echo -n %d | xsel --input --primary %i &&
  201. \ echo -n %d | xsel --clipboard --input %i<cr>
  202. " Yank current file path into into primary and selection clipboards
  203. nnoremap yf :!echo -n %c:p | xsel --input --primary %i &&
  204. \ echo -n %c:p | xsel --clipboard --input %i<cr>
  205. endif
  206. " Mappings for faster renaming
  207. nnoremap I cw<c-a>
  208. nnoremap cc cw<c-u>
  209. nnoremap A cw
  210. " Open console in current directory
  211. nnoremap ,t :!x-terminal-emulator &<cr>
  212. " Open editor to edit vifmrc and apply settings after returning to vifm
  213. nnoremap ,c :write | edit $MYVIFMRC | restart full<cr>
  214. " Toggle wrap setting on ,w key
  215. nnoremap ,w :set wrap!<cr>
  216. " Example of standard two-panel file managers mappings
  217. nnoremap <f3> :!less %f<cr>
  218. nnoremap <f4> :edit<cr>
  219. nnoremap <f5> :copy<cr>
  220. nnoremap <f6> :move<cr>
  221. nnoremap <f7> :mkdir<space>
  222. nnoremap <f8> :delete<cr>
  223. " Midnight commander alike mappings
  224. " Open current directory in the other pane
  225. nnoremap <a-i> :sync<cr>
  226. " Open directory under cursor in the other pane
  227. nnoremap <a-o> :sync %c<cr>
  228. " Swap panes
  229. nnoremap <c-u> <c-w>x
  230. " ------------------------------------------------------------------------------
  231. " Various customization examples
  232. " Use ag (the silver searcher) instead of grep
  233. "
  234. " set grepprg='ag --line-numbers %i %a %s'
  235. " Add additional place to look for executables
  236. "
  237. " let $PATH = $HOME.'/bin/fuse:'.$PATH
  238. " Block particular shortcut
  239. "
  240. " nnoremap <left> <nop>
  241. " Export IPC name of current instance as environment variable and use it to
  242. " communicate with the instance later.
  243. "
  244. " It can be used in some shell script that gets run from inside vifm, for
  245. " example, like this:
  246. " vifm --server-name "$VIFM_SERVER_NAME" --remote +"cd '$PWD'"
  247. "
  248. " let $VIFM_SERVER_NAME = v:servername