Hacker News new | past | comments | ask | show | jobs | submit login
ViHN: Vim for Hacker News (qsantos.fr)
124 points by qsantos 11 months ago | hide | past | favorite | 57 comments



Y'all may be interested in my HNTV script:

  curl -s 'https://news.ycombinator.com/from?site=youtube.com' \
  | egrep -o 'https?://www.youtube.com[^"]+' \
  | mpv --playlist=- \
    --speed=1.5 \
    --ytdl-format='bestvideo[height<=?720]+bestaudio/best'
[1] https://taylor.town/hntv


Nice. Reminds me of a project I built a long time ago: https://yahnd.com/theater/?t=week. Makes me want to update it to have all the urls on the listing page so I can use your player technique on it. Or throw em in a yt playlist.


Is there a YouTube API tool? Would love to create a YouTube playlist so that I can watch this on the TV.


I think you can stream stuff from VLC on the TV. My guess is that you could set up a proxy sort of thing to generate the stream on the fly.

Alternatively, you could create a bot to throw every YouTube link posted to HN in a playlist, which you could open up in the YouTube app!


I just use vimium, basically never have to use my mouse when browsing HN


Vimlike also works exceptionally well in Safari on Mac and iOS:

[1] https://www.jasminestudios.net/vimlike/


Anyone know how this compares to Vimari?


Having used both, I personally prefer vimlike —nothing major, have just run into fewer issues.


And Vimium C


I think Vimium C works better than Vimium. It's been so long since I switched that I can't remember exactly why, though.


one thing I like in Vimium C over Vimium is reload frame. Vimium it would reload the window and I have an older web app that uses frames where reloading the window resets everything back to a particular state and I have to go and reopen the frames.


I switched last week because its smooth scroll is smoother.

I also noticed that Vimium C is better at finding clickable elements for hints.


The only problem I have is when I use the search (which, I know, is not HN itself but a separate service), it won't pick up the dropdown options as clickable.


I use Vimium as well! It's very frustrating when I need to reach for the mouse to navigate a website.


I love the 'vim for this' trend. does vimium just take care of that for everything?


Yeah! You click links similar as you would with a "fingers" style plugin. i.e. f (letter combo).

I use Vimium C and haven't looked back.


There’s Vimari for the dozens of us that use Safari.


when I hit `F` the url density is too high that it's difficult to tell which is which, how do you navigate differently?


It's not that high on HN? The left most column is upvote. Then the next button immediately to the right is the link. Next row buttons from left to right are username, comments (via hours link), hide, and comments again (normal link).


Can be overwhelming at first, but you quickly get used to it.


Same here!


But... You can use $> lynx -vikeys from a terminal emulator inside the vim itself! That way you dont even have to invent anything or leave vim! (posted from vim btw)


You don't even need to drop down to a terminal -- there's https://github.com/dansomething/vim-hackernews (although it hasn't been updated since 2018) that interfaces with the API directly.


Interesting. Are you running lynx inside a vim terminal buffer?


To wit: https://i.redd.it/p5h7ongm51541.jpg

The rightmost buffer is `w3m` browsing arXiv.


In vim?


Yes, the entire screen you see is Vim.


Yeah, the most interesting part is that lynx is in a vim terminal buffer, and then the same vim is opened from lynx inside the almighty vim terminal buffer to edit this post textarea ;)


Interestingly enough, I'm reading this and posting in lynx. I have both vikeys and numbered links set...


w3m which I am using also seems able to browse HN; however, usually people want seamless navigation between HN and various links, so a graphical browser is a must. Qutebrowser is a good choice for those who enjoy keyboard navigation.


I would say not graphical but a javascript browser is a must if you want _various_ links, I know one for the terminal capable of this called browsh


Why not using keyboard controls for web pages in general? I tried multiple solutions for browsing the web and using vim binding to do so over the years. Some of them for extended periods of time, including Tridactyl, Vimium and others. My favorite by far is Qutebrowser because of its default commands and integration of them, for example moving between tabs, editing or copying URLs or configuration is pretty easy.


I do! I use Vimium C for general browsing. But, considering the time I spend on Hacker News, I needed something to optimize my procrastination even further!


> When GNOME Shell happened, I was forced to go looking for a new window manager. I ended up installing Ratpoison.

Wow, I used Ratpoison around 20 years ago. SunOS labs in school used some window manager I couldn't stand (don't remember which) and I saw a classmate with basically no window chrome on their display, and was intrigued.

