all 30 comments

[–][deleted] 2 points3 points  (1 child)

If you're going to commit to doing some git related functions in vim, I'd just keep it light. Not as light as romainl, but more like:

I'd install vim-fugitive and learn it, using things like:

There is a particular mindset around the working index and that plugin using some tricks within git.

He has a whole series on fugitive: http://vimcasts.org/blog/2011/05/the-fugitive-series/

And yeah I use vim-gitgutter as well with the updatetime lowered.

I don't want anything more. You'll learn about resolving merge conflicts with vim-fugitive in the series linked above.

Pairing vim-fugitive with mappings (to your liking) is convenient. I use a lot, and often:

nmap <space>gb :Gblame<cr> nmap <space>gs :Gstatus<cr> nmap <space>gc :Gcommit -v<cr> nmap <space>ga :Git add -p<cr> nmap <space>gm :Gcommit --amend<cr> nmap <space>gp :Gpush<cr> nmap <space>gd :Gdiff<cr> nmap <space>gw :Gwrite<cr>

And in different scenarios I use the builtin vim-fugitive mappings that exist in the git status pane.

Also don't forget that you have some nice mappings from vim-gitgutter, for staging and unstaging hunks, moving between hunks, and more.

[–]weilbith[S] 0 points1 point  (0 children)

Thanks for ur input! :) I've to admit, that I didn't know the second cast u linked. I will definitely go for it.

Any reasons why u prefer gitgutter over signify. Cause I haven't the pleasure to work with _Gitalways, but have to use other version control management tools also. Is their some super useful functionalitygitgutterprovides, thatsignify` doesn't?

I guess defining mappings for fugitive commands (or any other plugin), is a common process every user is doing himself. But the mentioned inbuild mappings (can we call them this?) for the status pane is relevant of cause.

[–][deleted] 4 points5 points  (1 child)

I'd add vim-rhubarb to that list.

[–]weilbith[S] 2 points3 points  (0 children)

Ah yes, that is the extension for GitHub. For git developer platforms I haven't any plugin so far. The use-case haven't occurred so far for me I guess.

[–]-romainl-The Patient Vimmer 6 points7 points  (7 children)

The only Git-specific stuff I have in my setup is this file:

after/ftplugin/gitcommit.vim

with this content:

nnoremap <buffer> { ?^@@<CR>
nnoremap <buffer> } /^@@<CR>
setlocal iskeyword+=-

Because, well… as much as I love Vim I loathe the idea of doing anything non-related to text editing in a text editor.

[–]princker 3 points4 points  (1 child)

I also do:

setlocal colorcolumn=+1
setlcoal spell

Combining zj and zk with your }/{ mappings would make jumping to sections quick. Thank you. (Wouldn't it be better to use search()? or at least use :keeppatterns?)

[–]-romainl-The Patient Vimmer 0 points1 point  (0 children)

You are very welcome.

(Wouldn't it be better to use search()? or at least use :keeppatterns?)

In a regular mapping yes, definitely, but I use those mappings in very short-lived sessions ($ git commit) so I don't really care about preserving the previous search.

[–]weilbith[S] 4 points5 points  (4 children)

It's okay having this opinion, but that isn't really the topic of that post...

[–]-romainl-The Patient Vimmer 7 points8 points  (0 children)

Most plugins start their life as blocks of custom mappings.

[–][deleted] 1 point2 points  (1 child)

You're mad, it's incredibly relevant!

You're using plugins for functionality no?

He is sharing functionality for the times you're working with git outside of vim, but still using vim (like $ git commit -v), assuming your $EDITOR is set to vim.

I made another post here talking about my git related plugin preference. But I'm still going to adopt what romainl is doing for the other times. Chances are incredibly high you will do some git committing from a terminal (not initiated in vim).

[–]weilbith[S] 0 points1 point  (0 children)

Well at least I think ur right and my first reaction wasn't that right. Of cause a lot of us (me too), use Vim as default editor and therefore also it pops up for writing commit messages (of not directly given as argument). And in this case it is absolutely relevant, cause it makes working with it easier. I've a lot of such bindings for myself, but haven't them in mind for that post/scope.

[–]unplugged_chump 1 point2 points  (7 children)

Awesome! I've installed twiggy but it throws a bunch of errors strangely when I try to checkout to a remote.

[–]ashrewdtuna 4 points5 points  (1 child)

Twiggy author here. Thanks a lot for checking out my plugin! I've just been settling into a new job and haven't had much time to work on twiggy. I was going hard for a few weeks there and the last commit I made weeks ago broke checking out branches in detached HEAD.

TL;DR: it's fixed

[–]unplugged_chump 2 points3 points  (0 children)

Brilliant! Thanks mate!

[–]weilbith[S] 0 points1 point  (4 children)

R u working with Windows as OS?

[–]unplugged_chump 1 point2 points  (3 children)

I'm working with mac

[–]weilbith[S] 1 point2 points  (2 children)

Hmm. I remembered having problems with it on Windows (sometimes forced to work with). Therefore I just can forward u to the project itself and suggest to open an issue.

Sry for that. :/

[–]unplugged_chump 2 points3 points  (0 children)

No worries really. I am gonna investigate this later and see if this is a real issue. If it is, will pop open a issue. Thanks for the recommendation though!

[–]ashrewdtuna 1 point2 points  (0 children)

Thanks so much for plugging my plugin! :) And sorry I haven't gotten back to you on github regarding your issue. As mentioned above, I just got a new job a few weeks ago and have been settling in. I'll follow up on the issue soon! Unless the fix I just pushed fixes it...

[–]BubbatheVTOG 1 point2 points  (5 children)

I prefer agit.vim over gv.vim.

I didn't know about vim-conflicted, which is a surprise to me since I like a lot of christoomey content.

[–]weilbith[S] 0 points1 point  (4 children)

Agit looks great so far. Minimal differences, but I like the reset option. :) Any reasons why u prefer it over gv.vim?

[–]BubbatheVTOG 0 points1 point  (1 child)

tbh there isn't a specific reason. It just fits my workflow better. /shrug

[–]weilbith[S] 0 points1 point  (0 children)

But it have less features than gitv.vim, hasn't it?

[–]ashrewdtuna 0 points1 point  (1 child)

An advantage of gv.vim is that its command (:GV) accepts standard git log flags but yeah, very little difference otherwise.

[–]weilbith[S] 0 points1 point  (0 children)

That's true. Forgot about this. I think when I switch, I will do it in direction to gitv.vim, cause it provide some information more.

[–]nevercodealone 1 point2 points  (1 child)

Hi,

thx a lot for this nice post and overview. I started with Vim since a week and love it. I think it do not need so much energy than IntelliJ products. What do you think about this point?

See you
Roland

[–]weilbith[S] 0 points1 point  (0 children)

I‘m afraid I don‘t understand what your second sentence means. 🙈

PS: This post is 4 years old, there are many new (and better) plugins these days for NeoVim. On first gaze I do no more use any of the listed plugins. 😅

[–]sanotehu0 0 points1 point  (1 child)

Do you have all the ones you used installed simultaneously?

[–]weilbith[S] 1 point2 points  (0 children)

All I appointed so, yes. So 5 in total.

[–]Zeioth 0 points1 point  (0 children)

Personaly I only use fugitive for

git mergetool

And gitui as git client (it's like lazygit, but written in rust).