<root> / vifmrc (192f90afddc4b813afbf7c95858fb929543dd992) (11KiB) (mode 100644) [raw]
" vim: set textwidth=80 syntax+=.autofold :

" ==============================================================================
" load machine specific settings of configuration

let $VIFMRC_HAS_RICH_FONT = ''
source $VIFM/vifmrc_settings

" ==============================================================================
" nesting detection

if $INSIDE_VIFM != ''
    let $SL_PREFIX = 'vifm '
else
    if $PS1 != ''
        let $SL_PREFIX = 'bash '
    endif
    let $INSIDE_VIFM = 'true'
endif

" ==============================================================================
" appearance

" hide side borders
set tuioptions-=s
if $TERM != 'linux'
    " use Unicode ellipsis
    set tuioptions+=u
endif

" change appearance of middle border
set fillchars=vborder:·

" use popup window instead of a single line for completion
set wildstyle=popup

" show suggestions
set suggestoptions=normal,visual,view,otherpane,delay,keys,registers,marks

" ==============================================================================
" various options

" use vim as default editor, open multiple files in tabs
set vicmd='vim -p'

" use trash
set trash

" how many directories to store in all kinds of history
set history=1000

" allow partially entered external commands with unambiguous beginning using :!
set fastrun

" natural sort of (version) numbers within filenames
set sortnumbers

" maximum number of changes that can be undone.
set undolevels=1000

" use vim's documentation system for :help command
set vimhelp

" follow links on l or Enter automatically, not just navigate to target
set nofollowlinks

" allow automatic runing of executable files
set runexec

" format for displaying time
set timefmt=%y.%m.%d\ %H:%M

" show list of matches on tab complition in command-line mode
set wildmenu

" ignore case in search pattern unless it contains at least one uppercase letter
set ignorecase
set smartcase

" don't highlight search results automatically
set nohlsearch

" use increment searching and filtering (search/filter while typing)
set incsearch

" try to leave some space from cursor to upper/lower border in lists
set scrolloff=4

" completely disable compatibility with older versions:
" * make yy and dd ignore selection and work with file under the cursor;
" * make <c-i> (and <tab>) work in same way as in Vim (go forward in history).
set cpoptions-=fst

" don't wrap long lines in preview pane
set nowrap

" expand tabulation characters as two spaces
set tabstop=2

" hide .. directory everywhere
set dotdirs=

" custom ruler format
set rulerformat='%2l-%S%[ +%x%]'

" what should be saved automatically between vifm runs
set vifminfo=dhistory,savedirs,chistory,state,tui,shistory,phistory,fhistory
           \,dirstack,registers,bookmarks,bmarks

" use trash directory per mount point, fallback to ~/.vifm/trash
set trashdir=%r/.vifm-Trash,$HOME/.vifm/trash

" update terminal title
set title

" perform file operations via system calls
set syscalls

" always match characters on f/F/;/, in a case sensitive way
set caseoptions=G

" mount FUSE file-systems here
set fusehome=~/.vifm/.fuse

" ignore .git directory on :find
set findprg='find %s %a -print ,
            \ -type d \( ! -readable -o ! -executable -o -path "*/.git" \)
            \ -prune'

" ==============================================================================
" custom status line look

" don't display file user/group on Windows
if !has('win')
    let $RIGHTS = '%[%u:%g%]'
endif

if $VIFMRC_HAS_RICH_FONT
    let &statusline = ''
    if $SL_PREFIX != ''
        let &statusline = '%2*'.$SL_PREFIX.'%4*'
    endif
    let &statusline .= '%1*'           " left separator
    let &statusline .= ' %t '          " file name
    let &statusline .= ''             " left separator
    let &statusline .= '%='            " fill the whole status line
    let &statusline .= ''             " right separator
    let &statusline .= ' %A '          " file attributes
    let &statusline .= '%4*%2*'       " right separator
    let &statusline .= ' '.$RIGHTS.' ' " user and group owners of the file
    let &statusline .= '%3*%1*'       " right separator
    let &statusline .= ' %5E '         " human readable cumulative file size
    let &statusline .= '%4*%2*'       " right separator
    let &statusline .= ' %d '          " file modification date and time
else
    let &statusline = ' '
    if $SL_PREFIX != ''
        let &statusline .= $SL_PREFIX.'| '
    endif
    let &statusline .= '%t%= %A '.$RIGHTS.'%15E %20d '
endif

" ==============================================================================
" various mappings

" use < and > without ctrl-w prefix key in normal mode
nnoremap < <c-w><
nnoremap > <c-w>>

" shellout
nnoremap <silent> s :shell<cr>

" display sorting dialog
nnoremap <silent> S :sort<cr>

" toggle visibility of preview window
nnoremap <silent> w :view<cr>
vnoremap <silent> w :view<cr>gv

" moving cursor in another pane
nnoremap <silent> J <space>j<space>
nnoremap <silent> K <space>k<space>

" open file in the background using its default program
nnoremap <silent> gb :file &<cr>l

" mappings for faster file renaming
" prepend to name
nnoremap I cw<c-a>
" replace file name stem
nnoremap cc cW<c-u>
" append to name
nnoremap A cw

" open vim to edit .vifmrc
nnoremap ,c :write | execute ':!%n${EDITOR:-vim} $MYVIFMRC' | restart<cr>
" open gvim to edit .vifmrc
nnoremap ,C :!gvim --remote-tab-silent $MYVIFMRC &<cr>

