본문 바로가기

Linux

byobu 컨트롤키가 안먹을때 keybindings.tmux

putty에서 control key가 안먹을때 아래와 같은 이유로 .byobu/keybindings.tmux에 하나씩 override 해서 수동 지정해야 한다.

# Fix putty/pietty function key problem
set -g terminal-overrides "xterm*:kf1=\e[11~:kf2=\e[12~:kf3=\e[13~:kf4=\e[14~:kf5=\e[15~:kf6=\e[17~:kf7=\e[18~:kf8=\e[19~"
set -g terminal-overrides "xterm*:kLFT5=\eOD:kRIT5=\eOC:kUP5=\eOA:kDN5=\eOB:smkx@:rmkx@"


이유 : * Ctrl and arrow keys doesn't work in putty! What do I do?

putty inverts the sense of the cursor key mode on ctrl, which is a bit hard for
tmux to detect properly. To get ctrl keys right, change the terminfo settings
so kUP5 (Ctrl-Up etc) are the adjusted versions, and disable smkx/rmkx so tmux
doesn't change the mode. For example with this line in .tmux.conf (assuming you
have TERM set to xterm):

set -g terminal-overrides "xterm*:kLFT5=\eOD:kRIT5=\eOC:kUP5=\eOA:kDN5=\eOB:smkx@:rmkx@"

Note that this will only work in tmux 1.2 and above.


########################################################################################

.byobu/keybindings.tmux

# General Setting
set -g prefix C-l
unbind C-b
bind C-l send-prefix

# window starts from 1 instead of 0
set -g base-index 0

##### Statusbar properties.
# Set status bar
set -g status-bg default
set -g status-fg default
set -g status-justify left
set -g status-left-length 20
set -g status-right-length 25
set -g status-left " #[fg=red][#[fg=green]#H #[fg=red]]#[default]"
set -g status-right "#[fg=red][ #[fg=green]%H:%M #[fg=magenta]%a %m-%d #[fg=red]] #[default]"
setw -g window-status-format '#[fg=blue,bold]#I #W#[default] '
setw -g window-status-current-format '#[fg=blue,bold,reverse]#I #W#[default] '
# Highlight active window
setw -g window-status-current-bg green
setw -g window-status-bg black
setw -g window-status-alert-attr default
setw -g window-status-alert-fg yellow
# message
set -g message-fg black
set -g message-bg green

##### Set notifications
setw -g monitor-activity on
set -g visual-activity on
set -g visual-bell on
set -g bell-action any

##### Automatically set window title
setw -g automatic-rename off
set -g set-titles on
set -g set-titles-string "[#H] [#I: #W#F]"
set -g status-utf8 on

#### Pane settings
set -g pane-active-border-bg black
set -g pane-active-border-fg green
set -g pane-border-fg white
set -g pane-border-bg black

# Fix putty/pietty function key problem
set -g terminal-overrides "xterm*:kf1=\e[11~:kf2=\e[12~:kf3=\e[13~:kf4=\e[14~:kf5=\e[15~:kf6=\e[17~:kf7=\e[18~:kf8=\e[19~"
set -g terminal-overrides "xterm*:kLFT5=\eOD:kRIT5=\eOC:kUP5=\eOA:kDN5=\eOB:smkx@:rmkx@"

# terminal scrollback
set -g terminal-overrides 'xterm*:smcup@:rmcup@'

##### Binding key
set -g status-keys emacs
setw -g mode-keys emacs

bind-key C-a last-window
# open man page in new window
bind ! command-prompt -p "man for " "split-window 'man %%'"

bind Tab choose-window

# rename current window
unbind ,
bind A command-prompt -p "rename current window to" "rename-window %%"

# split windows vertically and horizontally
unbind %
unbind '"'
bind | split-window -h
bind - split-window -v

bind + select-layout tiled

# setw -g xterm-keys on

# blank screen after a period of inactivity
set -g lock-command 'tput civis && read -s -n1'
# bind x set lock-command '/usr/bin/vlock' \; lock-client \; set lock-command 'tput civis && read -s -n1'

set -g history-limit 20000

set -g terminal-overrides "*88col*:colors=88,*256col*:colors=256,xterm*:colors=256"
set -g default-terminal "screen-256color"



