You are not logged in.
Pages: 1
Dear all,
I have just realized that the combination SHIFT+TAB does not work properly in bash.
When I am using an editor like vim or nano I would expect that hitting SHIFT+TAB would bring the cursor back,
instead in NANO it says that it is an unknown combination, while in vim it behaves as a tab.
I have used
cat -v
to discover that the combination SHIFT+TAB is mapped to
^[[Z
What should I do to have SHIFT+TAB behave as expected?
Thanks a lot in advance!
Offline
You don't explain well what you expect from the Shift+Tab combination: unindent, delete backwards, move the cursor left n characters? Is it bash or is it the two editors whose behaviors you wish to change? For bash, I've never known Shift+Tab to do anything unless that key combination has been mapped by the user.
For vim, take a look at http://vim.wikia.com/wiki/Make_Shift-Tab_work.
Offline
Thanks Old man,
I honestly don't know what to expect. Isn't shift+tab supposed to do the opposite of tab?
That is, if in a program tab indent 4 char, I expect shift+tab to unindent them,
if in bash TAB switches between the various choices (I haven't set this yet), I think shift tab should go in reverse order.
In vim I have set this behavior using .vimrc and it works fine on an Ubuntu machine having the same .vimrc file
(unfortunately I don't have access to it anymore).
If I understood correctly while reading reading, SHIFT+TAB is mapped to ^[[Z] when something is not configured properly.
I would first like to fix that, and then when it is mapped to the right combination, I will check how to configure the various
programs to behave as I would like.
Thanks again for the help!
P.s. I had already tried the solution you posted for vim, but it doesn't work...
Offline
Aha! Shift+Tab does work correctly for you, but your expectations are that it should work differently.
Changes to key bindings for bash + readline can be placed in either /etc/inputrc for system-wide modifications or in ~/.inputrc for per-user modifications.
For the filename completion, I think you actually want menu-completion. Try adding the following lines to your ~/.inputrc file.
TAB: menu-complete
"\e[Z": menu-complete-backward
Press Ctrl+x then Ctrl+r to have the changes take effect in your current shell.
I'll note that this works for bash and probably won't be of use with other shells. You are on your own if $TERM is incorrectly set.
Offline
Hi Oldman,
actually I don't want to set the menu-complete.
I just noticed that Shift+Tab behaves differently than in other linux installation (with the same configuration files),
which is why I thought something is wrong with my configuration.
Since following the links to set up vim that you sent me didn't work, I still think there might be some problem with my setup.
I have TERM set to xscreen-256color can this be a problem?
Offline
Which terminal emulator or emulators are you using?
Where are you setting $TERM? Do you have a typo in your previous post? I cannot find a terminfo file named 'xscreen-256color'. I can find 'screen-256color'.
I follow the generally good advice to never export TERM. Exporting TERM can mess up console terminals as well as the different terminal emulators I use.
I use my X resources files for 256 color xterm with:
xterm*termName: xterm-256color
Urxvt sets its own $TERM correctly for me, rxvt-unicode-256color.
I set the TERM variable for tmux in ~/.tmux.conf with this line:
set -g default-terminal "screen-256color"
Offline
Thanks, clearly I got it wrong, I meant xterm-256color.
What is the X resources file, can you send me a link?
Anyway, one of the problem I had is that I exported TERM in .profile.
If you do so, the term value set in .tmux.conf is overridden, which causes problems.
Now I only set term in bashrc, but if there is any better way, I'd like to change it.
Thanks again for all the help!
Offline
Don't set TERM at all: that is just going to break things.
You can set default-terminal in tmux, which should be sufficient.
Offline
OP, If you are using vi then the standard way to shift right by one indentation width is to use ctrl+t, and shift left with ctrl+d. Those will move whatever your "shiftwidth" setting is, which may not be 8 chars of course. And if you are a vi/vim user then you are far better of to use vi editing mode in bash, i.e. add "set -o vi" to your ~/.bashrc, and add a line "set editing-mode vi" in your ~/.inputrc.(for readline based apps). I also suggest adding a "shopt -s lithist" in your .bashrc so that in bash you can press "v" and editing large command history lines in vim with full line wrap etc.
Offline
Don't set TERM at all: that is just going to break things.
You can set default-terminal in tmux, which should be sufficient.
But if I don't set TERM I don't have 256 colors in my Bash shell...
Offline
That's not the way to fix that problem: see thisoldman's post at #6.
Offline
OP, If you are using vi then the standard way to shift right by one indentation width is to use ctrl+t, and shift left with ctrl+d. Those will move whatever your "shiftwidth" setting is, which may not be 8 chars of course. And if you are a vi/vim user then you are far better of to use vi editing mode in bash, i.e. add "set -o vi" to your ~/.bashrc, and add a line "set editing-mode vi" in your ~/.inputrc.(for readline based apps). I also suggest adding a "shopt -s lithist" in your .bashrc so that in bash you can press "v" and editing large command history lines in vim with full line wrap etc.
I haven't followed much Bulletmark . I use only vim (never vi). What does
set -o vi
and
set editing-mode vi
do?
What is vi editing mode?
I like my configuration now, I just fear that having set TERM manually, might have messed things a little.
However leaving TERM to the default (i.e. xterm) while I do not have 256 colors in the bash shell, I have them in vim, which for the moment is fine.
I have tried to set 256 colors in bash modifying .Xresources and .xinitrc, but without success..
Offline
I use my X resources files for 256 color xterm with:
xterm*termName: xterm-256color
Offline
add "set -o vi" to your ~/.bashrc, and add a line "set editing-mode vi" in your ~/.inputrc.
you just completely changed my shell for me. I'm a little sad that I didn't know this before just now
Offline
thisoldman wrote:I use my X resources files for 256 color xterm with:
xterm*termName: xterm-256color
It doesn't work for me.
I have also added the following to .xinitrc:
[[ -f ~/.Xresources ]] && xrdb -merge ~/.Xresources
but still when I restart my shell have TERM set to xterm.
Ps. I forgot to mention I am using LightDM and MATE desktop running automatically at startup.
Offline
.xinitrc only gets called if you use startx, if you use a DM then it never gets read.
Offline
.xinitrc only gets called if you use startx, if you use a DM then it never gets read.
Thanks Slithery, I got this wrong then
So why is the .Xresources file not applied? Should I put the xrdb line somewhere else?
Offline
Offline
The problem I am having though doesn't appen only at startup...
If I do manually
xrdb -merge .Xresources
TERM still doesn't get changed.
Offline
The problem I am having though doesn't appen only at startup...
If I do manually
xrdb -merge .Xresources
TERM still doesn't get changed.
You may have a typo or an error in a line in your .Xresources. I've noticed if there is an error in an X resource file, xrdb bails and any lines after the error are not processed.
Offline
it contains only that line...
Offline
Just to make sure, use the full path:
xrdb -merge /home/lucacerone/.Xresources
Offline
nothing... I also tried to enclose the full path in '' and "" but it does not change things...
Offline
Just to eliminate the obvious, did you start a new instance of xterm after the xrdb command?
Edit: Try starting an xterm instance using the command:
$ xterm -tn xterm-256color
Last edited by thisoldman (2014-07-16 16:49:34)
Offline
Pages: 1