tmux changes "\" to spacebar when prefix is pressed - configuration

In tmux.conf I have mapped \ (alt gr + q) to rename session and it worked fine up until few months ago, then stopped responding to \ when prefix is activated.
By chance I've figured out that tmux somehow started responding to spacebar for session rename when prefix is pressed.
I have remapped it to other characters for testing purposes and only \ is not responding and is changed to spacebar, this is happening even after fresh Linux installation.
Intrestingly, it does recognize \ when it's written out in terminal or any CLI editor and it's not problem with UTF8 because I've played with different option:
start tmux with tmux -u
UTF8 option enabled in .tmux.conf although it enabled by default
third solution had something to do with changing two language options from terminal to UTF8
Configuration for session and window rename
# Rename session and window
bind \ command-prompt -I "#S" "rename-session -- '%%'"
bind | command-prompt -I "#W" "rename-window -- '%%'"
Tmux version is 3.2, I couldn't find anything regarding this problem in man or in tmux issues on GitHub.

tmux 3.0 made two incompatible changes in config file parsing. One is
a \ on its own must be escaped or quoted as
either \\ or '\' (the latter works on older tmux versions).
See here. So you should try bind \\ ... or bind '\' ... instead.

Related

What's wrong with NSIS shortcut?

Should warning, that english is not my native, sorry for grammar misstakes.
I have a problem with shortcut that i create with NSIS. The shortcut's link leads to exe file, that use a json config, config is in the same directory with exe, and when i use the shortcut it returns me an error, that it can't finde the config, cause it's searching in the shortcut's directory. But when i make the shortcut by myself it works correct - searching config in the exe's directory. I need to create the shortcut, that will uses a config which lies in instdir. How to make it correctly?
That's how i create the shortcut:
CreateShortCut "$DESKTOP\%link_name%.lnk" \
"$INSTDIR\%SomeDir%\Application.exe" \
"" \
"C:\Users\Daniil.Bogdanov\Pic\logo.ico" 0
The config and exe lie in %SomeDir%
This isn't the most intuitive thing but CreateShortCut sets the working directory for your shortcut based on the current $OUTDIR value.
https://nsis.sourceforge.io/Docs/Chapter4.html#createshortcut
$OUTDIR is stored as the shortcut's working directory property. You can change it by using SetOutPath before creating the shortcut
So I'm guessing that your output path isn't the same as the location of your executable. This could be remedied by using SetOutputPath right before creating your shortcut.
SetOutPath "$INSTDIR\%SomeDir%\"
CreateShortCut "$DESKTOP\%link_name%.lnk" \
"$INSTDIR\%SomeDir%\Application.exe" \
"" \
"C:\Users\Daniil.Bogdanov\Pic\logo.ico" 0

Tmux: How to configure tmux to display the current working directory of a pane on the status bar?

I am new to tmux and I am trying to edit my tmux.conf file to have the left side of the status bar reflect:
[SessionName] [CurrentPane] [CurrentWorkingDirectory]
I am able to display the SessionName and CurrentPane. However I can't get to display the CurrentWorkingDirectory.
I've tried several #(shell command) options:
#(tmux select-pane -t :.#P; pwd) :
But this prints some other $PWD variable which does NOT reflect
the current directory of the bash session in the current pane.
#(tmux select-pane -t :.#P; tmux send-keys pwd Enter)
Firstly, although it did print the CurrentWorkingDirectory if I'm
in a terminal. It prints this in the terminal and NOT in the status
bar like how I want it. Secondly, It entered "pwd Enter" every 15
seconds whether or not I was in a terminal, which was a hassle to
reverse if your not as quick (like I am).
I've tried these options but to no avail, is it possible to do what I want? and how?
There is a variable for that, which doesn't seem to be in the manpage but is mentioned in the development version. For me, it works in the 1.8 release of tmux.
set -g status-left "#{pane_current_path}"
Note that it also works when you put it in the window-status. Each window status will mention respective working directories.
setw -g window-status-format "#{pane_current_path}".
I'm not sure how to do this in bash, but in zsh, there's a hook that gets run before every command. In your .zshrc:
precmd () {
tmux set -qg status-left "#S #P $(pwd)"
}
This will run that tmux command everytime you run a command. Hope this helps. Since bash doesn't have a precmd, I'm not sure how to do this.
Unfortunately, the proposed solution does not work for version 1.7 - "official version" for OpenSuse 12.3, but I managed to find a solution:
In /etc/tmux.conf:
setw -g window-status-current-format "#T(#I:#W#F)"
setw -g window-status-format "#T(#I:#W#F)"
Here #T - tells to display current pane title, which can be set with some escape sequence. For doing this at each shell command, put
somewhere in .bashrc:
[[ -n "$TMUX" ]] && PROMPT_COMMAND='echo -n -e "\e]2;${PWD/${HOME}/~}\e\\"'
This works for me on OpenSuse 12.3, tmux 1.7, bash 4.2.53.