#========================================================================================
# Toggle mouse on with ^B m bind m \ set -g mode-mouse on \;\ set -g mouse-resize-pane on \;\ set -g mouse-select-pane on \;\ set -g mouse-select-window on \;\ display 'Mouse: ON' # Toggle mouse off with ^B M bind M \ set -g mode-mouse off \;\ set -g mouse-resize-pane off \;\ set -g mouse-select-pane off \;\ set -g mouse-select-window off \;\ display 'Mouse: OFF' unbind + bind + \ new-window -d -n tmux-zoom 'clear && echo TMUX ZOOM && read' \;\ swap-pane -s tmux-zoom.0 \;\ select-window -t tmux-zoom unbind - bind - \ last-window \;\ swap-pane -s tmux-zoom.0 \;\ kill-window -t tmux-zoom






##############################################################################################
키 코드값 확인

Windows PuTTY client: xterm broken

The following is tested in Windows 7 SP-1 using PuTTY 0.60 to connect to Kubuntu 10.4 and 8.4. This is isolated to PuTTY because the same keyboard connecting to the same systems over vnc sends the right keys both in the GUI emacs as well as in the terminal windows with emacs -nw.

PuTTY claims to be an xterm but it mangles most of the keys. Most notably, Ctrl does not modify most of the function keys and keypad keys. Here follows what I have been able to put together using a combination of quoted-insert and the dribble file. This is nothing like what Emacs expects in xterm.el\e is escape (^[). ^M is 0x13<> means nothing happens. <putty> means PuTTY grabs it. <w7> means Windows 7 grabs it.

                Normal    Ctrl      Shift     Alt       CrSh      CrAlt     ShAlt     CrShAlt  
Left Arrow      \eOD      \e[D      \eOD      \e\eOD    \eOD      \e\eOD    \e\eOD    \e\eOD 
Right Arrow     \eOC      \e[C      \eOC      \e\eOC    \eOC      \e\eOC    \e\eOC    \e\eOC 
Up Arrow        \eOA      \e[A      \eOA      \e\eOA    \eOA      \e\eOA    \e\eOA    \e\eOA 
Down Arrow      \eOB      \e[B      \eOB      \e\eOB    \eOB      \e\eOB    \e\eOB    \e\eOB

                Normal    Ctrl      Shift     Alt       CrSh      CrAlt     ShAlt     CrShAlt  
Home            \e[1~     <>        \e[1~     \e\e[1~   <>        <>        \e\e[1~   <>
Insert          \e[2~     <>        \e[2~     \e\e[2~   <>        <>        \e\e[2~   <>
Delete          \e[3~     <>        \e[3~     \e\e[3~   <>        <w7>      \e\e[3~   <>     
Page Up         \e[5~     <putty>   \e[5~     \e\e[5~   <>        <putty>   \e\e[5~   <>     
End             \e[4~     <>        \e[4~     \e\e[4~   <>        <>        \e\e[4~   <>     
Page Down       \e[6~     <putty>   \e[6~     \e\e[6~   <>        <putty>   \e\e[6~   <>     

                Normal    Ctrl      Shift     Alt       CrSh      CrAlt     ShAlt     CrShAlt  
F1              \e[11~    \e[11~    \e[23~    \e\e[11~  \e[23~    \e\e[11~  \e\e[23~  \e\e[23~
F2              \e[12~    \e[12~    \e[24~    \e\e[12~  \e[24~    \e\e[12~  \e\e[24~  \e\e[24~       
F3              \e[13~    \e[13~    \e[25~    \e\e[13~  \e[25~    \e\e[13~  \e\e[25~  \e\e[25~
F4              \e[14~    \e[14~    \e[26~    <w7>      \e[26~    <>        <w7>      <>
F5              \e[15~    \e[15~    \e[28~    \e\e[15~  \e[28~    \e\e[15~  \e\e[28~  \e\e[28~
F6              \e[17~    \e[17~    \e[29~    \e\e[17~  \e[29~    \e\e[17~  \e\e[29~  \e\e[29~
F7              \e[18~    \e[18~    \e[31~    \e\e[18~  \e[31~    \e\e[18~  \e\e[31~  \e\e[31~
F8              \e[19~    \e[19~    \e[32~    \e\e[19~  \e[32~    \e\e[19~  \e\e[32~  \e\e[32~
F9              \e[20~    \e[20~    \e[33~    \e\e[20~  \e[33~    \e\e[20~  \e\e[33~  \e\e[33~
F10             \e[21~    \e[21~    \e[34~    \e\e[21~  \e[34~    \e\e[21~  \e\e[34~  \e\e[34~
F11             \e[23~    \e[23~    \e[23~    \e\e[23~  \e[23~    \e\e[23~  \e\e[23~  \e\e[23~
F12             \e[24~    \e[24~    \e[24~    \e\e[24~  \e[24~    \e\e[24~  \e\e[24~  \e\e[24~

NUM LOCK ON     Normal    Ctrl      Shift     Alt       CrSh      CrAlt     ShAlt     CrShAlt  
Num Lock        \eOP      <>        <>        <>        <>        <>        <w7>      <>
/               \eOQ      \eOQ      \eOQ      \e/       \eOQ      <>        \e/       <>
*               \eOR      \eOR      \eOR      \e*       \eOR      <>        \e*       <>
-               \eOS      \eOS      \eOS      \e-       \eOS      <>        \e-       <>
+               \eOl      \eOm      \eOm      \e+       \eOm      <>        \e+       <>
Enter           \eOM      \eOM      \eOM      \e^M      \eOM      \e^M      \e^M      \e^M
.               \eOn      \eOn      \eOn      \e.       \eOn      <w7>      \e.       <>
0               \eOp      \eOp      \eOp      <w7>      \eOp      <>        <>        <>
1               \eOq      \eOq      \eOq      <w7>      \eOq      <>        <>        <>
2               \eOr      \eOr      \eOr      <w7>      \eOr      <>        <>        <>
3               \eOs      \eOs      \eOs      <w7>      \eOs      <>        <>        <>
4               \eOt      \eOt      \eOt      <w7>      \eOt      <>        <>        <>
5               \eOu      \eOu      \eOu      <w7>      \eOu      <>        <>        <>
6               \eOv      \eOv      \eOv      <w7>      \eOv      <>        <>        <>
7               \eOw      \eOw      \eOw      <w7>      \eOw      <>        <>        <>
8               \eOx      \eOx      \eOx      <w7>      \eOx      <>        <>        <>
9               \eOy      \eOy      \eOy      <w7>      \eOy      <>        <>        <>

NUM LOCK OFF    Normal    Ctrl      Shift     Alt       CrSh      CrAlt     ShAlt     CrShAlt  
Num Lock       
/               \eOQ      \eOQ      \eOQ      \e/       \eOQ      <>        \e/       <>
*               \eOR      \eOR      \eOR      \e*       \eOR      <>        \e*       <>
-               \eOS      \eOS      \eOS      \e-       \eOS      <>        \e-       <>
+               \eOl      \eOm      \eOm      \e+       \eOm      <>        \e+       <>
Enter           \eOM      \eOM      \eOM      \e^M      \eOM      \e^M      \e^M      \e^M
.               \eOn      \eOn      \eOn      \e.       \eOn      <w7>      \e.       <>
0               \eOp      \eOp      \eOp      <w7>      \eOp      <>        <>        <>
1               \eOq      \eOq      \eOq      <w7>      \eOq      <>        <>        <>
2               \eOr      \eOr      \eOr      <w7>      \eOr      <>        <>        <>
3               \eOs      \eOs      \eOs      <w7>      \eOs      <>        <>        <>
4               \eOt      \eOt      \eOt      <w7>      \eOt      <>        <>        <>
5               \eOu      \eOu      \eOu      <w7>      \eOu      <>        <>        <>
6               \eOv      \eOv      \eOv      <w7>      \eOv      <>        <>        <>
7               \eOw      \eOw      \eOw      <w7>      \eOw      <>        <>        <>
8               \eOx      \eOx      \eOx      <w7>      \eOx      <>        <>        <>
9               \eOy      \eOy      \eOy      <w7>      \eOy      <>        <>        <>

'Linux' 카테고리의 다른 글

Linux 자동 강제 fsck 하기  (0) 2012.12.10
linux 특정 프로세서가 죽으면 자동 재실행  (0) 2012.12.05
vimdiff  (0) 2012.12.04
최신 git으로 업데이트 하기  (0) 2012.10.30
Swap 파일로 추가하기  (0) 2012.10.12