Last active
November 13, 2018 07:31
-
-
Save srcspider/5e8c2707289ce37904662c040bbe8571 to your computer and use it in GitHub Desktop.
emacs config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Startup Options | |
;; =============== | |
(defun insert-tab-char () | |
(interactive) | |
(insert "\t")) | |
(define-key global-map "`" 'insert-tab-char) | |
;; autocomplete backend | |
(when (>= emacs-major-version 24) | |
(require 'package) | |
(add-to-list | |
'package-archives | |
'("melpa" . "http://melpa.org/packages/") | |
t) | |
(package-initialize)) | |
(unless (package-installed-p 'company ) | |
(package-refresh-contents) | |
(package-install 'company )) | |
;; php autocomplete support | |
(unless (package-installed-p 'ac-php ) | |
(package-refresh-contents) | |
(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 | |
(split-window-horizontally) | |
(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-refresh-contents) | |
(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