TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Tmux for Mere Mortals

586 点作者 _7ffc大约 5 年前

38 条评论

asdff大约 5 年前
Spent too much time wonking a tmux config only realizing it was never going to work how I liked. You can&#x27;t have it all with the mouse no matter your settings, there will always be a compromise. It also doesn&#x27;t help that no one cites the version of tmux they wrote their configs for, nor that the configs are not backwards compatible with all versions of tmux for all settings.<p>It&#x27;s really clunky, but I went from tmux to just opening new shell windows as needed. I need to be able to resize and scroll, selecting text and copy behavior should be exactly like mac os. Even used a tiling window manager with it for a bit, but it felt pretty restrictive so I went back to just using the cursor to move things around.
评论 #23004222 未加载
评论 #23006028 未加载
评论 #23009816 未加载
评论 #23004200 未加载
评论 #23006318 未加载
评论 #23005703 未加载
VikingCoder大约 5 年前
Can someone please please make a util that configures tmux for me?<p>I&#x27;d like to run a small program that generates a tmux.conf, after asking me some questions, and having me demonstrate my responses.<p>So step one, it should be able to figure out what version of tmux I&#x27;m using. Then it probably needs to know what SSH program I&#x27;m using, so it knows how the keyboard and mouse from that program will mess with it.<p>Picture a Wizard where it asks, &quot;Do you use the mouse to copy and paste? Try to highlight this text: [example1]. Then try to paste it back into this screen.&quot; and etc.<p>Wouldn&#x27;t this be... kind of an obvious thing to make?
评论 #23009715 未加载
评论 #23007048 未加载
评论 #23010686 未加载
评论 #23007045 未加载
评论 #23007553 未加载
评论 #23009682 未加载
hhsuey大约 5 年前
After a few years in tmux, I actually moved back to just iterm2 (I&#x27;m always on osx). There are many new Iterm2 features over the last few years that make tmux unecessary IMO.<p>- Iterm2 can now restore sessions, even partially after a reboot (attempts to recreate workspaces). This was the main benefit of tmux for me.<p>- Iterm2 can also have a visual mode to browse your scrollback buffer, and there are some shortcuts similar to vim. This was the second main benefit of tmux for me.<p>- It&#x27;s less keybindings to remember and configure.<p>- Iterm2 can better size your split panes. You can also change text size per pane. Useful for wide text.<p>- A bunch of other things that iterm2 does better when tmux is not open. Autocomplete. Paste history. Instant replay. Some of these are quite gimmicky TBH, but could be useful for some.<p>- Text, colors, etc... appear sharper without tmux. I think. There are antialiasing configs you can mess around with in Iterm2 at least.<p>- Shell integration. Jump to your last shell prompts in scrollback. Highlight all your prompts in all your panes. Then move to those panes with your mouse without clicking. Amazing.
评论 #23004707 未加载
评论 #23004493 未加载
评论 #23005730 未加载
评论 #23004635 未加载
评论 #23014219 未加载
nickjj大约 5 年前
If anyone is curious what it looks like to use tmux in your day to day, I made a video about this at: <a href="https:&#x2F;&#x2F;nickjanetakis.com&#x2F;blog&#x2F;using-tmux-sessions-windows-panes-and-vim-buffers-together" rel="nofollow">https:&#x2F;&#x2F;nickjanetakis.com&#x2F;blog&#x2F;using-tmux-sessions-windows-p...</a><p>It covers how I use tmux sessions, windows and splits along with Vim buffers &#x2F; splits &#x2F; tabs to manage my work flow for developing applications and switching to different projects within seconds.<p>Despite the video being almost a year old, I work in the exact same way today. It&#x27;s been a very wonderful experience. My dotfiles are included at the bottom of the post if you wanted to poke around the configs.
评论 #23006415 未加载
cletus大约 5 年前
So I predominantly use Macs. The one and only reason why I personally use tmux is because of tmux -CC. I never bothered with screen&#x2F;tmux simply because I didn&#x27;t want to learn another whole new set of keybinds (let alone reconfigure them). tmux -CC largely behaves as a native app. Want a new tab? CMD+T. New window? CMD+N. Scrollback with the trackpad. That sort of thing.<p>The complete system is iterm2 + tmux -CC + et (EternalTerminal) for persistent ssh connections.
评论 #23008025 未加载
评论 #23010761 未加载
dustinkirkland大约 5 年前
Hi there! I&#x27;m the author and maintainer of Byobu (byobu.org) here. Byobu started as &quot;Screen for mere mortals&quot;, but eventually pivoted to work with Tmux, as well. Nowadays, Byobu is much more tightly tied to Tmux. You can think of it, as a super opinionated set of Tmux settings, easily portable across all of your machines. Happy to answer any questions here!
评论 #23009458 未加载
评论 #23027522 未加载
ssivark大约 5 年前
What this author has settled on looks very similar to commonly used tiling window manager shortcuts (which should not be very surprising, because a lot of the constraints desired by the author apply to the other situation also). In fact, even more directly, the author is basically using TMUX as a the tiling window manager for their terminals. So, I guess the funny thing is, this gives a nice bunch of Tmux shortcuts, <i>unless</i> you&#x27;re using a tiling WM for your system , in which case this is hopeless :-)<p>BTW, for any newbies looking to start out with tiling window managers, I would <i>highly</i> recommend Regolith (which is basically i3 with a nice set of conventions).
评论 #23004077 未加载
评论 #23004320 未加载
评论 #23005203 未加载
评论 #23006311 未加载
评论 #23006430 未加载
necrotic_comp大约 5 年前
I didn&#x27;t see this posted in this thread, but by far the most useful thing I&#x27;ve seen with tmux is the &quot;send-keys&quot; command - <a href="https:&#x2F;&#x2F;blog.damonkelley.me&#x2F;2016&#x2F;09&#x2F;07&#x2F;tmux-send-keys&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.damonkelley.me&#x2F;2016&#x2F;09&#x2F;07&#x2F;tmux-send-keys&#x2F;</a><p>This is nice in isolation, but it becomes powerful if you have a persistent target and have a keybinding to issue a send-keys command to the persistent target.<p>For instance, in my vimrc, I have a set of commands bound like so:<p>noremap &lt;leader&gt;R :silent !tmux send-keys -t 2.2 startjob Enter &lt;CR&gt;<p>noremap &lt;leader&gt;E :silent !tmux send-keys -t 2.2 killjob Enter &lt;CR&gt;<p>where startjob is a local alias to starting my development environment and 2.2 is the target.<p>This means from any of the vim instances I have, I can start and stop my development environment without having to do so in a running vim instance, and get all the appropriate logging in a terminal that I can switch to when I choose.<p>This becomes even more powerful with a build script I have triggered by an inotifywait that&#x27;s running in 2.1 that will build my entire environment with all its dependencies (yes, I need to do it this way because building one project may require another to be rebuilt, and just triggering &#x27;make&#x27; in vim doesn&#x27;t cut it) whenever a file is written.<p>It reduces a lot of the pain with developing a C++ project in the terminal and lets me get back to the work of just thinking about what needs to be done.<p>&#x27;Send-keys&#x27; is, to me, the killer feature of tmux.
kyuudou大约 5 年前
If you use vim as your IDE and haven&#x27;t already, make use of nerdtree with its git addon[1] along with tmux.<p>I use different tmux colors for different environments so I know where I&#x27;m at instantly.<p>[1]<a href="https:&#x2F;&#x2F;medium.com&#x2F;@victormours&#x2F;a-better-nerdtree-setup-3d3921abc0b9" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;@victormours&#x2F;a-better-nerdtree-setup-3d39...</a>
评论 #23008370 未加载
评论 #23007675 未加载
didibus大约 5 年前
I recommend people try out byobu from here: <a href="https:&#x2F;&#x2F;www.byobu.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.byobu.org&#x2F;</a><p>Provides a nice user friendly layer on top of tmux, much recommended.
评论 #23006193 未加载
jeroenjanssens大约 5 年前
A great feature of tmux is that every action can be automated from the command line using commands such as split-window, resize-pane, and select-layout. With the send-keys and capture-pane commands you can even automate interacting with any process running inside tmux. The man page provides a good overview of these commands. There also exists a wrapper for Python [0] and I&#x27;m currently working on one for R [1].<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;tmux-python&#x2F;libtmux&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tmux-python&#x2F;libtmux&#x2F;</a><p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;datascienceworkshops&#x2F;tmuxr" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;datascienceworkshops&#x2F;tmuxr</a>
rshnotsecure大约 5 年前
Tmux is what makes Linux <i>worth</i> it for me. Or more specifically, the command line. It is incredibly freeing, and discovering it is what made me finally choose the sysadmin path over outright programming.<p>Fun Fact: Google Cloud Shell is by default Tmux. You can tell, because you don&#x27;t need to start Tmux up ever if you are in it. Simply hit something like ctrl+b++&quot; and watch your terminal split in two.
评论 #23003943 未加载
cachestash大约 5 年前
I have honestly never seen any big value in using tmux over screen. I do all the multiplexing in my window manager and I use tilix which allows me to sync commands over multiple sessions.
评论 #23008180 未加载
评论 #23005426 未加载
thom大约 5 年前
Am I missing anything if I’ve always just logged in somewhere and used Emacs within screen? I get to use all the navigation, window management and clipboard commands I’m used to. Very rarely I’ll need to fire up ansi-term which is slightly less integrated I guess.
mcjiggerlog大约 5 年前
Nice to see somebody else go through the exact same thought processes I did - there&#x27;s no need for tiling when everything other than the terminal is fullscreened on its own workspace. 2D workspace grids are crucial to this flow though, which is sadly something that seems to be slowly being removed from most desktop environments. I can recommend <a href="https:&#x2F;&#x2F;extensions.gnome.org&#x2F;extension&#x2F;1485&#x2F;workspace-matrix&#x2F;" rel="nofollow">https:&#x2F;&#x2F;extensions.gnome.org&#x2F;extension&#x2F;1485&#x2F;workspace-matrix...</a> for Gnome.<p>My tmux bindings are also different, but the logic behind them is the same. Mine are available here - <a href="https:&#x2F;&#x2F;github.com&#x2F;tom-james-watson&#x2F;dotfiles" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tom-james-watson&#x2F;dotfiles</a>
K0SM0S大约 5 年前
&gt; Now tmux feels like a regular desktop app and truly boosts the productivity in the terminal. What do you think?<p>I think it&#x27;s <i>really</i> nice. Well done!<p>&gt; Mod+V: split vertically<p>&gt; Mod+B: split horizontally (“bisect”)<p>That&#x27;s <i>smart</i>. I love it!<p>% and &quot; tend to feel... just weird. I can see the visual cue, but it&#x27;s always been weird to me nonetheless.
评论 #23004021 未加载
评论 #23004190 未加载
todd3834大约 5 年前
I spend a lot of my time using VIM. About 6 months ago I started using tmux. I can honestly say I love it. It was a little rough at first but I just made a cheat sheet on a piece of paper the size of a business card. That helped a lot. The default keys start to feel okay just like with VIM. I don’t have any problem with people customizing tools however they want so this post is really great. Anything that lowers the barrier for entry and or improves things is great.<p>Personally I like to try the defaults for a reasonable length of time to see if there is maybe some logic behind why they were chosen. I’ve gotten so used to the defaults now that I don’t think I would change too much except for this one thing:<p>- Opening a new pane or window was customized to start in the folder where the command was originated from.
评论 #23004073 未加载
评论 #23004334 未加载
opan大约 5 年前
I see he generically refers to &quot;the mod key&quot; but I don&#x27;t see anything declaring what the mod key should be like you would in a tiling wm config, so I&#x27;m assuming the M- is the <i>meta</i> key in all these keybinds then. I wish that had been made more clear. I was pretty curious the whole time I read the article how he&#x27;d changed C-b to something else and what he&#x27;d picked. I had also briefly wondered if he&#x27;d somehow made things modal like vim so he could enter some sort of &quot;tmux mode&quot; where he could just press a key for an action and then return to his insert mode after. (also a bit like i3&#x2F;sway&#x27;s modes, the most common one being for resizing windows)
swiley大约 5 年前
A lot of people seem to think tmux is a replacement for a window manger which IMO isn’t quite right.<p>Personally I use it to organize VT sessions by topic; I’ll make a tmux socket in the root of a project (or at work, ticket) folder and leave things like vim running, that way I never end up loosing vim and opening it twice. You still need a window manager in addition to this to handle efermal windows (browsers, REPLs, other VTs with tmux for other projects etc.)<p>Also it keeps things from getting SIGHUP. Some fancy VT app probably isn’t going to do that and it’s certainly not going to do it in a platform agnostic way.
gfiorav大约 5 年前
These days I dropped tmux for vim :term (panel for files&#x2F;terminals; tabs for workspaces). If I&#x27;m in a remote server and want to preserve the session, I just use screen.
dfee大约 5 年前
Now would be a cool time to remark that VSCode is adding tmux control mode support (As of yesterday it was added to the backlog) [0]. This will be very useful in persisting terminals.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;vscode&#x2F;issues&#x2F;90696" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;vscode&#x2F;issues&#x2F;90696</a>
评论 #23006321 未加载
kohtatsu大约 5 年前
IMO these are the most important tmux config directives.<p><pre><code> # Inherit directory bind &#x27;%&#x27; split-window -h -c &#x27;#{pane_current_path}&#x27; bind &#x27;&quot;&#x27; split-window -v -c &#x27;#{pane_current_path}&#x27; bind c new-window -c &#x27;#{pane_current_path}&#x27; # Vim pane movement bind h select-pane -L bind l select-pane -R bind k select-pane -U bind j select-pane -D # Misc set -g renumber-windows on set -g escape-time 0 </code></pre> My prefix is Ctrl+F fwiw (on the inner session), I think with capslock as control I wouldn&#x27;t want to bother remembering and committing to one-stroke bindings.<p>System Preferences &gt; Keyboard &gt; Modifier Keys on Mac, I think it&#x27;s xkbdmap or such on Linux&#x2F;X11.<p>Edit: not to detract from the OP, it looks like they put a lot of thought into the ones they made so I&#x27;d do well to give them a shot. I&#x27;m happy tmux makes it so easy to bind keys as such.
ramraj07大约 5 年前
Tmux is amazing, my only request is there be an option to name panes (with the names showing perpetually on top or bottom of the pane). Every time I ssh into an ec2 instance I can&#x27;t remember what logs are showing in each pane!
评论 #23004428 未加载
JanMa大约 5 年前
If you are looking for a nice tmux config I can definitely recommend &quot;Oh my tmux&quot;: <a href="https:&#x2F;&#x2F;github.com&#x2F;gpakosz&#x2F;.tmux" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;gpakosz&#x2F;.tmux</a>
hx2a大约 5 年前
I&#x27;m currently reading &quot;tmux 2&quot; by Brian Hogan. It&#x27;s a great intro to what tmux can do and how to use it well.<p><a href="https:&#x2F;&#x2F;pragprog.com&#x2F;book&#x2F;bhtmux2&#x2F;tmux-2" rel="nofollow">https:&#x2F;&#x2F;pragprog.com&#x2F;book&#x2F;bhtmux2&#x2F;tmux-2</a><p>It&#x27;s a quick read and worth the effort. Available through O&#x27;Reilly learning online.
pot8n大约 5 年前
I&#x27;ve been using Tmux for years now when sshing to servers and I still can&#x27;t even make some copy-paste with my mouse.
d0m大约 5 年前
On my side, here&#x27;s how I configured my mac.<p>Workspace at the top level.<p>- cmd+f1..f9 --&gt; Switch to workspace. - cmd+ctrl+1..9 --&gt; Also switch to workspace (because fkeys are removed and the touchbar is terrible)<p>Inside each workspace, I use one app in full-screen.<p>Workspace 1 = IDE Workspace 2 = Terminals Workspace 3 = Browser Workspace 4-9 depends (Spotify, debugger, etc.)<p>For each app, I switch between tabs using cmd+1...9.<p>So intuitively, to jump somewhere, cmd+fX to go to the right workspace, then cmd+X to jump to the right tab. For instance, I know my database logs are always in the first tab of my terminal, so: cmd+f2, cmd+1. (On the mac with touchbar, capslock+cmd+2 then cmd+1 (as capslock is bound to ctrl)).<p>I try to keep this nomenclature everywhere as much as possible. For instance, in Chrome, cmd+1..N jump to the right tab. I configured vscode to do the same. I also disable any transition animations.<p>For me, this is so intuitive and fast that I have a hard time using 2 monitors as it&#x27;s faster to jump to the right place than moving my head around or to find the app using cmd+tab.<p>Finally, where it makes sense, I sub-divide some tabs in tiles. For instance, my &quot;web server tab&quot; is often divided in 4 tiles. Or my IDE is split in various tiles with the files I&#x27;m working on.<p>I used a similar approach back then when I was using stumpwm on linux and tried to bring it back to my mac with as little configuration change as possible. (I only have to map caps lock to ctrl and tweak a few hotkeys to switch workspaces).
mkhnews大约 5 年前
I have to say I spent some time on my tmux config, but the result is just awesome. I have key bindings to search&#x2F;select&#x2F;copy text and have integrated the mouse fully and can copy&#x2F;paste between all windows and other apps (such as firefox etc.) perfectly. I find tmux an incredible tool.
jchook大约 5 年前
I feel my spacebar is simply too big and could allow another “mod” key.<p>Would make a world of difference for apps like Tmux.
kps大约 5 年前
All I use tmux for is to reattach to sessions after a connection drops. The rest I just configure away as much as possible, but not quite as much as I want. Is there any simpler utility that <i>only</i> provides persistent sessions?
评论 #23009817 未加载
hendry大约 5 年前
Rebinding tmux to make it more like a window manager?<p>Two problems with this. 1) tmux is slower than a window manager like dwm 2) Why not just use dwm<p>Personally feel rebinding a tool like tmux will bite you down the road.
snvzz大约 5 年前
Changing the default keybindings will bite you in the back, the moment you have to touch a system that isn&#x27;t yours.<p>It&#x27;s worth learning the defaults, and it&#x27;s not that hard. They do make some sense.
xref大约 5 年前
So in the era of containers and kubernetes and devops “if you have to ssh in you’re doing something wrong” does learning tmux still have high value?
afarviral大约 5 年前
This is just what Ive been looking for! Thanks!
era86大约 5 年前
Tmux + Vim + TrackPoint (ThinkPad) means I very rarely ever leave home-row. It&#x27;s amazing!
zimpenfish大约 5 年前
Having tried tmux this week (I&#x27;m a screen diehard) and had it entirely disconnect and lose the session without warning because I pressed ... some key combination I have no idea what ... I&#x27;ve put that back into the &quot;eh, maybe&quot; pile for another 5 years.
strangelove026大约 5 年前
How does copy and paste work with this? On a mac
0xff00ffee大约 5 年前
Hmmm... I would find this extremely error-prone. Probably due to my own issues, but flipping through multiple remote sessions in tmux in the same window would get confusing after N=2 terminals.<p>But who manages THAT many remote sessions? Seems like an upstream problem to me, no?
评论 #23012980 未加载