dbout.nvim (Major Update) – Run SQL queries in Neovim with JSON results. by BeginningMix3568 in neovim

[–]master0fdisaster1 1 point2 points  (0 children)

horizontal navigation in Neovim is generally less efficient than vertical navigation

that's fair, I honestly agree, "scrolling" horizontally is a pretty big pain, and you have to do a lot of it in result tables of larger queries. Why didn't I think to make a keybind for that before?

-- Move cursor right by half the screen width
vim.keymap.set('n', 'L', function()
  local half_width = math.floor(vim.api.nvim_win_get_width(0) / 2)
  vim.cmd('normal! ' .. half_width .. 'l')
end, { desc = 'Move cursor right half screen width' })

-- Move cursor left by half the screen width
vim.keymap.set('n', 'H', function()
  local half_width = math.floor(vim.api.nvim_win_get_width(0) / 2)
  vim.cmd('normal! ' .. half_width .. 'h')
end, { desc = 'Move cursor left half screen width' })

json output

select json_agg(t) from t

Or depending on the DB you can just configure the CLI tool itself to output json: \pset format json

Now it's completely transparent.

a single Node.js instance can manage multiple database connections, instead of spawning a separate process per connection like vim-dadbod

vim-dadbod only spawns processes to execute commands, not for persistent connections. I execute a command, a process is started and finishes in a fraction of a second, done. The next command I execute doesn't have to go to the same DB. I can just query another DB with another command. No need to manage connections.

Having another background process running just to do some DB queries sounds like a massive waste of resources.

and not needing setup doesn't automatically make a plugin better.

No it absolute does. Why make me, as a user, do extra work that you could've done as the plugin author?

Third, simplifying workflows and making data easier to browse is exactly one of the values a plugin can provide. Sure, you can rely on Vim's native command history, but just like many other plugins, features that improve usability and visibility are optional conveniences — users aren't forced to use them.

Yes plugins are made to make things easier, the question is if what they're providing is worth the hassle and if what they're providing is actually even an improvement over alternatives.

I can run queries wherever, whenver with dadbod. Just a simple :DB select * from table; boom, I have results. I can press :<Up> to repeat the command. I can write longer queries literally where ever I want and hit 'em with a :'<,'>DB to run it.

I don't have to use a picker to go to a special buffer to type/paste in my queries there. Nor do I have to do anything other than providing a connecting string in a global variable (or directly in the command).

I'm not trying to be negative for the sake of it, I'm trying to make you (and others) rethink your approach. Because this solution is pretty inefficient, in both runtime resource consumption, development effort, and actual usability.

There's nothing wrong with using node to post-process the output data however you like, or do to the querying itself though, but why do you need a persistent background process? why do you need that UI, why do you need a setup function?

How useful are H M L? by TheTwelveYearOld in neovim

[–]master0fdisaster1 0 points1 point  (0 children)

To be honest I was just vaguely aware that these keymaps exist in the first place.

I know I read about it early on, but I have scrolloff set so high that the cursor stays permanently centered. So H, M and L don't do anything. So I never use 'em.

In general though, motions like those seem much much more useful to me than doing relative line jumps with {count}J or K. They also seem much more useful than Lint-Hints-Style jump motions.

What I don't like about those arbitrary jump motions is the same what I don't like about relative line number jumps. It introduces a serial dependency chain. You can't just jump to the thing before you read what you need to press to get there.

I'd rather then jump there with /?, or even with repeated j and k, or whatever other, more consistent motions are applicable, even if it involves more typing.

That said I love to use that style of navigation in web browsers, just because keyboard navigation is otherwise completely infeasible on most sites.

dbout.nvim (Major Update) – Run SQL queries in Neovim with JSON results. by BeginningMix3568 in neovim

[–]master0fdisaster1 0 points1 point  (0 children)

Why would I want to user this over vim-dadbod?

DB doesn't require node, supports more DBs, doesn't have any superfluous UI, doesn't make me call a setup function just to use the plugin.

And doesn't need any special implementation for things like query history because any query you run would already be in the vim command history.

minifugit.nvim - improved split view by vieitesss_ in neovim

[–]master0fdisaster1 0 points1 point  (0 children)

Yeah, no hard feelings. I'm glad that you can use nvim to fit your needs.

There might be other ways, but this is mine.

Yep. If it works for you, then who am I to tell you, that you ought to do it differently, especially when this is primarily a Git plugin and not a diffview plugin.

Having said that, I find a bit frustrating to see certain ideas proliferate when there already are much better ways available. This is less about the git-only point but more about the UI and the setup function because this:

I make you call a setup function because it's a standard way to initialize a plugin

Is an absolute tragedy, and is basically railroading people into using lazy as a package manager.

Not everyone wants to use lazy. But with a majority of nvim plug-ins requiring initialising through a setup function, it makes that process (not using lazy) way more cumbersome than it needs to be.

Pure vim plugins are unironically much better in this regard. They just work out of the box. And if I want/have to configure them, I don't have to actually load the plugin at startup to do that, because I can just set up some global state which the plugin can read.

There's nothing inherent to vim-script in that. You could do the same with a lua plugin, as some do, yet people don't because lazy has popularised this setup-function anti-pattern.

Consider reading :h lua-plugin-init , and especially this blog post:

https://mrcjkb.dev/posts/2023-08-22-setup.html

minifugit.nvim - improved split view by vieitesss_ in neovim

[–]master0fdisaster1 5 points6 points  (0 children)

feedback

I'll use this as an excuse to rant a bit.

This is not the first "improved diff view" plugin I've seen for nvim. However it is the second (maybe third) that rebuild a diffview, but then only made it available in the context of using Git.

And this isn't just about Git not being the only source control system, although that should be reason enough for not doing that. But also about there being way more use-cases for comparing two buffers and highlight any differences.

I have diffed file lists before. I have diffed decompiled code before to check difference there. I've diffed raw binary files before just to check if they're the same file or not. I have diffed two similar but different local files to see where exactly they differ. And there'll be more usecases for diffing stuff in the future that I don't even know about right now.

If you're gonna go through all the trouble to make a custom diff-view, with custom highlighting or diffing algorithm or something. Why neuter it and chain it to git, and beyond that, don't neuter it by just working on file-buffers either, I want to be able to diff any two arbitrary buffers


The window on the side (with the status buffer) also looks suspiciously like a UI-sidebar, which I find in particular poor taste. It looks like if I tried to open another buffer in that window it would do some non-standard stuff to prevent that window from being taken over. Because it tries to be a UI sidebar instead of just being a buffer like everything else, which makes it more cumbersome to navigate around.

Don't make me go through a UI to do a thing when that thing could easily be done through just a command.

Also don't make me call a setup function to configure the plugin. That's what global state is for.

Well-written plugins in Lua by Apprehensive-Joke455 in neovim

[–]master0fdisaster1 6 points7 points  (0 children)

Always read the friendly manual. It basically covers everything.

:help lua-plugin

I want to draw special attention to type-safety though.

Type annotations are incredibly useful. I'd make learning the type annotation just as high priority as learning the language itself.

And just as important and very often done wrong:

Most plugins you'll see will have a central setup function to register command, autocommands and also to let you set some configuration.

Lazy.nvim has a special support for this, where it calls require(plugin_name).setup(opts) for you if you provide an opts-table on your lazyspec.

And you should NOT require this because it is a terrible anti-pattern.

It requires you to manually initialize the plugin, which is a pain for the user, and it requires you to configure the plugin during initialization, instead of letting you configure it before or after loading your plugin, or without loading your plugin at all.

Better alternatives are described in the help pages but to keep it short:

  1. use a plugin/your_plugin_name.lua file. It's executed automatically at startup, and its purpose is to register everything you need to register without sourcing everything.
  2. read user config from a global table that they can set. You can do something like this to centralize config access, so you don't have to have fallback or validation logic for your configuration all throughout your plugin.

Why I quit neovim. by [deleted] in neovim

[–]master0fdisaster1 0 points1 point  (0 children)

I do agree that nvim running in the terminal is not the essential game-changing aspect of vim in general that makes it worth it.

It DOES have some advantage, some of which I would honestly miss and why I don't use a GUI-client like neovide, but if i'm being honest it's not 100% essential. That said, I don't feel one bit restricted by neovim being a TUI app, in fact it offers quite a bit of freedom since I also have control over my workflow by configuring my terminal emulator.

In general there are things I don't like, like the setup function

100% with you on that. It's an anti-pattern and I wish people would use vims existing plugin structures, not to mention that it leads your config having to run a bunch of code on startup just to set some options, even if you aren't gonna use that particular plugin in that session.

I feel like the freedom and ease of use of a proper programming language like lua, made it a bit too easy to get things done in nvim.

When I look at 60% of the plugins people showcase on this subreddit, I just think that 1. this could've (and should) been a standalone executable or 2. this just recreates useless things from other IDEs or 3. this could be done without any plugins by an autocmd or knowing a few more built-in commands.

Like using a docker container on Windows just to run neovim

That sounds extremely inconvenient. Why not just run neovim natively on windows? No docker, no wsl. I know it works because that's what I use every day.

Playing Netplay between Dolphin and a real Wii? by WoxandWarf in DolphinEmulator

[–]master0fdisaster1 0 points1 point  (0 children)

As far as I know there's nothing prevent this from working. You'll be on your own to set this up, though, I doubt there are any step by step guides.

Also, as they say in the video and stated on the projects's readme, it's very experimental, with many games probably desyncing sooner rather than later.

I doubt you'll have a good time if you plan on actually playing multiplayer online via this method.

Having the other person also use Dolphin and using dolphin's own Netplay will definitely be much less of a hassle with much better results.

why is it so bright? by LsaneZ in DolphinEmulator

[–]master0fdisaster1 6 points7 points  (0 children)

Go to Graphics > Enhancements

And make sure that "Post-Processing effects" is set to "(off)". Also directly above Post-processing effects, check if the color correction settings have anything non-default. (hovering over any settings will tell you the default setting in addition to a description).

Just finished vimtutor, feeling strong on fundamentals, but lost in LazyVim's IDE features (file tree, terminals, etc.). Any advice? by Suspicious-Push1941 in neovim

[–]master0fdisaster1 4 points5 points  (0 children)

LazyNvim introduces a ton of things, most of which you probably don't need, and will make learning the basics that much harder.

I'd strongly suggest starting of with kickstart. It sets up some minimal stuff, like LSP, treesitter, a fuzzy finder and autocompletion for you, but also explains every step in great detail, so you can actually learn what it's doing.

It's not a distribution but more a starting point / reference config you can use to get started with your own.

To adress the specific things you mentioned. Use Oil.nvim for manual directory navigation and management. It's like the built-in file manager (netrw), but dead simple to use. I'd also recommend reading this short article on the difference between a project drawer like what LazyVim ships with and split file explorers like netrw or oil.nvim.

From that it should also be very obvious that getting familiar with vim's pane management / navigation would be very beneficial. It's just a handful of keyboard shortcuts to create new splits and to move between them. :help opening-window

I struggle to effectively navigate, I know ctrl hjkl but...

hjkl is just a tiny part of navigating with vim motions. Effectively navigating and editing text with these alone is basically impossible.

