Fork me on GitHub
#vim
<
2022-08-18
>
dharrigan10:08:28

Anyone use vim fugitive? I'm trying to know how to view the diffs for only the file loaded into my buffer. Doing Git diff shows the diffs for everything changed in the repo.

Martynas Maciulevičius12:08:23

I use cli and there I paste the filename like this: git diff HEAD~1 my-file.txt I don't know if this helps Also it also works with git diff but sometimes you want to see several commits back and you can specify HEAD~2 etc.

mjw13:08:05

:Gdiff shows the current buffer

mjw13:08:53

Oh wait, that’s been deprecated in favor of :Gdiffsplit.

mjw13:08:36

Oh, you can also use :Git diff % for the current buffer if you don’t like the :Gdiffsplit split view.

☝️ 1
dharrigan14:08:18

thank you very much

🙇 1
emilaasa14:08:52

I access it quite often from the Gstatus window, press dd when hovering over one of files there

☝️ 1
emilaasa14:08:17

If you use gitgutter this is a default binding as well for lookning at diffs per hunk : nmap <Leader>hp <Plug>GitGutterPreviewHunk

👆 4
emilaasa14:08:45

Also cv (or cva for amend) in the gstatus window of fugitive will output a verbose diff for all changes to be committed below your commit message.

walterl17:08:35

> I access it quite often from the Gstatus window, press dd when hovering over one of files there What is extremely useful to someone who likes to keep commits as small as possible, without breaking the code, this diff view allows you to directly edit the staged file. That means you can stage sub-line level changes. neckbeard

dharrigan08:08:40

I don't think Gstatus works on later versions of vim fugitive (at least, doesn't work for me)

dharrigan08:08:52

Says Not an editor command.

sheluchin10:08:04

It's just :Git now.

☝️ 1
👍 1
Abhinav05:08:25

I know this isn’t the answer to the question you asked, but a nice git ui for neovim is lazygit https://github.com/kdheepak/lazygit.nvim I use this for all my git tasks. I only use vim fugitive to do git blames XD

walterl18:08:15

Going to give https://github.com/yatli/fvim a try, since it's the existing solution I could find to having multiple OS windows attached to the same nvim instance. > "try Ctrl-w ge to detach a window into a separate OS window!"

nate18:08:24

very cool, hadn't heard of it. interested to hear your impressions

walterl18:08:21

So far just spun up a quick REPL to test, detached that REPL window, and started a web server (via an integrant system). Everything works as expected.

walterl18:08:08

It's interesting that you can switch windows with vim commands: <C-w><C-w> cycles through vim windows in both OS windows. With focus following along properly.

nate18:08:34

wow, that's cool

walterl18:08:15

Only slight limitation is that the separate OS window is (only) a vim window; it doesn't have its own cmd-line (if you type : in the detached window, it opens the cmd-line in the main window), and you can't split it up further.

walterl18:08:17

So it's not a completely separate "client" connecting to the same vim server, as I originally wanted. But it's mitigated by the fact that you can detach multiple windows.

walterl18:08:41

I'm really just looking for a solution to having my vim session split over multiple monitors. Being able to have my nREPL and (especially) Conjure buffer on a separate screen will be a significant improvement already.

walterl18:08:58

I'm going to keep using this for a while and see how it goes.

walterl22:08:26

Meh, this isn't going to work. With only 4 tabs and different window configs on each, switching tabs don't always render the new tab 😞

walterl22:08:46

<C-l> renders it, but will be quite the flow breaker

walterl22:08:06

And that's even without detached windows

walterl22:08:34

Guess I'll have to wait for first-class support. Hopefully 0.8 🤞

dharrigan06:08:01

I'm quite a fan of neovide

Hukka07:08:49

Looking at the neovide features, it doesn't seem to have separate windows. But does it?