Search code examples
emacskeyboard-shortcutstmuxtty

tmux overriding emacs shortcuts


So I've been searching for like 40 minutes now without success, and "C-x" being obscure to most search engines, that didn't help at all. I've used tmux in combination with in-console emacs a few weeks ago and all worked fine. Then I didn't for some time and now I'm back on this configuration after customising my tmux a bit -- I wanted a totally distraction free environment for work, and tmux TTY seemed like a good place for that. Problem is now when I input C-x emacs doesn't pick it up anymore, which, you can guess, is very annoying. I don't really know why it won't work, and I'm sure as hell I didn't set anything to overlap with this command. Edit of course it works outside of tmux. So it must be a conflict with it but why ? and how to solve it without remapping emacs' commands ?

On a side note, I've read it's not possible to have 256 colour mode in TTY, is there really no way ? :/

Edit : About the 256 colors TTY, I've seen a few posts advising to use fbterm or some other terminal but all the ones cited were outdated. Is there really no other way ? Also I've been trying to have unicode characters working there but the answers were either the same as for 256 colours or configurations that didn't work on current version of Fedora 28.

Here is my .tmux.conf

# Reload config using C-b r
bind r source-file ~/.tmux.conf

# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %

# switch panes using Ctrl-arrow without prefix
bind -n C-Left select-pane -L
bind -n C-Right select-pane -R
bind -n C-Up select-pane -U
bind -n C-Down select-pane -D
bind-key -r x kill-pane

# Resize panes
bind -n M-< resize-pane -L 5
bind -n M-> resize-pane -R 5
bind -n M-w resize-pane -U 5
bind -n M-W resize-pane -D 5

# Enable mouse control (clickable windows, panes, resizable panes)
set -g mouse on
set -g pane-border-fg colour8
set -g pane-active-border-fg colour7
set -g pane-active-border-bg default

# Status bar
set -g status-position top

And here is my .emacs

;; .emacs


;; Added by Package.el.  This must come before configurations of
;; installed packages.  Don't delete this line.  If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)

(add-to-list 'package-archives
             '("melpa-stable" . "https://stable.melpa.org/packages/") t)

;; Irony
(add-hook 'after-init-hook 'global-company-mode)
;; Always start smartparens mode in js-mode.
;(add-hook 'js-mode-hook #'smartparens-mode)

;; Company-Irony backend
(eval-after-load 'company
  '(add-to-list 'company-backends 'company-irony))

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ansi-color-faces-vector
   [default default default italic underline success warning error])
 '(column-number-mode t)
 '(cua-mode t nil (cua-base))
 '(custom-enabled-themes (quote (misterioso)))
 '(diff-switches "-u")
 '(package-selected-packages
   (quote
    (company-irony flycheck-irony company irony autopair which-key w3)))
 '(show-paren-mode t))

;;
;; Epitech configuration
;;
(add-to-list 'load-path "~/.emacs.d/lisp")
(load "site-start.d/epitech-init.el")
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

;; Add a "lines" column
(global-linum-mode t)
(setq linum-format "%4d \u2502 ")

;; `lines-tail`, highlight the part that goes beyond the
;; limit of `whitespace-line-column`
(require 'whitespace)
(setq whitespace-style '(face empty tabs lines-tail trailing))
(global-whitespace-mode t)

;; Auto whitespace-cleanup
(add-hook 'before-save-hook #'whitespace-cleanup)

;; Set TAB behaviour
;; TABS should AWLAYS be spaces
(setq-default indent-tabs-mode nil)
;; Make TABS 4 spaces
(setq default-tab-width 4)

;; Autopair
(electric-pair-mode)

;; Fix "<<EOF \n<" issue in bash mode
(add-hook 'sh-mode-hook (lambda () (sh-electric-here-document-mode -1)))

;; Add in-terminal mouse support
(when (eq window-system nil)
  (xterm-mouse-mode t))

Thanks for your time.


Solution

  • I unbinded C-x and it didn't work so I left the unbind sitting in my conf. Now that I have booted on a new session and came back on the question it works fine. Case closed.