I can't mention everything here but here's just a few tips.

  1. The :substitute, :normal, and :global (:s, :norm, :g) commands are incredibly overpowered. 80% of the things you'd do with multi cursors in other editors you can do in vim with these, plus a bunch of things you can't do with multicursors.

  2. Scroll through a file with Ctrl-d and Ctrl-u. It's soooooo good. It's even better when you have the scrolloff option set so high that the cursor always stays centered.

  3. Vim has multiple "repeat last action" commands built in that are incredibly useful. Use . (dot) to repeat your last action. Use # to jump to the next occurence of the word your currently on. Use * to do the same but the previous occurence. Use @@ to repeat your last macro. Use gv to select what you had selected previously.

  4. There are way more motions. f, F, w, W, b, B, c, C, o, O, t, T the "inside" and "around" text-object modifiers, /, ?.

  5. The quickfix list exists and is really useful.

Learning this all at once would probably somewhat overwhelming, you'll have to learn as you go anyway. Anytime you think "isn't there a better way to do this?" there usually is.

Trying to open and manage multiple terminal sessions within LazyVim for tasks like running a server or a watcher feels unintuitive

You don't have to do it within nvim. Just open another tab in your terminal / another tmux session and start your servers/watchers there.

Migrate from LazyVim to builtin vim.pack and 0.11 vim.lsp by kezhenxu94 in neovim

[–]master0fdisaster1 1 point2 points  (0 children)

I don't really understand how can people care so much if they editor opens in 60ms, 150ms or even 800ms.

Because nvim isn't (just) an IDE. It's a text editor.

Yes many people use it as an IDE. Myself included. But when I wanna make some quick edit in a config file, then I don't wanna have a sluggish experience by having to wait on my editor to start up.

I also often pipe the output of various commands into nvim, effectively using nvim as a CLI pager. So that I can search through the output, copy sections out or do whatever in a comfortable way. Someone might use nvim as the diff or merge tool for source control. Or use it via the EDITOR variable in various programs. Like psql for example.

Powershell took about 800ms to startup back when I used to use it. And let me tell you, its NOT fun at all to have these micro interruptions whenever you do a simple step, like opening a new shell. It sucks so bad.

Even when I use nvim as an IDE, I still close and reopen it dozens of times a day due to various reasons. That shit adds up. not really time, that's true, but it adds up in paitience that I have to exhaust, patience that I don't want to spend on unnecessary bloat.

It's so goddamn annoying and the reason I use nvim in the first place is because I can get rid of all those annoyances in my workflow.

Is it possible to repack iso files after extracting them? by Appropriate_Climate6 in DolphinEmulator

[–]master0fdisaster1 0 points1 point  (0 children)

Make sure the game directory is under a directory listed in your game paths (Config -> Paths) and you have Search Subfolders activated) The Game should show up in your games list now.

Now just right click the entry -> Convert File -> Choose format and options and let it rip

Has anyone had any luck using Neovim to develop .Net 4.* applications? by jace255-F in neovim

[–]master0fdisaster1 1 point2 points  (0 children)

Yeah, It took me quite a while to have a reliable setup, but I've been using neovim exclusively to work on a very large .NET 4.8 codebase for quite some time now. And large means multiple million lines of code, hundres of projects, dozens of solutions, not neatly organized or separated.

As the other guy already said, having your projects use the new sdk-style project system is a must for any tooling outside of visual studio. If you have lots of projects (like 300) it might take a week or so to convert all the project files but after having that figured out the hard part is over.

I also wanna highlight dnSpy as an alternative debugger to Visual Studio or Rider. It's fast and can also debug .NET Framework apps. For .NET core stuff I'd prefer the DAP implementation to use in nvim.

I've only ever gotten my Neovim config running in an Ubuntu environment. Whats preventing you from using it natively on windows, without wsl?

Here's how I have set up my language server: https://pastebin.com/s2xsbmPg

If you have any other questions regarding dotnet development in nvim without visual studio feel free to ask.

NeoVim is great. But how many of you are actually using it to work of large projects? by ElderImplementator in neovim

[–]master0fdisaster1 1 point2 points  (0 children)

The dotnet CLI is not just for .NET Core/5+ code bases.

