These HIDDEN MOTIONS in Neovim will CHANGE how you work

Поділитися
Вставка
  • Опубліковано 1 чер 2024
  • Vim's motions are quite common knowledge amongst avid users, however, instead of customizing hacks to get access to additional types of objects, treesitter can parse them for you!
    Not only you can extend any type of object you like, it comes with a large set of defaults to apply actions, motions, swaps and jumps over objects like functions, comments, loops, classes and MANY more!
    In this video I'm showing to install, use and integrate the objects as well as exploring additional settings that you want to check out!
    LINKS
    ▶ github.com/nvim-treesitter/nv...
    ▶ github.com/omerxx/dotfiles
    MY FAVOURITE GEAR
    * If you enjoy my content, using the links below will help me with a small commission, so thank you!
    ⌨️ My keyboard is the wonderful HHKB: amzn.to/3HwJG60
    🔗 The HHKB is wired with a high quality coiled cable: amzn.to/3DCA87d
    ⌨️ Backup keyboard (for traveling mainly) - Nuphy Air60: amzn.to/3R3M7jz
    🖥️ My ultra wide 49" monitor: amzn.to/3JbVThC
    🎙️ Microphone - Shure MV7X: amzn.to/3kA7tZZ
    🦾 Boom Arm - amzn.to/3ZmQgln
    🎤 Audio Interface (for XLR microphones) - Focusrite Scarlett Solo: amzn.to/3Z3fBkQ
    🦾 Heavy Duty Monitor Arm: amzn.to/3kKp7tS
    🖱️ Mouse - MX Master 3: amzn.to/3DiZmaj
    📷 Camera - ZVE10: amzn.to/3I1jfVS
    🎥 Lens - Sigma 1.4 16mm: amzn.to/3BfFN15
    CONSIDER SUPPORTING THIS CHANNEL
    ☕ Buy me a coffee: www.buymeacoffee.com/omerxx
    🎷 60 day free Epidemic Music!: share.epidemicsound.com/w6zfxo
    MY KEY LINKS
    🍿 Subscribe: www.youtube.com/@devopstoolbo...
    🌍 My website: omerxx.com
    🗞️ Dev & Ops tools Telegram channel: t.me/espressops
    🎙️ DevOps Topeaks Podcast: topeaks.buzzsprout.com
    ⏱ Timestamps
    00:00 - Intro
    00:58 - Treesitter text objects
    01:35 - Selecting
    04:34 - More objects
    05:31 - Configure more
    07:00 - Moving
    09:07 - Swapping
    #neovim #vim #productive #program #dev #devops #software #softwareengineer #sysops #linux #terminal #console #cli #keyboard #commandline #sql #database
  • Наука та технологія

