News for hackers. Stuff that matters.
Re:Nvui: A NeoVim GUI written in C++ and Qt by teamspirit on Sunday August 29, 2021 @09:14PM (#28351988)
This looks very interesting. Are there any advantages to using it as opposed to neovim in a terminal?

I guess my question can be posed to any gui text editor. Still, nice project!

Re:Nvui: A NeoVim GUI written in C++ and Qt by phire on Sunday August 29, 2021 @09:42PM (#28352102)
In general: There are a few theoretical advantages when it comes to doing advanced syntax "highlighting". Not that I've seen any GUI IDE/editor ever do syntax highlighting that couldn't be done in a terminal.

There are a few examples in the GUI based disassemblers world (like IDA pro) which use graphical arrows to show where branch/jump instructions goto. The usefulness of those is enough to convince me that perhaps more research needs to be done in this direction.

There is also the small advantage of being able to have more than one font type/size on the screen. Your navigator panel can be a smaller font size, Your inline documentation viewer can use a variable-width font.

The counter-argument to all that is always: "Is it worth giving up the ability to be used in a terminal to add those few features?"

Everything else can be defined as "style" and gets very subjective. nvui looks like it has nice animations and smooth scrolling.

Re:Nvui: A NeoVim GUI written in C++ and Qt by jcelerier on Monday August 30, 2021 @04:27AM (#28353701)
> Not that I've seen any GUI IDE/editor ever do syntax highlighting that couldn't be done in a terminal.

A very basic feature is that IDEs underlines in yellow for warnings and in red for errors, as well as show fix-it popups when hovering the mouse around the error area I don't believe a terminal can do that while keeping syntax highlighting no ?

Re:Nvui: A NeoVim GUI written in C++ and Qt by Lio on Monday August 30, 2021 @04:35AM (#28353740)
Many terminals can display coloured undercurls that are different to the current text colour if that's what you mean.

E.g. here's a plugin for simple-term to add support for it: https://github.com/hexoctal/st-undercurl

The Kitty terminal has all kinds of graphics addons including coloured undercurls and images too:

https://sw.kovidgoyal.net/kitty/underlines/

Vim and NeoVim both support coloured undercurls too.

Re:Nvui: A NeoVim GUI written in C++ and Qt by da39a3ee on Monday August 30, 2021 @08:13AM (#28354850)
If you run your editor in a terminal, how do you do things like ctrl+click on a compiler error in the terminal and have the file opened in your editor at the correct line?
Re:Nvui: A NeoVim GUI written in C++ and Qt by sagarm on Monday August 30, 2021 @08:41AM (#28355032)
People who prefer the terminal don't click on things much.

Vanilla Vi users would use :make to populate the location list, and then :cn or :cp to navigate back and forth. :cope to open up the quick fix window where you can use all your regular VI keybindings to navigate. Enter opens the location under the cursor in your previous VIM split.

There are also plenty of plugins that add inline diagnostics. It's common to use bindings for navigating these that ape the spell check navigation bindings ]s and [s.

Re:Nvui: A NeoVim GUI written in C++ and Qt by da39a3ee on Monday August 30, 2021 @12:23PM (#28357329)
If I'm understanding you correctly that means you have to do your compilation from within vim. Isn't that constraining at times?
Re:Nvui: A NeoVim GUI written in C++ and Qt by sagarm on Monday August 30, 2021 @01:36PM (#28358454)
I don't always use :make. Navigating manually is fast: Specific lines is just :NN, jumping to an open buffer is just :b substr<tab><enter>.

Or, :tag FunctionName (which has completion) to jump to a symbol.

Or, forward incremental search to jump to a string in a file.

I also have a plugin to invoke fzf, (\tb to search buffers and \t to search for files by name), but I don't use it that often.

VIM has many tools to navigate through text. Everyone's got their own preferred methods.

Re:Nvui: A NeoVim GUI written in C++ and Qt by da39a3ee on Monday August 30, 2021 @01:47PM (#28358598)
So if you issue a compile command in a terminal, outside vim, and the compiler emits something like `myfile:17:7` to stdout, how do you then open vim on line 17 of myfile?
Re:Nvui: A NeoVim GUI written in C++ and Qt by sagarm on Monday August 30, 2021 @08:04PM (#28362449)
Often I already have the file in question open, so it's just :17 to jump to line 17.

If I don't have the file active but it's open (very likely if I have a compile error for it), then I can foreground the buffer with :b myfile<CR>. Then :17 to jump to line 17.

If the file isn't open at all, either fzf (\t myfile) or just :e path/to/myfile.

Re:Nvui: A NeoVim GUI written in C++ and Qt by da39a3ee on Monday August 30, 2021 @10:00PM (#28363173)
OK cool. I'm certainly a huge terminal user myself and no advocate of increasing mouse usage in general, but for working through things like compiler errors / stack traces etc, wouldn't you agree that, seeing as all the file path and line number is present, we should be able to invoke the appropriate handler with a single UI action (where appropriate handler means "open file at this line")? The number 17 isn't itself of interest, and it shouldn't have to pass through our brains IMO. The semantics should be "open editor at this error" not "open editor at line 17".
Re:Nvui: A NeoVim GUI written in C++ and Qt by sagarm on Tuesday August 31, 2021 @12:47PM (#28370377)
Yeah, :make gives you that, as do various LSP integration plugins.

The main downside of :make is that it's synchronous, which is why I sometimes build in a separate tmux pane.

Re:Nvui: A NeoVim GUI written in C++ and Qt by gnubison on Monday August 30, 2021 @12:51PM (#28357744)
Vanilla vi users don’t have :make, :cn, :cp, or :cope.
Re:Nvui: A NeoVim GUI written in C++ and Qt by sagarm on Monday August 30, 2021 @01:30PM (#28358374)
Vanilla VIM, sorry.
Re:Nvui: A NeoVim GUI written in C++ and Qt by bjoli on Monday August 30, 2021 @08:38AM (#28355002)
I focus the interaction window and press the keyboard shortcut for opening the editor at the point of the error? You don't need a mouse to navigate text.

I updated some Emacs package recently and now it opens any errors in a list buffer.

Re:Nvui: A NeoVim GUI written in C++ and Qt by auxym on Sunday August 29, 2021 @09:36PM (#28352079)
I have not tried this one yet, but what I'd like to see in a nvim gui:

- Splits I can drag around to move and resize with a mouse

- "Native" window tabs instead of terminal-style tabs

- A gvim-style menu bar with some operations for which I can't be bothered to remember the key combination.

So, overall, mostly mouse support and better discoverability. I've tried a few though and haven't really found what I'm looking for, open to suggestions :)

Re:Nvui: A NeoVim GUI written in C++ and Qt by jchook on Sunday August 29, 2021 @11:24PM (#28352538)
> Splits I can drag around to move and resize with a mouse

You can already use the mouse to resize splits in neovim, :set mouse+=a

> "Native" window tabs instead of terminal-style tabs

Which features would "native" tabs provide that aren't already available?

> A gvim-style menu bar with some operations for which I can't be bothered to remember the key combination.

Which operations would you put under the menu?

Re:Nvui: A NeoVim GUI written in C++ and Qt by yoz-y on Monday August 30, 2021 @01:29AM (#28353023)
> Which features would "native" tabs provide that aren't already available?

In ideal world: reordering, tearing off and merging.

> Which operations would you put under the menu?

Ostensibly, all of them?

Re:Nvui: A NeoVim GUI written in C++ and Qt by Lio on Monday August 30, 2021 @03:32AM (#28353475)
> In ideal world: reordering, tearing off and merging.

That's an interesting idea. It sounds like it should be technically possible in the terminal too.

Same would go with drag copying text.

Re:Nvui: A NeoVim GUI written in C++ and Qt by CJefferson on Monday August 30, 2021 @04:27AM (#28353702)
"tearing off" to me means creating a new window -- I don't know any terminal which lets you down a new window (although terminal lovers wouldn't want that I imagine).
Re:Nvui: A NeoVim GUI written in C++ and Qt by Lio on Monday August 30, 2021 @04:50AM (#28353823)
It's not something I'd want personally but I don't see why it wouldn't be possible for those that do.

The iTerm2/tmux integration show that's you can map TUI windows on to GUI windows including splits into new GUI windows.

It's actually possible to have both the TUI representation and GUI representation connected to the same remote tmux session.

https://iterm2.com/documentation-tmux-integration.html

Re:Nvui: A NeoVim GUI written in C++ and Qt by kchr on Monday August 30, 2021 @04:47AM (#28353808)
You can have tabs in vim instead of the terminal. Check :tabedit for example.
Re:Nvui: A NeoVim GUI written in C++ and Qt by yoz-y on Monday August 30, 2021 @05:03AM (#28353886)
Yes that's the idea. Tearing off a tab in vim and creating a new terminal window with an instance of vim having contents of that tab. This is possible in vim guis but afaik not in any terminal version.
Re:Nvui: A NeoVim GUI written in C++ and Qt by dkersten on Monday August 30, 2021 @08:48AM (#28355089)
When I'm using an IDE (vim-based or otherwise), I tend to have other things integrated into the editor session, for example I'm connected to a REPL or other external thing. If I pop a tab out into a new window, I don't want it to be an entirely separate editor session: I want it to keep all these extra integrated things as the parent. I still want to be able to evaluate code in the same REPL session as the parent without having to create a new session or connection.

I'm not sure how to handle something like this in a terminal editor, unless the vim plugins are aware of it (but they're not, since they weren't written for it). In a non-terminal editor like nvui, the new window could be just a view into a buffer, but still running inside the one instance of vim, allowing these plugins to keep working transparently, even though now there are multiple windows.

I don't think this is something that's easily possible with terminals without rewriting all the plugins that might need to be aware of it.

Re:Nvui: A NeoVim GUI written in C++ and Qt by mah3s on Monday August 30, 2021 @12:47AM (#28352870)
I want native style tabs and line numbers. By native style, I mean both of them in some way separate from the main code window. When I have line numbers enabled in nvim and if I select code using mouse to copy, line numbers get selected automatically and only way to get what I want is to use visual mode or turn off numbers. Its a bit slower than selecting with mouse for me
Re:Nvui: A NeoVim GUI written in C++ and Qt by jchook on Monday August 30, 2021 @01:23AM (#28353005)
There are lots of great ways to handle this in vim.

You can sync your system clipboard with vim, for example. This also works well with clipboard history apps like Alfred or CopyQ.

Also, :set mouse+=a solves the line number selection issue.

Re:Nvui: A NeoVim GUI written in C++ and Qt by notthemessiah on Sunday August 29, 2021 @11:16PM (#28352510)
Sounds like neovim-gtk has 2/3 (you can resize splits with the mouse, but you can't move them), but unfortunately, it's infrequently updated, sometimes I experience glitches, and it sometimes fails to build.

https://github.com/daa84/neovim-gtk/

Re:Nvui: A NeoVim GUI written in C++ and Qt by ComputerGuru on Sunday August 29, 2021 @09:42PM (#28352106)
Nvim already supports resizing splits with the mouse. Just :set mouse=a
Re:Nvui: A NeoVim GUI written in C++ and Qt by p00f on Monday August 30, 2021 @10:28AM (#28356002)
> native window tabs

You might want to watch https://github.com/glacambre/nwin

Re:Nvui: A NeoVim GUI written in C++ and Qt by O_H_E on Monday August 30, 2021 @12:29AM (#28352819)
> menu bar with some operations for which I can't be bothered to remember the key combination.

now, that's a good one.

Re:Nvui: A NeoVim GUI written in C++ and Qt by cossatot on Monday August 30, 2021 @12:56AM (#28352909)
I like having gvim or macvim as the default text editor to open files when the are clicked from Dolphin/Finder/etc so that I can read and edit the file with vim and my config, rather than whatever the OS default low power GUI text editor is. Maybe I could rig up something to open a new terminal and then open vim in that but vim in a GUI works quite well.
Re:Nvui: A NeoVim GUI written in C++ and Qt by chrischen on Sunday August 29, 2021 @10:21PM (#28352273)
A lot of performance issues when it comes to mouse based scrolling in the terminal.
Re:Nvui: A NeoVim GUI written in C++ and Qt by alpaca128 on Monday August 30, 2021 @02:24AM (#28353226)
I've been using NeoVide (same idea) for the last few weeks and I've noticed three differences: the colors/font are closer to the intended look, it's got nice smooth (and quick) animations, and it seems like the rendering is faster than in the terminal to a degree it feels more responsive.

Overall I like it a lot.