How to trouble shoot alias in neovim setup - lua

I am following this tutorial to use lua in setting up nvim as an IDE. I am using Mac Monterey (12.2) and Z shell. The install has a script,
#!/usr/bin/sh
NVIM_BEGINNER=~/.config/nvim-beginner
export NVIM_BEGINNER
rm -rf $NVIM_BEGINNER
mkdir -p $NVIM_BEGINNER/share
mkdir -p $NVIM_BEGINNER/nvim
stow --restow --target=$NVIM_BEGINNER/nvim .
alias nvb='XDG_DATA_HOME=$NVIM_BEGINNER/share XDG_CONFIG_HOME=$NVIM_BEGINNER nvim'
This runs just fine and the install succeeds. I get my splash screen and nvim starts. the directory structure mirrors that in the tutorial and I can create files etc.
When I quit and restart the terminal, the alias - nvb for launching this 'new' nvim IDE is not found. I have looked at the alias. I don't know where it is writing the alias assuming thats the problem. I have a .zsh_aliases file pointed to using an entry in .zshrc which works fine normally. When I put the alias alias nvb='XDG_DATA_HOME=$NVIM_BEGINNER/share XDG_CONFIG_HOME=$NVIM_BEGINNER nvim' in .zsh_aliases or .zshrc it doesnt work.

Related

PIPX Install on MAC - Duplicate user/xxx/.local/bin in PATH

I have recently installed PIPX on MAC running Big Sur and ZSH shell. During the install it prompted for the following to be added to the .zshrc file....
# Created by `pipx` on 2021-03-20 14:22:23
export PATH="$PATH:/Users/xxxx/.local/bin"
eval "$(register-python-argcomplete pipx)"
Running echo $PATH showed /Users/xxxx/.local/bin added to the end of my PATH variable. However, when I close the terminal and open up a new session, running echo $PATH now shows the location duplicated at the end of the PATH :/Users/xxxx/.local/bin:/Users/xxxx/.local/bin
Opening and closing new terminal sessions doesn't seem to create any more additions to PATH it just remains at these 2 entries....
I have run typeset -U PATH path to remove the duplicate but each time I open up new terminal sessions it just duplicates again.
Does anybody know how I can stop this from happening.....I would really like to keep my PATH variable as clean as possible.
Add the following path to your .zshrc file :
export PATH="${PATH}:$(python3 -c 'import site; print(site.USER_BASE)')/bin"
Reference: [command not found: pipx]: https://github.com/pipxproject/pipx/issues/283

Could not login with bash shell by default

I want to run a Ruby on Rails application. When I tried to run it, it shows me this,
The program 'rails' is currently not installed. You can install it by typing:
sudo apt install ruby-railties
So, I figured out the problem and I found that the problem is due to not login into bash shell. My terminal could not execute 'ruby' or 'ruby on rails' scripts. I checked .bashrc and .bash_profile files if PATH variable is set to point to rvm file.
When I did,
/bash/bin -l
it shows me ruby or rails are installed on system and I could start Rails server successfully. But if I opened another Terminal window, same problem occurs. Basically, I want to log into bash shell by default. Please correct and help me to sort out this. Thanks!
If you are sure the location of your bash shell is /bin/bash you could use this command (replacing "username" with your username):
chsh -s /bin/bash username
That will change your default shell in most unix like operating systems.
Afterwards you can verify it checking /etc/passwd where you will see the default shell at the end of the line of your username.
Warning: Try it first with a new user, in order to avoid losing your shell access if the path to bash is different :-)

Using the Command-line Command to launch Sublime Text 2 on OS X

I just started reading Michael Hartl's book on Rails and I've run across a problem in the setup phase. Hartl keeps referring to making a file in my home directory, but I'm not quite sure how to do this. For example, when I try to setup the command line for sublime text the instructions tell me to do this: Assuming you've placed Sublime Text 2 in the Applications folder, and that you have a ~/bin directory in your path, you can run:
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
My problem is that I don't know how to put a ~/bin directory in my path. I know this is real basic but any help would be greatly appreciation.
create or edit ~/.profile (works with both bash and zsh)
add the following
export PATH=$PATH:$HOME/bin
The line above is saying, overwrite the PATH environment variable and set it to the previous path plus ~/bin
Now when you try to run a command, bash will look in all the colon separated paths in your PATH environment variable for an executable.
To see your entire PATH, type echo $PATH in a terminal. Or better yet, type env to see all environment variables.
On your terminal
$ mkdir ~/bin
$ sudo ln -s "/Applications/Sublime Text2.app/Contents/SharedSupport/bin/subl" /usr/bin/subl
Edit ~/.base_profile
export PATH=$PATH:~/bin
usage:
open current directory:
subl .
In your ~/.bashrc file add to the end:
PATH="$HOME/bin:$PATH"

Hello world on ruby and rails (ror)

I've saved 'hello world' as a .rb file on my computer running Mac OS X Lion. I'm trying to create a new directory called ruby_tutorials in the root of my file system, but I'm having some trouble.
I tried typing in the command mkdir /ruby_tutorials in a terminal, but I got this error message: 'Permission Denied'. How can I overcome this?
Try this:
sudo mkdir /ruby_tutorials
sudo allows you to execute commands as a superuser. You need administrative privileges to create a directory in your root directory. One reason to use sudo for individual commands instead of always having administrative privileges is that it protects you from accidentally harming your system.

rubys> cd command not working in command line

I'm just getting into ruby and am trying to execute a walkthrough from Sam Ruby's Agile web development.
I've created a directory using mkdir work
Next i'm instructed to open a terminal and type rubys> cd work
The error I'm getting reads:
No command 'rubys' found, did you mean:
Command 'ruby' from package 'ruby' (main)
rubys: command not found
Can anyone inform me of what I'm doing wrong?
I've also tried changing from ~ to the work directory before entering my command.
In this book, rubys> is a command prompt, much like you have C:\> in the Windows terminal.
Ignore that first bit and everything should start working.
I guess you're doing it wrong.
mkdir work
creates a directory called "work". It has nothing to do with Ruby.
cd work
will then change into that directory. Forget about the rubys>.

Resources