u/y0shii3

Trouble with Neovim

I just installed Void and got Neovim with xbps, and I have two major problems with it that I didn't have on Fedora.

First, it's sluggish for no reason. Even when I launch it with nvim -u NONE, basic things like moving the cursor and scrolling the window are significantly slower than they were when I was using Fedora and also slower than any other app.

Second, I can't copy things to the system clipboard. When I do "+yy it says "No provider". In ~/.config/nvim/init.lua I have a line that says vim.opt.clipboard:append("unnamedplus") which worked on Fedora, but that clearly doesn't work anymore. (Solved it by downloading wl-clipboard)

If anybody has any clue why these things are happening let me know

reddit.com
u/y0shii3 — 1 day ago

Can't share database from Linux to Android

All I'm doing is saving the file from KeePassXC, syncing it with a copy in the cloud, then accessing it the cloud on my phone. KeePassDX says "Could not load the database" and gives no extra information. Keepass2Android says "The file header is corrupted" and "read failed: EISDIR". I know for a fact that my file is not corrupted, that it did sync fully in the cloud, and that I'm selecting the right file. I'm not using a passkey or keyfile, so that can't be the problem either.

Has anybody else run into this? Please help!

reddit.com
u/y0shii3 — 15 days ago
▲ 14 r/Zig

Inconsistency with keyword collision rules?

It seems like Zig is inconsistent about when shadowing/reusing keywords is allowed.

struct and enum, for example, are keywords, so you have to use @"string identifier" syntax to use them as field names, as in std.lang.Type.@"struct" and std.lang.Type.@"enum". But comptime_int and comptime_float are also keywords, and their Type tags don't use @""; evidently it's perfectly fine to have a union variant named comptime_int or null or undefined.

Is this because those union variants don't carry any extra information and that means a special rule applies? And why can't the compiler just let us use all keywords as fields if they'll always be distinguished by a period at the front anyway?

reddit.com
u/y0shii3 — 2 months ago
▲ 51 r/Zig

Getting the current time is weird

To get the current time, Zig used to provide functions like std.time.milliTimestamp which would immediately give you what you needed. Now it seems like you need to get a Clock instance and an Io instance to get a Timestamp instance, then convert the Timestamp to the result you need.

Before: const time_millis = std.time.milliTimestamp();

Now: const time_millis = std.Io.Clock.now(.awake, io).toMilliseconds();
or, alternatively: const time_millis = std.Io.Timestamp.now(io, .awake).toMilliseconds();

Why include now in two places where the only difference is the order of the parameters? Why do I need an Io instance to get the time?

reddit.com
u/y0shii3 — 3 months ago
▲ 71 r/Zig

Last week, the array multiplication operator ** was removed from Zig. The reasoning is that @​splat(m) was already preferred over .{m} ** n, and the use case .{i, j, k, ...} ** n is "rare enough that it does not need to be syntax."

Here's an example of the latter use case that was in Ziglings:

// Please set this array using repetition.
// It should result in: 1 0 0 1 1 0 0 1 1 0 0 1
const bit_pattern = [_]u8{ 1, 0, 0, 1, } ** 3;

And here's a solution that works in the latest build:

const bit_pattern: [12]u8 = @​bitCast(@as([3][4]u8, @​splat(.{ 1, 0, 0, 1, })));

That's not too bad, but it's kind of lame how much more verbose it got. Is this a good removal? Does this mean there's a chance ++ will get removed too, or is it common enough (e.g. for string concatenation) to keep?

reddit.com
u/y0shii3 — 4 months ago
▲ 25 r/Zig

I recently discovered this is valid in Zig: const hex_floating_point = 0x103.70p-5;

Is there any reason you would want to write hex numbers in scientific notation?

And why is the exponent written in decimal and interpreted with respect to binary? I would expect 0x0.0000_0000_0000_0001 == 0x1.0p-10, but it's actually 0x1.0p-64

reddit.com
u/y0shii3 — 4 months ago