Skip to content

Instantly share code, notes, and snippets.

@pr00thmatic
Created November 8, 2016 19:32
Show Gist options
  • Save pr00thmatic/b8eb27eec4223b7e32ed1179ae27916f to your computer and use it in GitHub Desktop.
Save pr00thmatic/b8eb27eec4223b7e32ed1179ae27916f to your computer and use it in GitHub Desktop.
;; install: web-mode
;; popup
;; yasnippet
;; js-doc
;; ;; can't get used to spanish keyboard ;_;
;; (global-set-key (kbd "M-;") 'beginning-of-buffer)
;; (global-set-key (kbd "M-:") 'end-of-buffer)
;; full screen
(toggle-frame-fullscreen)
;; whitespace inquisition
(global-set-key "\C-\M-z" 'whitespace-cleanup)
;; indenting :O
(setq js-indent-level 4)
;; linum mode
(global-linum-mode)
;; wind moves
(windmove-default-keybindings)
;; shut up emacs!!
(setq ring-bell-function 'ignore)
;; transparent emacs
(set-frame-parameter (selected-frame) 'alpha '(75 70))
(set-face-attribute 'default nil :background "black"
:foreground "white")
;; let there be parens!
(show-paren-mode 1)
;; melpa
(require 'package) ;; You might already have this line
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line
;; ********** YASNIPPET **********
;; yasnippet popup menu
;;; use popup menu for yas-choose-value
(require 'popup)
;; add some shotcuts in popup menu mode
(define-key popup-menu-keymap (kbd "M-n") 'popup-next)
(define-key popup-menu-keymap (kbd "TAB") 'popup-next)
(define-key popup-menu-keymap (kbd "<tab>") 'popup-next)
(define-key popup-menu-keymap (kbd "<backtab>") 'popup-previous)
(define-key popup-menu-keymap (kbd "M-p") 'popup-previous)
(defun yas-popup-isearch-prompt (prompt choices &optional display-fn)
(when (featurep 'popup)
(popup-menu*
(mapcar
(lambda (choice)
(popup-make-item
(or (and display-fn (funcall display-fn choice))
choice)
:value choice))
choices)
:prompt prompt
;; start isearch mode immediately
:isearch t
)))
(setq yas-prompt-functions '(yas-popup-isearch-prompt yas-ido-prompt yas-no-prompt))
;; yasnippet on load
(yas-global-mode 1)
;; don't load yas on term, i need tab autocompletion
(add-hook 'term-mode-hook (lambda ()
(yas-minor-mode -1)))
;; masm
(require 'asm-mode)
(add-hook 'asm-mode-hook (lambda ()
(setq indent-tabs-mode nil) ; use spaces to indent
(electric-indent-mode -1) ; indentation in asm-mode is annoying
(setq tab-stop-list (number-sequence 2 60 2))))
(define-key asm-mode-map (kbd "<ret>") 'newline-and-indent)
(define-key asm-mode-map (kbd "M-.") 'helm-etags-select)
(setq-default indent-tabs-mode nil)
(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
(defun my-web-mode-hook ()
(setq web-mode-markup-indent-offset 2))
(add-hook 'web-mode-hook 'my-web-mode-hook)
;; bye toolbars
(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
;; js doc
(require 'js-doc)
(add-hook 'js-mode-hook
#'(lambda ()
(define-key js2-mode-map "\C-ci" 'js-doc-insert-function-doc)
(define-key js2-mode-map "@" 'js-doc-insert-tag)))
;; ;; tern :O
;; (add-to-list 'load-path "/home/vg/.emacs.d/tern/tern/emacs/")
;; (autoload 'tern-mode "tern.el" nil t)
;; (add-hook 'js-mode-hook (lambda () (tern-mode t)))
;; (eval-after-load 'tern
;; '(progn
;; (require 'tern-auto-complete)
;; (tern-ac-setup)))
;; autocomplete
(global-auto-complete-mode t)
(put 'erase-buffer 'disabled nil)
;; UTF-8 by default!
(prefer-coding-system 'utf-8)
(setq coding-system-for-read 'utf-8)
(setq coding-system-for-write 'utf-8)
(setq org-startup-truncated 'nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment