vifm: Set statusline, ruler, fzf, and PDF combine

Set statusline to show more relevant information, and removed 'tip of
the day' functionality since I've never been looking at it.
Set ruler to show me how many files are hidden in a directory.

Added shortcut to quickly combine a bunch of PDFs (`gc`) that are
selected.

Added shortcut (`<leader>f`) to invoke fzf on current directory and
navigate to the result. This mirrors my vim use and mapping.
Additionally, added commands to invoke the fzf functionality (`:FZFfind`
and `FZFlocate`) by hand.

Lastly, moved the file classification and opening functionality a bit
out of the way.
Should still think about handing off opening files to xdg-open since
that's what it's there for, and only make vifm handle the file preview
stuff (i.e. the opposite window buffer preview).
This commit is contained in:
Marty Oehme 2021-03-14 17:31:05 +01:00
parent aa116e928f
commit 08c6aee17e
Signed by: Marty
GPG key ID: B7538B8F50A1C800

View file

@ -39,7 +39,6 @@ set nofollowlinks
" With this option turned on you can run partially entered commands with " With this option turned on you can run partially entered commands with
" unambiguous beginning using :! (e.g. :!Te instead of :!Terminal or :!Te<tab>). " unambiguous beginning using :! (e.g. :!Te instead of :!Terminal or :!Te<tab>).
" set fastrun " set fastrun
" Natural sort of (version) numbers within text. " Natural sort of (version) numbers within text.
@ -62,7 +61,7 @@ colorscheme cfillion.vifm
" Format for displaying time in file list. For example: " Format for displaying time in file list. For example:
" TIME_STAMP_FORMAT=%m/%d-%H:%M " TIME_STAMP_FORMAT=%m/%d-%H:%M
" See man date or man strftime for details. " See man date or man strftime for details.
set timefmt=%d-%m\ %H:%M set timefmt=%Y-%m-%d\ %H:%M
" Show list of matches on tab completion in command-line mode " Show list of matches on tab completion in command-line mode
set wildmenu set wildmenu
@ -94,7 +93,12 @@ if !has('win')
endif endif
" Set custom status line look " Set custom status line look
set statusline=" Hint: %z%= %A %10u:%-7g %15s %20d " set statusline="%A %10u:%-7g %10E / %-a %20d"
" Set ruler look (below statusline, showing directory info)
" set to show current file number, and overall number of files in dir
" with optional display of not-shown files if any are filtered out.
set rulerformat="%2l/%S %[[+%x]%]"
" decrease waiting time between input polling " decrease waiting time between input polling
set mintimeoutlen=50 set mintimeoutlen=50
@ -102,6 +106,9 @@ set mintimeoutlen=50
" set the pre-key timeout really high, see https://git.io/fNm1d " set the pre-key timeout really high, see https://git.io/fNm1d
set timeoutlen=5000 set timeoutlen=5000
" use fd instead of default find to make searching faster and more flexible
set findprg='fd %A --hidden --exclude .git --exclude node_modules'
" }}} " }}}
" Marks {{{ " Marks {{{
" ------------------------------------------------------------------------------ " ------------------------------------------------------------------------------
@ -143,7 +150,155 @@ command! mkcd :mkdir %a | cd %a
" command! vgrep nvim "+grep %a" " command! vgrep nvim "+grep %a"
command! reload :write | restart command! reload :write | restart
command! FZFlocate : set noquickview
\| let $FZF_PICK = term('locate $HOME | fzf 2>/dev/tty')
\| if $FZF_PICK != ''
\| execute 'goto' fnameescape($FZF_PICK)
\| endif
command! FZFfind : set noquickview
\| let $FZF_PICK = term('find | fzf 2>/dev/tty')
\| if $FZF_PICK != ''
\| execute 'goto' fnameescape($FZF_PICK)
\| endif
" }}} " }}}
" vifminfo {{{
" ------------------------------------------------------------------------------
" What should be saved automatically between vifm runs
" Like in previous versions of vifm
" set vifminfo=options,filetypes,commands,bookmarks,dhistory,state,cs
" Like in vi
set vifminfo=dhistory,savedirs,chistory,state,tui,shistory,
\phistory,fhistory,dirstack,registers,bookmarks,bmarks
" ------------------------------------------------------------------------------
" Examples of configuring both panels
" Customize view columns a bit (enable ellipsis for truncated file names)
"
" set viewcolumns=-{name}..,6{}.
" Filter-out build and temporary files
"
" filter! /^.*\.(lo|o|d|class|py[co])$|.*~$/
" }}}
" Mappings {{{
" ------------------------------------------------------------------------------
" make quitting simpler
nmap Q :q<cr>
" Sample mappings
" for now they use space for my leader key - so we can't switch panels with
" space, use tab for that
nnoremap <space> <nop>
nnoremap <space><space> t
" quick find mirroring my vim filefinder
nnoremap <space>f :FZFfind<cr>
" Start shell in current directory
nnoremap s :shell<cr>
" Display sorting dialog
nnoremap S :sort<cr>
" Toggle visibility of preview window
nnoremap w :view<cr>
vnoremap w :view<cr>gv
" Open file in existing instance of nvim
nnoremap e :!nvim %f<cr>
" Open file in the background using its default program
nnoremap gb :file &<cr>l
" yank current directory path into the clipboard
nnoremap yd :!echo -n %d | xclip -selection "clipboard" %i<cr>
" yank current file path into the clipboard
nnoremap yf :!echo -n %c:p | xclip -selection "clipboard" %i<cr>
" yank current filename without path into the clipboard
nnoremap yn :!echo -n %c | xclip -selection "clipboard" %i<cr>
" yank root of current file's name into the clipboard
nnoremap yr :!echo -n %c:r | xclip -selection "clipboard" %i<cr>
" Mappings for faster renaming
nnoremap I cw<c-a>
nnoremap cc cw<c-u>
nnoremap A cw
" More logical renaming, cw renames just the name, cW with extension
nnoremap cw cW
nnoremap cW cw
" Open editor to edit vifmrc and apply settings after returning to vifm
nnoremap <space>V :write | edit $MYVIFMRC | restart<cr>
" esc quits out of preview mode (it does in vim, why not here?)
qnoremap <esc> q
" Select file and jump in the indicated direction
nnoremap J tj
nnoremap K tk
" Example of standard two-panel file managers mappings
nnoremap <f3> :!less %f<cr>
nnoremap <f4> :edit<cr>
nnoremap <f5> :copy<cr>
nnoremap <f6> :move<cr>
nnoremap <f7> :mkdir<space>
nnoremap <f8> :delete<cr>
" toggle options
command! toggle :execute 'set %a! | echo "%a" &%a'
nnoremap tw :toggle wrap<cr>
nnoremap tm :toggle millerview<cr>
nnoremap tl :toggle lsview<cr>
nnoremap tn :toggle number<cr>
nnoremap tr :toggle relativenumber<cr>
nnoremap tN :windo toggle number<cr>
nnoremap tR :windo toggle relativenumber<cr>
nnoremap te :execute ':tree! | echo ":tree"'<cr>
nnoremap t <nop>
nnoremap tt t
" Switch pane to same directory as opposite pane
nnoremap <c-y> :cd %D<cr>
" zo shows hidden files, mimicking fold open in vim -- why does zc not close
" again?
nnoremap zc zm
" external commands
" extract currently selected file(s)
nnoremap gx :!atool -x %f<cr>
" combine selected PDFs into single one (named output.pdf)
noremap gc :!pdftk %f cat output output.pdf
" }}}
" Classify (Icons) {{{
" file types
set classify=' :dir:/, :exe:, :reg:, :link:'
" various file names
set classify+=' ::../::, ::*.sh::, ::*.[hc]pp::, ::*.[hc]::, ::/^copying|license$/::, ::.git/,,*.git/::, ::*.epub,,*.fb2,,*.djvu::, ::*.pdf::, ::*.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::'
" office files
set classify+=' ::*.doc,,*.docx::, ::*.xls,,*.xls[mx]::, ::*.pptx,,*.ppt::'
" }}}
"
" ------------------------------------------------------------------------------
" Filetypes {{{ " Filetypes {{{
" ------------------------------------------------------------------------------ " ------------------------------------------------------------------------------
@ -395,138 +550,6 @@ fileviewer */
" filetype * start, explorer " filetype * start, explorer
" }}} " }}}
" vifminfo {{{
" ------------------------------------------------------------------------------
" What should be saved automatically between vifm runs
" Like in previous versions of vifm
" set vifminfo=options,filetypes,commands,bookmarks,dhistory,state,cs
" Like in vi
set vifminfo=dhistory,savedirs,chistory,state,tui,shistory,
\phistory,fhistory,dirstack,registers,bookmarks,bmarks
" ------------------------------------------------------------------------------
" Examples of configuring both panels
" Customize view columns a bit (enable ellipsis for truncated file names)
"
" set viewcolumns=-{name}..,6{}.
" Filter-out build and temporary files
"
" filter! /^.*\.(lo|o|d|class|py[co])$|.*~$/
" }}}
" Mappings {{{
" ------------------------------------------------------------------------------
" make quitting simpler
nmap Q :q<cr>
" Sample mappings
" for now they use space for my leader key - so we can't switch panels with
" space, use tab for that
nnoremap <space> <nop>
nnoremap <space><space> t
" Start shell in current directory
nnoremap s :shell<cr>
" Display sorting dialog
nnoremap S :sort<cr>
" Toggle visibility of preview window
nnoremap w :view<cr>
vnoremap w :view<cr>gv
" Open file in existing instance of nvim
nnoremap e :!nvim %f<cr>
" Open file in the background using its default program
nnoremap gb :file &<cr>l
" yank current directory path into the clipboard
nnoremap yd :!echo -n %d | xclip -selection "clipboard" %i<cr>
" yank current file path into the clipboard
nnoremap yf :!echo -n %c:p | xclip -selection "clipboard" %i<cr>
" yank current filename without path into the clipboard
nnoremap yn :!echo -n %c | xclip -selection "clipboard" %i<cr>
" yank root of current file's name into the clipboard
nnoremap yr :!echo -n %c:r | xclip -selection "clipboard" %i<cr>
" Mappings for faster renaming
nnoremap I cw<c-a>
nnoremap cc cw<c-u>
nnoremap A cw
" More logical renaming, cw renames just the name, cW with extension
nnoremap cw cW
nnoremap cW cw
" Open editor to edit vifmrc and apply settings after returning to vifm
nnoremap <space>V :write | edit $MYVIFMRC | restart<cr>
" esc quits out of preview mode (it does in vim, why not here?)
qnoremap <esc> q
" Select file and jump in the indicated direction
nnoremap J tj
nnoremap K tk
" Example of standard two-panel file managers mappings
nnoremap <f3> :!less %f<cr>
nnoremap <f4> :edit<cr>
nnoremap <f5> :copy<cr>
nnoremap <f6> :move<cr>
nnoremap <f7> :mkdir<space>
nnoremap <f8> :delete<cr>
" toggle options
command! toggle :execute 'set %a! | echo "%a" &%a'
nnoremap tw :toggle wrap<cr>
nnoremap tm :toggle millerview<cr>
nnoremap tl :toggle lsview<cr>
nnoremap tn :toggle number<cr>
nnoremap tr :toggle relativenumber<cr>
nnoremap tN :windo toggle number<cr>
nnoremap tR :windo toggle relativenumber<cr>
nnoremap te :execute ':tree! | echo ":tree"'<cr>
nnoremap t <nop>
nnoremap tt t
" Switch pane to same directory as opposite pane
nnoremap <c-y> :cd %D<cr>
" zo shows hidden files, mimicking fold open in vim -- why does zc not close
" again?
nnoremap zc zm
" extract currently selected file(s)
nnoremap gx :!atool -x %f<cr>
" }}}
" Classify (Icons) {{{
" file types
set classify=' :dir:/, :exe:, :reg:, :link:'
" various file names
set classify+=' ::../::, ::*.sh::, ::*.[hc]pp::, ::*.[hc]::, ::/^copying|license$/::, ::.git/,,*.git/::, ::*.epub,,*.fb2,,*.djvu::, ::*.pdf::, ::*.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::'
" office files
set classify+=' ::*.doc,,*.docx::, ::*.xls,,*.xls[mx]::, ::*.pptx,,*.ppt::'
" }}}
"
" ------------------------------------------------------------------------------
" Various customization examples " Various customization examples