unswap caps and control - keyboard

I recently changed my keymapping to neo, however, Capslock is still swapped with the control-key.
/etc/default/keyboard contains just XKBOPTIONS="lv3:ralt_alt"
.xinitrc only loads my sound drivers and my windowmanager.
.xinputrc contains run_im ibus
If I add a script to .xinitrc, which runs setxkbmap de neo -option , setxkbmap -query still tells me options: ctrl:swapcaps
How can I debug this? I really don't want caps to be swapped with control anymore.

From setxkbmap man page:
-option name
Specifies the name of an option to determine the components which make up the keyboard description; multiple options may be specified, one per -option flag. Note that setxkbmap adds options specified in the command line to the options that were set before (as saved in root window properties). If you want to replace all previously spec‐ified options, use the -option flag with an empty argument first.
That is -option flag with no argument should do the trick:
setxkbmap -option

Related

How to bind multiple keys in gnu screen, specifically using arrow keys

First off, I'm using Opensuse 13.2 64-bit and also Arch_Linux 64-bit
Can't get the bind to work for either of them (well, the binds that I want), but I'm mostly focused on the Arch_Linux. Also, using openbox wm, xfce4-terminal. ( in opensuse using konsole and gnome 3) and my $TERM is set to xterm-256color in my ~/.bashrc and is switched to screen-256color when using screen in opensuse, but strangely is not changed in Arch.
I want to bind C-a down: to focus down, C-a up: to focus up, C-a left: to focus left etc.. Lets just focus on focus down for the moment.
I've tried everything in my ~/.screenrc file
bind "\E[B" focus down
bind "\EOB" focus down
bind "^[[B" focus down
bind "^[OB" focus down
bind "\033[B" focus down
bind "\033OB" focus down
bind "\033\133\102" focus down
bind j focus down # works fine
Nothing catches the down arrow key. I CAN use the following
bind -k kd focus down
however, I also want to bind multiple keys using the arrows and AFAIK the -k option only allows binding 1 key (or shift + left/right) . Actually I'm lucky I can even use the -k option since it is not documented.
Now I've checked my kd (termcap) and kcud1 (terminfo) using infocmp
infocmp -1 | grep kcud1
kcud1=\EOB,
infocmp -1C | grep kd
:kd=\EOB:\
and BTW these symbols can be looked up here for termcap and here for terminfo and its termcap equivelancies (actually I guess you can just use: man terminfo)
when I use Ctrl-v and press down arrow I get
^[[B
showkey -a
^[[B 27 0033 0x1b
91 0133 0x5b
66 0102 0x42
Anyone know how to go about this. I want to know why I can't use bind without the -k termcap_name and/or how to use combo of keys(such as ctrl/alt) and termcap names. Thanks for all and any info.
I've tried setting termcapinfo also with no luck. don't think I'm using it right.
termcapinfo * kd=\EOB
bind "\EOB" focus down
termcapinfo * kd=\E[B
bind "\E[B" focus down
etc...
It appears that GNU screen doesn't permit binding sequences of multiple keys.
Quoting the man page:
bind [-c class] key [command [args]]
Bind a command to a key.
...
The key argument is either a single
character, a two-character sequence of the form "^x" (meaning
"C-x"), a backslash followed by an octal number (specifying
the ASCII code of the character), or a backslash followed by a
second character, such as "\^" or "\". The argument can also
be quoted, if you like.
...
As said in this answer, try:
bindkey "^A^[OB" focus down
The vim trick is really helpful to get the code for the combinations you want (for example, if you wanted the combo Ctrla Ctrldown instead of Ctrla down, this would be ^[[1;5B instead of ^[OB).
Credit should go to koyae for the original answer.

.inputrc override Control+W

How do I override Control+W in bash within my .inputrc? The following on its own doesn't work:
"\C-w": forward-word
It does work when I add stty werase undef but then the 's' key is mysteriously disabled!
You need to use the option set bind-tty-special-chars Off in your .inputrc file in order to bind ^W like that. The reason is that:
Readline, beginning with version 5.0, reads the stty special character
settings and binds them to their readline equivalents each time
readline() is called from bug-bash mailing list
The bind-tty-special-chars option was introduced in 5.1 in order to work around this feature. Readline Changes - search for the option
set bind-tty-special-chars Off
"\C-w": forward-word
The slightly older-school method involves .bashrc like:
stty erase undef
bind '"\C-w": forward-word'

How do I insert a tab character in Iterm?

Simply put, I know you can do ctrl+v+tab to insert a physically real tab character in a bash statement. But how do I do the same for iTerm?
The answer was to hit control+v, then tab afterwards, not all together! Hope this helps someone.
It's not iTerm, but your shell that affects how you''re able to insert a tab.
First, make sure you're in BASH shell: Type the following command:
$ echo $RANDOM $BASH_VERSINFO
23714 3
The first is a random number, and the second should be the BASH Version number. If you get a blank line or just a random number, you're not in the BASH shell, and that's probably one of your issues.
Another thing is to execute this command:
$ set -o
allexport off
braceexpand on
emacs on
errexit off
errtrace off
[...]
privileged off
verbose off
vi off
trace off
The two lines of interest is the emacs and the vi lines. One of those should be on. If they're both off, you can't do the Ctrl-V-Tab to insert a tab character.
When the vi mode is on, it should be Ctrl-V-Tab like you said. With emacs mode on, it is either Ctrl-V-tab, or possibly Ctrl-Q-tab.
However, this isn't an iTerm thing, this is your shell that's doing it.
If by a "physically real tab character" you mean sending the tab hex code (0x09) to the shell, then you can do this in iTerm by pressing Ctrl + Tab (⌃ ⇥).
This is the default setting, although you can change it (as well as add other hex code values to send) in iTerm > Preferences > Profiles > Keys.
I'm not certain why you're comparing a "bash statement" with iTerm. You write bash scripts in iTerm. Which means, assuming you're writing your scripts in iTerm, you're already doing what you want.
I'll assume you mean scripting in vi vs command line. The way I get literal characters on the command line is by using vi editing mode. Do set -o vi. Then you can use ctrl+v followed by tab in the manner that you're used to.
IMO, using vi editing mode comes with a slew of other pluses like searching your history, faster navigation, etc. So you could just add it to your .bashrc if you wanted and use it all the time.
One should also try Ctl + V Ctl + I. It is working in konsole where Ctl+V+Tab deosn't work.

Use xkbdmap (setxkbmap) to map rwin to altgr?

Normally, I can find solutions by just googling around, but I can't find any decent documentation for xkbdmap except for the grossly inadequate man page.
Perhaps I'm going about this the wrong way. I have a US 105 plain old keyboard that does not have an AltGR key. To the right of the space bar, I have Alt, Windows key, some sort of menu key, and then a Control key.
(what's the point of the Windows key and the Menu key - does anyone actually use those?)
Apparently, some keyboard have another key which is the AltGR key. That with E would give you a Euro symbol for instance, apparently.
Because my keyboard doesn't have this key, I thought to use the xkbdmap command like this:
xkbdmap altgr:rwin
Why does this not work?
There's no xkbdmap command in the standard xorg distribution. You probably can use xmodmap but generally things are done slightly differently in the X11 land nowadays. If you use XKB (everybody uses XKB now) then there are virtual modifiers such as "compose" and "meta" and "level 3 chooser" which are mapped to real keys. This is done with the setxkbmap command. You probably want either
setxkbmap -option -option compose:rwin
or
setxkbmap -option -option lv3:rwin_switch,eurosign:e
depending on what exactly you want. Google setxkbmap options to figure out your possibilities.
(The first empty -option argument clears existing options, the second one adds to existing options. If you want to keep existing options, skip the first -option. Current options are stored in the properties of the root window.)
Note that most keyboards that have AltGr lack the right Alt key. If you want your right Alt to act like AltGr, change rwin to ralt in the above commands.

How do you specify a tab in .screenrc?

According to this website, you can change to command key sequence used by the Unix "screen" utility like this:
escape ^Bb # Instead of Control-a, make the
# escape/command character be
# Control-b
How would you make it Control-Tab, I wonder?
Never tried it, but you may have a go with this link

Resources