I'm Never Using Neovim's Terminal The Same Again

Поделиться
HTML-код
  • Опубликовано: 24 авг 2024

Комментарии • 69

  • @devopstoolbox
    @devopstoolbox  2 месяца назад

    Join 2000+ subscribers getting one dev/sec/ops tip every Friday: signup.omerxx.com

  • @AxWarhawk
    @AxWarhawk 2 месяца назад +29

    For the ctrl-z / fg people: I've often run into the habit of opening another vim job despite there being already one running in my shell. What I found to be the most helpful here is to put a little marker in your prompt which indicates whether there are jobs in your shell or not.

    • @devopstoolbox
      @devopstoolbox  2 месяца назад +6

      True! And smart!
      That’s actually why I don’t normally do this

  • @theherk
    @theherk 2 месяца назад +9

    For the years I was an emacs user, I was "everything in the editor", but for the years I've been using neovim, I'm very much "everything in the terminal". So I run wezterm, with some great project switching where I get a new workspace for any given git root.
    Then, within a workspace, and I have shortcuts to launch yazi, xplr, lazygit, or neovim. My EDITOR is a script that will run nvim normally if not in a git context, but if I am it will start a server storing the socket at the git root. Then any file I open any where in that workspace opens in my nvim instance for the workspace. That allows me to have many many terminals running at the same time as my project editor.

    • @devopstoolbox
      @devopstoolbox  2 месяца назад +1

      Sounds legit! With one caveat for me - I tend to use git worktrees, making the context of .git and the paths referencing weird, not sure if this works for you but sounds like you've got it figured out!

    • @jpratt8676
      @jpratt8676 2 месяца назад +1

      @@devopstoolbox can you do a video on making those ergonomic? I love the concept for things like rebasing all my branches parallel, running many instances of local CI, speeding up binary search for bugs but I'd love to think more about it and see other people's uses

    • @samuelabreu4349
      @samuelabreu4349 2 месяца назад +3

      but i really think we should politelly borrow somethings from emacs. Cus emacs can do some crazy shit that would make sense in a terminal. The hard thing about somehow making the terminal do some emacsy things.. is making it so it doesnt hurt the Unix Philosophy. Thats the major problem of emacs, it doesnt care about the Unix Philosophy. And Thats why we're using the terminal, right? Cus we want to keep the legacy, we want to keep (and share) touch with what made computers fun.

  • @eispalast1
    @eispalast1 2 месяца назад +12

    One thing I like about working with the built in terminal: when compiling a programm or checking for errors with valgrind, those programs print out the filename, line and column where the error happend. With a simple press of `gf` it takes me to this exact spot in the file where the error happend.
    I also have keybinding to quickly open and hide the terminal split while keeping the terminal session open.
    But I also get the idea why using tmux could be useful but I couldn't really find usecases for my typical workflow.

    • @devopstoolbox
      @devopstoolbox  2 месяца назад +2

      Interesting! Workflows are different and there’s no one size fits all, that’s the beauty 🤩

    • @hardenedapple
      @hardenedapple 2 месяца назад +3

      One could also have a custom command for turning a range of text into the quickfix list (after having manually modified that range of text, or adjusted the command until getting what you're interested in).
      I use a command `VsetQF` from my `vsh` plugin, and expect something similar could be used for `:terminal` as well.

  • @iEnjoyApplesauceVeryMuch
    @iEnjoyApplesauceVeryMuch 2 месяца назад +4

    I know I am probably going to get called a psychopath, but I actually like to run tmux in neovim, basically with ':term tmux attach -t some-session-for-specific-project' and then if you reload the session created with :mksession then neovim will automatically re-run the attach command, and it all kind of just works out. Then I can fully take advantage of vim's wonderful buffer/window/tab system for most terminal tasks without sacrificing the persistence.

    • @devopstoolbox
      @devopstoolbox  2 месяца назад +1

      HOLY MOLY
      I must say I didn't see this one coming 😆
      In some way it's genius, I have to give it a go!
      Thanks :)

    • @natrixnatrix
      @natrixnatrix 2 месяца назад +1

      This is how I also usually do it whenever I need persistence.

  • @kashperanto
    @kashperanto 5 дней назад

    I use tmux for projects, but I use neovim for most of my terminal-ing, because it's nice to have that ncreased integration to be able to jump to files, use more vim motions and plugins, etc.
    In embedded development I frequently need to have many different sub-projects open for any given project, so within my tmux session I'll have different windows with their own neovim session in the sub-project's folder.
    For quick shell stuff within a sub-project I just ctrl-z/fg from neovim, but most of my terminal work is done within neovim. I occasionally open a new window in tmux for certain tasks, but it's rare these days.
    I avoided the embedded terminal for many years because I thought it best to use tmux, but I'm glad I gave it a shot when migrating to neovim. One big thing that I like about it is that it gets a more consistent look for the rendering vs tmux and neovim (WSL has lots of weirdness, and term colors are a dark art in the best of cases).

  • @marcin6386
    @marcin6386 2 месяца назад +6

    If you are using vim or nvim. Make regularl breaks, and strech your hands, exercises hands. I and many others developed repetitive strain injury in both of hands. And this injury last for years and is very hard to get rid of.

    • @devopstoolbox
      @devopstoolbox  2 месяца назад +2

      Yep RSI is an issue and I think the best approach is an ergonomic combo of a standing desk and a split kb. I’ve got a video planned around it but it’s still not in motion

    • @thekillingspoon
      @thekillingspoon 2 месяца назад +1

      Reducing mouse use is very helpful for me (and most people, afaik), and using an ergonomic mouse. But yeah, it’s a thing pretty much everyone who’s deep enough into computers to even consider Vim/NeoVim/etc. will have to deal with, eventually, and there’s no going back to getting away with regularly overusing/abusing your body. It’s hard to learn not to take your body for granted.
      I’d recommend seeing at least a physical therapist. I had a shoulder injury that came with a free dose of tendinitis a year ago. I’m able to work full time now, most of the time, but I have had a few re-activations of the injury… mostly from lifting things that were too heavy and also from logically thinking my weak grip strength meant I should use a squeeze ball to get stronger. Whoops! The squeeze ball was a very bad idea. Using grip strength is a quick way to aggravate the injury for me, unfortunately. It’s a long road but my shoulder and lats and such are doing a lot better and getting stronger from regular, simple exercises to turn on the right muscles (to avoid using the ligaments and nerves for support) and work them.

  • @slipcurve1410
    @slipcurve1410 2 месяца назад +3

    That's great. Somehow I didn't know you could map things for the terminal specifically. I had ctrl-\ ctrl-n as a macro for the keyboard.

  • @EmileNani
    @EmileNani 2 месяца назад +5

    I learned more about neovim's terminal from this video. I have to stay with tmux for my terminal tasks. It provides more consistency and it is more manageable.
    For me I don't like the idea of trying to do everything in neovim especially terminal tasks

    • @devopstoolbox
      @devopstoolbox  2 месяца назад +2

      I must agree! But I think it’s important to at least know about it. Someday it may come in handy!

    • @aditya95sriram
      @aditya95sriram 2 месяца назад

      ​@@devopstoolbox totally agree! it's good to know that it's there, because who knows what kind of situations you might find yourself in 😅

  • @maguilecutty
    @maguilecutty 2 месяца назад +3

    I find floating pane just get in the way and you end up having to close them and you lose ur history u were referencing anyway.
    My preferred solution is to run tmux w nvim, then have a keymap to open a pane at 1/3 width, then have a kepmap to switch back and maximise the nvim pane. Obviously w alt+vim based movements between panes and mod + shift + vim movement between windows.
    You’ll thank me later x

    • @devopstoolbox
      @devopstoolbox  2 месяца назад

      Legit!
      To me, the mere sight of a 1/3 height terminal feels a. like pycharm 😆and b. just visibly unorganized. I want a full size (not 1/3) pane that I can toggle on and off quickly

    • @maguilecutty
      @maguilecutty 2 месяца назад +1

      @@devopstoolbox Yeah i guess thats personal preference - I like to be able to reference both both at the same time without having to toggle back and forth. In fact I am as anti toggle as possible which has had a HUGE influence on eye strain to the point where I can work for literally double the time, or have half the eye strain and brain fatigue.

  • @sahilmishra2945
    @sahilmishra2945 2 месяца назад +1

    there's a telescope plugin for Tmux I use to manage sessions, it works nicer in my vim brain than that C-b commands, great video as always

    • @devopstoolbox
      @devopstoolbox  2 месяца назад

      Really? For different sessions?

    • @sahilmishra2945
      @sahilmishra2945 2 месяца назад +1

      @@devopstoolbox yeah it's great I swap and rename/delete sessions from nvim and have it mapped to leader-at. it is the Tmux extension for telescope

    • @devopstoolbox
      @devopstoolbox  2 месяца назад +1

      @@sahilmishra2945 I have to see this one! Total recursion

  • @GOTHICforLIFE1
    @GOTHICforLIFE1 2 месяца назад +3

    i stick with one session per project, and i use floating terminal in nvim - in the occasion where i need multiple terminals i stick with another tmux window. But if i can help it i remain within neovim

    • @devopstoolbox
      @devopstoolbox  2 месяца назад

      I get it, it’s individual. Personally, mixing them up usually leads me to manual errors or just a bunch of keystrokes I didn’t have to make until I figure out what doing. That said, knowing it’s there was extremely useful many times!

  • @ayoubelmhamdi7920
    @ayoubelmhamdi7920 2 месяца назад +2

    using bang in ex mode or Ctrl-z is more intuitive than running emulator terminal or tmux
    i like how emacs handles the process, it's very simple and intuitive, I started using some approach by creating some functions.
    why, the terminal in vim is not intuitive, because, the screen of the laptop is too small, we should see one buffer at a time, so the convenient way to switch between buffers is to write the name of the buffer in ex mode (maybe nvim-cmp completion is useful in ex mode than insert mode) like: `:b foo.txt` or `:bn`

    • @devopstoolbox
      @devopstoolbox  2 месяца назад

      I definitely hadn’t thought of ex mode!
      But what you’re describing sounds a lot like what I’m doing with tmux. I’ll try your approach thanks!

  • @kesor6
    @kesor6 2 месяца назад +1

    The default keys (listed in the man page) for tmux do have plenty of commands to manage sessions. For example, ( and ) to jump to next/prev session. And $ to rename current session. L to go back to prev session. Also "s" to select a session using a chooser. It is only missing a new-session key, which I mapped to N. And although I did use sessionx for a while, eventually I don't really found a compelling need for it.

    • @devopstoolbox
      @devopstoolbox  2 месяца назад +1

      Yep, it has all the defaults! But finding a specific session is much nicer with a fuzzy finder and a preview. Ever since starting to working this way I’m creating dedicated sessions per projects and environments and I love the new workflow.
      I also dont find the default bindings to be “easy” - )( to move across without knowing where you’re going and a session previewed that feels “clunky”
      That’s said, we all like different options and that’s part of what I love about these tools, the ability to set my own style 😉

    • @kesor6
      @kesor6 2 месяца назад +2

      @@devopstoolbox The C-S session selector with choose-tree -Zs has a preview, and has a search with / and "n"/"p". You know me, I prefer to use whatever is default if possible, as it makes me more mobile across other systems that I often visit (i.e. not my computer)

    • @devopstoolbox
      @devopstoolbox  2 месяца назад +1

      @@kesor6 I do :) and you're right. It's nit picky, but I rather know the option and use daily what works quicker for me ;)

  • @crazydor12345
    @crazydor12345 2 месяца назад +1

    i think you missed the real functionality it gives you
    think of it (instead of different ways to do the same thing) as another layer
    meaning i use regolith that is based on i3 for windows management
    when i wanna focus on the terminal i zoom in
    than use tmux to work on multiple terminals
    but when i focus on coding or or something on nvim i focus again
    then if i just need something very specific from the terminal (like i do on splitting windows ) i create another terminal inside nvim
    this way i don't loose my focus
    and i can do this one small thing
    without zooming out (and focusing out) on all of the other terminals

    • @devopstoolbox
      @devopstoolbox  2 месяца назад

      It makes total sense. But since most of my work is multiple tmux sessions with multiple windows, having another shell in Neovim is mostly more confusing than helpful. Sometimes I do fire it but mostly I’d go for a floating tmux shell

  •  2 месяца назад +1

    I need to mention Zellij as alternative for tmux. Really good software with a strong momentum.

    • @devopstoolbox
      @devopstoolbox  2 месяца назад

      Totally! I try mentioning it whenever I can and also made a couple of videos covering it. Amazing piece of software

    •  2 месяца назад

      @@devopstoolbox Yeah, I watched them! Thanks for all your videos, I learn a lot from them.

  • @joergw
    @joergw 2 месяца назад +2

    thx, I'd like to buy you a coffee

    • @devopstoolbox
      @devopstoolbox  2 месяца назад

      Wow! Thank you so much!

    • @jpratt8676
      @jpratt8676 2 месяца назад

      I didn't even know you could do this wow

  • @samuelabreu4349
    @samuelabreu4349 2 месяца назад

    Shit youre good man!! You know and love this stuff. My sugestion is to go even deeper sometimes. I mean, the ctrl+Z/fg people. Would be nice if you asked some people that actually use this, yk. So we can enrich the video even more.
    Also i, again, really liked how you see this type of workflow, terminal workflow. I wanted to talk to you about it, just to share thoughts. Where can i reach you?

    • @devopstoolbox
      @devopstoolbox  2 месяца назад

      Hey! Thanks! This is great feedback and I’m always happy to hear thoughts.
      Feel free to drop a message at hi@omerxx.com and we’ll take it from there 🙏🏽

  • @kamalkamals
    @kamalkamals 2 месяца назад +1

    I like the header of our terminal, which theme of power10k using ??

    • @devopstoolbox
      @devopstoolbox  2 месяца назад +2

      Not using power10k :) My prompt is starship

    • @kamalkamals
      @kamalkamals 2 месяца назад

      @@devopstoolbox nop after inspect ur tmux config, it s plugins tmux that change the header with nice colos in the header

  • @chrisxu6491
    @chrisxu6491 2 месяца назад

    Question: how did you record terminal as well as the keys pressed?

  • @sub-harmonik
    @sub-harmonik 2 месяца назад +1

    trying to use nvim in powershell is somewhat painful

  • @aura.-X
    @aura.-X 2 месяца назад +1

    which WM are you using ?

    • @devopstoolbox
      @devopstoolbox  2 месяца назад +1

      Window manager? I don’t really, I use Tmux for the terminal, the OS is managed by Raycast (I’m on a Mac)

  • @gruvbox9
    @gruvbox9 Месяц назад

    do floatx and sessionx only run in linux?

    • @devopstoolbox
      @devopstoolbox  Месяц назад

      I'm using a mac, and I don't see a reason why it can't be used on Windows as well.
      Both are bash using native tmux commands to run

  • @mrlectus
    @mrlectus 2 месяца назад

    What plugin do you use for entering command? the floating one

    • @latch909
      @latch909 2 месяца назад +1

      That looks like nvim-noice

    • @devopstoolbox
      @devopstoolbox  2 месяца назад +1

      noice nvim :)

  • @Ekrembo
    @Ekrembo 2 месяца назад

    כפרעעעעעע

  • @hamm8934
    @hamm8934 2 месяца назад +4

    Eventually all roads of config lead to emacs ;)

  • @niksingh710
    @niksingh710 2 месяца назад +1

    will you give nix a try?
    m currently going through it and at first it is quite a curve to get the head around, but once you get the hang of it, it's fun.
    nixvim also if you give nix a shot