vifmrc (10106B) - raw


      1 " __     _____ _____ __  __ ____   ____
      2 " \ \   / /_ _|  ___|  \/  |  _ \ / ___|
      3 "  \ \ / / | || |_  | |\/| | |_) | |
      4 "   \ V /  | ||  _| | |  | |  _ <| |___
      5 "    \_/  |___|_|   |_|  |_|_| \_\\____|
      6 "
      7 
      8 " {{{ General config
      9 " This is the actual command used to start vi.  The default is vim.
     10 " If you would like to use another vi clone such as Elvis or Vile
     11 " you will need to change this setting.
     12 set vicmd=nvim
     13 
     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 
     20 " Open with preview window
     21 view
     22 
     23 " Trash Directory
     24 " The default is to move files that are deleted with dd or :d to
     25 " the trash directory.  If you change this you will not be able to move
     26 " files by deleting them and then using p to put the file in the new location.
     27 " I recommend not changing this until you are familiar with vifm.
     28 " This probably shouldn't be an option.
     29 set trash
     30 
     31 " This is how many directories to store in the directory history.
     32 set history=1000
     33 
     34 " Automatically resolve symbolic links on l or Enter.
     35 set nofollowlinks
     36 
     37 " Natural sort of (version) numbers within text.
     38 set sortnumbers
     39 
     40 " Maximum number of changes that can be undone.
     41 set undolevels=100
     42 
     43 " If you would like to run an executable file when you
     44 " press return on the file name set this.
     45 set norunexec
     46 
     47 " Selected color scheme
     48 colorscheme elly
     49 " colorscheme minimal
     50 
     51 " Format for displaying time in file list. For example:
     52 " TIME_STAMP_FORMAT=%m/%d-%H:%M
     53 " See man date or man strftime for details.
     54 set timefmt=%m/%d\ %H:%M
     55 
     56 " Show list of matches on tab completion in command-line mode
     57 set wildmenu
     58 
     59 " Display completions in a form of popup with descriptions of the matches
     60 set wildstyle=popup
     61 
     62 " Display suggestions in normal, visual and view modes for keys, marks and
     63 " registers (at most 5 files).  In other view, when available.
     64 set suggestoptions=normal,visual,view,otherpane,keys,marks,registers
     65 
     66 " Ignore case in search patterns unless it contains at least one uppercase
     67 " letter
     68 set ignorecase
     69 set smartcase
     70 
     71 " Don't highlight search results automatically
     72 set nohlsearch
     73 
     74 " Use increment searching (search while typing)
     75 set incsearch
     76 
     77 " Try to leave some space from cursor to upper/lower border in lists
     78 set scrolloff=4
     79 
     80 " Don't do too many requests to slow file systems
     81 if !has('win')
     82     set slowfs=curlftpfs
     83 endif
     84 
     85 " Things that should be stored in vifminfo
     86 set vifminfo=dhistory,chistory,state,shistory,phistory,fhistory,dirstack,registers,bookmarks,bmarks
     87 
     88 " Dont show delete confirmation
     89 set confirm-=delete
     90 
     91 " ------------------------------------------------------------------------------
     92 
     93 " :com[mand][!] command_name action
     94 " The following macros can be used in a command
     95 " %a is replaced with the user arguments.
     96 " %c the current file under the cursor.
     97 " %C the current file under the cursor in the other directory.
     98 " %f the current selected file, or files.
     99 " %F the current selected file, or files in the other directory.
    100 " %b same as %f %F.
    101 " %d the current directory name.
    102 " %D the other window directory name.
    103 " %m run the command in a menu window
    104 
    105 command! df df -h %m 2> /dev/null
    106 command! diff vim -d %f %F
    107 command! zip zip -r %f.zip %f
    108 command! run !! ./%f
    109 command! make !!make %a
    110 command! mkcd :mkdir %a | cd %a
    111 command! vgrep vim "+grep %a"
    112 command! reload :write | restart
    113 
    114 " Empty the ruler. By default, it shows the number of directories+files.
    115 set rulerformat=
    116 " }}}
    117 
    118 
    119 " {{{ File preview & file opening
    120 " The file type is for the default programs to be used with
    121 " a file extension.
    122 " :filetype pattern1,pattern2 defaultprogram,program2
    123 " :fileviewer pattern1,pattern2 consoleviewer
    124 " The other programs for the file type can be accessed with the :file command
    125 " The command macros %f, %F, %d, %F may be used in the commands.
    126 " The %a macro is ignored.  To use a % you must put %%.
    127 
    128 " For automated FUSE mounts, you must register an extension with :file[x]type
    129 " in one of following formats:
    130 "
    131 " :filetype extensions FUSE_MOUNT|some_mount_command using %SOURCE_FILE and %DESTINATION_DIR variables
    132 " %SOURCE_FILE and %DESTINATION_DIR are filled in by vifm at runtime.
    133 " A sample line might look like this:
    134 " :filetype *.zip,*.jar,*.war,*.ear FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR
    135 "
    136 " :filetype extensions FUSE_MOUNT2|some_mount_command using %PARAM and %DESTINATION_DIR variables
    137 " %PARAM and %DESTINATION_DIR are filled in by vifm at runtime.
    138 " A sample line might look like this:
    139 " :filetype *.ssh FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR
    140 " %PARAM value is filled from the first line of file (whole line).
    141 " Example first line for SshMount filetype: root@127.0.0.1:/
    142 "
    143 " You can also add %CLEAR if you want to clear screen before running FUSE
    144 " program.
    145 
    146 
    147 " CSV/Excel
    148 " filetype *.xlsx libreoffice %c %i
    149 fileviewer *.csv sed "s/,,,,/,,-,,/g;s/,,/ /g" %c | column -t | sed "s/ - /  /g" | cut -c -%pw
    150 
    151 " HTMLs
    152 fileviewer *.html w3m -dump %c
    153 filextype *.html,*.htm firefox %f 2>/dev/null &
    154 
    155 " Text based files
    156 filetype <*.csv,text/*> nvim
    157 fileviewer <*.csv,text/*> env -uCOLORTERM highlight -i %c --stdout -O ansi
    158 " fileviewer <*.csv,text/*> env -uCOLORTERM bat --color always --theme base16 --wrap never --pager never %c -p
    159 fileviewer *.[ch],*.[ch]pp,*.[ch]xx env -uCOLORTERM highlight -i %c --stdout -O ansi
    160 " fileviewer *.[ch],*.[ch]pp,*.[ch]xx env -uCOLORTERM bat --color always --theme base16 --wrap never --pager never %c -p
    161 
    162 " PDFs
    163 filextype *.pdf zathura %c %i &
    164 fileviewer *.pdf
    165         \ vifmimg pdf %px %py %pw %ph %c
    166         \ %pc
    167         \ vifmimg clear
    168 
    169 " ePUBs
    170 filextype *.epub zathura %c %i &
    171 fileviewer *.epub
    172         \ vifmimg epub %px %py %pw %ph %c
    173         \ %pc
    174         \ vifmimg clear
    175 
    176 " Fonts
    177 fileviewer *.otf,*.ttf,*.woff
    178         \ vifmimg font %px %py %pw %ph %c
    179         \ %pc
    180         \ vifmimg clear
    181 
    182 " Audios
    183 filetype <audio/*> mpv %c %i &
    184 fileviewer <audio/*>
    185         \ vifmimg audio %px %py %pw %ph %c
    186         \ %pc
    187         \ vifmimg clear
    188 
    189 " Videos
    190 filetype <video/*> mpv %c %i &
    191 fileviewer <video/*>
    192         \ vifmimg video %px %py %pw %ph %c
    193         \ %pc
    194         \ vifmimg clear
    195 
    196 " Images
    197 filextype <image/*> sxiv %c %i &
    198 fileviewer <image/*>
    199         \ vifmimg draw %px %py %pw %ph %c
    200         \ %pc
    201         \ vifmimg clear
    202 
    203 " Archives
    204 fileviewer *.zip,*.jar,*.war,*.ear,*.oxt zip -sf %c
    205 fileviewer *.tgz,*.tar.gz tar -tzf %c
    206 fileviewer *.tar.bz2,*.tbz2 tar -tjf %c
    207 fileviewer *.tar.txz,*.txz xz --list %c
    208 fileviewer *.tar tar -tf %c
    209 fileviewer *.rar unrar v %c
    210 fileviewer *.7z 7z l %c
    211 
    212 " Dont show preview on ../ as this confuses me at times
    213 fileview ../ echo >/dev/null
    214 
    215 " Show ls in the preview window, it creates a similar look as ranger.
    216 " The default directory tree thing is really messy
    217 fileviewer */ ls --color --group-directories-first
    218 fileviewer .*/ ls --color --group-directories-first
    219 
    220 " Other files
    221 " Using xdg-open to open the highlighted file with a compatible program and
    222 " the reason why I am using "file" to preview other files is so that "vifm"
    223 " does not lag when trying "cat" the file
    224 filetype * xdg-open %c
    225 fileviewer * file -b %c
    226 " }}}
    227 
    228 
    229 "{{{ Key mappings
    230 " Easily quit vifm by hitting q
    231 nmap q :q<cr>
    232 
    233 " Use comma to enter command mode
    234 nnoremap , :
    235 
    236 " Set highlighted image as wallpaper
    237 nnoremap bg :!sh $SCRIPTS/setbg %c &<cr>
    238 
    239 " Upload highlighted file to 0x0.st and then save url to clipboard
    240 nnoremap 0x0 :!curl -s -F'file=@%c' https://0x0.st > /dev/null | xclip -sel clip && notify-send "vifm" "File uploaded: $(xclip -o -selection clipboard)" &<cr>
    241 
    242 
    243 " Go to the file that is right before "../" for going to the top most file
    244 nnoremap gg ggj
    245 
    246 " Quick shortcuts to some dirs
    247 source ~/.cache/vifm-shortcuts
    248 
    249 " Easily go back home
    250 nnoremap cd :cd<cr>
    251 
    252 " Display sorting dialog
    253 nnoremap S :sort<cr>
    254 
    255 " Toggle visibility of preview window
    256 nnoremap w :view<cr>
    257 vnoremap w :view<cr>gv
    258 
    259 " Open file in nvim
    260 nnoremap o :!nvim %f<cr>
    261 
    262 " Open file in the background using its default program
    263 nnoremap gb :file &<cr>l
    264 
    265 " Yank current directory path into the clipboard
    266 nnoremap yd :!echo %d | xclip -i -selection clipboard %i<cr>
    267 
    268 " Yank current file path into the clipboard
    269 nnoremap yf :!echo %c:p | xsel -b %i<cr>
    270 
    271 " Mappings for faster renaming
    272 nnoremap I cw<c-a>
    273 nnoremap cc cw<c-u>
    274 nnoremap A cw
    275 
    276 " Extract an archive
    277 nnoremap x :!/home/siddharth/bin/utils/extract %f &<cr>
    278 
    279 " Share Files with dropbox
    280 nnoremap s :!dbshare %d/%b &<cr>
    281 nnoremap N :!dropbox-cli exclude add %d/%b &<cr>
    282 
    283 " Make a new directory
    284 nnoremap mkd :mkdir<space>
    285 "}}}
    286 
    287 
    288 "{{{ Icons
    289 " file types
    290 set classify='  :dir:/,  :exe:,  :reg:,  :link:'
    291 " various file names
    292 set classify+='  ::../::,  ::*.sh::,  ::*.[hc]pp::,  ::*.[hc]::,  ::/^copying|license$/::,  ::.git/,,*.git/::,  ::*.epub,,*.fb2,,*.djvu::,  ::*.pdf::,  ::*.htm,,*.html,,**.[sx]html,,*.xml::'
    293 set classify+='  ::*.go::,  ::*.vim,,vimrc::,  ::*.tex,,*.aux,,*.toc,,*.rnw,,*.rmd::,  ::*.js::,  ::*.css::,  ::*.log,,*.db::,  ::*.py,,*.pyc,,*.pyd,,*.pyo::,  ::*.md::,  ::*.json::,  ::*.vcf::, ::*.rss::'
    294 " archives
    295 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::'
    296 " images
    297 set classify+='  ::*.bmp,,*.gif,,*.jpeg,,*.jpg,,*.ico,,*.png,,*.ppm,,*.svg,,*.svgz,,*.tga,,*.tif,,*.tiff,,*.xbm,,*.xcf,,*.xpm,,*.xspf,,*.xwd,,*.webp::'
    298 " audio
    299 set classify+='  ::*.aac,,*.anx,,*.asf,,*.au,,*.axa,,*.flac,,*.m2a,,*.m4a,,*.mid,,*.midi,,*.mp3,,*.mpc,,*.oga,,*.ogg,,*.ogx,,*.ra,,*.ram,,*.rm,,*.spx,,*.wav,,*.wma,,*.ac3::'
    300 " media
    301 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::'
    302 " office files
    303 set classify+='  ::*.doc,,*.docx::,  ::*.xls,,*.xls[mx]::,  ::*.pptx,,*.ppt::'
    304 " miscelleneaous files
    305 "}}}
    306 
    307 " vim: ft=vim