Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
.emacs
(setq-default line-spacing 4)
;; Supress initial scratch message
(setq initial-scratch-message nil)
(require 'package)
(add-to-list
'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
;; (add-to-list 'load-path "~/.emacs.d/color-theme-6.6.0/")
(require 'org)
;; key bindings
(global-set-key (kbd "C-c C-c") 'compile)
(global-set-key (kbd "C-x C-m") 'execute-extended-command)
(global-set-key (kbd "C-.") 'repeat)
(global-set-key (kbd "M-.") 'repeat-complex-command)
(global-set-key (kbd "C-x 3") 'split-vertically-and-next-buffer)
(global-set-key (kbd "C-x C-r") 'remember)
(global-set-key (kbd "C-o") 'split-line)
(global-set-key (kbd "C-=") 'duplicate-line)
(global-set-key (kbd "C-x ;") 'comment-or-uncomment-region)
(global-set-key (kbd "C-a") 'beginning-of-line-alt)
(global-set-key (kbd "C-x C-k") 'kill-region)
(global-set-key (kbd "C-w") 'backward-kill-word)
(global-set-key (kbd "C-x k") 'kill-this-buffer)
(global-set-key (kbd "M-n") 'forward-paragraph)
(global-set-key (kbd "M-p") 'backward-paragraph)
(global-set-key (kbd "M-o") 'fixup-whitespace)
(global-set-key (kbd "C-c w") 'clipboard-kill-ring-save)
(progn (global-set-key (kbd "C-c C-m") 'bookmark-jump)
(define-key org-mode-map (kbd "C-c C-m") 'bookmark-jump))
(progn (global-set-key (kbd "C-x C-m") 'execute-extended-command)
(define-key org-mode-map (kbd "C-x C-m") 'execute-extended-command))
;; gui
(tool-bar-mode 0)
(scroll-bar-mode 0)
(menu-bar-mode 0)
(transient-mark-mode 0)
(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.
'(auto-save-default nil)
'(compilation-scroll-output t)
'(custom-safe-themes
(quote
("a8245b7cc985a0610d71f9852e9f2767ad1b852c2bdea6f4aadc12cce9c4d6d0" default)))
'(ediff-split-window-function (quote split-window-horizontally))
'(haskell-font-lock-symbols t)
'(haskell-interactive-popup-errors nil)
'(haskell-program-name "stack ghci")
'(indent-tabs-mode nil)
'(inhibit-startup-screen t)
'(make-backup-file-name-function nil)
'(make-backup-files nil)
'(org-return-follows-link t)
'(org-todo-keywords (quote ((sequence "TODO" "WAITING" "DONE"))))
'(pretty-symbol-patterns
(quote
((8594 lambda "=>"
(js-mode))
(955 lambda "\\<lambda\\>"
(emacs-lisp-mode inferior-lisp-mode inferior-emacs-lisp-mode lisp-mode scheme-mode python-mode inferior-python-mode))
(402 lambda "\\<function\\>"
(js-mode))
(8800 relational "!="
(c-mode c++-mode go-mode java-mode js-mode perl-mode cperl-mode ruby-mode python-mode inferior-python-mode))
(8800 relational "/="
(emacs-lisp-mode inferior-lisp-mode inferior-emacs-lisp-mode lisp-mode scheme-mode))
(8805 relational ">="
(c-mode c++-mode go-mode java-mode js-mode perl-mode cperl-mode ruby-mode python-mode inferior-python-mode emacs-lisp-mode inferior-lisp-mode inferior-emacs-lisp-mode lisp-mode scheme-mode))
(8804 relational "<="
(c-mode c++-mode go-mode java-mode js-mode perl-mode cperl-mode ruby-mode python-mode inferior-python-mode emacs-lisp-mode inferior-lisp-mode inferior-emacs-lisp-mode lisp-mode scheme-mode)))))
'(remember-data-file "~\\.notes.org")
'(tab-width 4)
'(truncate-lines t)
'(yas/indent-line (quote fixed)))
(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.
'(font-lock-comment-face ((t (:foreground "gray50" :slant normal :weight light))))
'(font-lock-constant-face ((t (:foreground "#222222"))))
'(font-lock-function-name-face ((t (:weight ultra-bold))))
'(font-lock-keyword-face ((t (:weight bold))))
'(font-lock-operator-face ((t nil)) t)
'(font-lock-string-face ((t (:foreground "#bd2c2c" :weight normal))))
'(font-lock-type-face ((t (:foreground "#000000"))))
'(hi-red-b ((t (:foreground "#cc4444"))))
'(org-done ((((class color) (min-colors 16) (background dark)) (:foreground "GreenYellow" :weight bold))))
'(org-level-1 ((t (:inherit outline-1 :foreground "black"))))
'(org-todo ((((class color) (min-colors 16) (background dark)) (:foreground "salmon" :weight bold))))
'(show-tabs-space-face ((t (:foreground "red"))))
'(web-mode-html-tag-face ((t nil))))
(column-number-mode 1)
(defun beginning-of-line-alt ()
(interactive)
(if (= 0 (current-column))
(back-to-indentation)
(beginning-of-line)))
(defun duplicate-line ()
(interactive)
(let ((c (current-column))
(s (progn (beginning-of-line) (point)))
(e (progn (end-of-line) (point))))
(insert "\n")
(insert-buffer-substring (current-buffer) s e)
(move-to-column c)))
(recentf-mode 1)
(ido-mode 1)
(toggle-truncate-lines 1)
;; (ido-everywhere 1)
(set-variable 'ido-enable-flex-matching t)
;; yes or no -> y or n
(fset 'yes-or-no-p 'y-or-n-p)
;; Show matching parens (mixed style)
(show-paren-mode 1)
(setq show-paren-delay 0.0)
(setq show-paren-style 'parenthesis)
(set-variable 'visible-bell t)
;; colors
(global-hl-line-mode 1)
(set-face-background 'hl-line "#FFffe2")
;; yasnippet mode
(require 'yasnippet)
(set-variable 'yas/root-directory "~/.emacs.d/yasnippet/snippets")
(global-set-key (kbd "C-<tab>") 'yas-expand)
(add-hook 'text-mode-hook 'yas-minor-mode)
(yas-global-mode 1)
(defun split-vertically-and-next-buffer ()
(interactive)
(split-window-horizontally)
(other-window 1)
(next-buffer)
(other-window -1))
(set-variable 'indent-tabs-mode ())
(put 'scroll-left 'disabled nil)
(remove-hook 'before-save-hook 'delete-trailing-whitespace)
;; (add-hook 'js-mode-hook 'pretty-symbols-mode)
(setq js-indent-level 4)
(require 'editorconfig)
(editorconfig-mode 1)
(defadvice tramp-completion-handle-file-name-all-completions
(around dotemacs-completion-docker activate)
"(tramp-completion-handle-file-name-all-completions \"\" \"/docker:\" returns
a list of active Docker container names, followed by colons."
(if (equal (ad-get-arg 1) "/docker:")
(let* ((dockernames-raw (shell-command-to-string "docker ps | perl -we 'use strict; $_ = <>; m/^(.*)NAMES/ or die; my $offset = length($1); while(<>) {substr($_, 0, $offset, q()); chomp; for(split m/\\W+/) {print qq($_:\n)} }'"))
(dockernames (cl-remove-if-not
#'(lambda (dockerline) (string-match ":$" dockerline))
(split-string dockernames-raw "\n"))))
(setq ad-return-value dockernames))
ad-do-it))
(require 'tramp)
;; DOCKER
(push
(cons
"docker"
'((tramp-login-program "docker")
(tramp-login-args (("exec" "-it" "-u0") ("%h") ("/bin/bash")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-i") ("-c"))))
tramp-methods)
(setq dired-listing-switches "-alh")
(require 'projectile)
(projectile-mode)
(add-to-list 'projectile-globally-ignored-directories "web/css")
(add-to-list 'projectile-globally-ignored-directories "web/js")
(add-to-list 'projectile-globally-ignored-directories "cache")
(add-to-list 'projectile-globally-ignored-directories "node_modules")
;; Haskell intero
(add-hook 'haskell-mode-hook 'intero-mode)
;; use eslint with web-mode for jsx files
(require 'flycheck)
(flycheck-add-mode 'javascript-eslint 'js-mode)
(defun my/use-eslint-from-node-modules ()
(let* ((root (locate-dominating-file
(or (buffer-file-name) default-directory)
"node_modules"))
(eslint (and root
(expand-file-name "node_modules/.bin/eslint"
root))))
(when (and eslint (file-executable-p eslint))
(setq-local flycheck-javascript-eslint-executable eslint))))
(add-hook 'flycheck-mode-hook #'my/use-eslint-from-node-modules)
;; turn on flychecking globally
(add-hook 'js-mode-hook 'flycheck-mode)
(require 'key-chord)
(key-chord-mode 1)
(key-chord-define-global "qq" 'execute-extended-command)
(key-chord-define-global "JJ" 'projectile-find-file)
(key-chord-define-global "jj" 'other-window)
(key-chord-define-global "qw" 'ido-switch-buffer)
(provide '.emacs)
;;; .emacs ends here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.