8 ms·
Boot to Vim, Vim as Pid 1 (2014)
- zadler 4y agoWhenever I have to do something in a TTY I kinda wish my normal terminal experience was that crisp and snappy.
- quesera 4y agoIt should be, unless you're running too much bash/zsh plugin stuff.
- petepete 4y agoAnd a terminal emulator with low latency definitely helps.
- arcanemachiner 4y agoI can only hope you're referring to network latency...
- Rufbdbskrufb473 4y agoProbably not. There are terminals with surprisingly high latency, even on modern hardware. See here for examples of ~100 ms of local latency: https://www.lkhrs.com/blog/2022/07/terminal-latency/ https://www.lkhrs.com/blog/2022/07/terminal-latency/
- codetrotter 4y agoI remember that urxvt used to be much more comfortable to use than some other terminal emulators whenever a process was spewing out thousands and thousands of lines of text. Some other terminal emulators at the time were very slow because they printed each and every line. urxvt on the other hand would skip printing lines to keep up. This was much preferable. If I intended to look at thousands of lines of text I would do so through a pager. So printing out thousands of lines of text directly into the terminal was almost always by accident. I have since gotten better at not accidentally printing a bunch to my terminal, so I am no longer using urxvt these days. But for a period of time urxvt was my preferred terminal emulator for that reason.
- petepete 4y agoI had this discussion with someone on here the other day who flat out believed I'd invented the problem. Kitty is so fast compared to anything else I've tried.
- quesera 4y ago> urxvt on the other hand would skip printing lines to keep up Really? That's a fatal flaw. Skipping lines is never ever OK for a terminal emulator. Not keeping up can also be a fatal flaw of course!
- codetrotter 4y agoIt’s not a flaw, it’s by design. https://man.archlinux.org/man/urxvt.1 https://man.archlinux.org/man/urxvt.1 > -ss|+ss > Turn on/off skip scrolling (allow multiple screens per refresh); resource skipScroll. > […] > skipScroll: boolean > True: (the default) specify that skip scrolling should be used. When receiving lots of lines, urxvt will only scroll once in a while (around 60 times per second), resulting in far fewer updates. This can result in urxvt not ever displaying some of the lines it receives; option -ss. > False: specify that everything is to be displayed, even if the refresh is too fast for the human eye to read anything (or the monitor to display anything); option +ss.
- quesera 4y agoFlawed design is still a flaw. I'll accept that it is a design feature to get around another failure mode, and that it might even be preferable sometimes. But it's a serious flaw. Terminal emulators should never drop output, that's what control flow signaling is for!
- codetrotter 4y agoIt’s not a flaw. It’s a different kind of use-case than you have in mind. It’s fine. No one is telling you to use urxvt. You can continue to use whatever terminal emulator you prefer. That’s the power of choice we have. Different programs that do the same kind of things but in different ways. So there is no reason to insist that urxvt is flawed.
- zamnos 4y agoNope. Alacrity is probably the terminal emulator that revealed this, but terminal emulation itself is sometimes there bottleneck and GPU acceleration is required to get around the problem.
- deleted 4y ago[deleted]
- zadler 4y agoNah it’s probably gnome terminal and the rest of the UI stack, schedulers etc. See eg https://lwn.net/Articles/751763/ https://lwn.net/Articles/751763/
- quesera 4y agoYes that's important too, but the magnitude of difference is relevant. A local shell with a non-pathological shell config and a reasonable terminal emulator is snappy-ish. Most sluggishness can be fixed in shell config. If that isn't working, some terminal emulators are definitely faster than others, especially on Linux with its wide variety of modern and historical choices! And of course tty will always be faster still, but far less convenient. When all is said and done and properly optimized, it's all probably still slower than the ProDOS prompt on an Apple //e (1MHz 6502 CPU), which can't help but make you wonder what we've all been doing for the last 40 years!
- 656565656565 4y agoWhat we’ve been doing for the last 40 years is producing layers of abstraction for developers to play with
- miniupuchaty 4y agoI have all the same config in TTY as in emulated terminal and emulated is nowhere near as snappy and smooth as TTY. Even with GPU accelerated terminals like alacritty, it's a lot better, but still far. If I wasn't working mostly on graphical applications I would just work from TTY.
- AlecSchueler 4y agoTry different terminals. rxvt is way faster than xterm for example.
- chlorion 4y agoI definitely recommend trying a hardware accelerated terminal emulator! It might sound silly at first, but it actually makes a pretty big difference! Even something is simple as drawing text is not that fast on a CPU, a GPU can do it not only faster but much more efficiently too.
- zadler 4y agoYea it’s about time I give it a proper go
- dang 4y agoDiscussed at the time: Boot to Vim, Vim as Pid 1 - https://news.ycombinator.com/item?id=8335226 https://news.ycombinator.com/item?id=8335226 - Sept 2014 (5 comments)
- hsbauauvhabzb 4y agoIs this comment automated? If not could it be?
- jojobas 4y agoNo, but you could bind a key to do it.
- dang 4y agoNot automated, but I wrote software to make it fast for me to find things using HN Search and keyboard shortcuts. This comes up a lot! https://news.ycombinator.com/item?id=35500297 https://news.ycombinator.com/item?id=35500297 https://news.ycombinator.com/item?id=35461648 https://news.ycombinator.com/item?id=35461648 https://news.ycombinator.com/item?id=34527279 https://news.ycombinator.com/item?id=34527279 (Jan 2023) https://news.ycombinator.com/item?id=33269207 https://news.ycombinator.com/item?id=33269207 (Oct 2022) https://news.ycombinator.com/item?id=30535024 https://news.ycombinator.com/item?id=30535024 (March 2022) https://news.ycombinator.com/item?id=29370676 https://news.ycombinator.com/item?id=29370676 (Nov 2021) https://news.ycombinator.com/item?id=28441182 https://news.ycombinator.com/item?id=28441182 (Sept 2021) https://news.ycombinator.com/item?id=27726982 https://news.ycombinator.com/item?id=27726982 (July 2021) https://news.ycombinator.com/item?id=27284079 https://news.ycombinator.com/item?id=27284079 (May 2021) https://news.ycombinator.com/item?id=27236708 https://news.ycombinator.com/item?id=27236708 (May 2021) https://news.ycombinator.com/item?id=26886074 https://news.ycombinator.com/item?id=26886074 (April 2021) https://news.ycombinator.com/item?id=26245003 https://news.ycombinator.com/item?id=26245003 (Feb 2021) https://news.ycombinator.com/item?id=26158300 https://news.ycombinator.com/item?id=26158300 (Feb 2021) (and yes of course I used the same software to find these)
- hestefisk 4y agoI’d rather boot to ed because ed is the standard editor.
- schoen 4y agoAmazingly, compared to the joke in https://www.gnu.org/fun/jokes/ed-msg.html https://www.gnu.org/fun/jokes/ed-msg.html, my copy of vim is about twice as big as Patrick's alleged absurdly large copy of vim in 1991 (plus it uses 17 times more space in support files).
- plugin-baby 4y ago> my copy of vim is about twice as big as Patrick's alleged absurdly large copy of vim in 1991 I’m guessing you’re amazed positively, given how much everything else has grown/bloated in the last 30 years!
- mtrower 4y agoActually, he’s talking about vi, not vim. You’re a whole ‘nother rung up the ladder with vim.
- schoen 4y agoThat's fair, since I could still run various more traditional vis and they'd be significantly smaller.
- samwillis 4y agoTry exiting Vim when there is nothing to exit to...
- mftb 4y ago...but then the difficulty of quitting Vim becomes a feature. Can't crash the system by exiting, if you can't exit (taps head meaningfully). /s
- BuildTheRobots 4y agoIt's less effort, but I've been changing `init=/usr/bin/vim` in grub to mess with people...
- deleted 4y ago[deleted]
- xwdv 4y agoWhat do you want to exit for? There’s only two reasons for a software engineer to use a computer: web browsing and Vim. Since you can already run commands and create files within Vim, there is nothing else to do. And soon, the web browsing part can be eliminated by running a GPT query to fetch answers to questions, right in your Vim terminal. GPT can dump pages of text right into a new buffer for manipulation. All roads lead to Vim. You don’t need anything else. Developers used vim 30 years ago and they’ll use it 30 years from now in 2053.
- mftb 4y ago> As we all know, nobody uses emacs. Ha! Old school. It's boring now that we're all pals.
- unixhero 4y agoEverybody uses Vscode, even Carmack. That war is over.
- mftb 4y agoThat's the spirit! (but I can't help it if you've mistaken a cleverly disguised web browser for a text editor.)
- divan 4y agoUntil they discover AstroVim (:
- krylon 4y agoBut it's not the standard editor! (SCNR)
- the_third_wave 4y agoEverybody who takes climate change and environmental protection seriously uses vi or - if they have to - emacs. Every time a VScode session is started the average global temperature goes up by %NaN degrees. Every time a new version is launched the smoldering heaps of electronic waste on faraway beaches rise by a few metres. People die, people are suffering. Whole ecosystems are collapsing and you're using VScode...
- alpaca128 4y agoWhat war?
- voidz7 4y agoeditor wars!
- ColonelPhantom 4y ago
- deleted 4y ago[deleted]
- etaioinshrdlu 4y agoI bet it wouldn't be too extremely hard to port Vim to https://github.com/jart/cosmopolitan https://github.com/jart/cosmopolitan and run it without an OS (BIOS mode in cosmopolitan).
- matheusmoreira 4y agoWouldn't that require implementing a terminal emulator inside vim?
- nixpulvis 4y agohttps://vimhelp.org/terminal.txt.html https://vimhelp.org/terminal.txt.html
- extinctpotato 4y agoThis is a terminal emulator within vim. I believe that they meant that a terminal emulator for Vim would be required so that it could handle ANSI escape codes, etc. This is something that a VGA graphics card couldn't handle on its own.
- jandeboevrie 4y agoAs we say in Dutch, u vraagt wij draaien (your request is my command, roughly translated) : https://raymii.org/s/blog/Bare_Metal_Boot_to_Vi.html https://raymii.org/s/blog/Bare_Metal_Boot_to_Vi.html
- etaioinshrdlu 4y agoWHOA! Awesome! You should post this on HN as a new post!
- duskwuff 4y agoThe addition of :terminal in vim8 makes this surprisingly viable. (If that works properly in this context? There might be some issues with running as pid1.)
- eimrine 4y agoIs this really possible in a real device? I would like to have a typewriter which really can not run anything except of vim.
- bschwindHN 4y agoAnything is possible with enough work!
- theK 4y agoJust keep in mind that vim is capable enough to execute other binaries, even start a shell as a subprocess.
- codesnik 4y agoI wonder, if processes started in those subshells, even normally terminated, would accumulate without normal init program? I forgot if "reaping" is something special to do.
- guipsp 4y agoPid1 must reap, yes
- mike256 4y agoReally? I think the processes would just accumulate and after some time you require a reset. Imho the same way as WSL-1 (unfortunately WSL-2 is still a no go if using citrix hypervisor) works in Windows. Okay, not really fair. It mostly works but I till get such on reaped, unkillable processed way more often than in a normal linux.
- Brian_K_White 4y agoI think they were agreeing with you that it's a problem. I don't know if it is or not myself, just saying how I read that comment.
- theK 4y ago> The above statement is ment to start a flamewar. Please do so, see the contact page to contact me. You gotta love nerds being tongue in cheek!
- Lindby 4y ago"If you exit vim, it will restart." This is like exception handling code with the comment: // this will never happen
- grugagag 4y agoI like the idea of making self sufficient app systems like this, especially on old hardware. But I have a dumb question: how do you get the files out of it if you have no networking/drivers?
- DaiPlusPlus 4y agohexdump files to console and take photos of each page of the screen, then use OCR to read the hex and output raw binary data?
- grugagag 4y agoYeah, that’ll do I guess
- rocket_surgeron 4y agoThis is so dumb. I love it.
- rektide 4y agoNot the same, but I really dig using vim (neovim) as my terminal multiplexer. Vim has tools for managing windows, splits, all the things, and it felt redundant having two separate tools. The one thing I needed was a way to attach/detach it, and have it survive across ssh disconnects. I struggled for a while trying to use things like reptyr or others. Eventually I remembered/rediscovered dtach, which is a very thin very simple proxy, as opposed to a full on terminal emulator / multiplexer. https://github.com/crigler/dtach https://github.com/crigler/dtach
- 64operator 4y agoIt would be better to boot straight into emacs because it's already a whole OS.