5 ms·
Show HN: Yode-Nvim – Focused Code Editing for Neovim
- gfodor 5y agoWhat’s the advantage of this over creating splits and navigating to the relevant code? This is what I do all the time, having a hard time understanding how this would improve that.
- hoschi 5y agoSplits are not based on content, but are controlled by a layout algorithm. For horizontal splits, for example, the size changes every time you create a new one. Yode-Nvim is based on the size of the seditors and enlarges/reduces them automatically. There are more layouting algorithms planned and they can be different for each tab, the code is already set up for that.
- enriquepablo 5y agoHow does Yode compare with tree-sitter?
- hoschi 5y agoYode (the POC 4 years before) itself only worked with a (JavaScript) AST to create seditors. Tree-sitter would have helped here to provide an AST for different programming languages uniformly directly in NeoVim. Yode-Nvim is more powerful than the first version because it operates on lines to create seditors. In this respect Tree-sitter doesn't matter for Yode-Nvim. If someone uses Tree-sitter to select code in visual mode, he can easily create seditors for code objects like functions. This is also possible without Tree-sitter, but you have to select the function yourself.
- auslegung 5y agoThis looks great, nicely done! I didn’t know I needed this :) Does anyone know if this exists for Emacs? I use both nvim and Emacs but primarily Emacs and would love to have this on both.
- vimacs2 5y agoWell you can hide the rest of the buffer and focus on a specific part of a file with the narrow-to-* functions (defun, region, or page). However, this plugin seems to be a little fancier and instead creates different buffers for each selection. The analogous feature set in Emacs are indirect buffers. Try binding a key to run the clone-indirect-buffer and narrow-to-region commands in sequence. This library might help too: https://www.emacswiki.org/emacs/NarrowIndirect https://www.emacswiki.org/emacs/NarrowIndirect
- pcr910303 5y agoAn off-topic comment: Interesting for the “GIF” section to have links to .mp4 videos — the “GIF” word now seems to be synonymous to short playable animations. Love that the author did that though, I’ve seen too many repos with multiple giant (~10MB) GIFs on the README and burn my mobile data plan.
- kasbah 5y agoUnfortunately I just see this error on Firefox 96.0.3 on Linux though: https://i.imgur.com/DgQLXqj.png https://i.imgur.com/DgQLXqj.png EDIT: looks like there is already an issue about it. https://github.com/hoschi/yode-nvim/issues/4 https://github.com/hoschi/yode-nvim/issues/4
- chrismorgan 5y agoI really dislike situations like this where the inferior becomes a name for the category, because it encourages people to keep using the inferior, often because that’s all they hear of and so all they know. “RSS” for feeds is a similar, though somewhat less bad, case (Atom is unequivocally superior, but in ways that seldom make a difference for most consumers for most content). (Admittedly, actual video codecs are more a minefield, as is seen here in the video not playing in most environments due to the use of full 4:4:4 chroma, whereas GIF is simple and stupid enough that it’s consistent.)
- peakaboo 5y agoThis looks really cool. Will absolutely try it out. :)
- nerdponx 5y agoI have been using NrrwRgn[0] for editing and presenting individual sections of code. How does Yode compare? [0]: https://github.com/chrisbra/NrrwRgn https://github.com/chrisbra/NrrwRgn
- hoschi 5y agoYode-Nvim can create more regions of the same file as well as a floating "window manager" for regions called "layout". Yode-Nvim syncs changes from regions to files in real time where you need to "write" the changes by hand with NrrwRgn.
- doix 5y agoHey this is super cool, but can it work without the floating windows? Can I assign seditors to regular vim splits (am I using the terminology correctly?). The narrow functions in Emacs were great, and almost made me switch to Emacs. I know NrrwRgn exists, but it didn't automatically sync the buffers, so you couldn't have them open side by side. This looks better, but I don't like the automatic layout stuff. I prefer to control that myself.
- hoschi 5y agothis already works, just use `YodeCreateSeditorReplace`. The command creates a seditor and opens it in the current window. You can then use the created seditor like any other buffer. To open a selected code part in normal splits do: :YodeCreateSeditorReplace :vsp <Leader>blt
- doix 5y agoI completely missed that command when looking through the docs. Thank you, and sorry for wasting your time! Great work on this plugin, it's amazing!
- hoschi 5y agoNaaah ;) Some people missed the installation instructions https://github.com/hoschi/yode-nvim/issues/5 https://github.com/hoschi/yode-nvim/issues/5
- Valodim 5y agoThis looks amazing, I love the idea. I wonder, as a general feeling, does the implementation of the floating narrowed regions involve a lot of hacks/workarounds, or does it come fairly naturally to nvim?
- hoschi 5y agoWith the buffer events and especially `nvim_buf_call` of NeoVim it is possible to do everything without hacks.