change bash shortcut keys such as Ctrl-C?
I am using Kubuntu 10.04. I would like to change some of the standard shortcut keys for bash (terminal).
Here are the shortcuts I would like to set up:
Ctrl-C to copy the selected text in
the terminal to the clipboard.Ctrl-V to paste from the clipboard
into the terminal.Ctrl-Z to undo the editing on the current line in the terminal.
Ctrl-Shift-C (or even better, Super-C) to terminate the command.
Ctrl-Shift-Z (or Super-Z) to be the background command.
Ctrl-Shift-V (or Super-V) to be the literal insert command (or whatever Ctrl-z did before).
How do I make these changes?
BTW, I like the way the terminal works on OS X. The use of the command key makes all the copy/paste commands very consistent (unlike many other things in OS X).
P.S. I read the bash man page and it didn't help. It gave me ideas, but I need specific examples for the above combinations. Thanks.
linux bash inputrc
add a comment |
I am using Kubuntu 10.04. I would like to change some of the standard shortcut keys for bash (terminal).
Here are the shortcuts I would like to set up:
Ctrl-C to copy the selected text in
the terminal to the clipboard.Ctrl-V to paste from the clipboard
into the terminal.Ctrl-Z to undo the editing on the current line in the terminal.
Ctrl-Shift-C (or even better, Super-C) to terminate the command.
Ctrl-Shift-Z (or Super-Z) to be the background command.
Ctrl-Shift-V (or Super-V) to be the literal insert command (or whatever Ctrl-z did before).
How do I make these changes?
BTW, I like the way the terminal works on OS X. The use of the command key makes all the copy/paste commands very consistent (unlike many other things in OS X).
P.S. I read the bash man page and it didn't help. It gave me ideas, but I need specific examples for the above combinations. Thanks.
linux bash inputrc
some of these "shortcuts" can not be "implemented" in bash, but have to be put onto the terminal itself (xterm, gnome-terminal, konsole etc).. eg "selected text", "clipboard"
– akira
Jul 6 '10 at 8:57
add a comment |
I am using Kubuntu 10.04. I would like to change some of the standard shortcut keys for bash (terminal).
Here are the shortcuts I would like to set up:
Ctrl-C to copy the selected text in
the terminal to the clipboard.Ctrl-V to paste from the clipboard
into the terminal.Ctrl-Z to undo the editing on the current line in the terminal.
Ctrl-Shift-C (or even better, Super-C) to terminate the command.
Ctrl-Shift-Z (or Super-Z) to be the background command.
Ctrl-Shift-V (or Super-V) to be the literal insert command (or whatever Ctrl-z did before).
How do I make these changes?
BTW, I like the way the terminal works on OS X. The use of the command key makes all the copy/paste commands very consistent (unlike many other things in OS X).
P.S. I read the bash man page and it didn't help. It gave me ideas, but I need specific examples for the above combinations. Thanks.
linux bash inputrc
I am using Kubuntu 10.04. I would like to change some of the standard shortcut keys for bash (terminal).
Here are the shortcuts I would like to set up:
Ctrl-C to copy the selected text in
the terminal to the clipboard.Ctrl-V to paste from the clipboard
into the terminal.Ctrl-Z to undo the editing on the current line in the terminal.
Ctrl-Shift-C (or even better, Super-C) to terminate the command.
Ctrl-Shift-Z (or Super-Z) to be the background command.
Ctrl-Shift-V (or Super-V) to be the literal insert command (or whatever Ctrl-z did before).
How do I make these changes?
BTW, I like the way the terminal works on OS X. The use of the command key makes all the copy/paste commands very consistent (unlike many other things in OS X).
P.S. I read the bash man page and it didn't help. It gave me ideas, but I need specific examples for the above combinations. Thanks.
linux bash inputrc
linux bash inputrc
edited Jan 30 at 22:20
Linger
2,796102740
2,796102740
asked Jul 6 '10 at 3:18
PaulPaul
168117
168117
some of these "shortcuts" can not be "implemented" in bash, but have to be put onto the terminal itself (xterm, gnome-terminal, konsole etc).. eg "selected text", "clipboard"
– akira
Jul 6 '10 at 8:57
add a comment |
some of these "shortcuts" can not be "implemented" in bash, but have to be put onto the terminal itself (xterm, gnome-terminal, konsole etc).. eg "selected text", "clipboard"
– akira
Jul 6 '10 at 8:57
some of these "shortcuts" can not be "implemented" in bash, but have to be put onto the terminal itself (xterm, gnome-terminal, konsole etc).. eg "selected text", "clipboard"
– akira
Jul 6 '10 at 8:57
some of these "shortcuts" can not be "implemented" in bash, but have to be put onto the terminal itself (xterm, gnome-terminal, konsole etc).. eg "selected text", "clipboard"
– akira
Jul 6 '10 at 8:57
add a comment |
4 Answers
4
active
oldest
votes
Those aren't features of bash, they're features of the terminal driver. As such, they're specified by stty(1).
$ stty -a
speed 38400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;
swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
5
OK. Thanks for the clue. Now, I'd still like to accomplish my goal. And I also know that inputrc can remap Ctrl-C. But I really don't care how I do it, I just want to know to how remap these shortcuts in a terminal.
– Paul
Jul 6 '10 at 3:25
14
Here's the "fish": stty intr ^k (where the terminate command, formerly Ctrl-C now becomes Ctrl-K, K can be any alpha key) No one "gave me that fish". I worked hard to find it on my own. So preaching with proverbs makes you look like a jerk, IMO.
– Paul
Jul 7 '10 at 16:25
How can you remap it to Ctrl+Shift+C?
– crypdick
Jun 22 '18 at 0:10
add a comment |
This is almost completely solved now. Part of the solution was first brought to my attention by MTK358 over at http://www.linuxquestions.org/questions/linux-software-2/change-bash-shortcut-keys-such-as-ctrl-c-818170/. He pointed out the (rather obvious, much to my embarassment) fact that the copy and paste shortcut keys can easily be changed by the menu settings of konsole. Once I saw this, it took about 1 minute to set up Ctrl-C and Ctrl-V to copy and paste with the terminal.
The other part of the solution should have been clear from the stty man page, but it wasn't (to me). I ended up just experimenting based on various clues, such as those posted above.
I decided which non-numeric key I wanted to replace Ctrl-C as the terminate command. (I used "k"). I never did find any info about how to convey a shift modifier to stty, so I gave up on that. With that decided, all I had to do was enter the following on the command line:
stty intr ^k
I verified that everything worked as desired.
Now I just had to place the single command above (stty intr ^k) in a startup script. I'm not sure which one is the "proper" one. I'd like this change to be system wide and permanent.
Any suggestions as to which script I should place the command in?
And finally, as to the preachy replies, they are unnecessary and unhelpful.
add a comment |
Some of thse can be set using the normal KDE keyboard shortcut mechanism. In Konsole's "Settings" menu, click on "Configure Shortcuts", and you'll get a dialog which you can use to change the key bindings for the functions which are handled by KDE. That will allow you to remap Ctrl+C to copy and Ctrl+V to paste - but keep in mind that once you do that, those key sequences will no longer be passed through to the terminal, so you won't be able to use Ctrl+C to interrupt a program, for example.
Other functions are controlled by the readline library, which you can configure by editing the file ~/.inputrc. To get Ctrl+Z to revert any edits made on the current line, you'd want to add
C-z: revert-line
but that key sequence is probably already trapped by the terminal, so you might have to use stty to unbind it before it'll work. First look for ^Z in the output of stty -a (as shown in Ignacio's answer) and then, for example, if it shows up in susp = ^Z, run
stty susp ^-
to unbind that key mapping.
The other changes you're asking about would have to be done with stty as Ignacio says, since those are terminal functions, but I'm not sure exactly how. The issue is that I don't know whether the terminal recognizes Shift, or if it does, how to convey that information to stty.
add a comment |
Bash uses emacs or vi mode on the command line. It has no concept of "selection" or "clipboard". It uses things like a "kill buffer" and "point", "mark", "word", "line", "kill" and "yank", etc.
Trying to shoehorn GUI-style functionality into it will be frustrating at best and won't work fully. You will have to try to combine functions of stty, readline and your terminal (presumably Terminal.app for you). You will need to remap functions such as intr, susp, lnext, etc., so you can still use their features.
I strongly recommend against such radical modifications. It just wasn't designed to do what you want.
When in Rome...
Dave, for a system that works just like OS X, might I suggest you use OS X? As Dennis hinted, even if you can get it to work, you'll be pretty hobbled when you log in as anything but you on your own machine.
– msw
Jul 6 '10 at 10:16
add a comment |
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f160388%2fchange-bash-shortcut-keys-such-as-ctrl-c%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Those aren't features of bash, they're features of the terminal driver. As such, they're specified by stty(1).
$ stty -a
speed 38400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;
swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
5
OK. Thanks for the clue. Now, I'd still like to accomplish my goal. And I also know that inputrc can remap Ctrl-C. But I really don't care how I do it, I just want to know to how remap these shortcuts in a terminal.
– Paul
Jul 6 '10 at 3:25
14
Here's the "fish": stty intr ^k (where the terminate command, formerly Ctrl-C now becomes Ctrl-K, K can be any alpha key) No one "gave me that fish". I worked hard to find it on my own. So preaching with proverbs makes you look like a jerk, IMO.
– Paul
Jul 7 '10 at 16:25
How can you remap it to Ctrl+Shift+C?
– crypdick
Jun 22 '18 at 0:10
add a comment |
Those aren't features of bash, they're features of the terminal driver. As such, they're specified by stty(1).
$ stty -a
speed 38400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;
swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
5
OK. Thanks for the clue. Now, I'd still like to accomplish my goal. And I also know that inputrc can remap Ctrl-C. But I really don't care how I do it, I just want to know to how remap these shortcuts in a terminal.
– Paul
Jul 6 '10 at 3:25
14
Here's the "fish": stty intr ^k (where the terminate command, formerly Ctrl-C now becomes Ctrl-K, K can be any alpha key) No one "gave me that fish". I worked hard to find it on my own. So preaching with proverbs makes you look like a jerk, IMO.
– Paul
Jul 7 '10 at 16:25
How can you remap it to Ctrl+Shift+C?
– crypdick
Jun 22 '18 at 0:10
add a comment |
Those aren't features of bash, they're features of the terminal driver. As such, they're specified by stty(1).
$ stty -a
speed 38400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;
swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
Those aren't features of bash, they're features of the terminal driver. As such, they're specified by stty(1).
$ stty -a
speed 38400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;
swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
answered Jul 6 '10 at 3:22
Ignacio Vazquez-AbramsIgnacio Vazquez-Abrams
96.6k6155211
96.6k6155211
5
OK. Thanks for the clue. Now, I'd still like to accomplish my goal. And I also know that inputrc can remap Ctrl-C. But I really don't care how I do it, I just want to know to how remap these shortcuts in a terminal.
– Paul
Jul 6 '10 at 3:25
14
Here's the "fish": stty intr ^k (where the terminate command, formerly Ctrl-C now becomes Ctrl-K, K can be any alpha key) No one "gave me that fish". I worked hard to find it on my own. So preaching with proverbs makes you look like a jerk, IMO.
– Paul
Jul 7 '10 at 16:25
How can you remap it to Ctrl+Shift+C?
– crypdick
Jun 22 '18 at 0:10
add a comment |
5
OK. Thanks for the clue. Now, I'd still like to accomplish my goal. And I also know that inputrc can remap Ctrl-C. But I really don't care how I do it, I just want to know to how remap these shortcuts in a terminal.
– Paul
Jul 6 '10 at 3:25
14
Here's the "fish": stty intr ^k (where the terminate command, formerly Ctrl-C now becomes Ctrl-K, K can be any alpha key) No one "gave me that fish". I worked hard to find it on my own. So preaching with proverbs makes you look like a jerk, IMO.
– Paul
Jul 7 '10 at 16:25
How can you remap it to Ctrl+Shift+C?
– crypdick
Jun 22 '18 at 0:10
5
5
OK. Thanks for the clue. Now, I'd still like to accomplish my goal. And I also know that inputrc can remap Ctrl-C. But I really don't care how I do it, I just want to know to how remap these shortcuts in a terminal.
– Paul
Jul 6 '10 at 3:25
OK. Thanks for the clue. Now, I'd still like to accomplish my goal. And I also know that inputrc can remap Ctrl-C. But I really don't care how I do it, I just want to know to how remap these shortcuts in a terminal.
– Paul
Jul 6 '10 at 3:25
14
14
Here's the "fish": stty intr ^k (where the terminate command, formerly Ctrl-C now becomes Ctrl-K, K can be any alpha key) No one "gave me that fish". I worked hard to find it on my own. So preaching with proverbs makes you look like a jerk, IMO.
– Paul
Jul 7 '10 at 16:25
Here's the "fish": stty intr ^k (where the terminate command, formerly Ctrl-C now becomes Ctrl-K, K can be any alpha key) No one "gave me that fish". I worked hard to find it on my own. So preaching with proverbs makes you look like a jerk, IMO.
– Paul
Jul 7 '10 at 16:25
How can you remap it to Ctrl+Shift+C?
– crypdick
Jun 22 '18 at 0:10
How can you remap it to Ctrl+Shift+C?
– crypdick
Jun 22 '18 at 0:10
add a comment |
This is almost completely solved now. Part of the solution was first brought to my attention by MTK358 over at http://www.linuxquestions.org/questions/linux-software-2/change-bash-shortcut-keys-such-as-ctrl-c-818170/. He pointed out the (rather obvious, much to my embarassment) fact that the copy and paste shortcut keys can easily be changed by the menu settings of konsole. Once I saw this, it took about 1 minute to set up Ctrl-C and Ctrl-V to copy and paste with the terminal.
The other part of the solution should have been clear from the stty man page, but it wasn't (to me). I ended up just experimenting based on various clues, such as those posted above.
I decided which non-numeric key I wanted to replace Ctrl-C as the terminate command. (I used "k"). I never did find any info about how to convey a shift modifier to stty, so I gave up on that. With that decided, all I had to do was enter the following on the command line:
stty intr ^k
I verified that everything worked as desired.
Now I just had to place the single command above (stty intr ^k) in a startup script. I'm not sure which one is the "proper" one. I'd like this change to be system wide and permanent.
Any suggestions as to which script I should place the command in?
And finally, as to the preachy replies, they are unnecessary and unhelpful.
add a comment |
This is almost completely solved now. Part of the solution was first brought to my attention by MTK358 over at http://www.linuxquestions.org/questions/linux-software-2/change-bash-shortcut-keys-such-as-ctrl-c-818170/. He pointed out the (rather obvious, much to my embarassment) fact that the copy and paste shortcut keys can easily be changed by the menu settings of konsole. Once I saw this, it took about 1 minute to set up Ctrl-C and Ctrl-V to copy and paste with the terminal.
The other part of the solution should have been clear from the stty man page, but it wasn't (to me). I ended up just experimenting based on various clues, such as those posted above.
I decided which non-numeric key I wanted to replace Ctrl-C as the terminate command. (I used "k"). I never did find any info about how to convey a shift modifier to stty, so I gave up on that. With that decided, all I had to do was enter the following on the command line:
stty intr ^k
I verified that everything worked as desired.
Now I just had to place the single command above (stty intr ^k) in a startup script. I'm not sure which one is the "proper" one. I'd like this change to be system wide and permanent.
Any suggestions as to which script I should place the command in?
And finally, as to the preachy replies, they are unnecessary and unhelpful.
add a comment |
This is almost completely solved now. Part of the solution was first brought to my attention by MTK358 over at http://www.linuxquestions.org/questions/linux-software-2/change-bash-shortcut-keys-such-as-ctrl-c-818170/. He pointed out the (rather obvious, much to my embarassment) fact that the copy and paste shortcut keys can easily be changed by the menu settings of konsole. Once I saw this, it took about 1 minute to set up Ctrl-C and Ctrl-V to copy and paste with the terminal.
The other part of the solution should have been clear from the stty man page, but it wasn't (to me). I ended up just experimenting based on various clues, such as those posted above.
I decided which non-numeric key I wanted to replace Ctrl-C as the terminate command. (I used "k"). I never did find any info about how to convey a shift modifier to stty, so I gave up on that. With that decided, all I had to do was enter the following on the command line:
stty intr ^k
I verified that everything worked as desired.
Now I just had to place the single command above (stty intr ^k) in a startup script. I'm not sure which one is the "proper" one. I'd like this change to be system wide and permanent.
Any suggestions as to which script I should place the command in?
And finally, as to the preachy replies, they are unnecessary and unhelpful.
This is almost completely solved now. Part of the solution was first brought to my attention by MTK358 over at http://www.linuxquestions.org/questions/linux-software-2/change-bash-shortcut-keys-such-as-ctrl-c-818170/. He pointed out the (rather obvious, much to my embarassment) fact that the copy and paste shortcut keys can easily be changed by the menu settings of konsole. Once I saw this, it took about 1 minute to set up Ctrl-C and Ctrl-V to copy and paste with the terminal.
The other part of the solution should have been clear from the stty man page, but it wasn't (to me). I ended up just experimenting based on various clues, such as those posted above.
I decided which non-numeric key I wanted to replace Ctrl-C as the terminate command. (I used "k"). I never did find any info about how to convey a shift modifier to stty, so I gave up on that. With that decided, all I had to do was enter the following on the command line:
stty intr ^k
I verified that everything worked as desired.
Now I just had to place the single command above (stty intr ^k) in a startup script. I'm not sure which one is the "proper" one. I'd like this change to be system wide and permanent.
Any suggestions as to which script I should place the command in?
And finally, as to the preachy replies, they are unnecessary and unhelpful.
answered Jul 7 '10 at 16:20
PaulPaul
168117
168117
add a comment |
add a comment |
Some of thse can be set using the normal KDE keyboard shortcut mechanism. In Konsole's "Settings" menu, click on "Configure Shortcuts", and you'll get a dialog which you can use to change the key bindings for the functions which are handled by KDE. That will allow you to remap Ctrl+C to copy and Ctrl+V to paste - but keep in mind that once you do that, those key sequences will no longer be passed through to the terminal, so you won't be able to use Ctrl+C to interrupt a program, for example.
Other functions are controlled by the readline library, which you can configure by editing the file ~/.inputrc. To get Ctrl+Z to revert any edits made on the current line, you'd want to add
C-z: revert-line
but that key sequence is probably already trapped by the terminal, so you might have to use stty to unbind it before it'll work. First look for ^Z in the output of stty -a (as shown in Ignacio's answer) and then, for example, if it shows up in susp = ^Z, run
stty susp ^-
to unbind that key mapping.
The other changes you're asking about would have to be done with stty as Ignacio says, since those are terminal functions, but I'm not sure exactly how. The issue is that I don't know whether the terminal recognizes Shift, or if it does, how to convey that information to stty.
add a comment |
Some of thse can be set using the normal KDE keyboard shortcut mechanism. In Konsole's "Settings" menu, click on "Configure Shortcuts", and you'll get a dialog which you can use to change the key bindings for the functions which are handled by KDE. That will allow you to remap Ctrl+C to copy and Ctrl+V to paste - but keep in mind that once you do that, those key sequences will no longer be passed through to the terminal, so you won't be able to use Ctrl+C to interrupt a program, for example.
Other functions are controlled by the readline library, which you can configure by editing the file ~/.inputrc. To get Ctrl+Z to revert any edits made on the current line, you'd want to add
C-z: revert-line
but that key sequence is probably already trapped by the terminal, so you might have to use stty to unbind it before it'll work. First look for ^Z in the output of stty -a (as shown in Ignacio's answer) and then, for example, if it shows up in susp = ^Z, run
stty susp ^-
to unbind that key mapping.
The other changes you're asking about would have to be done with stty as Ignacio says, since those are terminal functions, but I'm not sure exactly how. The issue is that I don't know whether the terminal recognizes Shift, or if it does, how to convey that information to stty.
add a comment |
Some of thse can be set using the normal KDE keyboard shortcut mechanism. In Konsole's "Settings" menu, click on "Configure Shortcuts", and you'll get a dialog which you can use to change the key bindings for the functions which are handled by KDE. That will allow you to remap Ctrl+C to copy and Ctrl+V to paste - but keep in mind that once you do that, those key sequences will no longer be passed through to the terminal, so you won't be able to use Ctrl+C to interrupt a program, for example.
Other functions are controlled by the readline library, which you can configure by editing the file ~/.inputrc. To get Ctrl+Z to revert any edits made on the current line, you'd want to add
C-z: revert-line
but that key sequence is probably already trapped by the terminal, so you might have to use stty to unbind it before it'll work. First look for ^Z in the output of stty -a (as shown in Ignacio's answer) and then, for example, if it shows up in susp = ^Z, run
stty susp ^-
to unbind that key mapping.
The other changes you're asking about would have to be done with stty as Ignacio says, since those are terminal functions, but I'm not sure exactly how. The issue is that I don't know whether the terminal recognizes Shift, or if it does, how to convey that information to stty.
Some of thse can be set using the normal KDE keyboard shortcut mechanism. In Konsole's "Settings" menu, click on "Configure Shortcuts", and you'll get a dialog which you can use to change the key bindings for the functions which are handled by KDE. That will allow you to remap Ctrl+C to copy and Ctrl+V to paste - but keep in mind that once you do that, those key sequences will no longer be passed through to the terminal, so you won't be able to use Ctrl+C to interrupt a program, for example.
Other functions are controlled by the readline library, which you can configure by editing the file ~/.inputrc. To get Ctrl+Z to revert any edits made on the current line, you'd want to add
C-z: revert-line
but that key sequence is probably already trapped by the terminal, so you might have to use stty to unbind it before it'll work. First look for ^Z in the output of stty -a (as shown in Ignacio's answer) and then, for example, if it shows up in susp = ^Z, run
stty susp ^-
to unbind that key mapping.
The other changes you're asking about would have to be done with stty as Ignacio says, since those are terminal functions, but I'm not sure exactly how. The issue is that I don't know whether the terminal recognizes Shift, or if it does, how to convey that information to stty.
answered Jul 6 '10 at 4:05
David ZDavid Z
4,95222948
4,95222948
add a comment |
add a comment |
Bash uses emacs or vi mode on the command line. It has no concept of "selection" or "clipboard". It uses things like a "kill buffer" and "point", "mark", "word", "line", "kill" and "yank", etc.
Trying to shoehorn GUI-style functionality into it will be frustrating at best and won't work fully. You will have to try to combine functions of stty, readline and your terminal (presumably Terminal.app for you). You will need to remap functions such as intr, susp, lnext, etc., so you can still use their features.
I strongly recommend against such radical modifications. It just wasn't designed to do what you want.
When in Rome...
Dave, for a system that works just like OS X, might I suggest you use OS X? As Dennis hinted, even if you can get it to work, you'll be pretty hobbled when you log in as anything but you on your own machine.
– msw
Jul 6 '10 at 10:16
add a comment |
Bash uses emacs or vi mode on the command line. It has no concept of "selection" or "clipboard". It uses things like a "kill buffer" and "point", "mark", "word", "line", "kill" and "yank", etc.
Trying to shoehorn GUI-style functionality into it will be frustrating at best and won't work fully. You will have to try to combine functions of stty, readline and your terminal (presumably Terminal.app for you). You will need to remap functions such as intr, susp, lnext, etc., so you can still use their features.
I strongly recommend against such radical modifications. It just wasn't designed to do what you want.
When in Rome...
Dave, for a system that works just like OS X, might I suggest you use OS X? As Dennis hinted, even if you can get it to work, you'll be pretty hobbled when you log in as anything but you on your own machine.
– msw
Jul 6 '10 at 10:16
add a comment |
Bash uses emacs or vi mode on the command line. It has no concept of "selection" or "clipboard". It uses things like a "kill buffer" and "point", "mark", "word", "line", "kill" and "yank", etc.
Trying to shoehorn GUI-style functionality into it will be frustrating at best and won't work fully. You will have to try to combine functions of stty, readline and your terminal (presumably Terminal.app for you). You will need to remap functions such as intr, susp, lnext, etc., so you can still use their features.
I strongly recommend against such radical modifications. It just wasn't designed to do what you want.
When in Rome...
Bash uses emacs or vi mode on the command line. It has no concept of "selection" or "clipboard". It uses things like a "kill buffer" and "point", "mark", "word", "line", "kill" and "yank", etc.
Trying to shoehorn GUI-style functionality into it will be frustrating at best and won't work fully. You will have to try to combine functions of stty, readline and your terminal (presumably Terminal.app for you). You will need to remap functions such as intr, susp, lnext, etc., so you can still use their features.
I strongly recommend against such radical modifications. It just wasn't designed to do what you want.
When in Rome...
edited Jul 6 '10 at 12:35
answered Jul 6 '10 at 9:24
Dennis WilliamsonDennis Williamson
78.2k14130167
78.2k14130167
Dave, for a system that works just like OS X, might I suggest you use OS X? As Dennis hinted, even if you can get it to work, you'll be pretty hobbled when you log in as anything but you on your own machine.
– msw
Jul 6 '10 at 10:16
add a comment |
Dave, for a system that works just like OS X, might I suggest you use OS X? As Dennis hinted, even if you can get it to work, you'll be pretty hobbled when you log in as anything but you on your own machine.
– msw
Jul 6 '10 at 10:16
Dave, for a system that works just like OS X, might I suggest you use OS X? As Dennis hinted, even if you can get it to work, you'll be pretty hobbled when you log in as anything but you on your own machine.
– msw
Jul 6 '10 at 10:16
Dave, for a system that works just like OS X, might I suggest you use OS X? As Dennis hinted, even if you can get it to work, you'll be pretty hobbled when you log in as anything but you on your own machine.
– msw
Jul 6 '10 at 10:16
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f160388%2fchange-bash-shortcut-keys-such-as-ctrl-c%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown

some of these "shortcuts" can not be "implemented" in bash, but have to be put onto the terminal itself (xterm, gnome-terminal, konsole etc).. eg "selected text", "clipboard"
– akira
Jul 6 '10 at 8:57