Git Product home page Git Product logo

Comments (5)

alextes avatar alextes commented on June 9, 2024

All I have myself so far is: "move yanked file to current dir" which turns out to be at the bottom of the list for me 😅

nnoremap <silent><buffer> m :!mv <c-r>" %<CR>

from vim-dirvish.

alextes avatar alextes commented on June 9, 2024

Another helpful bit is to put all these bindings under an augroup like detailed in the help files:

augroup dirvish_config
  autocmd!

  autocmd FileType dirvish nnoremap <silent><buffer> m :!mv <c-r>" %<CR>

augroup END

from vim-dirvish.

alextes avatar alextes commented on June 9, 2024

I managed to do one, and that's all I have time for right now 😭 .

  • move file / folder to provided path
function! g:DirvishDoMove() abort
  let target = trim(getline('.'))
  let filename = fnamemodify(target, ':t')
  let newname = input('Move to: ')
  let cmd = 'mv ' . shellescape(target) . ' ' . shellescape(expand("%") . newname . '/' . filename)
  let output = system(cmd)
  if v:shell_error
    call s:logError(output)
  endif

  " Reload the buffer
  Dirvish %
endfunction

Bound like so:

autocmd FileType dirvish nnoremap <silent><buffer> m :call DirvishDoMove()<CR>

Just noticed that this does not tab-complete the path as you write it. That'd be nice to have but I'd say outside of the scope.
Another nice-to-have here is that if the moved file is open in a buffer, this buffer does not get updated.

from vim-dirvish.

alextes avatar alextes commented on June 9, 2024

Too much work for me, closing this for now.

from vim-dirvish.

justinmk avatar justinmk commented on June 9, 2024

Thanks for looking into this. I'm open to adding some well-selected default behaviors, but ...

Must have:

  • copy file/folder to provided path
  • move file/folder to provided path
  • delete file/folder

"delete" is just so easy already (.rm<cr> or .rm -rf<cr>Z!), and making a destructive even easier is questionable. I'm also skeptical about copy/move. Separate prompts are not convincingly superior to... a shell script.

copy arglist to current dir
move arglist to current dir

I agree these are awkward currently.

delete arglist

This is already easy: [count].rm<cr>Z!

copy file/folder under cursor to provided path

What interface is going to be better than the already-existing : interface? Prompts are prompts.

Renaming multiple is a beast of its own. I think the most natural would be for the command to accept input after triggering for a single file

Yeah, this was one of the original motivations for Dirvish. Editing a script is easier, more intuitive, and (if Vim is doing its job...) faster, than learning a quasi-pseudo-DSL for another tool.

Thanks for the great dirvish plugin! 💛

Thanks for the kind words!

from vim-dirvish.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.