Skip to content

Instantly share code, notes, and snippets.

Last active Nov 13, 2018
What would you like to do?
emacs config
;; Startup Options
;; ===============
(defun insert-tab-char ()
(insert "\t"))
(define-key global-map "`" 'insert-tab-char)
;; autocomplete backend
(when (>= emacs-major-version 24)
(require 'package)
'("melpa" . "")
(unless (package-installed-p 'company )
(package-install 'company ))
;; php autocomplete support
(unless (package-installed-p 'ac-php )
(package-install 'ac-php ))
(require 'cl)
(require 'php-mode)
(add-hook 'php-mode-hook
'(lambda ()
(require 'ac-php-company)
(company-mode t)
(add-to-list 'company-backends 'company-ac-php-backend )))
;; general window settings
(fset 'yes-or-no-p 'y-or-n-p)
(setq initial-scratch-message "")
(kill-buffer "*Messages*")
(setq-default truncate-lines t)
;; extra themes path
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
;; load monokai theme (sublime default)
(load-theme 'monokai t)
;; Speedbar
(unless (package-installed-p 'sr-speedbar )
(package-install 'sr-speedbar ))
(require 'sr-speedbar)
(setq sr-sppedbar-right-side nil)
;; ------------------------------------------------
;; Basic Settings
;; ==============
; ensure undo limits are as high as possible
(setq undo-limit 20000000)
(setq undo-strong-limit 40000000)
;; disable useless bars
(scroll-bar-mode -1)
(tool-bar-mode 0)
;; disable selection via shift
(setq shift-select-mode nil)
;; enable line numbers
(global-linum-mode t)
;; store all backup and autosave files in the tmp dir
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
;; enable autocomplete everywhere
(add-hook 'after-init-hook 'global-company-mode)
(add-hook 'php-mode-hook
'(lambda ()
(auto-complete-mode t)
(require 'ac-php)
(setq ac-sources '(ac-source-php ) )
(yas-global-mode 1)
(define-key php-mode-map (kbd "C-]") 'ac-php-find-symbol-at-point) ;goto define
(define-key php-mode-map (kbd "C-t") 'ac-php-location-stack-back ) ;go back
;; Basic Control Shortcuts
;; =======================
;; \e = alt key
;; undo is C-/
;; redo si C-g followed by as many C-/ as necesary
;; paste from clipboard
(define-key global-map "\eq" 'clipboard-yank)
;; open & navigate
(define-key global-map "\ef" 'find-file)
(define-key global-map "\eF" 'find-file-other-window)
(define-key global-map "\ew" 'other-window)
;; buffers
(define-key global-map "\er" 'revert-buffer)
(define-key global-map "\ek" 'kill-this-buffer)
(define-key global-map "\es" 'save-buffer)
;; switch buffer
(global-set-key (read-kbd-macro "\eb") 'ido-switch-buffer)
(global-set-key (read-kbd-macro "\eB") 'ido-switch-buffer-other-window)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment