Skip to content

roginfarrer/vim-dirvish-dovish

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 

Repository files navigation

🧰 vim-dirvish-dovish

The file manipulation commands for vim-dirvish that you've always wanted

Have only tested on MacOS and Neovim, but it should work with Vim.

Installation & Requirements

You'll need:

Then install with your favorite package manager:

Plug 'roginfarrer/vim-dirvish-dovish', {'branch': 'main'}

Mappings

Function Default Key
Create file a <Plug>(dovish_create_file)
Create directory A <Plug>(dovish_create_directory)
Delete under cursor dd <Plug>(dovish_delete)
Rename under cursor r <Plug>(dovish_rename)
Yank under cursor (or visual selection) yy <Plug>(dovish_yank)
Copy file to current directory pp <Plug>(dovish_copy)
Move file to current directory PP <Plug>(dovish_move)

You can unmap all of the maps above and set your own (mine are below). Add this to ftplugin/dirvish.vim:

" unmap all default mappings
let g:dirvish_dovish_map_keys = 0

" unmap dirvish default
unmap <buffer> p

" Your preferred mappings
nmap <silent><buffer> i <Plug>(dovish_create_file)
nmap <silent><buffer> I <Plug>(dovish_create_directory)
nmap <silent><buffer> dd <Plug>(dovish_delete)
nmap <silent><buffer> r <Plug>(dovish_rename)
nmap <silent><buffer> yy <Plug>(dovish_yank)
xmap <silent><buffer> yy <Plug>(dovish_yank)
nmap <silent><buffer> p <Plug>(dovish_copy)
nmap <silent><buffer> P <Plug>(dovish_move)

Customize Commands

Most file operations can be customized. Below are the defaults:

" Used for <Plug>(dovish_yank)
function! g:DovishCopyFile(target, destination) abort
  return 'cp ' . a:target . ' ' . a:destination
endfunction

" Used for <Plug>(dovish_yank)
function! g:DovishCopyDirectory(target, destination) abort
  return 'cp -r' . a:target . ' ' . a:destination
endfunction

" Used for <Plug>(dovish_move)
function! g:DovishMove(target, destination) abort
  return 'mv ' . a:target . ' ' . a:destination
endfunction

" Used for <Plug>(dovish_delete)
function! g:DovishDelete(target) abort
  return 'trash ' . a:target
endfunction

" Used for <Plug>(dovish_rename)
function! g:DovishRename(target, destination) abort
  return 'mv ' . a:target . ' ' . a:destination
endfunction

Credit

Big shout out to Melandel for laying the foundation for this plugin!

About

File manipulation commands for vim-dirvish

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published