Skip to content

Instantly share code, notes, and snippets.

@alexagranov
Last active June 16, 2019 22:07
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 alexagranov/9844243 to your computer and use it in GitHub Desktop.
Save alexagranov/9844243 to your computer and use it in GitHub Desktop.
my .emacs config
(require 'tls)
(push "/usr/local/etc/libressl/cert.pem" gnutls-trustfiles)
;; ____________________________________________________________________________
;; Aquamacs custom-file warning:
;; Warning: After loading this .emacs file, Aquamacs will also load
;; customizations from `custom-file' (customizations.el). Any settings there
;; will override those made here.
;; Consider moving your startup settings to the Preferences.el file, which
;; is loaded after `custom-file':
;; ~/Library/Preferences/Aquamacs Emacs/Preferences
;; _____________________________________________________________________________
(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.
'(column-number-mode t)
'(delete-selection-mode t)
'(indent-tabs-mode nil)
'(inhibit-startup-screen t)
'(kill-whole-line t)
'(normal-erase-is-backspace t)
'(select-active-regions t)
'(show-paren-mode t)
'(tab-always-indent t)
'(transient-mark-mode t)
'(uniquify-buffer-name-style (quote forward) nil (uniquify))
'(use-empty-active-region t)
'(yank-pop-change-selection t))
(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.
'(default ((t (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 135 :width normal :foundry "Misc" :family "Fixed")))))
(require 'find-recursive)
(require 'snippet)
(add-to-list 'load-path "~/.emacs.d/web")
(require 'multi-web-mode)
(add-to-list 'load-path "~/.emacs.d/vendor/rvm")
(require 'rvm)
(setq path-to-ctags "/usr/local/bin/ctags")
(defun create-tags (dir-name)
"Create tags file."
(interactive "DDirectory: ")
(shell-command
(format "%s -f TAGS -e -R %s" path-to-ctags (directory-file-name dir-name)))
)
(put 'downcase-region 'disabled nil)
(defun regexp-revert (regexp)
"Revert all buffers whose path matches regexp"
(interactive "sPath Regexp: ")
(dolist (buffer (buffer-list))
(if (string-match-p regexp (or (buffer-file-name buffer) ""))
(progn
(set-buffer buffer)
(revert-buffer nil t)
(message "Reverting %s" (buffer-file-name buffer))))))
(setq mweb-default-major-mode 'html-mode)
(setq mweb-tags '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>")
(js-mode "<script[^>]*>" "</script>")
(css-mode "<style[^>]*>" "</style>")))
(setq mweb-filename-extensions '("php" "htm" "html" "ctp" "phtml" "php4" "php5"))
(multi-web-global-mode 1)
(defun please-turn-off-auto-fill ()
(auto-fill-mode 0) ; auto fill mode disabled
)
(add-hook 'html-mode-hook 'please-turn-off-auto-fill)
(add-hook 'text-mode-hook 'please-turn-off-auto-fill)
(add-to-list 'load-path "~/.emacs.d/vendor/coffee-mode")
(require 'coffee-mode)
(add-to-list 'auto-mode-alist '("\\.coffee$" . coffee-mode))
(add-to-list 'auto-mode-alist '("\\.coffee.erb$" . coffee-mode))
(setq whitespace-action '(auto-cleanup)) ;; automatically clean up bad whitespace
(setq whitespace-style '(trailing space-before-tab indentation empty space-after-tab)) ;; only show bad whitespace
(global-whitespace-mode 1)
(custom-set-variables '(coffee-tab-width 4))
(font-lock-add-keywords nil
'(("\\<\\(FIXME\\|TODO\\)"
1 font-lock-warning-face prepend)))
(font-lock-add-keywords nil
'(("\\<\\(FOO\\|BAR\\)"
1 font-lock-pseudo-keyword-face prepend)))
(when (>= emacs-major-version 24)
(require 'package)
(add-to-list
'package-archives
'("melpa stable" . "http://stable.melpa.org/packages/")
t)
(package-initialize))
(add-hook 'ruby-mode-hook 'ruby-refactor-mode-launch)
(require 'yaml-mode)
(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
(add-to-list 'auto-mode-alist '("\\.jb$" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.js$" . web-mode))
(add-to-list 'auto-mode-alist '("\\.js.erb$" . web-mode))
(add-to-list 'auto-mode-alist '("\\.scss$" . web-mode))
(setq web-mode-content-types-alist
'(("jsx" . "\\.js[x]?\\'")))
(add-hook 'prog-mode-hook
(lambda ()
(font-lock-add-keywords nil
'(("\\<\\(FIXME\\|TODO\\|BUG\\):" 1 font-lock-warning-face t)))))
;; (add-hook 'after-init-hook (lambda ()
;; (when (fboundp 'auto-dim-other-buffers-mode)
;; (auto-dim-other-buffers-mode t))))
(global-set-key (kbd "C-u") 'revert-buffer)
(global-set-key (kbd "C-c k") 'backward-kill-paragraph) ;; `C-c k'
(global-linum-mode t)
(setq tramp-default-method "ssh")
(auto-revert-mode 1)
(rvm-use-default) ;; use rvm's default ruby for the current Emacs session
(require 'flycheck)
(global-flycheck-mode 1)
;; disable jshint since we prefer eslint checking
(setq-default flycheck-disabled-checkers
(append flycheck-disabled-checkers
'(javascript-jshint)))
;; use eslint with web-mode for jsx files
(flycheck-add-mode 'javascript-eslint 'web-mode)
;; customize flycheck temp file prefix
(setq-default flycheck-temp-prefix ".flycheck")
;; disable json-jsonlist checking for json files
(setq-default flycheck-disabled-checkers
(append flycheck-disabled-checkers
'(json-jsonlist)))
(exec-path-from-shell-initialize)
(global-set-key (kbd "C-x n s") 'neotree-show)
(global-set-key (kbd "C-x n h") 'neotree-hide)
(set-face-attribute 'mode-line
nil
:foreground "#ffffff"
:background "#3b99fc"
:box '(:line-width 1 :style released-button))
(require 'prettier-js)
(add-hook 'js2-mode-hook 'prettier-js-mode)
(defun enable-minor-mode (my-pair)
"Enable minor mode if filename match the regexp. MY-PAIR is a cons cell (regexp . minor-mode)."
(if (buffer-file-name)
(if (string-match (car my-pair) buffer-file-name)
(funcall (cdr my-pair)))))
(add-hook 'web-mode-hook #'(lambda ()
(enable-minor-mode
'("\\.jsx?\\'" . prettier-js-mode))))
(defun prettier-for-ruby ()
"Run prettier-ruby from command line when saving ruby."
(when (eq major-mode 'ruby-mode)
(shell-command-to-string (format "./node_modules/.bin/prettier --write %s" buffer-file-name))))
(add-hook 'before-save-hook #'prettier-for-ruby)
(setq prettier-js-args '(
"--no-semi" "true"
"--trailing-comma" "es5"
"--single-quote" "true"
"--bracket-spacing" "true"
))
;; (load-theme 'solarized-light t)
(sml/setup)
;; Active/Inactive Frame settings
(custom-set-faces
'(mode-line ((t (:background "dim gray" :foreground "white"))))
'(mode-line-inactive ((t (:background nil)))))
(global-hl-line-mode 1)
;; underline the current line
;; (set-face-attribute hl-line-face nil :underline t)
(add-to-list 'default-frame-alist '(alpha . (100 92)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment