Readit News logoReadit News
nyx · 6 years ago
I 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.

nnq · 6 years ago

  Ctr+[
Vim-ing on devices with not physical Esc key makes you get used to this (default configured, no extra keymapping required) Esc alternative :P

latexr · 6 years ago
I really dislike shortcuts with `[` and similar keys. Design software also tends do use them. On a Portuguese keyboard layout[1], I need to press ⌥8 to get `[`. So shortcuts like ⌃[ become ⌃⌥8, which in vim produces `8`.

[1]: https://en.wikipedia.org/wiki/File:KB_Portuguese.svg

b1gtuna · 6 years ago
Whoa, I was not aware of this. Now I can completely avoid using the touchbar!
teddyh · 6 years ago
In many terminals (especially old ones), Ctrl-3 also commonly gives ESC.
equalunique · 6 years ago
I like that in spite of this requiring two fingers, each finger on it's own has to move less distance than one would in order to reach Esc.
bkanber · 6 years ago
Frankly I prefer Ctrl-[ over Esc because it requires less hand movement.
m463 · 6 years ago
Do you have a minimal keyboard?

Vim would be a particularly good editor since most operations are simple and elegant with only an occasional exit of insert mode.

but emacs... probably not as fun.

tjoff · 6 years ago
Unfortunately doesn't work for us that access [ via the AltGr layer. Unless someone knows of a workaround?
jniedrauer · 6 years ago
We have strayed too far from RMS's light
MisterTea · 6 years ago
No, I think the proper persons to look to are the C/Unix folks from bell labs where simplicity and pragmatism ruled.

RMS means well but GNU is a bloated mess.

dguaraglia · 6 years ago
RMS 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.
Jedi72 · 6 years ago
Who is RMS?
jeremyjh · 6 years ago
:imap jk <esc>

Will change your life man.

pradn · 6 years ago
I have to shy away from using these remappings because I often work in Vim-emulation mode. It's easier to map CapsLock to ESC system-wide. It works across the several Vim-emulating editors I use.
thomasfortes · 6 years ago
Consciously I know that jk is a better shortcut, but I've been using jj for so long that it's ingrained in the muscle memory, when I started using emacs the first thing that I did with evil was replicate all the shortcuts that I am used to in vim, the first one was jj.
dmitryminkovsky · 6 years ago
Hah that’s good one! I need to take a vacation and re-examine my vim life. So many good things to explore and muscle memory to tweak.
satvikpendem · 6 years ago
This is what Spacemacs and I think Evil Mode do as well
nobleach · 6 years ago
`:inoremap jk <esc>` first thing I usually do
fibo · 6 years ago
ahah nice trick, I added it to my .vimrc ... and why not? also this

inoremap uu <esc>

xissy · 6 years ago
Same here.
chrisshroba · 6 years ago
Same, curse you vimium!
tomjakubowski · 6 years ago
Does anyone know if lynx plans on supporting wasm? I'd like to try this editor in a terminal.
bla3 · 6 years ago
You might be on to something here. I could see this editor working really well in a terminal environment.
sagartewari01 · 6 years ago
You could try running it in neovim terminals.

Deleted Comment

halter73 · 6 years ago
At 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.

tombh · 6 years ago
I 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".

halter73 · 6 years ago
I 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/

aasasd · 6 years ago
> OCR

Hey, dial back the blasphemy there. HTML is not PDF, it's usually made from text in the first place.

I'd guess you could force all text to use a monospace font, with fixed measures and line-height, and limit the width of the page. Then mostly dump the resulting text arrangement into the terminal.

Now, layouts from the various elements and CSS are probably a lot trickier, but snapping all margins and padding to multiples of a symbol's size should go a long way.

It seems that this could even be embedded at different levels in the browser: the layout engine or just the user's JS. (If JS can obtain the exact layout of text lines and elements―likely not, though, especially in forms. Maybe via devtools.)

42yeah · 6 years ago
How about this in emacs www mode?
TazeTSchnitzel · 6 years ago
It would need to have its HTTP code gutted and replaced with something that uses JS's XMLHttpRequest or the request API, but I think that's all you'd need to change.
MuffinFlavored · 6 years ago
Or write a C function called http_request, refactor all of Lynx to use just this one function, and then do something like

    #if PLATFORM === 'WASM'
    then
      fetch()
    else
      the actual sockets and stuff
    end

tempodox · 6 years ago
What's a terminal? Every kid knows that anything that doesn't run in a browser can't be software.
ianai · 6 years ago
Definitely doesn’t scale.
tomaskafka · 6 years ago
You mean lynx.wasm?
AndyKelley · 6 years ago
The GitHub readme has a bunch of great content on it. https://github.com/rhysd/vim.wasm
be_erik · 6 years ago
This is absolutely incredible. I never thought this would be possible-- wasm opens a new phase of software development and deployment.
pjmlp · 6 years ago
tty2300 · 6 years ago
Wasm is company and technology independent and went through the proper process for becoming a standard rather than being forced in by some corp hoping to take over the internet.

It also doesn't have any of the security issues because its limited to things JavaScript can do.

guipsp · 6 years ago
CrossBridge is a cross compiler. Where is the open source flash runtime?
techntoke · 6 years ago
Or 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.
beefsack · 6 years ago
Don't immediately hand wave away the value of these sorts of things. I don't think anyone would use this as their primary editor, but I'd love something like this in our merge request / code review process, as that's currently entirely browser based already.
orev · 6 years ago
Would be nice to be able to use vim (or any other editor of your choice) in web text boxes.
VvR-Ox · 6 years ago
There is some benefits you may not see atm...

I'd love to have my VIM with my config just available as a web service to use it on every device! That's what I already love about NextCloud and the likes - just one install and every device can access it. If you know how you can also make it secure enough for every day stuff - I think to be really secure going offline is not enough anymore.

johnisgood · 6 years ago
Exactly. The first question that came to my mind is: "are the keystrokes logged?"
laughingman2 · 6 years ago
Or use emacs.
m463 · 6 years ago
I don't think that's necessary.

here's a VNC server in your browser:

https://github.com/novnc/noVNC

or an x window system tutorial, with an in-browser x server

https://magcius.github.io/xplain/article/index.html

personally I think this will lead to more hiding of what internet sites are doing, and prevent blocking of undesirable behavior.

ballenf · 6 years ago
The latency in Safari on a MacBook is better than VSCode. Which makes total sense, but is impressive and demonstrates how much better electron could be.
rajeevk · 6 years ago
Probably next step would be to run nginx/node in browser!

This will enable doing full web development in browser only

yjftsjthsd-h · 6 years ago
Actually I wonder how hard it would be to run node in a browser, given that it's already JavaScript. You obviously have to have to implement some amount of API surface at a minimum and it's possible that browsers are geared to be servers and clients, but it certainly sounds plausible at a first pass.
gorkish · 6 years ago
I have seen a project which runs a js webserver in a service worker; it's not a terribly far-fetched idea.
frutiger · 6 years 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!

kalefranz · 6 years ago
Where’s the escape key on my iPhone?
switz · 6 years ago
I think I finally understand Kafkaesque.
microcolonel · 6 years ago
There is no escape.
sbr464 · 6 years ago
Try:

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 · 6 years ago
This is incredible. I think I needed this about 40 years when typing on a small Teletype (non-ASR33) without an escape key.
closeparen · 6 years ago
Standard adaptation for touchbar Macs, too. I find it less of a disruption from the home row.
teddyh · 6 years ago
Something else to try is Ctrl-3. This commonly gives the ESC code.
hairui · 6 years ago
You can also ctrl-c
ClassyJacket · 6 years ago
Where's the escape key on my Macbook Pro?
vorpalhex · 6 years ago
Same place as before, it's just no longer as squishy
opan · 6 years ago
I 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 · 6 years ago
Android at least lets you install custom keyboards - and there are hacker keyboards that have escape on ...

Very useful for SSH and termux.

hota_mazi · 6 years ago
There's none, use Ctrl-[, duh.
monokrome · 6 years ago
This 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

aasasd · 6 years ago
The 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 · 6 years 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.

btym · 6 years ago
>The actual issue is that Windows and Linux don't properly use a ‘super’ key―while the ‘Win’ key is sitting there uselessly.

>These keys are great to use on Mac

The use of the super key on Mac is horrible. It should sit there uselessly, until I tell it to do otherwise. On Mac, here are no safe hotkeys to bind anything to. On Linux, my WM configuration has a ton of actions bound to the super key, and I never have to worry that it will conflict with another application.

hjk05 · 6 years ago
I’d love to hear your take on the nonsensical shape and staggered key layout. Do you have suggestions for keyboards that do away with this?

I have myself been looking at https://ergodox-ez.com/ but I’d love to hear of alternatives, especially if you have first hand experience on them.

zeptomu · 6 years ago
> The actual issue is that Windows and Linux don't properly use a ‘super’ key―while the ‘Win’ key is sitting there uselessly.

For me (Gnome) the super-key shows an overview of my windows and let's me enter a command which is fairly convenient.

TeMPOraL · 6 years ago
This 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.

tkinz27 · 6 years ago
I 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 · 6 years ago
I 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.
rdrey · 6 years ago
I 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
greggyb · 6 years ago
I thought this was just for ex mode, not for all of normal and insert modes.