u/Agent34e

How can I edit the same file in two windows?

Hi.

I'm semi new to coding and I like having two windows side by side. One that I'm working on, the other with other files for reference.

I've reached a point where I'm jumping between files a lot and my files have gotten long enough that what I want to reference isn't in another file, but the code above.

I've been using Micro, opening multiple tabs for what I'm working on on one side and opening reference files on the other.

What I'd really like to do is just open all of my files (as tabs) at once one in both windows and freely move between them.

However, I find it annoying needing to reload files all the time.

Is there an editor that will sync multiple windows?

I might move to vim or emacs if there's a simple solution there. But I prefer Micro and Helix. (Helix doesn't even seem to let me reload a file)

Am I dumb and there's a better way instead of tabs to quickly switch between files? Should I use splits and not separate windows for side-by-side viewing?

Thanks for any tips!

EDIT: Thanks! I am now enlightened by splits! I always figured why learn another binding when my window manager can handle it. Now I understand! Thank you!

(Micro is real dumb with splits though. Helix is wonderful.)

reddit.com
u/Agent34e — 3 days ago
▲ 4 r/Nix

I think I broke nix-shell?

I'm a casual NixOs user. Meaning I use the operating system, but don't do any developing.

I decided to try my hand at following a tutorial to make a roguelike in C. To get ncurses linked, I discovered I need to use nix-shell. Upon doing so, I discovered nix-shell has a weird fail point that I can't diagnose.

I've used nix-shell before, including with a shell.nix, but rarely.

Diagnosing from the simplest case, here is what's happening:

When I run nix-shell -p hello everything runs fine without any errors, my bash init script runs fine and reaches the end, then I get, "The program 'micro' is not in your PATH. It is provided ... You can make available ... " then, "bash: pkgNext: unbound variable". This causes the shell to fail.

Using the verbose flag doesn't help. Everything is fine until bash initializes and comes to the end. So, nix-shell seems to work but fails in initialization?

Writing it out, I see pkgNext is probably the culprit. However, I can't find any info related to it.

I've disabled everything that I can think of that would call micro: bash initialization, starship, the EDITOR variable, but nothing works.

I'm going crazy over here. Any help could be appreciated. Thanks!

EDIT: I figured it out. Leaving this here for anyone in the future. I'm dumb and aliased 'read' and 'write'. Not sure which one nix-shell uses, but removing those aliases fixed things.

reddit.com
u/Agent34e — 27 days ago