Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to just diff split the current buffer? #471

Closed
jcorbin opened this issue Mar 6, 2024 · 2 comments
Closed

How to just diff split the current buffer? #471

jcorbin opened this issue Mar 6, 2024 · 2 comments
Labels
question Further information is requested

Comments

@jcorbin
Copy link

jcorbin commented Mar 6, 2024

I'm trying to recover an analog of fugitive's :Gsplit but using diffview instead:

  • it looks like one could just :split diffview://......
  • but what's the best way to compute that "diffview path for the current buffer" url?
  • basically I'm trying to make my own :DiffviewSplit command, rather than using the whole tabpage ui deal
@jcorbin
Copy link
Author

jcorbin commented Mar 6, 2024

Here's where I'm at currently:

vim.api.nvim_create_user_command('DiffviewSplit', function()
  local bufname = vim.api.nvim_buf_get_name(0)
  vim.cmd.split('diffview://' .. bufname)
  -- NOTE this doesn't work, since diffview want a url more like
  -- 'diffview://' .. gitdir .. ':0:' .. relpath
end, {})

is there some function inside require('diffview') that can get the correct url?

@sindrets
Copy link
Owner

Creating a buffer with a valid diffview URI will not automatically populate it with content. It will just be an empty buffer. We don't have BufReadCmd auto commands set up for this, as the plugin itself does not need them.

There is no way to use the plugin without the tab page interface. But if you want to open a view with only the current file, you can call :DiffviewOpen -- %.

@sindrets sindrets added the question Further information is requested label May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants