The Holy Grail of Neovim Git Integrations

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
get Integrations with neovim are all over but  what do the type of integration actually means   for a daily workflow how does it affect focus and  productivity and which of them or what combination   is really the Holy Grail of nim and git there's  this quote Focus intensifies by getting used to   not being distracted and can improve with practice  this is by CAD Newport written in deep work this   means that the brain can be taught to focus  by avoiding distractions this also reminds of   a principle that says neuron that fire together  wire together this was proposed by Donald HB in   the 1940s and it essentially means that when  we're focused on a task for longer periods of   time we're literally forming the brain connections  and solidify them so that our brain gets used to   focus mode and works more efficiently what does  this have to do with giops you might ask great   question well it turns out that every time we  shift our Focus From a Certain task especially   by changing environment and context our brain  breaks certain Pathways and resets processes   of thinking imagine working on a project focusing  on how to build a certain logic and at some point   you'd like to commit your changes so so that you  don't lose your work or you just want another set   of eyes on your code and by that you want to push  your changes to a remote Branch if at this point   you'd shift your focus over to a [ __ ] with shiny  colorful buttons and lots of visuals these neural   Pathways we talked about earlier have stopped  and our brain shifts its focus do another task   it doesn't have to be this way so in this video  I want to show you a couple things that I used to   do one that I still use and one that's a complete  game changer for me let's get into it to start we   can minimize this pain by replacing a GUI with a  Tui by that I mean using a terminal interface that   doesn't require to pop another window lazy git is  incredible for this task it pops in the terminal   provides an interface with everything you need for  simple tasks from exploring the commit history or   the reflog checking out diffs and more but this  still requires switching context and moving away   to another window using something like f term for  example as a floating terminal will provide the   same experience but on top of the session of neim  you're currently running at the same can also be   run in a Timo pain on the side where I can move  in and out from and two zooming in and out and   keeping it right next to me similarly I can use a  TX window for doing the same thing while using t-x   ability to jump back and forth between two last  used windows I covered lazy extensively in the   video app here if you want to go in depth into  what it can do and if you still like the idea   of having it you can even bind it to a t-x popup  like I'm doing right here to enjoy it within your   TX sessions the only benefit in doing that over  F term is the fact that it's bound only to timx   and you don't have to have neovim running in  the background to reach the floating pain if   you're still unsure about timx here's a complete  guide taking you from zero to beast mode in no   time with all that said however lazy git in all  its forms regardless of how we can run it is   still its own interface don't get me wrong lazy  git is one of the most powerful interfaces out   there it's definitely something I keep close  by for more complex operations and I use it   almost every day for small repetitive actions  however of fetching pulling staging committing   and pushing I think that while lazy git is more  than capable it snaps me out of context maybe   for you the laser focused viewer this isn't the  case but this like many other external interfaces   proves to steer my focus away from the task at  hand and create friction and since I'm all about   removing friction lazy git doesn't cut it as a  usual interface if that's the goal my Holy Grail   of Vim operations had always been one if you're a  long-term Vim user team pop needs no introduction   but for the few who do just check out his gab  profile to learn about everything he had done   for the Vim Community there's 99% chances that  you've got a toot plugin installed right now on   your machine to doing some heavy lifting for you  in your Vim environment one of the many plugins   toop created and as hard as it is to compete with  a significantly popular one git fugitive is this   all things get within Vim fugitive brings git  closer to home this is the status pain showing   untracked stage or unstaged files after staging  a few hunks or even entire files which we can   do with a dash command in fugitive and we then  create a commit using again fugitive of course   the status will also update the pushed commit in  the same pain hitting a change will open the diff   below so we can explore the changes with ease we  can understand the status better than we do with   the CLI and all that without ever stepping out of  the ID when fugitive sends back the response from   GitHub it contains a pull request link that I can  then hit by using timx URL detection plugin I'll   leave a link below which I then use to pop up the  browser and open a PR on the go the status as well   as staging checking commit logs or just exploring  git blame which I love so much are just a couple   of gy Strokes away and so for the longest time git  fugitive was my go-to for anything that required   straightforward git operations within Vim I just  get signs for the visual hunks and would stage   them and handle within fugitive fugitive is way  more powerful than what it CHS on the surface it   can tackle almost any git requirement bisect  cherry picking even git config are all packed   inside everything done with verbosity and Lin  finess that's only reserved to tp's plugins   they're not fancy but they simply work here  I'm switching branches checking diffs and even   getting clipes into remote branches everything  from fugitives Lin menu I covered a lot about   this combo in this video and I highly recommend  checking it out but there comes a time that even   your most precious handy tools need to recognize  a modern successor fugitive was introduced with   a new baby brother written in Lua packed with  gems and slowly takes over the Golden stard for   neovim git interfaces Neo is everything fugitive  is but more it's slick works right within your VM   but it brings more to the table looking better  more intuitive and it comes with a few Banger   features that will blow your mind let's get into  it once installed neit is ready to be called from   within the editor the neit command simply pops the  status like the G command with fugitive much like   his predecessor the status shows untrapped unstage  files with collapsible sections tab toggles them   and the sections and they're easy to guess hit  s to Stage U to undo or unstage like all other   interfaces all commit messages and even reflog  lines can be expanded further and explored if   you need to see the changes this is a repetitive  theme with neit it's not as fancy as lazy git but   it is as powerful it follows fugitive simplistic  design but also provides a uix with the user in   mind everything is just better c will open the  commit panel and man here's the first Banger you   can do an interactive flag switching that you can  play with simply write the flag you're interested   in like like minus a or minus E for empty commits  and even more random options you probably didn't   use all that often like equal C to reuse a commit  message or even gpg to sign the commit when a   flag is mentioned neit will highlight it so that  you know what's been taken when you're ready to   move on use the menu below for hints C again will  commit the changes but you can also amend squash   and add other rebase options when you're ready  to move on the commit message and description   opens up for editing and finalizing the commit Q  finishes the process and now you're ready to push   similar to other tools Neo shows the commit ready  to push and you can go back and explore the change   navigating The View into the commit if you're  uncertain at any point just hit the question   mark and the menu pops where you can find almost  any option you can think of ready to go with one   keystroke p will open the pull menu and capital  P will push at any point neit Powers doesn't end   here hitting LL will pop a log buffer with commits  you can open by default with a blame toggled on   and review the changes made the logs are shown in  tree mode something up until trying new git I had   my own CLI long one liner doing the same as this  is the most intuitive way for me to understand   the structure of my git head I'll be honest here  this view becomes my favorite way to view changes   far more than any other interface so slick and  easy on the eyes but wait check this out with   neit you can stash changes view the stashed stack  pop and list but the cherry and top of everything   is the view giving you a glimpse into the stash  changes I don't even know why I'm so excited by   this it's the feeling of finding out how to do  something so smoothly instead of the Annoying   flow of typing repetitive CLI commands I was so  used to for doing the same I'll just add one side   note that ever since discovering G work trees my  stashing needs dropped to nearly zero but in some   cases I still do use it and having it in neogate  is a blessing from the heavens neogate is purred   with diffu so let's just check what diffu does to  help us better understand changes diffu open opens   up up both the differences marked with additions  and line removals similar to what you probably   used to from GitHub or gitlab as well as side menu  marking the files changed and even the lines added   and removed I must admit that for a while I've  been pushing commits to remote branches just so I   can enjoy the same view on GitHub and D completely  eliminates that need even without staging the   changes I can view them like I would in a pull  request waiting to be merged if you think I'm   done with neit surprises think again neit is  customizable in so many ways cover in way more   than most what standard plugins do you can even  tell it how to fire for example here I send it   to a floating pane within neovim like others this  feature is experimental but just imagine where the   plugin is going to be in the future I'm so happy  to have discovered it and Neo is officially my   new neovim git interface and the clear winner  in my mind when it comes to zero friction IDE   gitops to make neit a little bit more approachable  I migrated most of my fugitives command into this   small subset of key bindings litter GS will pop  the status and Q by default closes it as shown   before this is great to both understanding the  status of changes as well as expanding on them   and while the older ways of fugitive provided a  similar option Neo getsix is Superior in every   way lit gyc was converted to G commit using neit  where similarly I can use GP to pull or g capital   P to push this is mainly a safety feature so I  don't make mistakes and push by default keep in   mind that different from fugitive GC here pops the  commit panel and if you're after a quick commit by   providing a message and just sending it away just  hit C again so liter GC then C type a message and   go back to coding two more integrated bindings in  this file aren't Neo specific and I still need to   figure out whether they belong here or not and by  the way if you're viewing this and have a better   way of achieving these without going to other  plugins please do let me know so branches work   best for me with telescope it's a picker that's  dedicated for that and I use it directly the same   thing I do with blame it's just popping for me  with fugitive and it's the easiest way to go I'd   like to remove fugitive altogether and migrate  fully so please let me know in the comments if   you have a better way with that in mind though  let's check the last Missing Link which also   kind of solves the git blame issue I have the  Holy Grail of git Integrations and neim will   never be actually complete without mentioning G  signs it works best as a sidekick and I could not   work without it on the surface it adds signs of  lines added or removed and offers to Stage them   as new hunks ready to be committed so far an  essential for every user but this thing packs   much much more the list of options is something  you'd need an hour just to go through here are   my highlights and how I use it I'll just mention  that everything I show here is already on my DOT   files in the git science. Lua file but most of it  is coming from the g science project docs so with   a configuration in mind let's see the power of git  signs to start off circling around changes in the   code I have the convention of brackets coupled  with C to search for previous or next changes   with opening or closing brackets respectively  under the hood this is called the next or priv   hunk sometimes when you want to have large hunks  it's nice to see a focused preview of the change   even before staging and for that I use leader  HP for a hunk preview when I'm ready to Stage   I use leader HS for hunk stage or leader RS to  hunk reset I can reset the stage or the entire   buffer using capital r or capital S but I tend  to stay away from that and I don't use it a lot   at all Beyond others one Nifty feature I like to  toggle a lot is the inline blame option that can   be either run with signs toggle current line  blame or in short as configured with liter TB   to toggle the blame this sets the last committer  on the line I'm in with a small delay so that it   doesn't interfere too much this is off by default  but when I need the information I'd either pull   fugitives blame as shown before or just use this  one git signs is the modern version of Vim git   cutter if you're wondering and I've migrated to it  about 18 months ago and never looked back so for   those of you who missed features or were toggling  the G status or the diff to learn the ch es made   this one's for you removing friction from any  workflow is key for success in my eyes not only   when coding but any type of work that requires  some level of focus and that's why my process is   never complete if my entire environment isn't  supportive of this goal this is why I created   session X an open- Source session manager packed  with goodies for TX users I have a video covering   everything you need to know right here thank you  for watching and I will see you on the next one
Info
Channel: DevOps Toolbox
Views: 29,275
Rating: undefined out of 5
Keywords:
Id: K-FKqXj8BAQ
Channel Id: undefined
Length: 13min 28sec (808 seconds)
Published: Fri Mar 15 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.