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.
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.
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.
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.
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!
@@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
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.
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.
Using xterm or ssh, I have my bash environment. I start vim (not neovim), and I can edit. I type :ter and have a terminal pane with yet another bash. I can even launch another vim. No configuration, add-ons or scripting needed. I've been doing this for 20 years. Cheers!
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).
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
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
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
@@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.
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
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!
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.
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 😉
@@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)
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
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
Hey! Not something I remember actually using but I did come across a few that seemed to have good potential. It's good stuff for another video.. I'll make some research :)
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`
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.
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
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.
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?
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 🙏🏽
neomux? I would really like to use neovide but I can't integrate it with the tmux worflow If I could open a neovide and use it as my terminal emulator and have all my tmux splits in it but when one of the splits is nvim it would be handled by neovide then life would be great
I with I could link to a video where I say this, but it's still in production, so here's a quote from my script - "sending it to the best tool ever - fzf (more on fzf in the video above, and yes I said fzf and f-zed-f to accomodate for people on both sides of the pond, it's totally ok to cuss in the comments)" 😅
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
Join 2000+ subscribers getting one dev/sec/ops tip every Friday: signup.omerxx.com
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.
True! And smart!
That’s actually why I don’t normally do this
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.
Interesting! Workflows are different and there’s no one size fits all, that’s the beauty 🤩
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.
Is there anyway you can share your setup?
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.
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!
@@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
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.
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.
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 :)
This is how I also usually do it whenever I need persistence.
Using xterm or ssh, I have my bash environment. I start vim (not neovim), and I can edit.
I type :ter and have a terminal pane with yet another bash. I can even launch another vim.
No configuration, add-ons or scripting needed. I've been doing this for 20 years. Cheers!
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).
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
I must agree! But I think it’s important to at least know about it. Someday it may come in handy!
@@devopstoolbox totally agree! it's good to know that it's there, because who knows what kind of situations you might find yourself in 😅
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.
Yep! A mode of its own
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
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
@@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.
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
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!
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.
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 😉
@@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)
@@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 ;)
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
Really? For different sessions?
@@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
@@sahilmishra2945 I have to see this one! Total recursion
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
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
Hi Omer, is there any tool in Neovim for fully remote pair programming? I've found plugins for LAN work, but none for 100% remote collaboration.
Hey! Not something I remember actually using but I did come across a few that seemed to have good potential. It's good stuff for another video.. I'll make some research :)
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`
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!
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.
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
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.
I like the header of our terminal, which theme of power10k using ??
Not using power10k :) My prompt is starship
@@devopstoolbox nop after inspect ur tmux config, it s plugins tmux that change the header with nice colos in the header
I need to mention Zellij as alternative for tmux. Really good software with a strong momentum.
Totally! I try mentioning it whenever I can and also made a couple of videos covering it. Amazing piece of software
@@devopstoolbox Yeah, I watched them! Thanks for all your videos, I learn a lot from them.
Question: how did you record terminal as well as the keys pressed?
screen capture and a camera :)
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?
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 🙏🏽
question for anyone: how did he make his cmdline to be a floating window? or is it just an edit?
In Neovim? github.com/folke/noice.nvim
What plugin do you use for entering command? the floating one
That looks like nvim-noice
noice nvim :)
thx, I'd like to buy you a coffee
Wow! Thank you so much!
I didn't even know you could do this wow
neomux?
I would really like to use neovide but I can't integrate it with the tmux worflow
If I could open a neovide and use it as my terminal emulator and have all my tmux splits in it but when one of the splits is nvim it would be handled by neovide then life would be great
which WM are you using ?
Window manager? I don’t really, I use Tmux for the terminal, the OS is managed by Raycast (I’m on a Mac)
trying to use nvim in powershell is somewhat painful
sounds like it!
do floatx and sessionx only run in linux?
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
It's pronounced EF ZEE EF btw :)
I with I could link to a video where I say this, but it's still in production, so here's a quote from my script -
"sending it to the best tool ever - fzf (more on fzf in the video above, and yes I said fzf and f-zed-f to accomodate for people on both sides of the pond, it's totally ok to cuss in the comments)" 😅
כפרעעעעעע
Eventually all roads of config lead to emacs ;)
It appears so 😂
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
Already in motion :)