I use tmux, i3wm tiling window manager and vim splits, dual monitor - vertical and horizontal. Was crazy to get used to initially, but it's great now. tmux is a must.
@@adriansrfr It's a must have, cannot live without thing once you see how great it really is and it's potential to fit your needs and workflow. If you haven't already used it, get started and with time you'll start to unlock it's possibilities. i3wm handles the window tiles (including my terminal/tmux sessions on different monitors, with different layouts). I connect to multiple ssh sessions at any given time (20-30 servers) with only a keystroke in tmux, which can resume those connections at any time and it hosts a lot of my apps (vim, ncmpcpp, neomutt, vpn, reddit, man pages, etc. in split or full-screen), easily searchable tabs/windows. Think of it like one central terminal that has all the tabs you need. With just a tiling wm, I would have to have 20-30+ terminal windows (or tabs, which is what I get in tmux) just for the SSH connections, 10 other for my apps and maybe some more too. Trying to find server xyz or window 123.. is easy in tmux, just cntrl-f and search. If you want to copy/paste long lines in a terminal, tmux makes it very easy. Imagine trying to copy/paste 10,000+ lines of code with the mouse in a terminal window, what a pain. Tmux can be done instantly. I also move and switch my tmux windows to different sessions, depending on what desktop/window/monitor I am on without the need to re-arrange a layout. I also connect to tmux session via floating window which I move to/from scratchpad - another very hand thing, remote and local tmux sessions. Color themeable, etc. I am not giving it justice, but it's such a useful thing to have once you get used to it and customise it to suite your needs. Give it a try if you haven't already, you'll be glad you did in due time.
Thanks for pointing out how easy it is to switch between sessions! I've always kept everything in one session thinking I had to detach and reattach tmux to switch to a different session. This is great!
No problem. The cool thing about this set up is you can even open 2 terminals and connect to 2 different windows from the same session so you can see stuff side by side on 2 monitors. I do this once in a while for certain projects.
And if you're using Vim, you'll be familiar with the slash key for search. This works in the session list if you have five different sessions open like I do (I keep my dotfiles and TIL repos open in separate sessions and swap to them pretty frequently without having to navigate my filesystem even though I do have an alias to go directly to my dotfiles)
No problem. Thanks for watching. What misconceptions did you have prior to watching the video btw? Maybe I could make future videos on those things separately.
@@NickJanetakis I wasn’t really sure about all the available functionalities like windows, tabs, sessions, and how to combine them. It would be cool to talk about when to use vim buffers and when to use different terminals in another video
Neat video. I like your example workflow, but the video can be hard to follow because I can see what you're doing, but I have no idea how to do it myself. A write up of which keyboard commands do what things would make it a lot easier to follow along and emulate. Thanks and keep up the good work.
Thanks. Maybe I'll try using one of those "show key presses" programs next time. Although in this video, when you hear me say things like "leader S", "leader 1", those are keyboard shortcuts I'm hitting but I don't think I covered every key press. Here's an article I wrote a few years ago that talks about some of the other concepts (like windows, panes, etc.): nickjanetakis.com/blog/who-else-wants-to-boost-their-productivity-with-tmux
got here from searching around for tmux navigation, something i've been trying to streamline is navigating between windows from different sessions. I can use `prefix+s` to get an overview of sessions can use `prefix+w` to get a tree hierarchy of session and windows, but both of those still require using navigation keys such as `hjkl` to move between the sessions and windows amongst the sessions. like you i run quite a bit of sessions for various projects i'm working on, usually orgazing projects similar to you, ie. a rails project gets it's own session, i keep another session open for my dotfiles and updating documenation and configs within that session. so when i working throughout my day, i like jmp back to my dotfiles session to update a config or two to make things a little easier for my liking. however, i find cubersome to navigate back to the session and then within the window of that session, and `prefix+w` can get a little gnarly at times. so i've been looking for a way to quick jmp to my dotfiles window, `dots` within my `daily` session from a seperate session such as `webdev` or `rails`. ideally i'd look for something i can go into tmux cmd mode ala `prefix+:` input the name of the window `dots` and then i'm there. and i've also been looking for a way to quickly jmp between two windows regardless of the session they belong to. ie. in vim i have `leader,leader` to quickly jmp from the current and previous files, ala to how `cd -` jmps to the previous dir. is this sort of workflow you have experimented with? cool intro video BTW. 👍
Hi. If you're using tmux 2.6+ you can do leader+L (you need to shift L) and that will flip you between the last used sessions. It's pretty much what cd - does with directories. If you want to change that bind you can bind whatever key you want to switch-client -l. If you do leader+l (lower case L) it flips you between windows in that session, so the L does have meaning. Also, you can navigate the session results with the arrow keys or use the mouse if you configure tmux with mouse support. I never use `hjkl` to navigate it. Also just a heads up if you hit the right arrow over a session with leader+s you can expand the tree view for just that session without having to explicitly use leader+w. I mostly use leader+s and only very rarely expand out the tree when I want to jump to a specific window within a session because like you said, the fully expanded tree view can get a little crazy with a bunch of sessions. Although for editing dotfiles I don't use a separate tmux session for that. Usually what happens is I'm hacking away on a Rails / whatever app and then it's like "oh, I'd like to modify my vimrc to do this new thing". So what I did in Vim was assign a hotkey that opens my ~/.vimrc file in a new tab of that existing Vim buffer and then I can quickly make my addition, close the tab, source my vimrc and continue programming. I have Vim mappings to both edit my vimrc in a new tab and source Vim as leader+ev and leader+sv. They are in my dotfiles at: github.com/nickjj/dotfiles/blob/6a8db651f3725ad0b174897efee2f5d0bcf5a777/.vimrc#L308
@@NickJanetakis I have similar bindings in my vimrc as well, however the dotfiles window is just an example, being able to jmp to a window by it's name for me would be much quicker than navigating a tree hierarchy especially if i already know the name of the window. and i try not to use the arrow keys cuz it takes my right hand away from the home row keys, and using the same key mappings and vim just seems more fluid IMHO. i'll exp with that `leader+l` combos. thanks for pointing that out.
Very informative video! One question i have in this setup: if i open a vim instance in a tmux session, after I'm done with my work and exit tmux. If i configure vim (.vimrc or install new plugins) does the already running vim instance inside tmux session gets updated with the new config file? Since I'm starting to use vim so i figure i would come back in my vimrc file and change alot.
Hi, In that case you'll need to reload your vimrc. You can either close / open Vim or run :so $MYVIMRC to reload it (that is the exact command to run). Certain plugins will expect you to close Vim tho, so sourcing your vimrc file doesn't always work for updating it.
Very inspiring, I'll try out some ideas in my own workflow for sure! As a wish for future videos I'd find it much easier to follow if there were some real project files instead of all the dummies. Maybe your blog, some open source project or whatever :)
Thanks for the feedback. I'll make sure to include a real project next time. Once the course platform gets a bit more polished, I'll make something on that.
Yeah, on my Linux laptop I am using i3 and it's great. Tmux is still useful for splitting a workspace into multiple "tab-like" windows and also session persistence. There's also some other nice perks I didn't mention in this video, like being able to search your terminal's buffer. Using it allows you to use a fast and light weight terminal, but then get excellent features that are fully controlled by tmux. In my day to day use when using a tiled window manager, I still found myself using tmux as I do in this video. Then I used workspaces more like an active way to manage what I want to see at the moment (terminal + browser , video recording set up, image editing tools, etc.).
It's 25" and runs at 2560x1440. I did a huge write up on it and overall how to pick a monitor for programming at nickjanetakis.com/blog/how-to-pick-a-good-monitor-for-software-development.
I haven't optimized things that far. In practice I manually source it in the panes on a need to know basis. Basically the next time I need to use a feature of the bashrc file that was just modified, I source it. Otherwise I don't worry about it.
Great tutorials Nick. Helped me a lot to set up a decent Linux environment on my Windows machine. Still trying to figure out how you were able to make color themes work! Nothing works on my machine, they are completely ignored (both in the shell and in vim). The only thing that works is to change colors (and fonts) in the Options menu of the window. I installed Dainty package which then allows me to change the theme in the window and gives me something decent. Also when I change variable in .bashrc (like echo -ne "\e]0;WSLtty\a" or export LS_COLORS='ow=01;34', I see a change for a second and then it's overriden by the default config! Weird :) Did you face that too? Thanks.
Hi, thanks. I have not faced any weirdness in that regard. For the wsltty theme itself I downloaded the mintty gruvbox file from: github.com/morhetz/gruvbox-contrib/blob/master/mintty/gruvbox.minttyrc (wsltty is based on mintty), and from there I reference that in the wsltty options as the theme I want to use. Since I use the gruvbox theme I added this line to my ~/.profile , `source "$HOME/.vim/plugged/gruvbox/gruvbox_256palette.sh" ` (which is in my dotfiles at github.com/nickjj/dotfiles/blob/master/.profile). That file became available after installing gruvbox for Vim. Without that line, the theme's colors were a little off in Vim.
This was a great video. You're setup is very similar to mine. For you or anyone else here who's taking a liking to tmux I recommend using tmux in scripting to speed up the process of session creation. The two most useful scripts I've ever written 1) create a tmux session with 4 windows: a command window with 2 panes, a vim window, 1 pane ready for side tasks, and a window with ranger a vi based file explorer. 2) can take argument pairs of a name and a directory (or '-w' for a 'workspace' in ~/) to create multiple sessions with the last script in certain directories. I really recommend spending a little time making these commands (I used bash) that fit your workflow. My repo can be found at github.com/arburty/tmsetup-command. While they wont work out of the box because of other personalized commands simple tweaks can help be a great starting point
Thanks. I haven't gotten into scripting out specific sessions, mainly because once I have it set up, I keep it saved with tmux-resurrect (which supports restoring too).
I have tmux configured to yank to the system clipboard, then you can freely copy paste between anything. Details are in: th-cam.com/video/_MgrjgQqDcE/w-d-xo.html
Hi, I'm recently switched to vim, zsh and tmux and I love it. Except tmux doesn't work like expected. Can you help me? If i enter tmux. And then try some short cuts for example new window. C-B c or other keys nothing happened. I looked up at Google at some of them saying i have to release to key C-B and the typing the key i want. But does doesn't work as well it print's simply the key for example c. I'm really disappointed about that.
Hi, I am using zsh nowadays and it's all working here. You might want to poke around my tmux and zsh config files at github.com/nickjj/dotfiles. I've remapped my tmux key from C-b to ` so it's a bit easier to access. Normally you would hit CTRL+b (let go) then quickly hit the key you want to do based on the action you want to perform.
From the limited bits I know on Emacs, an Emacs buffer is an independent floating window that would be comparable to opening a second terminal, and an Emacs window could be somewhat comparable to a Vim buffer or tmux split pane in the sense that it let's you do something in a segment of your screen.
tmux sessions are persisted between reboots if you use the tmux-resurrect plugin (which is mentioned in this video). I also made a dedicated video on that recently here: th-cam.com/video/sMbuGf2g7gc/w-d-xo.html
Even with a tiling window manager it's useful with its ability to have sessions. Tmux windows / panes tend to feel better for quickly opening and switching to different terminals too. I tend to use tiling window managers to split graphical apps (like a browser and terminal), or use their workspaces in a similar way as virtual desktops (entirely separate desktops for different types of work).
Honestly, there wouldn't be much difference. The only difference is the contents of the Vim buffers. It's the same Vim splits, tmux windows, panes, sessions, etc.
I use tmux, i3wm tiling window manager and vim splits, dual monitor - vertical and horizontal. Was crazy to get used to initially, but it's great now. tmux is a must.
Why is tmux a must if you have a windows tiling manager?
@@adriansrfr It's a must have, cannot live without thing once you see how great it really is and it's potential to fit your needs and workflow. If you haven't already used it, get started and with time you'll start to unlock it's possibilities. i3wm handles the window tiles (including my terminal/tmux sessions on different monitors, with different layouts). I connect to multiple ssh sessions at any given time (20-30 servers) with only a keystroke in tmux, which can resume those connections at any time and it hosts a lot of my apps (vim, ncmpcpp, neomutt, vpn, reddit, man pages, etc. in split or full-screen), easily searchable tabs/windows. Think of it like one central terminal that has all the tabs you need.
With just a tiling wm, I would have to have 20-30+ terminal windows (or tabs, which is what I get in tmux) just for the SSH connections, 10 other for my apps and maybe some more too. Trying to find server xyz or window 123.. is easy in tmux, just cntrl-f and search. If you want to copy/paste long lines in a terminal, tmux makes it very easy. Imagine trying to copy/paste 10,000+ lines of code with the mouse in a terminal window, what a pain. Tmux can be done instantly. I also move and switch my tmux windows to different sessions, depending on what desktop/window/monitor I am on without the need to re-arrange a layout. I also connect to tmux session via floating window which I move to/from scratchpad - another very hand thing, remote and local tmux sessions. Color themeable, etc.
I am not giving it justice, but it's such a useful thing to have once you get used to it and customise it to suite your needs. Give it a try if you haven't already, you'll be glad you did in due time.
Thanks for this, I'm still quite new to this and this really showed the power of tmux which everyone talks about.
Thanks for pointing out how easy it is to switch between sessions! I've always kept everything in one session thinking I had to detach and reattach tmux to switch to a different session. This is great!
No problem. The cool thing about this set up is you can even open 2 terminals and connect to 2 different windows from the same session so you can see stuff side by side on 2 monitors. I do this once in a while for certain projects.
And if you're using Vim, you'll be familiar with the slash key for search. This works in the session list if you have five different sessions open like I do (I keep my dotfiles and TIL repos open in separate sessions and swap to them pretty frequently without having to navigate my filesystem even though I do have an alias to go directly to my dotfiles)
I'm getting into Vim recently, and for the moment I use the same workflow but using Vim's built-in Sessions feature.
TIL about the tmux zoom feature! Who knew? Nice video, thanks!
This is exactly the info I was looking for. Thank you for the video, very concise and useful.
Hey! Thanks for this video. I'm just starting with tmux and this was super helpful to clarify some misconceptions.
No problem. Thanks for watching. What misconceptions did you have prior to watching the video btw? Maybe I could make future videos on those things separately.
@@NickJanetakis I wasn’t really sure about all the available functionalities like windows, tabs, sessions, and how to combine them. It would be cool to talk about when to use vim buffers and when to use different terminals in another video
tmux-prefix + ) = go to next session,
tmux-prefix + ( = go to previous session
Pretty much what I am doing. Resurrect and Continuum actually is must-have in this setup.
Μπράβο Νικόλα! Όπα! σουβλάκι! μουσακάς!
Haha thanks.
Neat video. I like your example workflow, but the video can be hard to follow because I can see what you're doing, but I have no idea how to do it myself. A write up of which keyboard commands do what things would make it a lot easier to follow along and emulate. Thanks and keep up the good work.
Thanks. Maybe I'll try using one of those "show key presses" programs next time. Although in this video, when you hear me say things like "leader S", "leader 1", those are keyboard shortcuts I'm hitting but I don't think I covered every key press. Here's an article I wrote a few years ago that talks about some of the other concepts (like windows, panes, etc.): nickjanetakis.com/blog/who-else-wants-to-boost-their-productivity-with-tmux
got here from searching around for tmux navigation, something i've been trying to streamline is navigating between windows from different sessions.
I can use `prefix+s` to get an overview of sessions
can use `prefix+w` to get a tree hierarchy of session and windows,
but both of those still require using navigation keys such as `hjkl` to move between the sessions and windows amongst the sessions.
like you i run quite a bit of sessions for various projects i'm working on, usually orgazing projects similar to you, ie. a rails project gets it's own session, i keep another session open for my dotfiles and updating documenation and configs within that session.
so when i working throughout my day, i like jmp back to my dotfiles session to update a config or two to make things a little easier for my liking. however, i find cubersome to navigate back to the session and then within the window of that session, and `prefix+w` can get a little gnarly at times.
so i've been looking for a way to quick jmp to my dotfiles window, `dots` within my `daily` session from a seperate session such as `webdev` or `rails`. ideally i'd look for something i can go into tmux cmd mode ala `prefix+:` input the name of the window `dots` and then i'm there. and i've also been looking for a way to quickly jmp between two windows regardless of the session they belong to. ie. in vim i have `leader,leader` to quickly jmp from the current and previous files, ala to how `cd -` jmps to the previous dir.
is this sort of workflow you have experimented with?
cool intro video BTW. 👍
Hi. If you're using tmux 2.6+ you can do leader+L (you need to shift L) and that will flip you between the last used sessions. It's pretty much what cd - does with directories. If you want to change that bind you can bind whatever key you want to switch-client -l. If you do leader+l (lower case L) it flips you between windows in that session, so the L does have meaning.
Also, you can navigate the session results with the arrow keys or use the mouse if you configure tmux with mouse support. I never use `hjkl` to navigate it. Also just a heads up if you hit the right arrow over a session with leader+s you can expand the tree view for just that session without having to explicitly use leader+w. I mostly use leader+s and only very rarely expand out the tree when I want to jump to a specific window within a session because like you said, the fully expanded tree view can get a little crazy with a bunch of sessions.
Although for editing dotfiles I don't use a separate tmux session for that. Usually what happens is I'm hacking away on a Rails / whatever app and then it's like "oh, I'd like to modify my vimrc to do this new thing". So what I did in Vim was assign a hotkey that opens my ~/.vimrc file in a new tab of that existing Vim buffer and then I can quickly make my addition, close the tab, source my vimrc and continue programming. I have Vim mappings to both edit my vimrc in a new tab and source Vim as leader+ev and leader+sv. They are in my dotfiles at: github.com/nickjj/dotfiles/blob/6a8db651f3725ad0b174897efee2f5d0bcf5a777/.vimrc#L308
@@NickJanetakis
I have similar bindings in my vimrc as well, however the dotfiles window is just an example, being able to jmp to a window by it's name for me would be much quicker than navigating a tree hierarchy especially if i already know the name of the window.
and i try not to use the arrow keys cuz it takes my right hand away from the home row keys, and using the same key mappings and vim just seems more fluid IMHO. i'll exp with that `leader+l` combos. thanks for pointing that out.
@@NickJanetakis and yeah, `prefix+L` is essentially the `cd -` i was looking for. 🌈🚽🥇
Very informative video!
One question i have in this setup: if i open a vim instance in a tmux session, after I'm done with my work and exit tmux. If i configure vim (.vimrc or install new plugins) does the already running vim instance inside tmux session gets updated with the new config file? Since I'm starting to use vim so i figure i would come back in my vimrc file and change alot.
Hi, In that case you'll need to reload your vimrc. You can either close / open Vim or run :so $MYVIMRC to reload it (that is the exact command to run). Certain plugins will expect you to close Vim tho, so sourcing your vimrc file doesn't always work for updating it.
Thanks for your answer! I really appreciate your video.
Very inspiring, I'll try out some ideas in my own workflow for sure!
As a wish for future videos I'd find it much easier to follow if there were some real project files instead of all the dummies. Maybe your blog, some open source project or whatever :)
Thanks for the feedback. I'll make sure to include a real project next time. Once the course platform gets a bit more polished, I'll make something on that.
I only use a dynamic window manager. Easy tiling and splitting. Tmux instances looks cool though
Yeah, on my Linux laptop I am using i3 and it's great. Tmux is still useful for splitting a workspace into multiple "tab-like" windows and also session persistence. There's also some other nice perks I didn't mention in this video, like being able to search your terminal's buffer. Using it allows you to use a fast and light weight terminal, but then get excellent features that are fully controlled by tmux. In my day to day use when using a tiled window manager, I still found myself using tmux as I do in this video. Then I used workspaces more like an active way to manage what I want to see at the moment (terminal + browser , video recording set up, image editing tools, etc.).
Looking good, what size monitor is that? Looks like a monster
It's 25" and runs at 2560x1440. I did a huge write up on it and overall how to pick a monitor for programming at nickjanetakis.com/blog/how-to-pick-a-good-monitor-for-software-development.
I love the resurrect plugin. Thanks! Suppose you edit your bash.rc config. How do you source it in all other sessions, panes and windows?
I haven't optimized things that far. In practice I manually source it in the panes on a need to know basis. Basically the next time I need to use a feature of the bashrc file that was just modified, I source it. Otherwise I don't worry about it.
Bananas ~ b-a-n-a-n-a-s
Great tutorials Nick. Helped me a lot to set up a decent Linux environment on my Windows machine. Still trying to figure out how you were able to make color themes work! Nothing works on my machine, they are completely ignored (both in the shell and in vim). The only thing that works is to change colors (and fonts) in the Options menu of the window. I installed Dainty package which then allows me to change the theme in the window and gives me something decent. Also when I change variable in .bashrc (like echo -ne "\e]0;WSLtty\a" or export LS_COLORS='ow=01;34', I see a change for a second and then it's overriden by the default config! Weird :) Did you face that too? Thanks.
Hi, thanks. I have not faced any weirdness in that regard. For the wsltty theme itself I downloaded the mintty gruvbox file from: github.com/morhetz/gruvbox-contrib/blob/master/mintty/gruvbox.minttyrc (wsltty is based on mintty), and from there I reference that in the wsltty options as the theme I want to use. Since I use the gruvbox theme I added this line to my ~/.profile , `source "$HOME/.vim/plugged/gruvbox/gruvbox_256palette.sh"
` (which is in my dotfiles at github.com/nickjj/dotfiles/blob/master/.profile). That file became available after installing gruvbox for Vim. Without that line, the theme's colors were a little off in Vim.
I realize this comment is old, but you should try a Linux OS. It's usually easier to troubleshoot than WSL.
This was a great video. You're setup is very similar to mine. For you or anyone else here who's taking a liking to tmux I recommend using tmux in scripting to speed up the process of session creation. The two most useful scripts I've ever written
1) create a tmux session with 4 windows: a command window with 2 panes, a vim window, 1 pane ready for side tasks, and a window with ranger a vi based file explorer.
2) can take argument pairs of a name and a directory (or '-w' for a 'workspace' in ~/) to create multiple sessions with the last script in certain directories.
I really recommend spending a little time making these commands (I used bash) that fit your workflow. My repo can be found at github.com/arburty/tmsetup-command. While they wont work out of the box because of other personalized commands simple tweaks can help be a great starting point
Thanks. I haven't gotten into scripting out specific sessions, mainly because once I have it set up, I keep it saved with tmux-resurrect (which supports restoring too).
How do you copy text b/w tmux sessions
I have tmux configured to yank to the system clipboard, then you can freely copy paste between anything. Details are in: th-cam.com/video/_MgrjgQqDcE/w-d-xo.html
Hi, I'm recently switched to vim, zsh and tmux and I love it. Except tmux doesn't work like expected. Can you help me? If i enter tmux. And then try some short cuts for example new window. C-B c or other keys nothing happened. I looked up at Google at some of them saying i have to release to key C-B and the typing the key i want. But does doesn't work as well it print's simply the key for example c.
I'm really disappointed about that.
Hi, I am using zsh nowadays and it's all working here. You might want to poke around my tmux and zsh config files at github.com/nickjj/dotfiles. I've remapped my tmux key from C-b to ` so it's a bit easier to access. Normally you would hit CTRL+b (let go) then quickly hit the key you want to do based on the action you want to perform.
@@NickJanetakis i tried this with c but nothing happens :(
@@juridiener5942 Are you sure you're in tmux when trying these commands?
@@NickJanetakis yes, it's showing me at the bottom.
Ok i found my issue, i did something stupid i had two configs in separate locations 🤦
Would you say this is comparable to Emacs windows and buffers?
From the limited bits I know on Emacs, an Emacs buffer is an independent floating window that would be comparable to opening a second terminal, and an Emacs window could be somewhat comparable to a Vim buffer or tmux split pane in the sense that it let's you do something in a segment of your screen.
I just have 9 open terminals and alt-tab between them :(
Been there done that haha.
That's been my life this year, and now that I finally have some time to relax, it's so nice to learn of a better way. Thanks Nick.
tmux sessions are not preserved between reboots. I rather use vim sessions.
tmux sessions are persisted between reboots if you use the tmux-resurrect plugin (which is mentioned in this video). I also made a dedicated video on that recently here: th-cam.com/video/sMbuGf2g7gc/w-d-xo.html
Tmux if you don't have a windows tiling manager.
Even with a tiling window manager it's useful with its ability to have sessions. Tmux windows / panes tend to feel better for quickly opening and switching to different terminals too. I tend to use tiling window managers to split graphical apps (like a browser and terminal), or use their workspaces in a similar way as virtual desktops (entirely separate desktops for different types of work).
Hi what terminal is this?
Hi, it's wsltty. I did a full video on it here: th-cam.com/video/XS4j-VS3Atg/w-d-xo.html
It would be much more helpful to show real workflow instead of "apples, bananas and oranges"
Honestly, there wouldn't be much difference. The only difference is the contents of the Vim buffers. It's the same Vim splits, tmux windows, panes, sessions, etc.