LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-11-2009, 07:14 PM   #1
kofucii
Member
 
Registered: May 2007
Location: Bulgaria
Distribution: Slackware, SCO Unix
Posts: 62

Rep: Reputation: 20
Map delete key to ctl+c


Hello,
Im using Slackware 12.2, korn shell with editor VI.
How can I map the delete key to ctl+c on console.

In X, it works with:
stty intr ^H

But in console the delete key is: ^[[3~, and stty do not accept this:
stty intr ^[[3~

Does anybody know, how to do this. It must be set on korn shell with command line mode set to Vi, not Emacs.
 
Old 08-12-2009, 12:09 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Isn't crtl+c mapped to SIGTERM on most consoles?
 
Old 08-12-2009, 04:28 PM   #3
karamarisan
Member
 
Registered: Jul 2009
Location: Illinois, US
Distribution: Fedora 11
Posts: 374

Rep: Reputation: 55
Judging by what he tried to do, he wants delete to cause a SIGINT (not SIGTERM; that's the one kill uses if you don't specify another). OP, shot in the dark here - try `stty intr '^[[3~'`. When you get this working, you'll want to put a switch to run the appropriate one based on the value of $TERM. Like so:
Code:
 52 case "$TERM" in
 53     'xterm')
 54     bindkey '^[[H' beginning-of-line
 55     bindkey '^[OH' beginning-of-line
 56     bindkey '^[[F' end-of-line
 57     bindkey '^[OF' end-of-line
 58     bindkey '^[[3~' delete-char
 59     bindkey '^[[6~' end-of-history
 60     bindkey '^[[5~' insert-last-word
 61     ;;
 62     'xterm*')
 63     bindkey '^[OH' beginning-of-line
 64     bindkey '^[OF' end-of-line
 65     bindkey '^[[3~' delete-char
 66     bindkey '^[[6~' end-of-history
 67     bindkey '^[[5~' insert-last-word
 68     ;;
 69     'screen')
 70     bindkey '^[[1~' beginning-of-line
 71     bindkey '^[[4~' end-of-line
 72     bindkey '^[[3~' delete-char
 73     bindkey '^[[6~' end-of-history
 74     bindkey '^[[5~' insert-last-word
 75     ;;
 76     'linux')
 77     bindkey '^[[1~' beginning-of-line
 78     bindkey '^[[4~' end-of-line
 79     bindkey '^[[3~' delete-char
 80     bindkey '^[[6~' end-of-history
 81     bindkey '^[[5~' insert-last-word
 82     ;;
 83 esac
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I map the control key to the caps lock key in Linux? tate1615 Linux - General 4 07-14-2008 01:20 PM
can't map Alt Gr key vito_huang Linux - General 1 04-23-2007 02:11 PM
Smart Key Signature ERRORS! How do I delete this bad key from my computer? Balarabay1 Linux - Software 4 09-27-2006 11:01 AM
Map Mouse Button to Key Parksy Linux - Hardware 0 01-07-2004 08:00 PM
Ksnapshot -- How to map Printscreen key jmke2002 Linux - General 4 08-29-2003 06:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration