17 ms·
Vim.wasm
- kalefranz 7y agoWhere’s the escape key on my iPhone?
- switz 7y agoI think I finally understand Kafkaesque.
- microcolonel 7y agoThere is no escape.
- deleted 7y ago[deleted]
- sbr464 7y agoTry: Ctrl and [ That should send the same as Esc (ASCII 27). I seem to remember this working on a new iPad Pro keyboard.
- no-such-address 7y agoThis is incredible. I think I needed this about 40 years when typing on a small Teletype (non-ASR33) without an escape key.
- midgetjones 7y agoThe reason is interesting as well. Paraphrasing from this blog post[0] When you format the ASCII table in four columns, you can see `ESC` and `[` on the same row. Holding `CTRL` essentially ~lops off the first three bits~ subtracts 64, resulting in `ESC` ... ... 0011000 CAN 0111000 8 1011000 X 1111000 x 0011001 EM 0111001 9 1011001 Y 1111001 y 0011010 SUB 0111010 : 1011010 Z 1111010 z 0011011 ESC 0111011 ; 1011011 [ 1111011 { 0011100 FS 0111100 < 1011100 \ 1111100 | 0011101 GS 0111101 = 1011101 ] 1111101 } 0011110 RS 0111110 > 1011110 ^ 1111110 ~ 0011111 US 0111111 ? 1011111 _ 1111111 DEL [0] http://www.catb.org/esr/faqs/things-every-hacker-once-knew/ http://www.catb.org/esr/faqs/things-every-hacker-once-knew/
- jcr1488 7y ago> Holding `CTRL` essentially lops off the first three bits No, it inverts the 7th bit (or subtracts 64). The Linux `ascii(7)` man page has a similar table, but with 2 columns. The first 32 control characters listed there have their "caret notation" character in the opposite column.
- midgetjones 7y agoThanks! Listen to this person ^
- nothrabannosir 7y agoIs this why the symbol for Ctrl is also commonly the symbol for xor?!
- jcr1488 7y agoI'm not sure. I think the caret is just a prefix to make it distinguishable from the normal letters. It is the reason why Ctrl+i in a terminal is the same as Tab though. Likewise for Ctrl+m == Enter.
- closeparen 7y agoStandard adaptation for touchbar Macs, too. I find it less of a disruption from the home row.
- daveFNbuck 7y agoCaps lock is right on the home row.
- ultrarunner 7y agoBUT HOW WOULD I WRITE MY FORTRAN?
- closeparen 7y agoOh, right. I have control remapped on caps lock, so it's caps lock + [.
- boomskats 7y agoThis is where https://github.com/alols/xcape https://github.com/alols/xcape is amazing. I'm not sure, but I think Karabiner can be configured to act the same way.
- apetrovic 7y agoKarabiner is amazing. I have caps lock mapped to ctrl-cmd-alt when pressed with some other key, and esc when pressed and released alone.
- daveFNbuck 7y agoI just remap caps lock to escape.
- sbr464 7y agoNot as easy to remap keys though, on the iPad (keyboard cover) unless I’m not aware.
- hairui 7y agoYou can also ctrl-c
- teddyh 7y agoSomething else to try is Ctrl-3. This commonly gives the ESC code.
- opan 7y agoI missed the lowercase i on first read. I'll comment anyway in case this helps others. Hacker's Keyboard from f-droid has an escape key. If using the compact layout you can get to it by holding the tab key. I think on the full layout it has a more traditional placement. I'm not sure what alternative keyboards iOS has.
- pjc50 7y agoAndroid at least lets you install custom keyboards - and there are hacker keyboards that have escape on ... Very useful for SSH and termux.
- lvh 7y agoiOS has the same feature: https://developer.apple.com/design/human-interface-guidelines/ios/extensions/custom-keyboards/ https://developer.apple.com/design/human-interface-guideline...
- ClassyJacket 7y agoWhere's the escape key on my Macbook Pro?
- vorpalhex 7y agoSame place as before, it's just no longer as squishy
- hota_mazi 7y agoThere's none, use Ctrl-[, duh.
- deleted 7y ago[deleted]
- hq6 7y agoRunning on Firefox and `Shift` generates a `^P` character.
- RandomGuyDTB 7y agoFirefox on Debian 9 x86 here, not happening to me.
- knolax 7y agoSame, Firefox on Arch
- lone_haxx0r 7y agoSame here, Firefox on Ubuntu 16.04.
- arendtio 7y agoSame, Firefox on Arch
- nyx_ 7y agoI thought I was getting stuck in insert mode, and I got fairly frustrated before realizing my Vim keybindings browser extension was grabbing ESC and keeping it from this weird browser-Vim. We brought this abomination on ourselves.
- xissy 7y agoSame here.
- chrisshroba 7y agoSame, curse you vimium!
- jniedrauer 7y agoWe have strayed too far from RMS's light
- dguaraglia 7y agoRMS is the Terence McKenna of open source: a fundational figure whose ideas where way ahead of the curve, but also a too extreme to attract the mainstream.
- neilv 7y agoAlmost no one goes full RMS. But I suggest that the world would be much better if everyone went even 50% RMS. Relevant: https://old.reddit.com/r/StallmanWasRight/ https://old.reddit.com/r/StallmanWasRight/ (Disclosure: RMS was a childhood hero, since I read the Steven Levy "Hackers" book, right up there with Mr. Rogers, Richard Feynman, Neil Armstrong, and Marvin Minsky. One day, RMS reached out, to ask me to sign over copyright, to the FSF, of a tiny bit of Emacs code ("Yes, sir!"). Today, I occasionally have the privilege of exchanging emails with him.)
- OskarS 7y agoIt's true, even though most people don't go "full RMS", he's clearly a force for good in the Universe, and he's fighting the good fight for the benefit of all of us.
- AndyKelley 7y agoThe GitHub readme has a bunch of great content on it. https://github.com/rhysd/vim.wasm https://github.com/rhysd/vim.wasm
- frutiger 7y ago:colorscheme unknown "that's weird :set file^I^I "I guess tab autocomplete doesn't work :set filetype=cpp i#include <iostream><Esc> "I guess syntax highlighting doesn't work either :set tabstop=4 softtabstop=4 i^I^I "at least that worked!
- mises 7y agoAny plug-in support? Could I upload my vimrc to a server, then download it, apply it, and run :PlugInstall to get my vim setup in any web browser?
- unrealhoang 7y agoOnly if your plugins are Vimscript only
- hestefisk 7y agoWould be even more awesome with plain nvi support :)
- masukomi 7y agowhere would it store your plugins? this is vim running in your browser, not some weird hybrid server-side vim thing that stores all your config files and plugins server-side in a per-user account but then transpiles them to wasm (regardless of plugin language) and sends them to the browser.
- steve19 7y agoUnfortunately it's not working on my android phone with hacker keyboard (full keyboard with esc). There are also horizontal lines across the screen that should not be there.
- positr0n 7y agoI am impressed that :imap jk <Esc> :imap kj <Esc> works great. However it seems like outer and inner text objects aren't working at all. E.g. daw, ci)
- Rainymood 7y agoAnytime I end up in someone else's Vim editor the first thing I do is :imap kj <Esc> Worked fine here, felt super snappy too.
- fxfan 7y agois this a common key binding? I've seen it before and it makes a lot of sense but I'm wondering if I will run into issues. I don't want to disrupt my flow and muscle memory and later regret it.
- govg 7y agoUnless you type a lot of graph algorithms notes (and have to write "Dijkstra"), you rarely encounter the key sequence jk. It makes it easier to work with vim and never move to hit the Esc key.
- irishsultan 7y agoThat or you're writing in Dutch. Neither of ij, jk or even kj work in Dutch, because they are very common.
- govg 7y agoThat's a very fair point! I hadn't considered this at all, I mostly write in English, and subconsciously assumed this would be true of most Vim users.
- mkl 7y agoI guess it depends whether you want to write about playing blackjack with Dijkstra in Reykjavik! I might need to try it out for a bit. It has the nice feature that if you press it in normal mode there's usually no effect.
- yjhoney 7y agosorry for being dense, but I can't seem to save files or do anything seemingly practical. Is there any practical use cases for this library, or is this purely along the lines of "Hey checkout this cool hack!"
- tomrod 7y agoFor the moment I'm going with hack. I hope the author will work out some of these kinks so that it becomes usable !
- boothby 7y agoWhen I was working on the Sage Notebook, circa 2007, I made the best textarea-IDE I could... folks requested vim and emacs bindings but browsers just weren't ready. Heck, I wrote my own javascript console because iirc only Firefox had one at the time, I digress... I look forward to a vim plugin for the IPython notebook!
- _bohm 7y agoI used this back in the day and it worked pretty well. Not sure how it cooperates with the newer Jupyter makeover but worth a shot! https://github.com/lambdalisue/jupyter-vim-binding https://github.com/lambdalisue/jupyter-vim-binding
- espadrine 7y agoIt is a text editor, not a file server. It is similar to CodeMirror, Ace, and Monaco. CodeMirror: https://codemirror.net/ https://codemirror.net/ Ace: https://ace.c9.io/ https://ace.c9.io/ Monaco: https://microsoft.github.io/monaco-editor/index.html https://microsoft.github.io/monaco-editor/index.html
- opan 7y agoI haven't tried it yet, but that should still make it as useful as pasting text into vim to make changes quickly. Things like highlighting a sentence and making it all lowercase or uppercase is very simple. (v/V/C-v for one of the visual mode selection types, then pressing u after the select makes it all lowercase, and ~ can swap case if you had capslock on and typed "sOMETHING LIKE THIS"). There's also :sort for quick alphabetizing and the classic :s/word1/word2 text replacement.
- tomrod 7y agoThis is so cool! Well done!
- diehunde 7y agoLol. Why no :Explore?
- be_erik 7y agoThis is absolutely incredible. I never thought this would be possible-- wasm opens a new phase of software development and deployment.
- techntoke 7y agoOr just use regular Vim and not think that everything needs to run inside of a web browser, especially if you value user privacy and computer resources.
- orev 7y agoWould be nice to be able to use vim (or any other editor of your choice) in web text boxes.
- deleted 7y ago[deleted]
- semi-extrinsic 7y agoThere are browser extensions that offer this. E.g. the excellent Tridactyl for Firefox lets you pop up a gVim window for any text box if you press Ctrl+i.
- herewulf 7y agoThis has been possible for years with Vimperator and then Pentadactyl. Unfortunately it's awkward and can't take advantage of text fields with real time JavaScript processing (e.g.: Gmail, Markdown preview).
- chansiky 7y agoThere is surfingkeys for chrome. You press `shift+I` to go into into insert mode. [surfing keys](https://github.com/brookhong/Surfingkeys https://github.com/brookhong/Surfingkeys)
- opan 7y ago
- taf2 7y agovery cool, some of the set commands don't seem to work for me... set softtabstop for example didn't appear to work. also i might have a local setting but tab complete with set wasn't working... again probably local settings. and :w wtf didn't work :D seems to crash it. This is super cool [update] ah i see from the readme write support is in the todo list.
- viksit 7y agoAlso see previous discussion about the code on the GitHub repo https://news.ycombinator.com/item?id=17487936 https://news.ycombinator.com/item?id=17487936
- chris_wot 7y agoDon't do :wq
- Dynomite54 7y agoA little late for that.
- kurtisc 7y agoOr try to change splits
- tomjakubowski 7y agoDoes anyone know if lynx plans on supporting wasm? I'd like to try this editor in a terminal.
- 42yeah 7y agoHow about this in emacs www mode?
- halter73 7y agoAt this point, the easier route to getting a text-based browser to support something like this would be creating a new one based on WebKit/Blink. It would probably need to get the engine to draw to a fake screen buffer and run an OCR algorithm over that. And even if the OCR and layout worked well, there would be a lot other work necessary to get reasonable text based interactivity, though that's probably partially solved by projects like Vimium. Some interactions like dragging would likely never be supported. Not easy at all, but somehow more reasonable than updating lynx to support all of today's new technologies. I wonder if anyone's already tried something like it.
- halter73 7y agoI just found Browsh[1] which seems to be basically this but with Gecko. It seems they don't need to do OCR which makes sense thinking about it more. Cool stuff. Haven't gotten to try it yet. [1] https://www.brow.sh/ https://www.brow.sh/
- tombh 7y agoI did! See brow.sh It uses Firefox as a backend so can in fact run Wasm. However it doesn't use OCR, it uses the DOM to get precise coordinates for text nodes, this recreating a pure text representation of the page, using nothing but spaces and carriage returns for "formatting".
- colordrops 7y agoThe vim browser demo uses pixels drawn to canvas though.
- lone_haxx0r 7y agoI can't save. :w test "test" E667: Fsync failed Warning: original file may be lost or damaged.
- sabujp 7y agoi had to turn off adblock plus and ublock origin to get this to work for some reason
- fouc 7y agoWhy does it completely freeze on :w foo ? It asks for ENTER or any key but that doesn't work at all at that point.
- fouc 7y agoWill wasm ever use html/css properly? Or will it just be more like flash?
- overgard 7y agoWell, HTML/CSS are sort of separate and wasm doesn’t replace them, but if you mean DOM access, it’s planned but not available yet. You basically have to write JS glue code that interacts with your web assembly code
- jillesvangurp 7y agoIt can already interact with the dom and people are working on making this more seamless and faster. The real question would be: why would you do that when you can instead use any proper native UI toolkit? Answer: it's now a choice. If you need command line stuff like vi running smoothly in a browser, the DOM is an obstacle, not a solution. If on the other hand you want a wasm application driving the DOM and generally looking and feeling like a web app, you can do that as well. There are several frameworks emerging for rust, kotlin, C#, and other languages that do exactly that and that use bindings for the DOM and other APIs you have in javascript in a browser. Basically, you are writing normal dom/html/css based applications; except it all compiles down to wasm and does not involve any javascript.
- z92 7y agoGood work. Almost there. Things that doesn't work starts from where you might need to change word "ciw", visually select word "viw".
- curioussavage 7y agopretty fun as an experiment. It would be so cool if someday github/gitlab had this as an option for editing files
- opan 7y agoI think this is why a lot of people still handle issues via email. It integrates well with the classic text editors.
- SuMu2600 7y agoIs there a good iOS port of Vim available?
- Terretta 7y agoiVim by Boogaloo https://github.com/terrychou/iVim https://github.com/terrychou/iVim
- mshockwave 7y ago:! cat /etc/passwd [blocked] sorry can't help myself trying this. but good job!
- irth 7y agoIt runs client side, though
- metalliqaz 7y agoIt's nice when tools prevent you from pwning yourself :)
- User23 7y agoVi, the original roguelike.
- cyansmoker 7y ago<ctrl-w>w closed my browser window. Should have seen this one coming.
- monokrome 7y agoThis is pretty dope, but I'm terrified about the fact that Firefox lets it take over Ctrl+L, Ctrl+1, or any other way (that I can find, at least) of breaking out of Vim with a keyboard aside from closing the tab with Ctrl+W - which is even more terrifying since I use that in Vim a ton, too :O ...but this is pretty cool :D
- TeMPOraL 7y agoThis is a problem. The browser wants to be a computing platform, so it's injecting itself between the actual OS and the software you'd like to run. But it's still an userland program, so it uses regular keyboard shortcuts. Shortcuts the software you'd like to run needs as well. I had a similar problems with Emacs in the browser (I stumbled upon it a long time ago). The keys I needed the most were also the keys intercepted by the browser.
- aasasd 7y agoThe actual issue is that Windows and Linux don't properly use a ‘super’ key―while the ‘Win’ key is sitting there uselessly. Ironically, MS' own ‘ergonomic’ (cough) keyboards have gigantic Win keys, right under the thumbs which are the strongest digits. These keys are great to use on Mac, it's an eye-opener as to how the historical keyboard mutations ended up in just the wrong way for two platforms (and for Emacs). I could also say some things about the nonsensical shape of keyboards and the moronic replication of the typewriters' staggered key layout...
- the_pwner224 7y ago> The actual issue is that Windows and Linux don't properly use a ‘super’ key―while the ‘Win’ key is sitting there uselessly. Some people do use the super key. I have it bound to a huge number of actions (WASD to switch workspaces, Alt+WASD to move window to adjacent workspaces, C to close window, X to pause/unpause media, Z to show workspace overview, tab to switch between workspaces like alt-tab does for windows, P and ; to invert colors, F and T to control window tiling, / to bring up the dropdown terminal, and the 4x4 grid from '6' to '.' to go to one of my 16 workspaces). It would be a shame if applications started using 'super' in their keybindings - having a key that is effectively globally reserved for user-configurable actions is very useful. There are no worries about conflicting keybindings when you use super; the same cannot be said of keybindings that use ctrl or even ctrl+alt+letter - for example, many IDEs use ctrl+alt+letter to do stuff, which would mess with global user-configured shortcuts. Perhaps the position could be optimized though.
- tinus_hn 7y agoPerhaps it’s because I block web fonts but once I start typing little turds remain where the intro text was.
- nitrogen 7y agoI've seen that too on other sites, and I think it's a font rendering bug with hinting or subpixel smoothing not properly adjusting the bounding box that needs to be repainted.
- chapium 7y agowhy do you block webfonts?
- woogley 7y agoSame reason people block Google Analytics or Facebook Like buttons. Many fonts are hosted by fonts.google.com
- dingaling 7y agoPersonally because I prefer the fonts that I have chosen.
- tinus_hn 7y agoFont parsers are generally poorly written so avoiding untrusted fonts is more secure. Web fonts also slow down the web and are a privacy issue. All that for no gain because they are completely useless. I already have fonts on my computer and they are fine. That’s why I block web fonts.
- roryokane 7y agoI see that too in Firefox on macOS, even with all blocking turned off. You can fix it with Vim’s ^L command (control-L: refresh display). I’ve had to do that in the MacVim GUI occasionally too, especially when displaying symbols such as “→” that are wider than a normal character.
- tkinz27 7y agoI wonder if this will be useful for electron based editors like vscode's vim plugin. I know the plugin is "good" but I always find something that works in vim and doesn't in the plugin and end up going back to my terminal.
- johnny22 7y agoI heard that you could embed neovim for that sort of thing, since neovim has an ipc. I don't know how well the feature is maintained though.
- greggyb 7y agoI thought this was just for ex mode, not for all of normal and insert modes.
- rdrey 7y agoI recently found Oni, which aims to be a web-tech UI for neovim. (The new version should even support the full VSCode extension API / ecosystem) https://github.com/onivim/oni2 https://github.com/onivim/oni2
- bhaak 7y agoTrying to save errors out with "E667: Fsync failed" and then it gets stuck.
- netmonk 7y agoHow can i save a file ?
- deleted 7y ago[deleted]
- jodrellblank 7y agoHow do Emscripten cross-compiled things and WASM compiled things handle the display? Is it a framebuffer they blindly draw to, do they need shim layers added to interpret normal output to window-scaled in-browser output?
- bbayer 7y agoIn this example, author implements custom UI layer as it is described in readme "WebAssembly frontend for Vim is implemented as a new GUI frontend". Input and output is handled in JS side but core functionality resides on WebAssembly part. I am not familiar with Vim but probably I/O is well seperated from logic code so it might be easier to modify it to work on browser but I actually don't know how it is working for other applications.
- odiroot 7y agoTry inputting some diacritics, it breaks spectacularly. Just tried ą ę ł etc ;)
- ww520 7y agoThink I crashed it. Did a :w foobar and got an error and the page was stuck, with the computer fan ramped up.
- nunobrito 7y agoLooks good! How can I close it?
- yitchelle 7y ago:q! is not working! Help, I can't exit. But seriously, this is great work.
- webvimbeta 7y agoThe timing on this is really interesting for me. I've been working on a full web vim product (plugins, multi-session, cloud storage, backup, etc.) and I'm pretty close to a beta product (POC is fully functional, just polishing a few rough edges). If anyone is interested in hearing more, email me at webvimbeta@gmail.com
- mikorym 7y agoWhat is the use case for this?
- linsomniac 7y agoDoes this get us any closer to being able to edit text fields using vi keybindings? I've tried some of the plugins (long ago) and was underwhelmed with the experience.
- mdtusz 7y agoTry out qutebrowser. Still some shortcomings, but I've switched to it for daily use.
- khorpy 7y agoI see many comments on broken key combinations. Obviously, we need to somehow overcome a UI/UX limitations of the applications that run inside a browser if we're moving into browsers with the consumer apps. I wrote a dedicated article on this: https://database.blog/trello-hot-keys/ https://database.blog/trello-hot-keys/
- rvalue 7y agoI was hoping :w with filename would download the contents :D
- hjk05 7y agoSounds like a great fun little project. Shame it doesn’t work.
- zeptomu 7y agoMy test for "non-native" Vim is always 'q:' which should open a command line window of previous commands at the bottom of your screen - unfortunately that does not work. Furthermore I can't use 'Ctrl-v' that let's you select a column of text (EDIT: correction, this does work). 'q:' should not be captured by the browser? Nevertheless impressive work.
- tjoff 7y agoctrl+v works fine for me (firefox windows)
- zeptomu 7y agoIt does not work for me on Firefox/Fedora (EDIT: it does). However 'q:' still does nothing.
- huseyinkeles 7y agovi( vi' vi" also didn't work
- sureaboutthis 7y agoWhy was wasm used for this? It's not a javascript replacement as stated by webassembly.org.
- coolreader18 7y agoBecause it's a pure port of Vim, which is written in C.
- tedmiston 7y agoOn mobile I see a blank gray page. Perhaps this only works on desktop browsers. I still have no idea what it is.
- chapium 7y agoI imagine vim wouldn't be very optimized for mobile.
- tedmiston 7y agoWhen I clicked on the post, I figured it would be some sort of vim plugin etc. Hopefully they can update the site to show a banner or some indication saying what the site is (vim in a browser?) and that it doesn't support mobile browsers.
- jhare 7y agoNow I really can't quit the internet
- vmarovic 7y agodiw or ciw doesn't seem to work :(
- exabrial 7y agoFucking touchbar.
- idoco 7y agoMy take on vim web version: http://exitvim2.win http://exitvim2.win
- jsturges 7y agoNot sure if it's a bug or user error (not sure if writing is supposed to be supported yet), but after doing the following, the page becomes nonresponsive: :o test.tx :wq I get an fsync failed error and I'm told to press enter or type a command to continue. I can't do either.
- vldr 7y agoNext step will be to bundle this in an electron app.