diff options
26 files changed, 347 insertions, 576 deletions
diff --git a/emacs.d/core/core-autocompletion.el b/emacs.d/core/core-autocompletion.el deleted file mode 100644 index 724ccf3..0000000 --- a/emacs.d/core/core-autocompletion.el +++ /dev/null @@ -1,7 +0,0 @@ -(use-package company - :ensure t - :config - (progn - (add-hook 'prog-mode-hook 'company-mode))) - -(provide 'core-autocompletion) diff --git a/emacs.d/core/core-bindings.el b/emacs.d/core/core-bindings.el deleted file mode 100644 index 629eb54..0000000 --- a/emacs.d/core/core-bindings.el +++ /dev/null @@ -1,13 +0,0 @@ -(global-set-key (kbd "M-j") 'join-line) - -(global-set-key (kbd "C-x C-b") 'ibuffer) - -(global-set-key (kbd "<s-return>") 'toggle-frame-fullscreen) - -(global-set-key (kbd "C-c s") 'fc/visit-term-buffer) - -(global-set-key (kbd "s-N") 'fc/switch-to-scratch) - -(define-key emacs-lisp-mode-map (kbd "C-c C-e") 'eval-buffer) - -(provide 'core-bindings) diff --git a/emacs.d/core/core-default.el b/emacs.d/core/core-default.el deleted file mode 100644 index 7756257..0000000 --- a/emacs.d/core/core-default.el +++ /dev/null @@ -1,20 +0,0 @@ -;; alias yes-or-no to y-or-n -(fset 'yes-or-no-p 'y-or-n-p) - -;; set utf-8 as the default encoding -(prefer-coding-system 'utf-8-unix) - -(global-auto-revert-mode 1) - -(setq - auto-save-default nil - auto-save-list-file-prefix nil - make-backup-files nil - require-final-newline t - vc-follow-symlinks t - next-screen-context-lines 5 - tab-always-indent 'complete) - -(setq-default indent-tabs-mode nil) - -(provide 'core-default) diff --git a/emacs.d/core/core-defun.el b/emacs.d/core/core-defun.el deleted file mode 100644 index ad17af4..0000000 --- a/emacs.d/core/core-defun.el +++ /dev/null @@ -1,42 +0,0 @@ -(defun fc/switch-to-scratch () - "Switch to scratch, grab the region if it's active." - (interactive) - (let ((contents - (and (region-active-p) - (buffer-substring (region-beginning) - (region-end))))) - (switch-to-buffer "*scratch*") - (if contents - (progn - (goto-char (buffer-end 1)) - (insert contents))))) - -(defun fc/rename-this-buffer-and-file () - "Renames current buffer and file it is visiting." - (interactive) - (let ((name (buffer-name)) - (filename (buffer-file-name)) - (read-file-name-function 'read-file-name-default)) - (if (not (and filename (file-exists-p filename))) - (error "Buffer '%s' is not visiting a file!" name) - (let ((new-name (read-file-name "New name: " filename))) - (cond ((get-buffer new-name) - (error "A buffer named '%s' already exists!" new-name)) - (t - (rename-file filename new-name 1) - (rename-buffer new-name) - (set-visited-file-name new-name) - (set-buffer-modified-p nil) - (message "File '%s' successfully renamed to '%s'" name (file-name-nondirectory new-name)))))))) - -(defun fc/visit-term-buffer () - "Create or visit a terminal buffer." - (interactive) - (if (not (get-buffer "*ansi-term*")) - (progn - (split-window-sensibly (selected-window)) - (other-window 1) - (ansi-term (getenv "SHELL"))) - (switch-to-buffer-other-window "*ansi-term*"))) - -(provide 'core-defun) diff --git a/emacs.d/core/core-editor.el b/emacs.d/core/core-editor.el deleted file mode 100644 index ddc59b4..0000000 --- a/emacs.d/core/core-editor.el +++ /dev/null @@ -1,56 +0,0 @@ -(use-package swiper - :ensure t - :bind (("C-s" . swiper)) - :config - (setq ivy-use-virtual-buffers t) - (ivy-mode)) - -(use-package counsel - :ensure t - :config - (setq counsel-find-file-at-point t)) - -(use-package helm - :ensure t) - -(when (memq window-system '(mac ns x)) - (use-package exec-path-from-shell - :ensure t - :init (setq exec-path-from-shell-debug +1) - :config - (exec-path-from-shell-initialize) - (exec-path-from-shell-copy-envs '("TMPDIR")))) - -(use-package dired - :commands dired - :init - (setq dired-listing-switches "-laGhv")) - -(use-package ag - :ensure t - :defer t) - -(use-package smartparens - :ensure t - :config - (progn - (require 'smartparens-config) - (smartparens-global-mode 1) - (setq sp-show-pair-delay 0) - (setq sp-autoinsert-if-followed-by-word nil) - (show-smartparens-global-mode t))) - -(use-package projectile - :ensure t - :init - (setq projectile-enable-caching t) - (setq projectile-completion-system 'ivy) - :config - (projectile-global-mode)) - -(use-package server - :config - (unless (server-running-p) - (server-start))) - -(provide 'core-editor) diff --git a/emacs.d/core/core-flycheck.el b/emacs.d/core/core-flycheck.el deleted file mode 100644 index 11bb20b..0000000 --- a/emacs.d/core/core-flycheck.el +++ /dev/null @@ -1,55 +0,0 @@ -(use-package flycheck - :ensure t - :defer t - :preface (progn - (defun check-source-predicate () - (and (executable-find "check.pex") - (buffer-file-name) - (string-match "src/source/.*\.py$" (buffer-file-name))))) - :init - (progn - (add-hook 'prog-mode-hook 'flycheck-mode) - (setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc))) - :config - (progn - (setq flycheck-mode-line - '(:eval - (pcase flycheck-last-status-change - (`not-checked nil) - (`no-checker (propertize " -" 'face 'warning)) - (`running "") - (`errored (propertize " ✘" 'face 'error)) - (`finished - (if flycheck-current-errors - (let* ((error-counts (flycheck-count-errors flycheck-current-errors)) - (no-errors (cdr (assq 'error error-counts))) - (no-warnings (cdr (assq 'warning error-counts))) - (flycheck-face (cond (no-errors 'error) - (no-warnings 'warning)))) - (propertize (format " [✗:%s/%s]" (or no-errors 0) (or no-warnings 0)) 'face flycheck-face)) - (propertize " [✓]" 'face 'success))) - (`interrupted " -") - (`suspicious '(propertize " ?" 'face 'warning))))) - - (setq flycheck-puppet-lint-rc "/Users/fcuny/src/twitter-ops/utilities/puppet/.puppet-lint.rc") - - (flycheck-define-checker source-check - "A syntax checker for python source code in Source, using `check.pex'" - :command ("check.pex" source) - ;;; errors are reported like this: - ;;; E241:ERROR <file name>:<line> <message> - :error-patterns ((error line-start (id (1+ nonl)) ":ERROR" (1+ nonl) ":" line (message) line-end) - (warning line-start (id (1+ nonl)) ":WARNING" (1+ nonl) ":" line (message) line-end)) - :predicate check-source-predicate - :modes (python-mode)) - (add-to-list 'flycheck-checkers 'source-check))) - -(use-package flycheck-pos-tip - :defer t - :init - (progn - (eval-after-load 'feature-flycheck - '(setq-default flycheck-display-errors-function #'flycheck-pos-tip-error-messages))) - :ensure t) - -(provide 'core-flycheck) diff --git a/emacs.d/core/core-flyspell.el b/emacs.d/core/core-flyspell.el deleted file mode 100644 index 551c59b..0000000 --- a/emacs.d/core/core-flyspell.el +++ /dev/null @@ -1,11 +0,0 @@ -(use-package flyspell - :ensure t - :init - (progn - (setq ispell-program-name "aspell" - ispell-list-command "--list") - (add-hook 'prog-mode-hook 'flyspell-prog-mode) - (add-hook 'text-mode-hook 'turn-on-flyspell) - (add-hook 'org-mode-hook 'turn-on-flyspell))) - -(provide 'core-flyspell) diff --git a/emacs.d/core/core-git.el b/emacs.d/core/core-git.el deleted file mode 100644 index a695def..0000000 --- a/emacs.d/core/core-git.el +++ /dev/null @@ -1,46 +0,0 @@ -;; this makes emacs slow to work with source -(delete 'Git vc-handled-backends) - -(use-package magit - :ensure t - :bind ("C-x g" . magit-status) - :config - (progn - (setq magit-completing-read-function 'ivy-completing-read) - (setq magit-item-highlight-face 'bold))) - -(use-package gitconfig-mode - :ensure t) - -(use-package gitignore-mode - :ensure t) - -(use-package gist - :ensure t - :bind ("C-c g p" . gist-region-or-buffer-private) - :config - (setq gist-view-gist t)) - -(use-package github-browse-file - :ensure t - :defer t) - -;; run magit in full screen -;; http://www.lunaryorn.com/2016/04/28/fullscreen-magit-status.html -(add-to-list 'display-buffer-alist - `(,(rx "*magit: ") - (fcuny/display-buffer-fullframe) - (reusable-frames . nil))) - -(defun fcuny/display-buffer-fullframe (buffer alist) - "Display BUFFER in fullscreen. - -ALIST is a `display-buffer' ALIST. - -Return the new window for BUFFER." - (let ((window (display-buffer-pop-up-window buffer alist))) - (when window - (delete-other-windows window)) - window)) - -(provide 'core-git) diff --git a/emacs.d/core/core-load-paths.el b/emacs.d/core/core-load-paths.el deleted file mode 100644 index cfb2840..0000000 --- a/emacs.d/core/core-load-paths.el +++ /dev/null @@ -1,14 +0,0 @@ -(add-to-list 'load-path (concat user-emacs-directory "core/")) - -(require 'core-default) -(require 'core-ui) -(require 'core-editor) -(require 'core-defun) -(require 'core-git) -(require 'core-flycheck) -(require 'core-flyspell) -(require 'core-autocompletion) -(require 'core-bindings) -(require 'core-pants) -(require 'core-modes) -(require 'core-term) diff --git a/emacs.d/core/core-modes.el b/emacs.d/core/core-modes.el deleted file mode 100644 index b994b1e..0000000 --- a/emacs.d/core/core-modes.el +++ /dev/null @@ -1,7 +0,0 @@ -(defun fcuny/load-layers () - (mapc 'load - (directory-files (concat user-emacs-directory "modes") t "\\.el$"))) - -(fcuny/load-layers) - -(provide 'core-modes) diff --git a/emacs.d/core/core-pants.el b/emacs.d/core/core-pants.el deleted file mode 100644 index cc9a93e..0000000 --- a/emacs.d/core/core-pants.el +++ /dev/null @@ -1,12 +0,0 @@ -(load-file "~/src/pants.el/pants.el") - -(use-package pants - :bind (("C-c b" . pants-find-build-file) - ("C-c r" . pants-run-binary) - ("C-c t" . pants-run-test)) - :config - (progn - (setq pants-source-tree-root "/Users/fcuny/src/source" - pants-bury-compilation-buffer t))) - -(provide 'core-pants) diff --git a/emacs.d/core/core-term.el b/emacs.d/core/core-term.el deleted file mode 100644 index 19877c3..0000000 --- a/emacs.d/core/core-term.el +++ /dev/null @@ -1,93 +0,0 @@ -(use-package eshell - :ensure t - :defer t - :init - (progn - (setq eshell-cmpl-cycle-completions nil - ;; auto truncate after 20k lines - eshell-buffer-maximum-lines 20000 - ;; history size - eshell-history-size 350 - ;; no duplicates in history - eshell-hist-ignoredups t - ;; buffer shorthand -> echo foo > #'buffer - eshell-buffer-shorthand t - ;; my prompt is easy enough to see - eshell-highlight-prompt nil - ;; treat 'echo' like shell echo - eshell-plain-echo-behavior t) - - ;; Caution! this will erase buffer's content at C-l - (add-hook 'eshell-mode-hook - #'(lambda () - (define-key eshell-mode-map (kbd "C-l") 'eshell/clear)))) - :config - (progn - (require 'esh-opt) - - ;; quick commands - (defalias 'eshell/e 'find-file-other-window) - (defalias 'eshell/d 'dired) - (setenv "PAGER" "less") - - ;; support `em-smart' - (require 'em-smart) - (setq eshell-where-to-jump 'begin - eshell-review-quick-commands nil - eshell-smart-space-goes-to-end t) - (add-hook 'eshell-mode-hook 'eshell-smart-initialize) - - ;; Visual commands - (require 'em-term) - (mapc (lambda (x) (push x eshell-visual-commands)) - '("el" "elinks" "htop" "less" "ssh" "tmux" "top")) - - ;; automatically truncate buffer after output - (when (boundp 'eshell-output-filter-functions) - (push 'eshell-truncate-buffer eshell-output-filter-functions)))) - -(use-package multi-term - :ensure t - :defer t - :init - (progn - (defun multiterm (_) - "Wrapper to be able to call multi-term from shell-pop" - (interactive) - (multi-term))) - :config - (progn - (defun term-send-tab () - "Send tab in term mode." - (interactive) - (term-send-raw-string "\t")) - (add-to-list 'term-bind-key-alist '("<tab>" . term-send-tab)))) - -(use-package shell-pop - :ensure t - :defer t - :bind (("C-:" . shell-pop)) - :init - (progn - (setq shell-pop-window-position 'bottom - shell-pop-window-size 30 - shell-pop-term-shell 'ansi-term - shell-pop-full-span t) - (defmacro make-shell-pop-command (type &optional shell) - (let* ((name (symbol-name type))) - `(defun ,(intern (concat "shell-pop-" name)) (index) - (interactive "P") - (require 'shell-pop) - (shell-pop--set-shell-type - 'shell-pop-shell-type - (backquote (,name - ,(concat "*" name "*") - (lambda nil (funcall ',type ,shell))))) - (shell-pop index)))) - (make-shell-pop-command eshell) - (make-shell-pop-command shell) - (make-shell-pop-command term shell-pop-term-shell) - (make-shell-pop-command multiterm) - (make-shell-pop-command ansi-term shell-pop-term-shell))) - -(provide 'core-term) diff --git a/emacs.d/core/core-ui.el b/emacs.d/core/core-ui.el deleted file mode 100644 index cc86ede..0000000 --- a/emacs.d/core/core-ui.el +++ /dev/null @@ -1,79 +0,0 @@ -(defvar fcuny/font-family "Droid Sans Mono") -(defvar fcuny/font-size 130) - -(defun fcuny/set-font-size (size) - (interactive) - (set-face-attribute 'default nil :height size)) - -(defun fcuny/regular-mode () - (interactive) - (set-frame-font fcuny/font-family) - (fcuny/set-font-size fcuny/font-size)) - -(defun fcuny/presentation-mode () - (interactive) - (set-frame-font fcuny/font-family) - (fcuny/set-font-size 190)) - -;; no menu -(menu-bar-mode -1) - -;; show parenthesis -(show-paren-mode +1) - -;; enable colors -(global-font-lock-mode +1) - -;; no startup screen -(setq inhibit-startup-message t) -(setq initial-scratch-message "") - -;; highlight the current line -(global-hl-line-mode -1) - -(setq frame-title-format '("%b - "(:eval (format "%s" (projectile-project-name))))) - -;; no blink cursor -(blink-cursor-mode -1) - -;; show the column number in the mode-line -(setq column-number-mode t) - -(when window-system - ;;hide tool-bar - (tool-bar-mode 0) - ;;hide scroll-bar - (scroll-bar-mode 0) - ;;hide menu-bar - (menu-bar-mode -1) - ;; set the font size and family - (fcuny/regular-mode)) - -(require 'whitespace) -(global-whitespace-mode 1) -(setq whitespace-style '(face trailing tabs tab-mark)) - -(use-package rainbow-delimiters - :ensure t - :defer t - :init - (progn - (add-hook 'emacs-lisp-mode-hook #'rainbow-delimiters-mode))) - -(setq-default mode-line-position - '((line-number-mode ("(%04l" (column-number-mode ",%03c)"))))) - -(setq-default mode-line-buffer-identification - (list (propertize "%50b" 'face (list :weight 'bold)))) - -(setq-default mode-line-format - '("%e" mode-line-front-space - ;; Standard info about the current buffer - mode-line-mule-info - mode-line-client - mode-line-modified - mode-line-frame-identification - mode-line-buffer-identification " %m " mode-line-position - (flycheck-mode flycheck-mode-line))) - -(provide 'core-ui) diff --git a/emacs.d/init.el b/emacs.d/init.el index ddab1ba..dccae8e 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -1,4 +1,5 @@ (require 'package) +(setq package-user-dir "~/.emacs.d/var/elpa") ;;; Code: (setq package-archives @@ -20,4 +21,349 @@ (setq use-package-minimum-reported-time 0 use-package-verbose t) -(load-file (concat user-emacs-directory "core/core-load-paths.el")) +;; alias yes-or-no to y-or-n +(fset 'yes-or-no-p 'y-or-n-p) + +;; set utf-8 as the default encoding +(prefer-coding-system 'utf-8-unix) + +;; reload the buffer when a file changes +(global-auto-revert-mode 1) + +(setq + auto-save-default nil + auto-save-list-file-prefix nil + make-backup-files nil + require-final-newline t + vc-follow-symlinks t + next-screen-context-lines 5 + tab-always-indent 'complete) + +;; turn off indent tabs +(setq-default indent-tabs-mode nil) + +;; nice font +(set-face-attribute 'default nil :font "Source Code Pro" :height 130) + +;; light background +;; (set-background-color "#FFFFFF") + +;; no menu +(menu-bar-mode -1) + +;; show parenthesis +(show-paren-mode +1) + +;; disable colors +(global-font-lock-mode -1) + +;; no startup screen +(setq inhibit-startup-message t) +(setq initial-scratch-message "") + +;; no blink cursor +(blink-cursor-mode -1) + +;; show the column number in the mode-line +(setq column-number-mode t) + +(when window-system + (tool-bar-mode 0) ;;hide tool-bar + (scroll-bar-mode 0) ;;hide scroll-bar + (menu-bar-mode -1)) ;;hide menu-bar + +;; no frindge +(set-fringe-mode 0) + +;; auto close bracket insertion +(electric-pair-mode 1) + +;; if running in macos, load environment variables +(when (memq window-system '(mac ns x)) + (use-package exec-path-from-shell + :ensure t + :init (setq exec-path-from-shell-debug +1) + :config + (exec-path-from-shell-initialize) + (exec-path-from-shell-copy-envs '("TMPDIR")))) + +;; I want dired +(use-package dired + :commands dired + :init + (setq dired-listing-switches "-laGhv")) + +;; install recentf +(use-package recentf + :config + (setq recentf-save-file "~/.emacs.d/var/recentf")) + +;; get counsel and swiper +(use-package swiper + :ensure t + :bind (("C-s" . swiper)) + :config + (setq ivy-use-virtual-buffers t) + (ivy-mode)) + +(use-package counsel + :ensure t + :config + (setq counsel-find-file-at-point t)) + +;; I need helm +(use-package helm + :ensure t) + +;; interface to ag +(use-package ag + :ensure t + :defer t) + +;; get projectile +(use-package projectile + :ensure t + :init + (setq projectile-enable-caching t) + (setq projectile-completion-system 'ivy) + (setq projectile-known-projects-file "~/.emacs.d/var/projectile-bookmarks.eld") + (setq projectile-cache-file "~/.emacs.d/var/projectile.cache") + :config + (projectile-global-mode)) + +;; check my spelling, it can only help +(use-package flyspell + :ensure t + :init + (progn + (setq ispell-program-name "aspell" + ispell-list-command "--list") + (add-hook 'prog-mode-hook 'flyspell-prog-mode) + (add-hook 'text-mode-hook 'turn-on-flyspell) + (add-hook 'org-mode-hook 'turn-on-flyspell))) + +;; this makes emacs slow to work with source +(delete 'Git vc-handled-backends) + +(use-package magit + :ensure t + :bind ("C-x g" . magit-status) + :config + (progn + (setq magit-completing-read-function 'ivy-completing-read) + (setq magit-item-highlight-face 'bold))) + +;; run magit in full screen +;; http://www.lunaryorn.com/2016/04/28/fullscreen-magit-status.html +(add-to-list 'display-buffer-alist + `(,(rx "*magit: ") + (fcuny/display-buffer-fullframe) + (reusable-frames . nil))) + +(defun fcuny/display-buffer-fullframe (buffer alist) + "Display BUFFER in fullscreen. + +ALIST is a `display-buffer' ALIST. + +Return the new window for BUFFER." + (let ((window (display-buffer-pop-up-window buffer alist))) + (when window + (delete-other-windows window)) + window)) + +;; pants related stuff +(load-file "~/src/pants.el/pants.el") + +(use-package pants + :bind (("C-c b" . pants-find-build-file) + ("C-c r" . pants-run-binary) + ("C-c t" . pants-run-test)) + :config + (progn + (setq pants-source-tree-root "/Users/fcuny/src/source" + pants-bury-compilation-buffer t))) + +;; validate the syntax on the fly +(use-package flycheck + :ensure t + :defer t + :preface (progn + (defun check-source-predicate () + (and (executable-find "check.pex") + (buffer-file-name) + (string-match "src/source/.*\.py$" (buffer-file-name))))) + :init + (progn + (add-hook 'prog-mode-hook 'flycheck-mode) + (setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc))) + :config + (progn + (setq flycheck-mode-line + '(:eval + (pcase flycheck-last-status-change + (`not-checked nil) + (`no-checker (propertize " -" 'face 'warning)) + (`running "") + (`errored (propertize " ✘" 'face 'error)) + (`finished + (if flycheck-current-errors + (let* ((error-counts (flycheck-count-errors flycheck-current-errors)) + (no-errors (cdr (assq 'error error-counts))) + (no-warnings (cdr (assq 'warning error-counts))) + (flycheck-face (cond (no-errors 'error) + (no-warnings 'warning)))) + (propertize (format " [✗:%s/%s]" (or no-errors 0) (or no-warnings 0)) 'face flycheck-face)) + (propertize " [✓]" 'face 'success))) + (`interrupted " -") + (`suspicious '(propertize " ?" 'face 'warning))))) + + (setq flycheck-puppet-lint-rc "/Users/fcuny/src/twitter-ops/utilities/puppet/.puppet-lint.rc") + + (flycheck-define-checker source-check + "A syntax checker for python source code in Source, using `check.pex'" + :command ("check.pex" source) + ;;; errors are reported like this: + ;;; E241:ERROR <file name>:<line> <message> + :error-patterns ((error line-start (id (1+ nonl)) ":ERROR" (1+ nonl) ":" line (message) line-end) + (warning line-start (id (1+ nonl)) ":WARNING" (1+ nonl) ":" line (message) line-end)) + :predicate check-source-predicate + :modes (python-mode)) + (add-to-list 'flycheck-checkers 'source-check))) + +(use-package flycheck-pos-tip + :defer t + :init + (progn + (eval-after-load 'feature-flycheck + '(setq-default flycheck-display-errors-function #'flycheck-pos-tip-error-messages))) + :ensure t) + +;; configuration for ansible +(use-package ansible + :ensure t) + +(use-package ansible-doc + :ensure t) + +;; configuration for puppet +(when (memq window-system '(mac ns x)) + (dolist (var '("GEM_HOME" "MY_RUBY_HOME")) + (unless (getenv var) + (exec-path-from-shell-copy-env var)))) + +(use-package puppet-mode + :ensure t + :mode ("\\.pp$" . puppet-mode) + :init + (progn + (add-hook 'puppet-mode-hook 'flycheck-mode))) + +;; configuration for thrift +(use-package thrift + :ensure t + :defer t) + +;; configuration for yaml +(use-package yaml-mode + :mode ("\\.\\(yml\\|yaml\\)\\'" . yaml-mode) + :ensure t + :defer t) + +;; configuration for go +(when (memq window-system '(mac ns x)) + (dolist (var '("GOPATH" "GO15VENDOREXPERIMENT")) + (unless (getenv var) + (exec-path-from-shell-copy-env var)))) + +(use-package go-mode + :ensure t + :defer t + :config + (progn + (bind-key "C-c C-f" 'gofmt go-mode-map) + (bind-key "C-c h" 'godoc go-mode-map) + (bind-key "C-c C-g" 'go-goto-imports go-mode-map) + (bind-key "C-c C-r" 'go-remove-unused-imports go-mode-map)) + :init + (progn (add-hook 'go-mode-hook (lambda () + (go-eldoc-setup) + (add-hook 'before-save-hook 'gofmt-before-save))))) + +(use-package go-eldoc + :ensure t + :defer t + :init (add-hook 'go-mode-hook 'go-eldoc-setup)) + +;; configuration for markdown +(use-package markdown-mode + :ensure t + :mode ("\\.\\(m\\(ark\\)?down\\|md\\)$" . markdown-mode) + :config + (progn + (let ((preferred-markdown-impl "peg-markdown")) + (when (executable-find preferred-markdown-impl) + (setq markdown-command preferred-markdown-impl))))) + +;; configuration for python +(use-package python + :mode ("BUILD\\|\\(\\.\\(py\\|aurora\\)\\)$" . python-mode) + :config + (progn + (setq python-indent-offset 2))) + +;; configuration for racket +(use-package geiser + :config + (setq geiser-active-implementations '(racket)) + :ensure t) + +;; configuration for shell +(setq-default + sh-basic-offset 2 + sh-indentation 2) + +;; some bindings +(global-set-key (kbd "M-j") 'join-line) +(global-set-key (kbd "C-x C-b") 'ibuffer) +(global-set-key (kbd "<s-return>") 'toggle-frame-fullscreen) +(global-set-key (kbd "C-c s") 'fc/visit-term-buffer) +(global-set-key (kbd "s-N") 'fc/switch-to-scratch) +(define-key emacs-lisp-mode-map (kbd "C-c C-e") 'eval-buffer) + +;; custom functions +(defun fc/switch-to-scratch () + "Switch to scratch, grab the region if it's active." + (interactive) + (let ((contents + (and (region-active-p) + (buffer-substring (region-beginning) + (region-end))))) + (switch-to-buffer "*scratch*") + (if contents + (progn + (goto-char (buffer-end 1)) + (insert contents))))) + +(defun fc/rename-this-buffer-and-file () + "Renames current buffer and file it is visiting." + (interactive) + (let ((name (buffer-name)) + (filename (buffer-file-name)) + (read-file-name-function 'read-file-name-default)) + (if (not (and filename (file-exists-p filename))) + (error "Buffer '%s' is not visiting a file!" name) + (let ((new-name (read-file-name "New name: " filename))) + (cond ((get-buffer new-name) + (error "A buffer named '%s' already exists!" new-name)) + (t + (rename-file filename new-name 1) + (rename-buffer new-name) + (set-visited-file-name new-name) + (set-buffer-modified-p nil) + (message "File '%s' successfully renamed to '%s'" name (file-name-nondirectory new-name)))))))) + +;; start the server if not already running +(use-package server + :config + (unless (server-running-p) + (server-start))) diff --git a/emacs.d/modes/cfg-ansible.el b/emacs.d/modes/cfg-ansible.el deleted file mode 100644 index 51643e2..0000000 --- a/emacs.d/modes/cfg-ansible.el +++ /dev/null @@ -1,7 +0,0 @@ -(use-package ansible - :ensure t) - -(use-package ansible-doc - :ensure t) - -(provide 'cfg-ansible) diff --git a/emacs.d/modes/cfg-docker.el b/emacs.d/modes/cfg-docker.el deleted file mode 100644 index ec60a11..0000000 --- a/emacs.d/modes/cfg-docker.el +++ /dev/null @@ -1,7 +0,0 @@ -(use-package docker - :ensure t) - -(use-package dockerfile-mode - :ensure t) - -(provide 'cfg-docker) diff --git a/emacs.d/modes/cfg-puppet.el b/emacs.d/modes/cfg-puppet.el deleted file mode 100644 index e08848d..0000000 --- a/emacs.d/modes/cfg-puppet.el +++ /dev/null @@ -1,13 +0,0 @@ -(when (memq window-system '(mac ns x)) - (dolist (var '("GEM_HOME" "MY_RUBY_HOME")) - (unless (getenv var) - (exec-path-from-shell-copy-env var)))) - -(use-package puppet-mode - :ensure t - :mode ("\\.pp$" . puppet-mode) - :init - (progn - (add-hook 'puppet-mode-hook 'flycheck-mode))) - -(provide 'cfg-puppet) diff --git a/emacs.d/modes/cfg-thrift.el b/emacs.d/modes/cfg-thrift.el deleted file mode 100644 index 4f491c2..0000000 --- a/emacs.d/modes/cfg-thrift.el +++ /dev/null @@ -1,5 +0,0 @@ -(use-package thrift - :ensure t - :defer t) - -(provide 'cfg-thrift) diff --git a/emacs.d/modes/cfg-yaml.el b/emacs.d/modes/cfg-yaml.el deleted file mode 100644 index a2c6435..0000000 --- a/emacs.d/modes/cfg-yaml.el +++ /dev/null @@ -1,6 +0,0 @@ -(use-package yaml-mode - :mode ("\\.\\(yml\\|yaml\\)\\'" . yaml-mode) - :ensure t - :defer t) - -(provide 'cfg-yaml) diff --git a/emacs.d/modes/lang-c.el b/emacs.d/modes/lang-c.el deleted file mode 100644 index 9b4f357..0000000 --- a/emacs.d/modes/lang-c.el +++ /dev/null @@ -1,8 +0,0 @@ -(use-package google-c-style - :ensure t - :defer t - :config - (progn - (setq c-basic-offset 2))) - -(provide 'lang-c) diff --git a/emacs.d/modes/lang-go.el b/emacs.d/modes/lang-go.el deleted file mode 100644 index 0b56bd9..0000000 --- a/emacs.d/modes/lang-go.el +++ /dev/null @@ -1,30 +0,0 @@ -(when (memq window-system '(mac ns x)) - (dolist (var '("GOPATH" "GO15VENDOREXPERIMENT")) - (unless (getenv var) - (exec-path-from-shell-copy-env var)))) - -(use-package go-mode - :ensure t - :defer t - :config - (progn - (bind-key "C-c C-f" 'gofmt go-mode-map) - (bind-key "C-c h" 'godoc go-mode-map) - (bind-key "C-c C-g" 'go-goto-imports go-mode-map) - (bind-key "C-c C-r" 'go-remove-unused-imports go-mode-map)) - :init - (progn (add-hook 'go-mode-hook (lambda () - (go-eldoc-setup) - (add-hook 'before-save-hook 'gofmt-before-save) - (set (make-local-variable 'company-backends) '(company-go)))))) - -(use-package go-eldoc - :ensure t - :defer t - :init (add-hook 'go-mode-hook 'go-eldoc-setup)) - -(use-package company-go - :ensure t - :defer t) - -(provide 'lang-go) diff --git a/emacs.d/modes/lang-markdown.el b/emacs.d/modes/lang-markdown.el deleted file mode 100644 index f4f544d..0000000 --- a/emacs.d/modes/lang-markdown.el +++ /dev/null @@ -1,10 +0,0 @@ -(use-package markdown-mode - :ensure t - :mode ("\\.\\(m\\(ark\\)?down\\|md\\)$" . markdown-mode) - :config - (progn - (let ((preferred-markdown-impl "peg-markdown")) - (when (executable-find preferred-markdown-impl) - (setq markdown-command preferred-markdown-impl))))) - -(provide 'lang-markdown) diff --git a/emacs.d/modes/lang-python.el b/emacs.d/modes/lang-python.el deleted file mode 100644 index 582698b..0000000 --- a/emacs.d/modes/lang-python.el +++ /dev/null @@ -1,7 +0,0 @@ -(use-package python - :mode ("BUILD\\|\\(\\.\\(py\\|aurora\\)\\)$" . python-mode) - :config - (progn - (setq python-indent-offset 2))) - -(provide 'lang-python) diff --git a/emacs.d/modes/lang-scala.el b/emacs.d/modes/lang-scala.el deleted file mode 100644 index 6dde62d..0000000 --- a/emacs.d/modes/lang-scala.el +++ /dev/null @@ -1,7 +0,0 @@ -(use-package scala-mode - :ensure t) - -(use-package ensime - :ensure t) - -(provide 'lang-scala) diff --git a/emacs.d/modes/lang-scheme.el b/emacs.d/modes/lang-scheme.el deleted file mode 100644 index 1f0dec3..0000000 --- a/emacs.d/modes/lang-scheme.el +++ /dev/null @@ -1,6 +0,0 @@ -(use-package geiser - :config - (setq geiser-active-implementations '(racket)) - :ensure t) - -(provide 'lang-scheme) diff --git a/emacs.d/modes/lang-shell.el b/emacs.d/modes/lang-shell.el deleted file mode 100644 index 7d1ec0c..0000000 --- a/emacs.d/modes/lang-shell.el +++ /dev/null @@ -1,14 +0,0 @@ -(setq-default - sh-basic-offset 2 - sh-indentation 2) - -(use-package sh-script - :ensure t - :init - (progn - (dolist (pattern '("\\.bash_local\\'" - "\\.bash_profile\\'" - "\\.bash_login\\'" - "\\.bash_logout\\'" - "\\.bashrc\\'")) - (add-to-list 'auto-mode-alist (cons pattern 'sh-mode))))) |