configure file name for Tcl/Tk

When you build Tcl/Tk by default it creates the files
tclsh85
wish85
However many programs call tclsh and wish. This is one fix for that
cp tclsh85 tclsh
cp wish85 wish
However, can you simply build tclsh and wish directly, perhaps using a configure argument?
This behavior is The Right Thing as it allows several versions of the interpreter and its libraries to coexist in the system. The system, in turn, does provide a way to "bless" one of the version as "default" — for instance, Debian provides "alternatives". In essence, usually a symlink with the "canonical" name is created pointing to the real executable, like /usr/bin/tclsh → /usr/bin/tclsh85. And with the "blessed" version available via such a symlink for the applications that do not care about the precise version of the runtime, certain other applications still can pick some specific runtime version by referring to the interpreter's real executable name.
This also provides an easy way to test an existing program against an experimental runtime version: you just run /usr/bin/tclsh86 /path/to/the/script.tcl instead of just running /path/to/the/script.tcl as usually which relies on the shebang to pick the interpreter.
A long time ago, the builds of Tcl and Tk used to work in the way you describe. It was changed to the current system (putting the version number in the name) to allow multiple versions to coexist more smoothly; this was a very strong demand from the user community at the time.
Symlink the version-less filenames to the real ones (or use the mechanism of your distribution) if you want to give up control over which version to use. Alternatively, use this (fairly horrible) piece of mixed shell/Tcl code at the top of your files:
#!/bin/sh
# Try with a versionless name \
exec tclsh "$0" ${1+"$#"}
# Otherwise, try with tclsh8.6 \
exec tclsh8.6 "$0" ${1+"$#"}
# Otherwise, try with tclsh8.5 \
exec tclsh8.5 "$0" ${1+"$#"}
# Otherwise, try with tclsh8.4 \
exec tclsh8.4 "$0" ${1+"$#"}
# Otherwise... well... give up! \
echo "no suitable Tcl interpreter" >&1; exit 1
This relies on the fact that Tcl, unlike the Unix shell, treats a \ at the end of a comment line as meaning that the comment extends onto the next line.
(Myself? I don't usually put in #! lines these days; I don't consider it an imposition to write tclsh8.5 myscript.tcl.)

Autocompletion in the MySQL command-line client

