From 5f0f2f90361a4c0a76478b288998595fc3ddebd2 Mon Sep 17 00:00:00 2001 From: Roger Gonzalez Date: Wed, 8 Apr 2020 10:38:14 -0300 Subject: Added my old emacs config --- .emacs.d.back/setup/setup-flycheck-mode.el | 54 ++++++++++++++ .emacs.d.back/setup/setup-js-mode.el | 66 +++++++++++++++++ .emacs.d.back/setup/setup-org-mode.el | 114 +++++++++++++++++++++++++++++ .emacs.d.back/setup/setup-python-mode.el | 13 ++++ .emacs.d.back/setup/setup-web-mode.el | 73 ++++++++++++++++++ .emacs.d.back/setup/setup-yaml-mode.el | 18 +++++ 6 files changed, 338 insertions(+) create mode 100644 .emacs.d.back/setup/setup-flycheck-mode.el create mode 100644 .emacs.d.back/setup/setup-js-mode.el create mode 100644 .emacs.d.back/setup/setup-org-mode.el create mode 100644 .emacs.d.back/setup/setup-python-mode.el create mode 100644 .emacs.d.back/setup/setup-web-mode.el create mode 100644 .emacs.d.back/setup/setup-yaml-mode.el (limited to '.emacs.d.back/setup') diff --git a/.emacs.d.back/setup/setup-flycheck-mode.el b/.emacs.d.back/setup/setup-flycheck-mode.el new file mode 100644 index 00000000..062dfe93 --- /dev/null +++ b/.emacs.d.back/setup/setup-flycheck-mode.el @@ -0,0 +1,54 @@ +;;; setup-flycheck-mode.el --- rogs default flycheck mode configuration +;; +;;; Commentary: +;; +;; My default configuration for flycheck mode +;; +;;; Code: + +;; FlyCheck configs +;; More help: http://codewinds.com/blog/2015-04-02-emacs-flycheck-eslint-jsx.html#configuring_emacs +;; http://www.flycheck.org/manual/latest/index.html +;; http://codewinds.com/blog/2015-04-02-emacs-flycheck-eslint-jsx.html +(require 'flycheck) + +;; Turn on flychecking globally +(add-hook 'after-init-hook #'global-flycheck-mode) + +;; 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))) + +;; Use local eslint from node_modules before global +;; http://emacs.stackexchange.com/questions/21205/flycheck-with-file-relative-eslint-executable +(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/eslint/bin/eslint.js" + 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) + +;; https://github.com/purcell/exec-path-from-shell +;; Only need exec-path-from-shell on OSX +;; This hopefully sets up path and other vars better +(when (memq window-system '(mac ns)) + (exec-path-from-shell-initialize)) + +(provide 'setup-flycheck-mode) +;;; setup-flycheck-mode.el ends here diff --git a/.emacs.d.back/setup/setup-js-mode.el b/.emacs.d.back/setup/setup-js-mode.el new file mode 100644 index 00000000..d782154f --- /dev/null +++ b/.emacs.d.back/setup/setup-js-mode.el @@ -0,0 +1,66 @@ +;;; setup-js-mode.el --- rogs default js mode configuration +;; +;;; Commentary: +;; +;; My default configuration for js mode +;; +;;; Code: + +;; Associates json-mode to all .eslintrc files +(add-to-list 'auto-mode-alist '("\\.eslintrc\\'" . json-mode)) + +;; JS2 mode +(require 'js2-refactor) +(require 'xref-js2) + +(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode)) +(add-to-list 'auto-mode-alist '("\\.js\\'" . rjsx-mode)) +(add-hook 'js2-mode-hook #'js2-refactor-mode) +(add-hook 'js2-mode-hook #'emmet-mode) +(setq emmet-expand-jsx-className? t) +(js2r-add-keybindings-with-prefix "C-c C-f") +(define-key js2-mode-map (kbd "C-k") #'js2r-kill) +(define-key js2-mode-map (kbd "C-c ;") #'comment-line) +(define-key js2-mode-map (kbd "C-c C-;") #'comment-or-uncomment-region) + +;; js-mode (which js2 is based on) binds "M-." which conflicts with xref, so +;; unbind it. +(define-key js-mode-map (kbd "M-.") nil) + +(add-hook 'js2-mode-hook (lambda () + (add-hook 'xref-backend-functions #'xref-js2-xref-backend nil t))) + +(setq js2-highlight-level 3) + +;; Turn off js2 mode errors & warnings (we lean on eslint/standard) +(setq js2-mode-show-parse-errors nil) +(setq js2-mode-show-strict-warnings nil) + +;; Tern +(require 'company) +(require 'company-tern) + +(add-to-list 'company-backends 'company-tern) +(add-hook 'js2-mode-hook (lambda () + (tern-mode) + (company-mode))) + +;; Disable completion keybindings, as we use xref-js2 instead +(define-key tern-mode-keymap (kbd "M-.") nil) +(define-key tern-mode-keymap (kbd "M-,") nil) + +;; Indium +(unless (package-installed-p 'indium) + (package-install 'indium)) +(require 'indium) +(add-hook 'js2-mode-hook #'indium-interaction-mode) +(define-key js2-mode-map (kbd "C-c i") 'indium-launch) + +;; PrettierJS +(eval-after-load 'js2-mode + '(progn + (add-hook 'js2-mode-hook #'add-node-modules-path) + (add-hook 'js2-mode-hook #'prettier-js-mode))) + +(provide 'setup-js-mode) +;;; setup-js-mode.el ends here diff --git a/.emacs.d.back/setup/setup-org-mode.el b/.emacs.d.back/setup/setup-org-mode.el new file mode 100644 index 00000000..49882364 --- /dev/null +++ b/.emacs.d.back/setup/setup-org-mode.el @@ -0,0 +1,114 @@ +;;; setup-org-mode.el --- rogs default org mode configuration +;; +;;; Commentary: +;; +;; My default configuration for org mode +;; +;;; Code: + +(setq org-agenda-files (quote ("~/Dropbox/org"))) + +;; Keyword and faces +(setq-default org-todo-keywords + '((sequence "TODO(t!)" "IN_PROGRESS(i!)" "WAIT(w@/!)" "SOMEDAY(s!)" "|" "DONE(d@/!)" "CANCELLED(c@/!)"))) + +(setq-default org-todo-keyword-faces + '(( "TODO" . (:foreground "white" :background "darkorchid4" :weight bold)) + ( "IN_PROGRESS" . (:background "deeppink3" :weight bold)) + ( "WAIT" (:background "red" :weight bold)) + ( "SOMEDAY" . (:foreground "white" :background "#00807E" :weight bold)) + ( "DONE" . (:foreground "white" :background "forest green" :weight bold)) + ( "CANCELLED" . (:foreground "light gray" :slant italic)))) + +;; Priorities +;; A: Do it now +;; B: Decide when to do it +;; C: Delegate it +;; D: Just an idea +(setq org-highest-priority ?A) +(setq org-lowest-priority ?D) +(setq org-default-priority ?B) +(setq org-priority-faces '((?A . (:foreground "white" :background "dark red" :weight bold)) + (?B . (:foreground "white" :background "dark green" :weight bold)) + (?C . (:foreground "yellow")) + (?D . (:foreground "gray")))) + +;; Time formats +(setq org-time-stamp-custom-formats '("<%d/%m/%y %a>" . "<%d/%m/%y %a %H:%M>")) +(setq org-display-custom-times t) + +;; Tags +(setq org-tag-alist '(("payments" . ?p) ("girlfriend" . ?g) ("call" . ?c) ("mail" . ?m) ("rogs" . ?r) ("jobs" . ?j) ("backend" . ?b) ("frontend" . ?f) ("devops" . ?d) ("bugs" . ?u) ("improvements" . ?i))) + +;; Log into drawer +(setq org-log-into-drawer t) + +;; Archive location +(setq org-archive-location "archive/%s_archive::") + +;; Log when reschedule +(setq org-log-reschedule t) + +;; Log when done +(setq org-log-done t) + +;; Capture templates +(setq org-capture-templates + (quote + ( + ;; Personal templates + ("p" "Templates for personal") + ("pr" "Non-scheduled" entry + (file+headline "~/Dropbox/org/personal.org" "Captured") + (file "~/.emacs.d/org/templates/basic-task.txt")) + ("ps" "Scheduled" entry + (file+headline "~/Dropbox/org/personal.org" "Captured") + (file "~/.emacs.d/org/templates/scheduled-task.txt")) + ("pl" "Logbook entry for Personal" entry (file+datetree "logbook-personal.org") "** %U - %^{Activity}  :LOG:") + ;; Massive templates + ("m" "Templates for massive") + ("mr" "Non-scheduled" entry + (file+headline "~/Dropbox/org/massive.org" "Captured") + (file "~/.emacs.d/org/templates/basic-task.txt")) + ("ms" "Scheduled" entry + (file+headline "~/Dropbox/org/massive.org" "Captured") + (file "~/.emacs.d/org/templates/scheduled-task.txt")) + ("ml" "Logbook entry for Massive" entry (file+datetree "logbook-work.org") "** %U - %^{Activity}  :LOG:") + ("mm" "New daily meeting" entry + (file+datetree "~/Dropbox/org/massive-dailies.org") + (file "~/.emacs.d/org/templates/meeting.txt")) + ;; Rogs templates + ("r" "Templates for rogs") + ("rr" "Non-scheduled" entry + (file+headline "~/Dropbox/org/rogs.org" "Captured") + (file "~/.emacs.d/org/templates/basic-task.txt")) + ("rs" "Scheduled" entry + (file+headline "~/Dropbox/org/rogs.org" "Captured") + (file "~/.emacs.d/org/templates/scheduled-task.txt")) + ))) + +;; Wrap long lines +(add-hook 'text-mode-hook 'turn-on-visual-line-mode) + +;; Enforce ordered tasks and add a tag +(setq org-enforce-todo-dependencies t) +(setq org-track-ordered-property-with-tag t) +(setq org-agenda-dim-blocked-tasks t) +(setq org-enforce-todo-checkbox-dependencies t) + +;; Org habits +(require 'org-habit) +(setq org-habit-graph-column 50) + +;; Include diary +(setq org-agenda-include-diary t) + +;; Keep line breaks on export +(setq org-export-preserve-breaks t) + +;; Org bullets +(require 'org-bullets) +(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))) + +(provide 'setup-org-mode) +;;; setup-org-mode.el ends here diff --git a/.emacs.d.back/setup/setup-python-mode.el b/.emacs.d.back/setup/setup-python-mode.el new file mode 100644 index 00000000..d7897f95 --- /dev/null +++ b/.emacs.d.back/setup/setup-python-mode.el @@ -0,0 +1,13 @@ +;;; setup-python-mode.el --- rogs default python mode configuration +;; +;;; Commentary: +;; +;; My default configuration for python mode +;; +;;; Code: + +(elpy-enable) +(setq elpy-rpc-backend "jedi") + +(provide 'setup-python-mode) +;;; setup-python-mode.el ends here diff --git a/.emacs.d.back/setup/setup-web-mode.el b/.emacs.d.back/setup/setup-web-mode.el new file mode 100644 index 00000000..7f6857e7 --- /dev/null +++ b/.emacs.d.back/setup/setup-web-mode.el @@ -0,0 +1,73 @@ +;;; setup-web-mode.el --- rogs default web mode configuration +;; +;;; Commentary: +;; +;; My default configuration for web mode +;; +;;; Code: + +;; Web Mode: Begin +;; JSX configs: http://cha1tanya.com/2015/06/20/configuring-web-mode-with-jsx.html +(require 'web-mode) +(add-to-list 'auto-mode-alist '("\\.phtml\\'" . 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)) +(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode)) +(add-to-list 'auto-mode-alist '("\\.css\\'" . web-mode)) +(add-to-list 'auto-mode-alist '("\\.scss\\'" . web-mode)) +(add-to-list 'auto-mode-alist '("\\.es6\\'" . web-mode)) + +;; Use web-mode for .jsx files +(add-to-list 'auto-mode-alist '("\\.jsx$" . web-mode)) + +;; Use web-mode for .hbs files +(add-to-list 'auto-mode-alist '("\\.hbs$" . web-mode)) + +(setq web-mode-content-types-alist + '(("jsx" . "\\.js[x]?\\'") + ("javascript" . "\\.es6?\\'"))) + +(defadvice web-mode-highlight-part (around tweak-jsx activate) + (if (equal web-mode-content-type "jsx") + (let ((web-mode-enable-part-face nil)) + ad-do-it) + ad-do-it)) + +(defadvice web-mode-highlight-part (around tweak-jsx activate) + (if (equal web-mode-content-type "js") + (let ((web-mode-enable-part-face nil)) + ad-do-it) + ad-do-it)) + +;; Style-Gook +(defun my-web-mode-hook () + "Hooks for Web mode." + (setq web-mode-enable-auto-pairing t) + (setq web-mode-enable-css-colorization t) + (setq web-mode-enable-auto-expanding t) + (setq web-mode-enable-current-element-highlight t) + (setq web-mode-enable-current-column-highlight t) + ) + +;; Emmet-Hook +(add-hook 'web-mode-before-auto-complete-hooks + '(lambda () + (let ((web-mode-cur-language + (web-mode-language-at-pos))) + (if (string= web-mode-cur-language "css") + (setq emmet-use-css-transform t) + (setq emmet-use-css-transform nil))))) + +(add-hook 'web-mode-hook 'emmet-mode) ;; Auto-start on any markup modes +(add-hook 'html-mode-hook 'emmet-mode) ;; Auto-start on any markup modes +(add-hook 'web-mode-hook 'my-web-mode-hook) +(add-hook 'web-mode-hook #'emmet-mode) +(setq emmet-preview-default t) +(add-hook 'web-mode-hook 'rainbow-mode) + +(provide 'setup-web-mode) +;;; setup-web-mode.el ends here diff --git a/.emacs.d.back/setup/setup-yaml-mode.el b/.emacs.d.back/setup/setup-yaml-mode.el new file mode 100644 index 00000000..059c74e2 --- /dev/null +++ b/.emacs.d.back/setup/setup-yaml-mode.el @@ -0,0 +1,18 @@ +;;; setup-yaml-mode.el --- rogs default yaml mode configuration +;; +;;; Commentary: +;; +;; My default configuration for yaml mode +;; +;;; Code: + +(require 'yaml-mode) + (add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode)) + (add-to-list 'auto-mode-alist '("\\.yaml\\'" . yaml-mode)) + +(add-hook 'yaml-mode-hook + '(lambda () + (define-key yaml-mode-map "\C-m" 'newline-and-indent))) + +(provide 'setup-yaml-mode) +;;; setup-yaml-mode.el ends here -- cgit v1.2.3