" toggle wrap setting on ,w key
nnoremap ,w :set invwrap<cr>

" faster search of files that start with a particular string
nnoremap f/ /^

" substitute in all files
nnoremap as :%s/

" force file editing rather than opening it
nnoremap E :edit<cr>

" use space and shift-tab as tab in quick view mode
qnoremap <space> <tab>
qnoremap <s-tab> <tab>

" toggle between sorting: by name <--> by size <--> by mtime
command! togglesort
         \ :if &sort == '-size,+name'
         \ |    set sort=+mtime
         \ |    echo 'Sorted by modification date'
         \ |elseif &sort == '+name'
         \ |    set sort=-size
         \ |    echo 'Sorted by size'
         \ |else
         \ |    set sort=+name
         \ |    echo 'Sorted by name'
         \ |endif
nnoremap ,S :togglesort<cr>

" ==============================================================================
" various commands

" creates directory and immediately enters it
command! mkcd :mkdir %a | cd %a
command! mkcd! :mkdir! %a | cd %a

" run make in current directory
command! make !!make %a

" ==============================================================================
" targeting Vim instances

" set target Vim server name
command! target : let $VIMARGS = '--servername "%a"'
               \| execute "!tmux %%i set-environment VIMARGS '".$VIMARGS."'"

" open file in existing instance of gvim (uses target)
if executable('run-gvim')
    " run-gvim can be a custom wrapper for gvim that does some extra work
    nnoremap <silent> o :    ![ -z "$(gvim --serverlist)" ] && run-gvim %f
                        \ || run-gvim --remote-tab-silent %f:p &<cr>
else
    nnoremap <silent> o :    ![ -z "$(gvim --serverlist)" ] && gvim $VIMARGS %f
                        \ || gvim $VIMARGS --remote-tab-silent %f:p &<cr>
endif
" open file in new instance of gvim
nnoremap O :!gvim %f &<cr>

" ==============================================================================
" file lists configuration

" default set of view columns
set viewcolumns=*{name}..,6{}.

" brief information about files
nnoremap ,b :set viewcolumns=*{name}..,6{}.<cr>
" detailed information about files
nnoremap ,d :set viewcolumns=*{name}.,10{perms},12{uname},-7{gname},10{size}.,20{mtime}<cr>

" ==============================================================================
" tabs

" go to previous tab page or move current tab page to position specified by the
" count
nnoremap <silent> gT : <c-u>
                    \| if v:count == 0
                    \|     execute 'normal gT'
                    \| elseif v:count > tabpagenr('$')
                    \|     tabmove
                    \| elseif v:count >= tabpagenr()
                    \|     execute 'tabmove' v:count
                    \| elseif v:count < tabpagenr()
                    \|     execute 'tabmove' v:count - 1
                    \| endif
                    \| <cr>

" switch to the next tab page
nnoremap <c-n> gt
" switch to the previous tab page
nnoremap <c-p> gT

" ==============================================================================
" general bookmarks

mark b ~/bin/
mark c ~/.vifm/
mark h ~/
mark t ~/tmp/
mark V ~/.vim/bundle/

" ==============================================================================
" filename filtering

" *.o - object files
" *.lo - object files for shared libs
" *.d - dependency file generated by compiler (also source file in D)
" *.class - JVM byte code
" *.pyc - Python byte code
" *.pyo - optimized Python byte code
" *.meta - magnet-link file for torrents
" .*~ - temporary files
" $RECYCLE.BIN - trash bin on Windows volumes
filter! /^.*\.(lo|o|d|class|py[co]|meta)$|.*~$|^\$RECYCLE\.BIN\/$/

" ==============================================================================
" color scheme

colorscheme near-default

" ==============================================================================
" "icons" for files

if $VIFMRC_HAS_RICH_FONT
    " file types
    set classify=' :dir:/, :exe:, :reg:, :link:'
    " various file names
    set classify+=' ::../::, ::*.sh::, ::*.[hc]pp,,*.cc,,*.hh::, ::*.[hc]::'
    set classify+=' ::/^copying|license$/::, ::.git/,,*.git/::/'
    set classify+=' ::*.epub,,*.fb2,,*.djvu::, ::*.pdf::'
    set classify+=' ::*.htm,,*.html,,**.[sx]html,,*.xml::'
    " archives
    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::'
    " images
    set classify+=' ::*.bmp,,*.gif,,*.jpeg,,*.jpg,,*.ico,,*.png,,*.ppm,,*.svg,,
                  \*.svgz,,*.tga,,*.tif,,*.tiff,,*.xbm,,*.xcf,,*.xpm,,*.xspf,,
                  \*.xwd::'
    " audio
    set classify+=' ::*.aac,,*.anx,,*.asf,,*.au,,*.axa,,*.flac,,*.m2a,,*.m4a,,
                  \*.mid,,*.midi,,*.mp3,,*.mpc,,*.oga,,*.ogg,,*.ogx,,*.ra,,
                  \*.ram,,*.rm,,*.spx,,*.wav,,*.wma,,*.ac3::'
    " media
    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,,*.webm::'
    " office files
    set classify+=' ::*.doc,,*.docx::, ::*.xls,,*.xls[mx]::'
    set classify+=' ::*.pptx,,*.ppt::'
endif

" ==============================================================================
" load machine specific local set of settings

source $VIFM/vifmrc_local

" ==============================================================================
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/dotvifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/dotvifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master