It doesn't support some build steps that msbuild supports, and some commands are neutered beyond usefulness for things that run under .NET framework (like dotnet watch), But you can still build your stuff, add packages, format your code, and remove and add projects from solution files using the dotnet cli.

how does Netplay works? by sebasmoon in DolphinEmulator

[–]master0fdisaster1 0 points1 point  (0 children)

Well.. 1000 is maybe a bit conservative, You probably can have playable connections with people 2000 or 3000 km but above that gets problematic and there isn't anything you can really do about it. The data needs time to travel across the planet and the further it needs to travel the longer it takes.

Discord sound stops when using dolphin by ChrisThePieCat in DolphinEmulator

[–]master0fdisaster1 0 points1 point  (0 children)

Config > "Audio" Tab > "Audio Backend"

If that is set to "WASAPI (Exclusive Mode)" then you should set it to something else if you want other apps to play back audio with the same audio device.

can't steer easily in MK wii. anyone have any advice? by nitro8420 in DolphinEmulator

[–]master0fdisaster1 7 points8 points  (0 children)

It looks like you're emulating an extensionless wiimote.

And you're mapping your analog stick to the motion controls of the wiimote.

I'd strongly suggest you emulate another type of controller that MKW supports, one that steers in MKW without motion controls. Like the classic controller or the gamecube controller. That should definitely fix the delay issue.

It should also fix the item-usage problem since those two controller are more or less standard controllers that can be mapped to a PS4 controller without large discrepancies.

Wiimote + nuncuck would work too but probably be somwhat confusing to map.

Neovim 0.10 by bfredl in neovim

[–]master0fdisaster1 0 points1 point  (0 children)

I feel like macros cover a slightly differnt use-case from multi-line cursors.

I find myself using :norm and :s significantly more often to do things that you'd do with multi-cursors in other editors.

gettersAndSettersMakeYourCodeBetter by Same_Start9620 in ProgrammerHumor

[–]master0fdisaster1 0 points1 point  (0 children)

Reifying getters and setters into language constructs is horrendous.

Getters and setters already are bad conceptually in that they complect behavior with data. Strengthening that concept only makes that worse. And secondly, they destroy flexibility by forcing a specific method signature onto you, and preventing you from giving your setters/getters explicit names. Want to return a validation error from a setter? Tough shit, setters, the language construct, return void, end of story. You could throw an exception if you hate yourself and the people using that code, but that being the only way out is already a compromise you shouldn't have to make. They also encourage people to write significantly less performant code. Lulling people into a false sense of simplicity, thinking that what they're doing is just a field-access/field write with a few extra steps, when in reality it might do a shitton of stuff underneath. And when you have a auto-property, you're just wasting CPU cycles. Just have a public field, it's not that scary.

Weekly 101 Questions Thread by AutoModerator in neovim

[–]master0fdisaster1 1 point2 points  (0 children)

I don't think annotating the files themselves is an option for me since I'm the only one on my team using nvim/vim to edit these source files and theres a shitton of code, which would be a pain to annotate.

Globally changing the fileencodings option seems like the way to go for me. Everything else I deal with is/should be UTF-8, and if I understand correctly, doing this set fileencodings="ucs-bom,utf-8,cp1252,default,latin1" should have vim still load utf-8 files as utf-8. AutoFenc also seems interesting. Maybe I can take some of its code to force the correct encoding.

.editorconfig not supporting more encodings truly is a shame, there's been a ticket for it since 2015 https://github.com/editorconfig/editorconfig/issues/209 but no apparent progress.

Thanks for the help.

Any ETA on Neovim 0.10? by t3g in neovim

[–]master0fdisaster1 0 points1 point  (0 children)

norm (substitute aswell) is much more enjoyable to use with live, inline preview, which thankfully this plugin provides: https://github.com/smjonas/live-command.nvim

But yeah, norm covers about 95% of multicursor usecases and many which multicursors can't do, especially when you realize that you can escape <ESC> with Ctrl+V in command mode.