Skip to content

Instantly share code, notes, and snippets.

@mattonem
Created September 5, 2019 12:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattonem/c82bd66ae252a04ef654bcf51ca2f72a to your computer and use it in GitHub Desktop.
Save mattonem/c82bd66ae252a04ef654bcf51ca2f72a to your computer and use it in GitHub Desktop.
emacs php conf
;; 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)
(when (>= emacs-major-version 24)
(require 'package)
(add-to-list
'package-archives
;; '("melpa" . "http://stable.melpa.org/packages/") ; many packages won't show if using stable
'("melpa" . "http://melpa.milkbox.net/packages/")
t))
(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
(composer emojify phpunit helm-phpunit restclient treemacs-magit treemacs-projectile ibuffer-projectile projectile expand-region smartparens flycheck web-mode php-mode company-php company company-mode helm-projectile helm minimap ac-php magit))))
(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.
)
; activate all the packages (in particular autoloads)
(package-initialize)
; fetch the list of packages available
(unless package-archive-contents
(package-refresh-contents))
(unless (package-installed-p 'php-mode)
(package-install 'php-mode))
(unless (package-installed-p 'web-mode)
(package-install 'web-mode))
(unless (package-installed-p 'flycheck)
(package-install 'flycheck))
(unless (package-installed-p 'smartparens)
(package-install 'smartparens))
(unless (package-installed-p 'expand-region)
(package-install 'expand-region))
(unless (package-installed-p 'magit)
(package-install 'magit))
(unless (package-installed-p 'minimap)
(package-install 'minimap))
(unless (package-installed-p 'helm)
(package-install 'helm))
(unless (package-installed-p 'company-php)
(package-install 'company-php))
(unless (package-installed-p 'projectile)
(package-install 'projectile))
(unless (package-installed-p 'helm-projectile)
(package-install 'helm-projectile))
(unless (package-installed-p 'ibuffer)
(package-install 'ibuffer))
(unless (package-installed-p 'ibuffer-projectile)
(package-install 'ibuffer-projectile))
(unless (package-installed-p 'treemacs-projectile)
(package-install 'treemacs-projectile))
(unless (package-installed-p 'treemacs-magit)
(package-install 'treemacs-magit))
(unless (package-installed-p 'restclient)
(package-install 'restclient))
(unless (package-installed-p 'phpunit)
(package-install 'phpunit))
(unless (package-installed-p 'emojify)
(package-install 'emojify))
(require 'helm)
(global-set-key (kbd "M-x") 'helm-M-x)
(require 'projectile)
(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(projectile-mode +1)
(require 'helm-projectile)
(helm-projectile-on)
(require 'company-php)
(add-hook 'after-init-hook 'global-company-mode)
(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html\\.twig\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
(require 'expand-region)
(global-set-key (kbd "C-=") 'er/expand-region)
(require 'ibuffer)
(global-set-key (kbd "C-x C-b") 'ibuffer)
(add-hook 'ibuffer-hook
(lambda ()
(ibuffer-projectile-set-filter-groups)
(unless (eq ibuffer-sorting-mode 'alphabetic)
(ibuffer-do-sort-by-alphabetic))))
(add-hook 'php-mode-hook #'smartparens-mode)
(add-hook 'js-mode-hook #'smartparens-mode)
(add-hook 'org-mode-hook #'smartparens-mode)
(add-hook 'html-mode-hook #'smartparens-mode)
(setq-default emojify-emoji-styles #'unicode)
(add-hook 'after-init-hook #'global-emojify-mode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment