Body
Die folgenden Punkte sind für Emacs konfiguriert:
Paket-Quelle
Als Quelle der hier verwendeten Pakete dient das MELPA-Repository. Die Einrichtung ist unter Getting Started beschrieben.
Für Systeme ohne Internetverbindung gibt es elpa-mirror, dass die Pakete zur späteren Installation zusammenstellt.
Einrückungen
Der Blog-Eintrag zeigt eine elegante Möglichkeit, verschiedene Einrück-Konfigurationen anzulegen und dazwischen zu wechseln.
Datei- und Projektverwaltung
Dies erledigt die Kombination aus Projectile und Neotree.
Motiv
Als Einfärbe-Thema habe ich Cyberpunk gewählt.
Ergebnis
;; http://blog.binchen.org/posts/easy-indentation-setup-in-emacs-for-web-development.html
(defun my-setup-indent (n)
;; java/c/c++
(setq-local c-basic-offset n)
;; web development
(setq-local coffee-tab-width n) ; coffeescript
(setq-local javascript-indent-level n) ; javascript-mode
(setq-local js-indent-level n) ; js-mode
(setq-local js2-basic-offset n) ; js2-mode, in latest js2-mode, it's alias of js-indent-level
(setq-local web-mode-markup-indent-offset n) ; web-mode, html tag in html file
(setq-local web-mode-css-indent-offset n) ; web-mode, css in html file
(setq-local web-mode-code-indent-offset n) ; web-mode, js code in html file
(setq-local css-indent-offset n) ; css-mode
)
(defun my-office-code-style ()
(interactive)
(message "Office code style!")
;; use tab instead of space
(setq-local indent-tabs-mode t)
;; indent 4 spaces width
(my-setup-indent 4))
(defun my-personal-code-style ()
(interactive)
(message "My personal code style!")
;; use space instead of tab
(setq indent-tabs-mode nil)
;; indent 2 spaces width
(my-setup-indent 2))
(defun my-setup-develop-environment ()
(interactive)
(my-personal-code-style))
;; prog-mode-hook requires emacs24+
(add-hook 'prog-mode-hook 'my-setup-develop-environment)
;; a few major-modes does NOT inherited from prog-mode
(add-hook 'lua-mode-hook 'my-setup-develop-environment)
(add-hook 'web-mode-hook 'my-setup-develop-environment)
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(when no-ssl
(warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)
(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.
'(package-selected-packages
(quote
(cyberpunk-theme projectile magit git yaml-mode php-mode))))
(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.
)
;; https://github.com/bbatsov/projectile
;; Projectile
(projectile-mode +1)
(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
;; https://www.emacswiki.org/emacs/NeoTree
;; Neotree
(require 'neotree)
(global-set-key [f8] 'neotree-toggle)
(setq neo-smart-open t)
(setq projectile-switch-project-action 'neotree-projectile-action)
;; Cyberpunk theme
(add-hook 'after-init-hook
(lambda () (load-theme 'cyberpunk t)))
Tastenkombinationen
F8 NeoTree öffnen/schließen
Kommentare
Hervorhebung zusammengehöriger Klammern
;; https://www.emacswiki.org/emacs/ShowParenMode
(show-paren-mode 1)