vifm: Add additional configuration and functions
Renamed fuzzy find functions to simpler and more logical names: `fzf` to find and select anything recursing from current directory. `fzfcd` to find and enter any directory recursively under current one. `fzfhome` to locate and select anything from user's home directory. Added shortcuts for above commands: <space>f `fzf` <space>c `fzfcd` <space>F `grep` from current directory. Added shortcuts to create and extract archives: xx to extract selected archive. xa to archive selected files, giving name of file under cursor. xc to archive and compress selected files, giving name of file under cursor. Move ability to sync current pane to other one from mapping (c-y) to command (`:syncme`). This is a command only used once in a while and does not necessarily need its own full mapping. Additionally, having it as an invocable command mirrors the built-in `:sync` command to do the exact opposite - sync the other pane to the selected one.
This commit is contained in:
parent
8a6cdcba8b
commit
8422285717
1 changed files with 33 additions and 15 deletions
|
@ -149,18 +149,23 @@ command! run !! ./%f
|
||||||
command! make !!make %a
|
command! make !!make %a
|
||||||
command! mkcd :mkdir %a | cd %a
|
command! mkcd :mkdir %a | cd %a
|
||||||
" command! vgrep nvim "+grep %a"
|
" command! vgrep nvim "+grep %a"
|
||||||
command! reload :write | restart
|
command! syncme :cd %D
|
||||||
|
|
||||||
command! FZFlocate : set noquickview
|
command! fzfhome : set noquickview
|
||||||
\| let $FZF_PICK = term('locate $HOME | fzf 2>/dev/tty')
|
\| let $FZF_PICK = term('locate $HOME | fzf 2>/dev/tty')
|
||||||
\| if $FZF_PICK != ''
|
\| if $FZF_PICK != ''
|
||||||
\| execute 'goto' fnameescape($FZF_PICK)
|
\| execute 'goto' fnameescape($FZF_PICK)
|
||||||
\| endif
|
\| endif
|
||||||
command! FZFfind : set noquickview
|
command! fzf : set noquickview
|
||||||
\| let $FZF_PICK = term('find | fzf 2>/dev/tty')
|
\| let $FZF_PICK = term('find | fzf 2>/dev/tty')
|
||||||
\| if $FZF_PICK != ''
|
\| if $FZF_PICK != ''
|
||||||
\| execute 'goto' fnameescape($FZF_PICK)
|
\| execute 'goto' fnameescape($FZF_PICK)
|
||||||
\| endif
|
\| endif
|
||||||
|
command! fzfcd : set noquickview
|
||||||
|
\| let $FZF_PICK = term('find -type d | fzf 2>/dev/tty')
|
||||||
|
\| if $FZF_PICK != ''
|
||||||
|
\| execute 'cd' fnameescape($FZF_PICK)
|
||||||
|
\| endif
|
||||||
" }}}
|
" }}}
|
||||||
" vifminfo {{{
|
" vifminfo {{{
|
||||||
" ------------------------------------------------------------------------------
|
" ------------------------------------------------------------------------------
|
||||||
|
@ -246,14 +251,6 @@ qnoremap <esc> q
|
||||||
nnoremap J tj
|
nnoremap J tj
|
||||||
nnoremap K tk
|
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
|
" toggle options
|
||||||
command! toggle :execute 'set %a! | echo "%a" &%a'
|
command! toggle :execute 'set %a! | echo "%a" &%a'
|
||||||
nnoremap tw :toggle wrap<cr>
|
nnoremap tw :toggle wrap<cr>
|
||||||
|
@ -267,19 +264,38 @@ nnoremap te :execute ':tree! | echo ":tree"'<cr>
|
||||||
nnoremap t <nop>
|
nnoremap t <nop>
|
||||||
nnoremap tt t
|
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
|
" zo shows hidden files, mimicking fold open in vim -- why does zc not close
|
||||||
" again?
|
" again?
|
||||||
nnoremap zc zm
|
nnoremap zc zm
|
||||||
|
|
||||||
" external commands
|
" external commands
|
||||||
" extract currently selected file(s)
|
" extract currently selected file(s)
|
||||||
nnoremap gx :!atool -x %f<cr>
|
nnoremap xx :!atool -x %f<cr>
|
||||||
|
" compress currently selected file(s)
|
||||||
|
nnoremap xc :!atool -a %c:r.tar.gz %f<cr>
|
||||||
|
" archive currently selected file(s)
|
||||||
|
nnoremap xa :!atool -a %c:r.tar %f<cr>
|
||||||
" combine selected PDFs into single one (named output.pdf)
|
" combine selected PDFs into single one (named output.pdf)
|
||||||
noremap gc :!pdftk %f cat output output.pdf
|
noremap gc :!pdftk %f cat output output.pdf
|
||||||
|
|
||||||
|
" fzf movements
|
||||||
|
nnoremap <space>f :fzf<cr>
|
||||||
|
nnoremap <space>c :fzfcd<cr>
|
||||||
|
nnoremap <space>F :grep<space>
|
||||||
|
|
||||||
|
" allows preview to work for normal view and single pane view
|
||||||
|
noremap <silent> w : if &quickview && !layoutis('only')
|
||||||
|
\| view
|
||||||
|
\| else
|
||||||
|
\| if layoutis('only')
|
||||||
|
\| if &lines + 50 < &columns | vsplit | else | split | endif
|
||||||
|
\| endif
|
||||||
|
\| view!
|
||||||
|
\| execute 'qnoremap w q:view|only|qunmap w<lt>cr>'
|
||||||
|
\| execute 'wincmd w'
|
||||||
|
\| endif
|
||||||
|
\| <cr>
|
||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
" Classify (Icons) {{{
|
" Classify (Icons) {{{
|
||||||
" file types
|
" file types
|
||||||
|
@ -403,6 +419,8 @@ fileviewer *.gif
|
||||||
|
|
||||||
" Images
|
" Images
|
||||||
filextype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm
|
filextype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm
|
||||||
|
\ {View in vimiv}
|
||||||
|
\ vimiv %f,
|
||||||
\ {View in sxiv}
|
\ {View in sxiv}
|
||||||
\ sxiv %f,
|
\ sxiv %f,
|
||||||
\ {View in feh}
|
\ {View in feh}
|
||||||
|
|
Loading…
Reference in a new issue