КОМЕНТАРІ • 64

  • @dabzilla05
    @dabzilla05 8 місяців тому +15

    This editing is next-level. Thanks for going the extra mile to cover these advanced topics with such depth. Treesitter objects are one of those things I have been meaning to learn forever and I already had some crazy realizations just from the default keybinds you showed

    • @devopstoolbox
      @devopstoolbox  8 місяців тому

      Oh man! Thank you buddy! 🙏🏽

  • @hemanthkotagiri8865
    @hemanthkotagiri8865 8 місяців тому +15

    After my man prime, your videos are the ones that I eagerly wait to see the notification of. The moment I do, I stop my work and listen to you and drop a like. You teach me always something new man! Thank you!(have been using treesitter text objects for past 2 months already and they are a game changer!)

    • @devopstoolbox
      @devopstoolbox  8 місяців тому +2

      Damn what a feedback! Thank for the kind words mate! Honestly I’m humbled just by the mention next to the prime which I also learn from a ton.
      Thanks again man!

    • @seconds21ive43
      @seconds21ive43 8 місяців тому +1

      I'll second this! You do an an insane job of taking a fairly complex thing, simplifying it down, and sharing it with the rest of us. These options are incredible and will be a huge help to me.

    • @devopstoolbox
      @devopstoolbox  8 місяців тому +1

      @@seconds21ive43 made my day! 🙏🏿

  • @CarstenFuehrmann
    @CarstenFuehrmann 7 місяців тому +2

    These shortcuts for selecting text objects are nice. But I prefer a shortcut for incrementally extending the text object selection until you have covered the area I want. The advantage is that it needs no configuration per language or text object type, and has even lower cognitive load during usage.
    Another, killer, alternative is to use the flash.nvim plugin by folke. With that, you can't only move your cursor at lightning speed, but also make treesitter actions like e.g. this: press v to enter selection mode. Then press S to enter the Treesitter mode of flash. Then flash will show you letters as jump labels around _all_ text objects. (The same letter at the beginning _and_ end of each text object.) Then just press the jump label, and you have your selection. It also works with actions like c instead of v. Again, no need for any language-specific or text-object-specific configuration.

  • @ronitgandhi7716
    @ronitgandhi7716 8 місяців тому +4

    This intro's are getting sick + wild video by video🤣 very cool intro btw and video was also so much informative.

    • @devopstoolbox
      @devopstoolbox  8 місяців тому +2

      😂 they are LOL
      Thanks buddy!
      Doing everything I can to deliver the information 😉

  • @nil70n
    @nil70n 8 місяців тому +3

    Everytime I hit one of your videos I end up editing my dotfiles. Love your content mate, thanks!

  • @Redyf
    @Redyf 8 місяців тому +4

    These videos are really helpful, thank you!

    • @devopstoolbox
      @devopstoolbox  8 місяців тому +2

      No probs! And thanks for the feedback!

  • @binh1298ify
    @binh1298ify 7 днів тому

    Thank you so much, very helpful video 🙏

  • @staystealth
    @staystealth 8 місяців тому

    this was amazing. i finally understand why treesitter text objects are so powerful

  • @arthurlokhov6856
    @arthurlokhov6856 8 місяців тому

    Hi, thank you for your videos. Which keyboard can you recommend? It is important to me that it can be connected both by wire (for a quick response for games), and there via bluetooth (I often connect the keyboard to my laptop, then to the desktop, because the laptop has a dead keyboard. Also, the keyboard should be compact, because I will carry it along with my laptop (that is, 100% of the keys with numpad disappear).
    I don't understand keyboards, that's why I'm asking this question here. Is it also possible to buy a clave without engraving? And most importantly with Linux support and to have mechanics.
    I was considering Numpy Air 75 or something from Keychron, but I really don't understand this topic. And I would not really like to buy some garbage.

  • @jamtart22
    @jamtart22 8 місяців тому

    neovim is getting insanely good!!!

  • @DAVE-GM
    @DAVE-GM 2 місяці тому

    A Master Class!

  • @ErikOnNoobTube
    @ErikOnNoobTube 8 місяців тому +1

    I've always been afraid to change from native vim motions. I like being able to easily transfer my editing skills to wm's and other workstations. But these improved textobjects is something I've always missed in vim. Here's hoping they will become native in the future, otherwise I'm installing this right now :)

    • @devopstoolbox
      @devopstoolbox  8 місяців тому

      Haha. I totally get your point. For me, Vim (and Neovim) became much more than this tool I can use on severs, to my main IDE. As such, my only goal is making it as fast + efficient programming environment

  • @glyphack
    @glyphack 8 місяців тому +1

    Awesome intro well done

    • @devopstoolbox
      @devopstoolbox  8 місяців тому

      Thank you! I was unsure about it 😉

  • @devabdul
    @devabdul 8 місяців тому

    Its very useful❤❤

  • @maurolimaok
    @maurolimaok 8 місяців тому

    I 'm just a noobie, at 55yo, and this is gold.
    Thanks for the channel.

    • @devopstoolbox
      @devopstoolbox  8 місяців тому +1

      It’s kind of a theme with Vim users I believe: “life long students” 😉
      Thanks mate!

  • @austinevans9467
    @austinevans9467 8 місяців тому

    I feel like most of this can be achieved with "cib, vib, cab, vab, etc.." (for parameters / arguments; essentially anything inside parenthesis) and "ciB, viB, caB, vaB, etc.." (for loops, functions, classes, structs, etc..; anything inside curly braces). It's also more convenient since it's basically just one motion for all the things. However I think text objects shine for things like quickly changing lhs/rhs of an assignment or multi-line comments like you showed in the video and other things that really require language context. Also ciB doesn't really work for non curly brace languages lol

    • @devopstoolbox
      @devopstoolbox  8 місяців тому

      You’re right! I think that’s why text objects are needed though (for function-aware treesitter where it’s not straight forward like in Python). I guess it boils down to preference and muscle memory

    • @austinevans9467
      @austinevans9467 8 місяців тому

      @@devopstoolbox Yeah I'm definitely going to setup some keybinds for those not-so straightforward things. Thanks for sharing! I wouldn't have known about this plugin otherwise. Love your editing style btw.

  • @niksingh710
    @niksingh710 8 місяців тому

    I have tried them earlier but was not having an intuitive set of mappings.
    Your mappings seem intuitive will give them a shot again maybe this time it stays XD

    • @devopstoolbox
      @devopstoolbox  8 місяців тому +1

      Yes! Let me know how it goes! Honestly I’m probably using the function wrapper 99% of times and the ability to jump between then (]m) the others are too random for me to use daily

    • @niksingh710
      @niksingh710 8 місяців тому +1

      @@devopstoolbox yeah i am too using the functions one more often but putting others for reference as if i got a need to use i try to use the keymaps instead of some way around.
      but keeping the keymaps similar to vim-surround makes it easier to grasp.

  • @yesidev4131
    @yesidev4131 7 місяців тому +1

    I have a question, in the minute 6:17 when you write a file, the output message shows you only the file name, when normally shows the full path, How can I configure it so that it only shows the file name and not the full path?

    • @devopstoolbox
      @devopstoolbox  7 місяців тому

      TBH this is just how notify behaves by default, here's my config - github.com/omerxx/dotfiles/blob/887d90e962b6925171c41ba0fdc804bca17b9dbc/nvim/lua/plugins/lazy.lua#L127 (nothing special about it).
      That said, I removed write notifications recently, found them more annoying than helpful... I just run `:file` when I need to know the full name if it's not shown

    • @yesidev4131
      @yesidev4131 7 місяців тому +1

      ​@@devopstoolbox you have all the reason, finally I preferred remove the plugin, I didn't see anything value for me, I wanted to try it because I saw it in your videos, but it's very annoying in very simple things like create a file from nvim tree.

    • @devopstoolbox
      @devopstoolbox  7 місяців тому +1

      @@yesidev4131 yes I can relate. To be fully honest I’m mostly using it because it has a nice visual appeal which also works great on videos. I still have it on daily but it’s nothing major in productivity or anything like that

    • @yesidev4131
      @yesidev4131 7 місяців тому

      ​@@devopstoolbox Sure, changing the subject, will you start to stream on twitch? or any stream platform? I am DevSecOps engineer for 3 years ago from Colombia, and these types of videos as well as entertaining are very helpful. To know how other works with more experience it's appreciated and normally the actually streamers They are mostly just software development

  • @akshay6019
    @akshay6019 8 місяців тому +1

    how did you add blur to your terminal?

    • @devopstoolbox
      @devopstoolbox  8 місяців тому

      This is wezterm's macos option for blurry background, here's the line on my dotfiles - github.com/omerxx/dotfiles/blob/master/wezterm/wezterm.lua#L7
      And this is the docs:
      wezfurlong.org/wezterm/config/lua/config/macos_window_background_blur.html

  • @devstefancho
    @devstefancho 8 місяців тому

    how do you refactor code when moving file to another path or changing directory name, filename
    I think native lsp is not support this yet

    • @devopstoolbox
      @devopstoolbox  8 місяців тому +1

      Hi! Not sure what you're referring to, but if you `git mv` a file to another path / change name, why would the LSP care? Should work just the same.
      If you can elaborate on what exactly you're trying to do I can probably help more

    • @devstefancho
      @devstefancho 8 місяців тому +1

      @@devopstoolbox Yes, you are right, actually lsp is not reponsible for this.
      what I want to do is
      if i change src/foo.js to src/bar.js
      then old pathname(src/foo.js) string from all files should replace with new pathname(src/bar.js)
      if 100 files use foo.js then I should repeat 100 times changing code
      (i.e. import "src/foo.js" => import "src/bar.js")
      In this case how do you deal with?

    • @devopstoolbox
      @devopstoolbox  8 місяців тому +1

      @@devstefancho hmmm this would either be provided by a plugin of some sort or an extreme LSP plugin. Something similar is renaming a variable which updates all the references across all files. I don’t find myself changing files all that often to think of a solution but sounds like it’s out there

  • @a_maxed_out_handle_of_30_chars
    @a_maxed_out_handle_of_30_chars 8 місяців тому

    why is the video just 720p? is there some issues with youtube?

  • @WillEhrendreich
    @WillEhrendreich 8 місяців тому

    Awesome stuff. I use fsharp primarily, so I think the support is limited for treesitter.

    • @devopstoolbox
      @devopstoolbox  8 місяців тому

      Yep, a rather niche language. Did you not find any support?

    • @WillEhrendreich
      @WillEhrendreich 8 місяців тому

      @@devopstoolbox it's in process, there's a repo people are working on, and I put a request in on treesitter's language support issue. It's just not 100% yet.

  • @czintrpt5585
    @czintrpt5585 8 місяців тому

    Huh, have been using af motion for ages, didn't realize it's not a native vim motion 😅

    • @devopstoolbox
      @devopstoolbox  8 місяців тому

      Not native per-se but I lost it when I figured I had it all along

  • @jizhang2407
    @jizhang2407 8 місяців тому

    Thanks for sharing. (Somehow, I can only watch this video in 720p quality...)

    • @devopstoolbox
      @devopstoolbox  8 місяців тому +1

      Oh no! You're right! Thank you for letting me know I have no idea how I missed this.
      Do you think it affects the end result significantly? I mean, not ideal for sure (checking now what happened) but I wonder if it's worth re-uploading.

  • @JoelJosephReji
    @JoelJosephReji 8 місяців тому +1

    Woah

  • @Saturate0806
    @Saturate0806 8 місяців тому

    Why did no one cover this until now?

    • @devopstoolbox
      @devopstoolbox  8 місяців тому

      I was just as baffled about this 😅

  •  8 місяців тому +1

    Can you share your wallpapers?

    • @devopstoolbox
      @devopstoolbox  8 місяців тому

      Hi! What wallpapers are you referring to :) ?

    •  8 місяців тому

      @@devopstoolbox The one on your video

    • @devopstoolbox
      @devopstoolbox  8 місяців тому

      You mean the 4 colors background for the snippets part? This is just a Final Cut generator with some colors I picked and a little blur..@

  • @janAkaliKilo
    @janAkaliKilo 7 місяців тому

    3:40 - it's not 'oop', it is pronounced as 'oops'

  • @windowsrefund
    @windowsrefund 19 днів тому

    Isn't the problem that we're talking about objects that are very language specific? I mean, go may have "functions" but other languages do not.

    • @devopstoolbox
      @devopstoolbox  19 днів тому +1

      The idea behind text objects is their ability to understand the language you’re working with, in part, that’s the reason behind treesitter. With that information it can map different objects even if Python and TS don’t have the same function structure.