They helped me compile it (no small feat given our resource constraints) and off I went, until my hand started to cramp a year later from hitting ctrl-t so much. I switched to ion for awhile, and then ended up scavenging a linux box to do assignments from home.

I'm happy to see some folks still holding firm on the "no-pointer" front.


As a fan of vi/vim keyboard navigation everywhere, I’m always intrigued to see how other people solve this. But if you’re looking for a more generalized approach, I can recommend a mix of vimium and w3m with vim key bindings.


Is it really vim if you don't have modes and can't combine operations ;p. Everything is pretty much single keystrokes that don't combine in any meaningful way. The only "vim" thing about it is h/j/k/l. Thing like collapsing don't use vim keys z(a|o|c), going to different places doesn't use g<thing>.

There's some weird scroll into view code as well, holding j to just scroll down buffers up a bunch of scrolls and then scrolls all at once. I'm guessing it's a side effect of smooth scrolling or something.

To avoid being a typical grumpy HN commentator, nice work :).


Thanks!

And I agreed that this is not “pure” Vim.

But I did need to find a compromise. There is little point in having an “insert” mode, like Vimium does, since I am targeting a very specific website and not overriding any existing shortcut (AFAICT). If you think it's important to you, I might consider implementing custom key bindings so that you can use with “pure” Vim shortcuts!

Regarding the scrolling, it could be two things:

1. I do not update the address bar on every key press, to avoid some kind of rate limitation I encountered when I did so initially. Instead, there is a very short delay so before it happens. But the viewport should still scroll immediately. 2. If it's smooth scrolling, there is actually a toggle you can change in the extension settings. If you still have the behavior without smooth scrolling, I would be curious to know more, to see if I can make the experience more pleasant.


I can confirm it was indeed caused by smooth scrolling. I didn't realize there was a setting.


Simple man: I see a screen with a window manager with gaps, I scream.

We're paying thousands of dollars for machines with high resolution displays, why don't people use the whole display???


I like my windows (contexts really) to have more visual separation so all my Amethyst windows have 5px margins.


Because we want to enjoy our wallpapers too.


I use https://haxplore.com which has a very nice way to navigate the nested conversations in my opinion.


I did not know of Haxplore, thanks!


tl;dr: I made ViHN [1] to read Hacker News without having to move my hands away from the keyboard. It’s freely available on Firefox [2] and Chrome [3].

[1] https://github.com/qsantos/ViHN/

[2] https://addons.mozilla.org/fr/firefox/addon/vihn/

[3] https://chromewebstore.google.com/detail/vihn/cfmccoefeojndm...


I use Surfingkeys [1] with Firefox (also for Chrome) for this. Last time I looked it was by far the best solution and superior to vimium.

[1]: https://github.com/brookhong/Surfingkeys


You haven't used Tridactyl then. https://github.com/tridactyl/tridactyl


I have! And I liked it! But Surfingkeys has 95% of the functionality of Tridactyl, but but does not need a troubleshoot guide like Tridactyl. Moreover, Surfingkeys implements a better search function on websites. With Surfingkeys, you also don't need to install an external application to work in input masks with Vim, as Surfingkeys has a Vim implementation on board that is completely sufficient for filling out input masks. I also like Surfingkeys' visual mode.


In what ways is it superior to Vimium?


Surfingkeys has much more keyboard shortcuts, implemented vimedit for input fields, better search, sessions...


Re >I never quite liked the idea of trying to remember what comments the user might have seen.

One way to do this by simply storing the latest comment's timestamp, and then you know that all the comments with a greater timestamp are newer


     lynx -vikeys gopher://hngopher.com


HN reads easily on eww-mode and with evil-mode you get Vim keys. There's also eww-lnum with quick link numbering.



Switched to this immediately, great HN tv too hah


There should be a couple command line tools to read HN, this way you can even stay in the terminal and don't need to switch to the browser

Switching to my browser, navigating to HN, and checking the first page (and going back if nothing interests me) already does not require me to touch my mouse and can be done with very few keystrokes. Typically, I visit HN when I'm waiting for something to complete or similar, though, in which case I anyways happily move my hand to the mouse, as I'll be _browsing_ for a bit


There is HNTerm [1], which also has an online demo [2].

[1]: https://github.com/ggerganov/hnterm

[2]: https://hnterm.ggerganov.com


I don't often comment on HN, but when I do, it's a shameless plug[1]. :-)

[1]: http://neonmodem.com




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: