How is it possible for the terminal to automatically recognize newly installed modules as independent commands w/out being defined - linux

On my PC I have quite a few aliases, path variables and modules like npm, scoop shims, go modules, powershell/bash functions/modules and my question is, does the pc search through all of these things the moment after I run a command? or is there some kind of registry that stores all of these values so they are quickly accessible? That would be my guess but both on my linux machine and my windows pc I have syntax highlighting on and it "knows" that a command is valid even prior to running it.
I was really curious about what process is taking place here earlier today when I installed gum (charmbracelets go TUI module) and it automatically recognized "gum -file" as a valid command when I hadn't explicitly defined it anywhere and it isn't prepended with "go" or "scoop" (assuming that I used one or the other to install the module)
I tried googling this question but I was inundated with pages of irrelevant stuff regarding basic questions about path errors and bloated articles about how to add stuff to your path.

Related

Configure node with .noderc

I feel like this is a silly question but I can't get node to run a .noderc file, not even to just log to the console and not even on linux where I would expect everything to work.
My use case is that for work I have to use Windows and npm has installed modules to a particular location (%HOME%\AppData\Roaming\npm\node_modules\), whereas the default module.paths in node does not include that directory. I am fine with the location, so I don't want to fix this on the npm end of things. I have easily fixed the issue by appending this path to modules.paths, so the real solution should be for me to add that to an rc file.
I tried making a .noderc in my Windows home directory, and to my surprise it seems to not be running. I did the same on my personal laptop running a linux distro (~/.noderc) and the same thing happens. A log to console or definition of a test var does not show up in the REPL.
Is there something obvious I am missing? Usually programs have a hierarchy they run through, with default configs, a system level config file (if it exists), and a user level config file (if it exists). In the case of a program like X, they are executed in order and overwrite options, where as in something like bash, they are checked in reverse order and the first one found is executed (it is common for the first line of a user level bash config to source the system level one). How does node function?
EDIT:
In the comments below where I link to an old SO thread I noticed that there is a bit of a hack involving an alias to get the .noderc to work. So I guess a better question is, how are things like module.paths configured in node? There must be a way not involving a full rebuild.
As there has been no answer for over 10 days, I am going to just post my workaround form the comment above. It looks like there is no node config file. Any further info on that welcome. In order to solve my particular problem, I used the NODE_PATH environment variable.
I personally prefer to use use config files and not environment variables for scripting issues that need to be addressed every time. Config files are always read automatically, while using an environment variable requires you to always remember to add the variable or to permanently add the variable to your environment (which clutters the environment). I prefer to restrict environment variables to specific variations from the default. However, as I said, I can't find a config file for node.

Move Emacs from Linux to Windows

I've had a break from programming the last two years and want to start up again. Right now I'm using a Windows computer, but my work and compiler is on my Linux computer.
My question is:
Is it possible to move my entire emacs work environment from Ubuntu to Windows 10? I did some changes in emacs back in the days that I got used to and would love to continue like that on my Windows computer.
Briefly...
The most important things to copy are your ~/.emacs.d directory and your init file (see C-hig (emacs)Init File for the different filenames this might have, or check with C-hv user-init-file).
See C-hig (emacs)Windows HOME regarding where the .emacs.d directory should live on your Windows system.
Note the comments in that Info node on the site-lisp directory as well, in case you've been using elisp libraries in there (possibly without realising), as they can form part of your Emacs configuration as well.
Any byte-compiled elisp (.elc files) should remain compatible so long as you're moving to an equal-or-newer version of Emacs (which sounds likely in this case). Natuarally things do change between releases, though, and it's possible to encounter incompatibilities when upgrading, but I wouldn't worry about that in advance -- try the latest version first, and if you run into problems that you can't solve (which shouldn't be very likely), you can always install the version of Emacs you were originally using.

Changing ncurses 6 "terminfo-dirs" after compilation/installation

There is a ncurses6 originally installed in a user home dir, let's say "/home/test", so a test environment was built over this ncurses path, a lot of (in development) apps were compiled and is working now, depending only of the current HOME env variable.
But, because of a purpose beyond our control, we have to change the user home dir. And now it's anything different from "/home/test".
The external apps and ncurses tools still working, we need just point the libraries with LD_LIBRARY_PATH and use a more specific path like we used before for ncurses tools:
LD_LIBRARY_PATH=~/bin/ncurses-6.0/lib ~/bin/ncurses-6.0/bin/tic
But now, after changing the user home dir, we need to point also the terminfo database:
TERMINFO=~/bin/ncurses-6.0/share/terminfo LD_LIBRARY_PATH=~/bin/ncurses-6.0/lib ~/bin/ncurses-6.0/bin/tic
But, is there any way to make the TERMINFO database path permanent without recompiling and reinstalling the ncurses ? Is it hard code in ncurses during compilation ?
The default values are compiled-in. You can override those with environment variables (TERMINFO is standard, TERMINFO_DIRS is an extension). That's not new with ncurses6 (it predates ncurses4, twenty years ago).
The most practical "permanent" change would be to put the overrides in your shell initialization.
It's possible to modify an ELF binary (there's no checksums), but the resulting path couldn't be longer. It could be shorter, since the strings are null-terminated. Since your example adds to the path, that wouldn't work for you, anyway.

Vim plugin Align fails to work. Can it be installed without vimball?

I've happily installed the vim Align plugin on my home computer, but on the Red Hat servers at work, the installation doesn't work. The servers at work have a very old copy (2006) of vimball, which from Googling I know doesn't support more recent vimballs, including Align. I can't get the systems group (IT department) to upgrade vimball, so I thought perhaps I could simply copy the various files into ~/.vim/plugin by hand. I copied the 3 files from my home system AlignMapsPlugin.vim AlignPlugin.vim cecutil.vim, but when I attempt to use Align from within vim I get the following error message
E117: Unknown function: Align#Align
I know that it's seeing the plugin, because when I remove the plugin the error message is different (it says "Not an editor command Align").
Is there a workaround for this? I love "Align" and would sure like to use it at work as well as at home.
{rtp}/plugin is not the only location where plugin files can be placed. The name of the function suggests that there is at least one file in {rtp}/autoload named Align.vim (autoloaded functions must have names looking like path#to#file#with#function#without#leading#autoload#function_name(), this example is for function located in {rtp}/autoload/path/to/file/with/function/without/leading/autoload.vim). But I strongly suggest that if #LucHermitte’s solution is not acceptable, you should use something that supports holding plugins in separate directories. If you used VAM all you needed to do (assuming that you have already installed align using VAM) is to look for files in ~/.vim/vim-addons/Align%294 and copy all of them.
Update: Forgot to say, you may try to install newer vimball plugin into your ~/.vim. In order to do this you need copy a file placed in /usr/share/vim/vim73/autoload/vimball.vim to ~/.vim/autoload (there is another related file, /usr/share/vim/vim73/plugin/vimballPlugin.vim, but it is not likely to be changed). No need to make IT department to upgrade anything, unless the newest version uses the newest vim features.
Install a recent (/the latest) vim in your $HOME. I've been doing this for ages now. It's the easiest way to get the job done (i.e. to have a proper environment).

Tutorial/Guide to create a classic, small Linux application in a package (Debian)

I've made a small script in my machine, and an alias in .bashrc that calls it. It's a bash script with 3 lines, but it can grow.
Now, some people in my team found it useful, and want to use it.
Instead of saying "copy this alias, do this, do that, install that lib" I was thinking about creating a simple package to be a little more professional. Fact is, I've never done something like this before. And the problem to me is not creating a package, is trying to decide what usually do you put in a package.
Suppose I want to take my script, and create myapplication. I want to create a .deb file that my team would install and:
Have a /usr/bin/myapplication or /usr/sbin/myapplication (what's the difference between them?), so they would just call myapplication at their terminal and it would work;
Have a man page; (Where are usually located man pages in a debian system?);
Have a possibility to read a .myapplicationrc in home folder with some configurations;
Have an entry for shortcuts in a gnome installation (is it possible to have an universal shortcut "format" that's is available to KDE and Gnome as well?);
Install dependencies.
I'm new to all that stuff. I usually code simple scripts and create an alias in my bashrc. I've never done a package before. Which guides do you know of that can help me accomplish what I thinking of above?
Here is a place to start, though I welcome a more succinct answer.
I couldn't find a complete guide. I think the best thing to do is download a package that does exactly what I'm thinking of and do some reading, like taskwarrior.

Resources