In Linux, and many other systems, when navigating the terminal you can press Tab to auto complete a directory or file name.
I'm wondering if there is anything like that in the MySQL terminal. For example, if I want to get the description of someTableWithRidiculousLongName I could type describe someTableW then Tab and it would auto-complete the rest.
Does anything like that exist in the MySQL terminal?
Edit or create a file called .my.cnf in your home directory, containing:
[mysql]
auto-rehash
To enable autocomplete within the MySQL prompt type:
mysql> \#
After that you can type:
mysql> describe someTableW[TAB]
To get:
mysql> describe someTableWithRidiculousLongName
start MySQL console with additional option --auto-rehash, i.e.
mysql --auto-rehash -u root -p
I know this is an old question, but I've found very helpful MySql cli client with advanced autocompletion:
mycli. It's much smarter than builtin auto-rehash feature.
On OS X 10.11.6 I set --auto-rehash as described above, but it did not work. (This is OS X so mysql is compiled with the BSD libedit library.)
Then I remembered that I had set vi key-bindings for mysql client by creating ~/.editrc, containing one line: bind -v. This works great for giving me vi-like navigation in mysql client, but it broke column name completion (I was able to verify this by removing .editrc).
So I researched a little bit and found that ~/.editrc should have at least the following lines:
bind -v
bind \\t rl_complete
With this additional line, name completion works correctly in mysql AND vi-like navigation works also. (There are other .editrc settings which greatly improve mysql client navigation, but this isn't the place to start that thread of discussion.)
Some notes about auto-rehash:
When you enable autocompletion editing the mysql config file..
[mysql]
auto-rehash
You can do it for all users or only for one user:
/etc/my.cnf: All Users
~/.my.cnf: Actual user
You can also disable autocompletion adding:
no-auto-rehash
Extracted from: http://www.sysadmit.com/2016/08/linux-mysql-autocompletar.html
You can also auto-complete based on the command history. Start typing, then invoke the keys which are bound to ed-search-prev-history and ed-search-next-history. This applies if mysql comes with libedit support. The default keybindings are Ctrl-P and Ctrl-N, but this can be customized in .editrc. My example for Ctrl-up and Ctrl-down:
# start typing, then press Ctrl-Up
bind "\e[1;5A" ed-search-prev-history
# start typing, then press Ctrl-Up, then Ctrl-Down
bind "\e[1;5B" ed-search-next-history
Previously, mysql was based on readline, and then history-search-backward and history-search-forward are the correct commands. Configuration then was by means of .inputrc. Same example as above:
# these are the key bindings for the readline library
# start typing, then press Ctrl-Up
"\e[1;5A": history-search-backward
# start typing, then press Ctrl-Up, then Ctrl-Down
"\e[1;5B": history-search-forward
So, say you started typing sel and invoke Ctrl-Up, select * from some_long_table_name would come up if that is a command I have used earlier.

Why won't PHP 5.2.14 display any errors (even from the command line)?

I have PHP 5.2.10 and PHP 5.2.14 (x86 non-threadsafe Win32 builds) installed on a Windows 2008 R2 server and on Windows 7 64 bit.
For some reason PHP 5.2.14 refuses to show error messages.
Even when I set the following settings in php.ini I don't get any errors reported if I use 5.2.14:
error_reporting = E_ALL
display_errors = On
This happens even when running a test script from the command line using php.exe with a deliberate syntax error:
c:\php>php test.php
PHP is using the correct php.ini file because I can see my settings change when I run php.exe -i.
I also notice that php.exe in PHP 5.2.14 is very slow to start up.
When I perform the same set of tests using PHP 5.2.10 on the same machines I get error messages reported just fine.
Both of the php.ini files are stock (based off of php.ini-recommended) but with the error_reporting and display_errors settings modified.
I have found this truly annoying, so here's a strategy for checking the syntax from the command line:
Don't load the ini file.
Turn on display_errors and display_startup_errors explicitly.
php -n -l -d display_errors -d display_startup_errors path/to/your/phpfile.php
$ php -h
-n No php.ini file will be used
-l lint, syntax checking only
-d foo[=bar] Define INI entry foo with value 'bar'
I'm running a later PHP (5.4.24), but these other answers lack the -d option I found exemplified elsewhere that makes PHP display intelligible parsing errors when running from the command line:
php -d display_errors test.php
This is the best answer to the question I was googling. Running the linter with -l only tells you "Errors parsing foo.php".
You might have to enable display_startup_errors as well:
display_startup_errors boolean
Even when display_errors is on, errors that occur during PHP's startup sequence are not displayed. It's strongly recommended to keep display_startup_errors off, except for debugging.
You can also try to lint the file with c:\php>php -l test.php to test for syntax errors.
Lately, I had to work on someone else's project... Not being able to debug, I had no choice but to check for this:
error_reporting(0);
So, check on your source code. Search for something like this: "error_reporting(0);".
Once you've found it, comment it!!!
Normally, you don't have to put that in the source code, but in the php.ini file.