Why readline does not unset `backward-delete-char`? - readline

I need to bind the code 127 (aka DEL, aka ^?) to delete-char.
If I put DEL: delete-char to ~/.inputrc, it does not work. This is because this code is used by backward-delete-char by default.
So, first I need to free this code from backward-delete-char:
$ bind -u backward-delete-char
But for some reason it is not unset:
$ bind -q backward-delete-char
backward-delete-char can be invoked via "\C-?".
What should be changed in source code of readline library (for local use) to unbind the \C-? from backward-delete-char?
N.B. If I unset for example delete-char, it works flawlessly:
$ bind -u delete-char
$ bind -q delete-char
delete-char is not bound to any keys.

Running GNU bash, version 4.4.19(1)-release (x86_64-apple-darwin16.6.0) I see the same thing. I am able to unset the one I wanted with this: bind -m emacs-meta -u backward-kill-word
According to the maintainer Chet:
Unless you use the -m' option, the commands act on the current keymap, which is eitheremacs' or (usually) `vi-insert'
I found that his example commands didn't quite work, and only -m emacs-meta worked - but I'm not sure how to discover precisely which keymap applies.
Discovery process: searched the mailing list (Googled and site:http://lists.gnu.org/archive/html/bug-bash/ "bind -u") and picked up:
Re: Some readline functions can't be unbound with bind -u

Related

Can't use commands from ipython or julia repls with zsh

When I try to run a shell command in ipython or the julia repl it just says
shell> ls
zsh:1: command not found: ls
Not sure if it matters, but I have my path set in zshenv instead of zshrc so that emacs shell works.
Any ideas?
Edit:
I'm on macOS 10.14.6
For Julia, The shell> REPL prompt does in fact use a shell to execute its commands (on non-Windows systems). It effectively does something like run(`$shell -c ls`), and for most shells (including zsh) this means "non-interactive" mode and limits the number of init files that get loaded. You want to make sure your shell is working in this mode; I'd guess that if you type zsh -c ls at your terminal it'll be similarly broken.
Alternatively, you can customize which shell Julia uses through an environment variable. Setting JULIA_SHELL=/bin/sh is probably a safe bet — Julia uses that environment variable if it is set, otherwise it uses SHELL, and finally it falls back to /bin/sh if neither is set.
I'm not as familiar with ipython, but I'd wager it's doing something similar.

nix-env and nix-build not found after installation (debian buster)

after the installation following the instructions with
curl https://nixos.org/nix/install | sh
and logout/login, nix-env and nix-build are not found.
I had the problem with debian stretch and now with buster. What am I doing wrong?
The nix manual instructs to execute
source ~/.nix-profile/etc/profile.d/nix.sh
but the instructions printed after the execution say to do (I do not remember exactly)
./~/.nix-profile/etc/profile.d/nix.sh
and the same command is inserted into ~/.profile. The cause of the problem is the difference between . and source (see this superuser question). The script is setting up the $PATH variable in the environment and has the desired effect wtih source but no effect with . (which operates in its own shell and closes it at the end).
Cure:
change the line in .profile (or better move it to .bashrc) to
if [ -e /home/xxx/.nix-profile/etc/profile.d/nix.sh ]; then source /home/xxx/.nix-profile/etc/profile.d/nix.sh; fi
(xxx is your user name),
You need to add this recommended script.
For me only setting $PATH like this worked (in .profile)
export PATH="$PATH:/nix/var/nix/profiles/default/bin"

tmux: variable indicating whether text is selected?

I use vi keybindings in Tmux's copy-mode, and I'd like to make Esc clear the current selection if there is one, or exit copy-mode if nothing was selected.
bind -T copy-mode-vi Escape if-shell -F '#{selection_active_flag}' \
'send-keys -X clear-selection' \
'send-keys -X cancel'
I was hoping Tmux might expose a variable that indicates the selection state (I made up selection_active_flag to express my intent, it doesn't actually exist), similar to window_zoomed_flag (which does exist).
Is there a way to achieve this?
Tmux 2.6 introduced selection_present. As stated in the changelog,
Add selection_present format when in copy mode (allows key bindings that do
something different if there is a selection).
This is exactly what I was looking for, and though I'm running Tmux 2.6, it seems I have an outdated man page, as it made no mention of selection_present.
The final working solution is:
bind -T copy-mode-vi Escape if-shell -F '#{selection_present}' \
'send-keys -X clear-selection' \
'send-keys -X cancel'

How to get Docker work properly from within the msys2 bash?

Since I prefer using bash (and use git anyway), I tried running docker run -it ubuntu bash (after a successful hello-world), which unfortunately resulted in a invalid handle error. Using cmd.exe instead, it works fine.
Turns out the problem is my using ConEmu to host mintty.exe. Using mingw64.exe (or mintty.exe) directly instead, the error reads
the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'
instead and provides the helpful information to prefix winpty, which then also works from within ConEmu. Note however that winpty also messes up your command line parameters, e.g. winpty echo yes /no yields yes C:/yourmsyspath/no...

nagios-herald Install and config

I tried to install nagios-herald on my test VM.
I tried to configure herald to send emails. When I tried to send mail via command, It's working but not able to fetch/send with the proper formatted.
Below are commands for your reference.
[root#localhost ~]# /usr/local/nagios-herald/bin/nagios-herald --env-file /usr/local/nagios-herald/test/env_files/nagios_vars.EXAMPLE --formatter=check_ping -r amit#example.com -y nagios#example.com --message-type email -u http://192.168.124.25 --trace
Please anyone suggest me for configuration of nagios-herald with Nagios.
Just a quick tip, dont forget to set the following in nagios.cfg:
enable_environment_macros=1
Also, here is mine commands.cfg:
define command {
command_name notify-host-by-email
command_line /usr/local/nagios-herald/bin/nagios-herald --message-type email -r $CONTACTEMAIL$ --formatter=$_HOSTMESSAGE_FORMATTER_NAME$ --nagios-cgi-url=http://192.168.0.1/nagios/cgi-bin/cmd.cgi --reply-to=nagios#somehost
}
define command {
command_name notify-service-by-email
command_line /usr/local/nagios-herald/bin/nagios-herald --message-type email -r $CONTACTEMAIL$ --formatter=$_SERVICEMESSAGE_FORMATTER_NAME$ --nagios-cgi-url=http://192.168.0.1/nagios/cgi-bin/cmd.cgi --reply-to=nagios#somehost
}
After this you should have it working.
Good luck.
There is no check_ping formatter in the default project. If you've written one and it lives outside of the project directory, you can teach nagios-herald how to find it with -F </path/to/custom/formatters>.
I also noticed you are using the --trace option. If you specify either -l <logfile> in the command or logfile: in the config, you'll see what issues nagios-herald is encountering. I'm betting you'll see it state that it can't locate the check_ping formatter and fell back to the base formatter.

Resources