5 ms·
the author goes in details on why tmux is great, which it is, but fails to mention it's greatest feature: send-keys. I can have my code in pane 0 and my code c
by buf 3y ago
the author goes in details on why tmux is great, which it is, but fails to mention it's greatest feature: send-keys.
I can have my code in pane 0 and my code console running a shell in pane 1, and simply use the send-keys command to execute the selected code (or line) instantly in pane 1.
I use this command more than 100 times per day.
- phero_cnstrcts 3y agoInteresting. Is it for testing out parts of a shell script or does it have more uses?
- buf 3y agonot just a shell script. Any code. I could have a rails console running below in a pane and send rails code directly from the file above. Works with anything
- thristian 3y agoI find it incredibly useful for iterating on SQL queries. Write a query, send to the database, examine the result, tweak the query a little, go around again.
- ilyt 3y agoI just use that feature in IDE...
- perrygeo 3y agoUseful for executable documentation or runbooks, whatever you call the next level above scripts. You check your scripts into source control but how do you invoke the script? Copy and paste the example? Type it by hand every time? There's no need to copy-paste from a README into a terminal when you can "send" it.
- deleted 3y ago[deleted]
- FirmwareBurner 3y ago>simply use the send-keys command to execute the selected code (or line) instantly in pane 1. Sorry, I don't get it. How can you only run selected code or lines individually without the full context of the program/project that code is part of?
- wcrossbow 3y agoThis style of doing things is very common in languages with a (good) REPL, think clojure or ipython. You keep sending snippets and iterating on them until they work as intended. For that, you don't need the full context of your program. Not a LISPer but apparently in that land you could actually have the program running and a REPL attached to it, in which case, you actually do have all the program at your disposal.
- vladvasiliu 3y agoThe only nice REPL I have experience with is ipython. And even a few years ago, just turning on autoreload allowed me to do that without selecting anything and copying / pasting, just edit the function in the editor and run it again. IIRC the docs said there were some edge cases, but I never ran into those.
- crabbone 3y agoWhy do people keep repeating it... Python doesn't have a REPL. It has an interactive shell. Read-eval-print-loop relies on being able to feed what you print back to the read function. Interactive shell doesn't need the ability to print code: it prints whatever information a function wants to print (often times nothing). In Python sometimes you can feed back the results of a function into some other function (when you are in the interactive shell), but usually they are nothing like Python code...
- buf 3y agoHere is a super basic example of running rails code: https://cln.sh/xXNlf51m https://cln.sh/xXNlf51m Now imagine instead of a empty rails shell, I had my server running there and I can set breakpoints. Or why not both a shell and a server?
- ilyt 3y agoI select it with a mouse and paste it with middle button...
- bombcar 3y agotmux is for people who hate touching the mouse. It almost could stand for “touch mouse? Unthinkable eXercise!”
- colpabar 3y agoI started out as a vim+tmux purist and couldn’t agree more. I mainly use vscode now but I still use vim keybindings. I loathe having to use the mouse and I think I will forever.
- perrygeo 3y agoThis. It changed my workflow from "type commands directly in your terminal" to "type commands as a playbook, then execute the playbook line by line". Self-documenting, no copy-pasta errors, a full curated history of your workflow in plain text without having to reconstruct it from shell histories.