Emacs
Un article de Tifauve|NET.
Utiliser Emacs
Sommaire |
Notations
- C-x : appui simultané sur les touches Control et x
- C-x C-f : appui simultané sur les touches Control et x suivi SUIVI d'appui simultané sur les touches Control et f
- C-x b : appui simultané sur les touches Control et x SUIVI d’un appui sur la touche b
Fichiers
- Ouvrir un fichier : C-x C-f
- Fermer un fichier : C-x k
- Créer un fichier : C-x C-f puis de compléter le nom
- Enregistrer un fichier ouvert : C-x C-s
- Enregistrer avec un autre nom : C-x C-w
- Quitter emacs: C-x C-c
Couper/Copier/Coller
- Marquer l’emplacement de départ avec C-Barre d’espace puis déplacer le curseur avec les flèches de direction
- Tout sélectionner : C-x h
- Copier : M-w
- Couper : C-w
- Coller : C-y
- Undo: C-_
Chercher/Remplacer
- Recherche après le curseur : C-s
- Recherche avant le curseur : C-r
- Remplacement : M-% (=presser simultanément les touches Alt-Shift-ù)
Déplacement
- Positionner le curseur au début et à la fin du fichier édité: Home et End
- Paginer: touches de pagination classique
- Début de ligne : C-a
- Fin de ligne : C-e
Effacer du texte
- Effacer le mot avant le curseur : M-Backspace
- Effacer le mot après le curseur : C-d
- Effacer toute la ligne après le curseur : C-k
Manipulations diverses
- Annuler la combinaison de touche actuelle: ESC ESC ESC
- Enlever buffer du bas: C-x 1 (C-x puis Shift-&)
- Lister buffers ouverts: C-x C-b
- Changer de buffer: C-x C-flèche droite ou gauche
personnalisation
pour python
installer d'abord rope/ropemacs, python-mode et emacs-goodies pour les couleurs
sudo apt-get install emacs-goodies-el
sudo apt-get install python-mode
sudo apt-get install python-rope python-ropemacs
Fichier init.el à mettre dans ~/.emacs.d
;;full screen
(defun toggle-fullscreen ()
(interactive)
(x-send-client-message nil 0 nil "_NET_WM_STATE" 32
'(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))
(x-send-client-message nil 0 nil "_NET_WM_STATE" 32
'(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))
)
(toggle-fullscreen)
;; Affiche le numéro de ligne et de colonne
(column-number-mode t)
(line-number-mode t)
;;enlever toolbar
(tool-bar-mode -1)
;;coupure de ligne
(setq truncate-partial-width-windows nil)
;; ========== completion ==========
(require 'completion)
(setq make-backup-files nil) ; stop it from making backups
;; disable welcome message
(setq inhibit-startup-message t)
(setq inhibit-startup-echo-area-message t)
(setq initial-scratch-message nil)
;; color mode
(require 'color-theme)
(defun color-theme-tm ()
"Color theme by dngpng, created 2007-09-11."
(interactive)
(color-theme-install
'(color-theme-tm
((background-color . "#111")
(background-mode . dark)
(border-color . "#111")
(cursor-color . "yellow")
(foreground-color . "#ddd")
(mouse-color . "sienna1"))
(default ((t (:background "#111" :foreground "#ddd"))))
(blue ((t (:foreground "blue"))))
(bold ((t (:bold t))))
(bold-italic ((t (:bold t :slant italic))))
(border-glyph ((t (nil))))
(buffers-tab ((t (:background "#111" :foreground "#ddd"))))
(font-lock-builtin-face ((t (:foreground "#dd7b3b"))))
(font-lock-comment-face ((t (:foreground "#666" ))))
(font-lock-constant-face ((t (:foreground "#99cf50"))))
(font-lock-doc-string-face ((t (:foreground "#9b859d"))))
(font-lock-function-name-face ((t (:foreground "#e9c062" :bold t))))
(font-lock-keyword-face ((t (:foreground "#cf6a4c" :bold t))))
(font-lock-preprocessor-face ((t (:foreground "#aeaeae"))))
(font-lock-reference-face ((t (:foreground "8b98ab"))))
(font-lock-string-face ((t (:foreground "#65b042"))))
(font-lock-type-face ((t (:foreground "#c5af75"))))
(font-lock-variable-name-face ((t (:foreground "#3387cc"))))
(font-lock-warning-face ((t (:bold t :background "#420e09" :foreground "#eeeeee"))))
(erc-current-nick-face ((t (:foreground "#aeaeae"))))
(erc-default-face ((t (:foreground "#ddd"))))
(erc-keyword-face ((t (:foreground "#cf6a4c"))))
(erc-notice-face ((t (:foreground "#666"))))
(erc-timestamp-face ((t (:foreground "#65b042"))))
(erc-underline-face ((t (:foreground "c5af75"))))
(nxml-attribute-local-name-face ((t (:foreground "#3387cc"))))
(nxml-attribute-colon-face ((t (:foreground "#e28964"))))
(nxml-attribute-prefix-face ((t (:foreground "#cf6a4c"))))
(nxml-attribute-value-face ((t (:foreground "#65b042"))))
(nxml-attribute-value-delimiter-face ((t (:foreground "#99cf50"))))
(nxml-namespace-attribute-prefix-face ((t (:foreground "#9b859d"))))
(nxml-comment-content-face ((t (:foreground "#666"))))
(nxml-comment-delimiter-face ((t (:foreground "#333"))))
(nxml-element-local-name-face ((t (:foreground "#e9c062"))))
(nxml-markup-declaration-delimiter-face ((t (:foreground "#aeaeae"))))
(nxml-namespace-attribute-xmlns-face ((t (:foreground "#8b98ab"))))
(nxml-prolog-keyword-face ((t (:foreground "#c5af75"))))
(nxml-prolog-literal-content-face ((t (:foreground "#dad085"))))
(nxml-tag-delimiter-face ((t (:foreground "#cda869"))))
(nxml-tag-slash-face ((t (:foreground "#cda869"))))
(nxml-text-face ((t (:foreground "#ddd"))))
(gui-element ((t (:background "#0e2231" :foreground "black"))))
(highlight ((t (:bold t :slant italic))))
(highline-face ((t (:background "#4a410d"))))
(italic ((t (nil))))
(left-margin ((t (nil))))
(mmm-default-submode-face ((t (:background "#111"))))
(mode-line ((t (:background "#e6e5e4" :foreground "black"))))
(primary-selection ((t (:background "#222"))))
(region ((t (:background "#4a410d"))))
(text-cursor ((t (:background "yellow" :foreground "black"))))
(underline ((nil (:underline nil)))))))
(color-theme-tm)
;;python
(autoload 'python-mode "python-mode" "Python Mode." t)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
(add-to-list 'interpreter-mode-alist '("python" . python-mode))
;; pymacs
(autoload 'pymacs-apply "pymacs")
(autoload 'pymacs-call "pymacs")
(autoload 'pymacs-eval "pymacs" nil t)
(autoload 'pymacs-exec "pymacs" nil t)
(autoload 'pymacs-load "pymacs" nil t)
;;(eval-after-load "pymacs"
;; '(add-to-list 'pymacs-load-path YOUR-PYMACS-DIRECTORY"))
(pymacs-load "ropemacs" "rope-")
(setq ropemacs-enable-autoimport t)
;;ido-mode
(require 'ido)
(ido-mode t)