mxtty | direnv | |
---|---|---|
2 | 160 | |
9 | 11,759 | |
- | 1.4% | |
8.9 | 8.7 | |
14 days ago | 6 days ago | |
Go | Go | |
GNU General Public License v3.0 only | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
mxtty
-
Why does the `reset` command include a delay?
> TERM is already used for determining color support.
It's one of many ways to determine colour support. And arguably the worst of all of the ways too.
- $TERM
This isn't intended to contain colour information, yet that's how it's often abused. Meaning a lot of applications are broken in non-xterm terminals if they happen to use the $TERM variable correctly
- ANSI code: CSI 22 c (Send Device Attributes, ANSI color)
This is the correct way to check for a device capability. But it requires more effort and knowledge of terminals than your average developer has. So is rarely supported by console applications.
- $COLORTERM
This is the modern day equivalent to the device capability API. But also isn't used often
- $COLORFGBG
This was the original env var intended to be used like $COLORTERM, but fell out of favour because, well, nobody bothered to read any docs.
- $FORCE_COLOR
This is an often used standard. Christ only knows why this one exists when we already have 3 other env vars being used this way. Another example of nobody bothering to read any docs
- $NO_COLOR
This is intended to do the opposite of the others and tell applications not to use colour. However even this is often ignored.
----
That's 6 different ways to check whether to colour output or not. Only one actual standard method and everything is only partially supported (if at all) in applications. Hence why applications then need a `--color` flag, which even that differs in support and syntax across different command line tools. And the "default" method you described, $TERM, actually breaks applications on alternative terminal emulators and hardware terminals -- that is unless they decide to announce themselves as `xterm` and in that case that environmental variable becomes entirely useless.
----
> Not sure what terminals do without color support with color escape codes.
They ignore them.
ANSI escape codes are a pain in the arse to parse but there is at least a documented standard way to parse them. Anything that is a CSI (Control Sequence Introducer) sequence, and that includes SGR (Select Graphic Rendition) parameters like colour codes, start with `{ESC}[` and terminate with a character in the range of 0x40 to 0x7E. It's actually a little more complicated than that[1] but that's the gist of it.
So you know what to print and what to ignore.
There are other escape sequences too, the other big one being OSC (Operating System Command) and they're terminated `{ESC}\`, which is usually referred to as ST (String Terminator). That is unless you're xterm, and then you terminate OSC sequences with either ST or BELL (char 0x07).
A lot of this makes more sense if you look at code rather than documentation. So I've made an effort to ensure my own terminal emulator's source code is as self-documenting as possible:
https://github.com/lmorg/mxtty/blob/main/virtualterm/ansi_c1...
[1] https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_(Control_...
-
The New Terminal (Beta) Is Now in JetBrains IDEs
The problem with a lot of these tools is that they fight with the shell to provide the UX enhancements (the comments in this thread are littered with people commenting that this new terminal breaks basic feature X, Y or Z. Really what they should be doing is working with the existing command line primitives as a hook for their UX enhancements.
I know those existing primitives are 50 years old and suck in a great many ways. But the alternative is having a terminal that only works some of the time.
This is field I'm actively experimenting in too. And have already had some degree of success despite the project being only a couple of months old: https://github.com/lmorg/mxtty
My point is this: any refinements to the terminal interface shouldn't break support for terminal applications. But all to often (this term included) form is now prioritised over function.
direnv
-
Show HN: Dotenv, if it is a Unix utility
I think direnv already does a good job in this space, and it's already available in your package manager.
https://direnv.net/
-
Mise is a polyglot tool version manager
I switched from asdf to mise after a comment on lobste.rs[1] suggested I do so a few months ago, and I have been very happy with it.
It sands off some of asdf's sharp UI edges and provides a somewhat larger but still reasonable feature set; I've also replaced most of my direnv[2] usage with it.
The mise -> asdf comparison page is useful[3]
1: https://lobste.rs/s/66uxbj/how_love_homebrew#c_mvmsjp
2: https://direnv.net/
3: https://mise.jdx.dev/dev-tools/comparison-to-asdf.html
-
Nix-direnv is a quality of life improvement
I also made the export diff configurable, motivated by this post: https://github.com/direnv/direnv/pull/1233
- Direnv – Unclutter Your .profile
-
Conditional Git Configuration
Nice.
For years I've been using [direnv](https://direnv.net/) for this, setting environment variables which git picks up. This looks like a more feature complete equivalent, although to be honest I only really need switching of committer email and the SSH key used.
- FLaNK 25 December 2023
-
Development Environments with Guix, similar to devenv.sh
Direnv, for the uninitiated, loads and unloads environment variables when directories are entered and exited. Under every project folder there is a `$PROJ_DIR/.envrc` which contains:
-
Emacs Advent Calendar 9: devdocs, code-cells, dREPL, etc.
buffer-env: A pure-Elisp version of the direnv utility. Useful to make Emacs aware of Python virtualenvs (which, judging by the questions posted here, is unfortunately still a complication for a lot of people). Similar to (and inspired by) envrc, but doesn't require the direnv program.
-
golang cli vs env var in windows?
You can look at direnv to see this in action as they wrote shell hooks that get loaded into the shell profile and are executed on every prompt. https://direnv.net/
-
Nix Survival Mode: macOS upgrades won't break Nix anymore
Yes, most Nix users employ https://direnv.net or the equivalent for your IDE of choice. Emacs for instance has https://github.com/purcell/envrc which set per-buffer variables.
What are some alternatives?
spaceship-prompt - :rocket::star: Minimalistic, powerful and extremely customizable Zsh prompt
Pipenv - Python Development Workflow for Humans.
lorri - Your project's nix-env
Home Manager using Nix - Manage a user environment using Nix [maintainer=@rycee]
Neovim-from-scratch - 📚 A Neovim config designed from scratch to be understandable
Poetry - Python packaging and dependency management made easy
autojump - A cd command that learns - easily navigate directories from the command line
asdf - Extendable version manager with support for Ruby, Node.js, Elixir, Erlang & more
pyenv - Simple Python version management
exrc.vim - Local vimrc files
funky - Funky takes shell functions to the next level by making them easier to define, more flexible, and more interactive.
devenv - Fast, Declarative, Reproducible, and Composable Developer Environments