-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eww integration #4107
Comments
I like your idea. It would be nice to have I think using most of Vimperator's keybindings is a good idea. |
+1 |
I'd like to prototype a pull request for this on coming days. I should be able to manage to do it on a custom layer, however as there are no external packages to be installed and also no default keys being overwritten I guess it should be put on the core. For this second option I'd need some guidance: where is the correct place to put custom keybindings on spacemacs core? Some example of well written code doing similar things?. Alternatively I can proceed with a separate layer (something like +vim/vimeww) and then if it work well think of a way to integrate on the core. I use vim keybindings, so I don't know what keybindings may sound good for emacs style guys. Having some suggestions at least for the basic operations would be really useful. |
This is very timely for me. Just this morning, I decided to try using eww for at least some reading on the web. I'd like to point out that eww defines a set of useful modal keybindings (such as "q" for quitting the browser), which are active in spacemacs when in emacs or hybrid mode. It might be good to copy these as much as possible into whatever keybindings you decide on. There's some documentation at https://www.gnu.org/software/emacs/manual/html_mono/eww.html. |
Here's a list of keybindings in the order they appear on the manual page:
|
Here's another set of keybindings: http://oremacs.com/2014/12/30/ace-link-eww/ |
@axyz in that case it sounds like it would fit better in the Spacemacs layer, rather than in core. It works much like any other layer. |
@TheBB then I'll start with a layer @fintelkai honestly I find vimperator keys more easy to remember, but as stated before I'm not used to emacs keys (except |
@axyz Go for vimperator bindings with evilification of eww keymaps. This way people using Vim style will get vimperator like bindings, people using Emacs style will get default eww bindings. |
You should consider adding this |
@tuhdo Originally I was thinking to use ace-jump to maintain consistency, however I think I'm going to give a look at eww-lnum as well. Mainly because of the additional features it has ( I'm also encountering some issues like randomly loosing the evilified-state (especially when dealing with text inputs, or sometimes when loading a new link) That's probably a problem with some timings I can guess, however pressing |
when I go in evil-insert state and then I press esc, evil-normal-state is activated and I loose all my keybindings. Probably it could work using simply Is there a way to map all escapes (ESC and that's the basic structure of what I'm doing right now:
actually going over an input in normal state allows you to write, but if you press a binded key, such as a possible alternative, but I'm not sure about it, may be to remove the new bindings from specific keymaps such as I also fear the problem could be related to #1874 as well (but not going in normal mode should avoid it eventually?) |
Currently reverting to evilified state in insert state is not supported, this is also an issue with other states like lisp state etc... |
just to know, what are the problems that would arise if I simply map the evil normal state instead of evilified? (maybe adding a control to check if the user have the emacs style option) |
Evilified state keymap is very small to limit the number of shadowed original bindings, then we apply a set of rules automatically to rebind those shadowed keys. If your intent is to remap everything like with evil-magit then you can use the normal state. But I feel that Eww is the first app that would ideally require both evilified state and normal state. I mean when you are navigating you want evilified state, when you are editing you want full insert + normal state access. Maybe renaming the evilified state I think you cannot use motion state instead of evilified because this keymap is inherited by normal state (summoning @justbur to confirm or not :-)) |
You can also create your own evil state from scratch, check how it is done with evilified. |
assuming that I'm going to create something like vimperator state or web-motion state... won't I end up having the same problem to go back in vimperator mode from the normal or edit mode as happens with evilified? The best thing would be to be able to use insert and normal states on text inputs, however it would also mean to have to "escape" 2 times to go back in evilified(or motion or vimperator). This is an interesting topic, however I also think that I could remap everything as eww do not have a huge amount of keys and probably a full "vim" experience do not need to rely on default emacs bindings. |
@axyz I haven't looked at all of the keybindings for eww, but here are two tools you can try (evil-make-overriding-map eww-mode-map 'normal) will make all of the bindings in eww-mode-map take priority over the default bindings in normal state. It's a quick way to elevate all of the default bindings in eww-mode-map. Then you can selectively use (evil-define-key 'normal eww-mode-map
KEY1 'DEF1
KEY2 'DEF2
;; etc
) to override any bindings in either eww-mode-map or evil-normal-state-map that you don't like after step one. Basically, I would stick to normal state in this case and shadow the keybindings in evil-normal-state-map as you see appropriate using the above tools. |
@justbur great, seems to work quite well with inputs. just a small problem:
|
that's step two 😄 (evil-define-key 'normal eww-mode-map "l" 'evil-forward-char) |
thanks, I was missing 'evil-forward-char 😛 |
@axyz there's also this shortcut if you like (evil-add-hjkl-bindings eww-mode-map 'normal) |
If there is not so much
So normal state is left untouched. |
All in all the paradigm I propose is roughly the same as a terminal one with a normal/insert prompt and a key bindings to escape from the prompt. |
in case it wasn't mentioned yet, consider that EWW will have multi-buffer support soon ™️ |
@a13ph nice! that should make easy dealing with vimperator functions such as at the moment in the with a proper multibuffer support we may end up avoiding to manually hack buffer names to make it work correctly. |
as a side note (far beyond my actual elisp and emacs internals knowledge...) it seems to me that eww is quite slow to load a new url. javascript is not executed, so I guessed it may be a problem with http requests, but loading really plain html websites such as http://motherfuckingwebsite.com is fairly fast. So the problem is probably on complex css rendering. duckduckgo is an example: on a normal browser it is as fast as google (maybe a little slower) but on ess it is much much slower and this is why I've decided to default to google as a default search engine. probably eww layout rendering may be optimized (where to open an issue?) ignoring or "polyfilling" some really slow css rules hard to implement on an emacs buffer. |
I think it's supposed to be addressed on emacs-bugs. Edit: emacs-bugs, not emacs-devel |
A draft of the keybindings for the navigation state that @syl20bnr proposed: ;; keybindings are exactly the same as in vimperator unless otherwise stated
(evil-define-key 'normal eww-mode-map
"&" 'eww-browse-with-external-browser ;; default in eww-mode
"q" 'eww-quit ;; different in vimperator (run macro)
"a" 'eww-add-bookmark
"yy" 'eww-copy-page-url
"f" 'eww-lnum-follow
"F" 'eww-lnum-universal ;; in vimperator open new tab
"gu" 'eww-up-url
"gt" 'eww-top-url
"f" 'eww-lnum-follow
"F" 'eww-lnum-universal
"h" 'eww-back-url ;; H in vimperator, because h is :help, but I think lowercase is better for us
"l" 'eww-forward-url ;; in vimperator, L is used for consistency, but again I think lower case is nicer for us
"r" 'eww-reload
) Leader keys: (spacemacs/set-leader-keys-for-major-mode 'eww-mode
"h" 'eww-history
"ba" 'eww-add-bookmark ;; also "a" in normal state
"bb" 'eww-list-bookmarks
"s" 'eww-view-source
"c" 'url-cookie-list) Random note: Have you guys heard that |
BTW, I created #4975 to at least add eww files to .gitignore. |
Did anyone look at this since 2016? Could these bindings form the basis of a |
There is a pending layer for this, I plan to finish to merge it at some point :-) |
Any news on the pending layer? A brief browse through the issues reveals that you are working since March on a rewrite of the layer system which stalled progress on any potential |
In the meantime, there is also https://github.com/coljamkop/eww-layer |
This is the PR that syl20bnr was referring to (above): Add eww layer #9871 |
@lexxish thanks for the link! It works great |
Hey! I'm glad you guys are finding some use from my eww layer and I am grateful for the excitement around it. TBH, I don't have a whole lot of useful contributions on GitHub, so this really brightens the rest of my day. 😀 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid! |
This issue has never been more valid. |
Please review #9871 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid! |
quick web browsing inside emacs is very useful (especially with search-engines like google, stackoverflow, wikipedia, etc
SPC a /
).However eww keybindings are almost non existent and quite buggy on spacemacs.
I may create my own bindings, but I think that being eww included by default on emacs they should be integrated on the spacemacs core and also they should be chose wisely to work correctly with evil and spacemacs keybindings philosophy.
as a side note, by default it seems that you can have only one eww buffer, we do not want a full featured browser and for the moment it may be ok as it is, but in the future we may think to something that works with layers or workspaces or similar.
I'm going to list an unordered list of things I've noticed and ideas about this topic:
o
over links triggerace-link-eww
to quickly jump to a link, but if you are not over a linko
will just insert a new line below. This do not make sense as you cannot actually edit the buffer and insert mode won't work. So I guess ace-link-eww should always work.o
anddd
) should be disabledo
sounds good foropen
link, however we may try to follow vimperator keys and usef
forfollow link
and maybe in the futureF
to follow on new buffer,
(orSPC m
) is not defined here so we have a lot of keys available for common operations.SPC a /
, maybe something likeSPC a w
opening a default page or maybe asking for an url and if empty just going about:blank to be ready to accepto
orp
commands...d
orq
may be used to kill the eww buffer:q
is similar to popups strengthening the idea of quick browsing and then close, however macro may be useful as well for some kind of dynamical scraping or similar sod
may be a better alternative (used on vimperator to close a tab, also not being a popupq
may seems misleading)ideas for keybindings (similar to vimperator):
H
page backL
page forwardf
follow link (usingace-link-eww
)o
open an urly
in visual mode will copy text, in normal mode would be nice to be smart and copy an url if over a link or an image or copy a paragraph or a word otherwise (to be discussed)p
open the url in the clipboard (or specified register)r
reloadb
add to bookmarksB
remove from bookmarks?SPC m
keys may be used for helm awesomeness like:SPC m l
helm buffer with links on the page to be followedSPC m h
helm buffer to jump to an header or maybea
for anchors?SPC m i
helm buffer to jump to images by their title or filenameSPC m b
helm buffer with bookmarksThe text was updated successfully, but these errors were encountered: