diff options
Diffstat (limited to '')
-rw-r--r-- | emacs.d/custom/fcuny-common.el | 42 | ||||
-rw-r--r-- | emacs.d/custom/fcuny-docker.el | 5 | ||||
-rw-r--r-- | emacs.d/custom/fcuny-edit.el | 29 | ||||
-rw-r--r-- | emacs.d/custom/fcuny-flycheck.el | 67 | ||||
-rw-r--r-- | emacs.d/custom/fcuny-git.el | 14 | ||||
-rw-r--r-- | emacs.d/custom/fcuny-go.el | 13 | ||||
-rw-r--r-- | emacs.d/custom/fcuny-hygiene.el | 14 | ||||
-rw-r--r-- | emacs.d/custom/fcuny-json.el | 14 | ||||
-rw-r--r-- | emacs.d/custom/fcuny-lisp.el | 6 | ||||
-rw-r--r-- | emacs.d/custom/fcuny-make.el | 5 | ||||
-rw-r--r-- | emacs.d/custom/fcuny-navigation.el | 67 | ||||
-rw-r--r-- | emacs.d/custom/fcuny-protobuf.el | 7 | ||||
-rw-r--r-- | emacs.d/custom/fcuny-puppet.el | 6 | ||||
-rw-r--r-- | emacs.d/custom/fcuny-python.el | 8 | ||||
-rw-r--r-- | emacs.d/custom/fcuny-settings.el | 36 | ||||
-rw-r--r-- | emacs.d/custom/fcuny-shell.el | 8 | ||||
-rw-r--r-- | emacs.d/custom/fcuny-text.el | 25 | ||||
-rw-r--r-- | emacs.d/custom/fcuny-ui.el | 37 | ||||
-rw-r--r-- | emacs.d/custom/fcuny-vars.el | 10 | ||||
-rw-r--r-- | emacs.d/custom/fcuny-yaml.el | 4 |
20 files changed, 417 insertions, 0 deletions
diff --git a/emacs.d/custom/fcuny-common.el b/emacs.d/custom/fcuny-common.el new file mode 100644 index 0000000..079c042 --- /dev/null +++ b/emacs.d/custom/fcuny-common.el @@ -0,0 +1,42 @@ +(defun fcuny/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 fcuny/remove-mysql-columns () + "Removes | from text. This is useful when I want to drop the column separator from some text coming from a mysql query." + (interactive) + (if (region-active-p) + (replace-regexp "\s?|\s?" "" nil (region-beginning) (region-end)) + (replace-regexp "\s?|\s?" ""))) + +(defun fcuny/copy-whole-buffer () + "Selects the buffer and copy it." + (interactive) + (save-excursion + (mark-whole-buffer) + (copy-region-as-kill 1 (buffer-size)))) + +(defun fcuny/check-work-machine-p () + "Returns t if this is a work machine" + (string-match "tw-mbp.*" (system-name))) + +(defun fcuny/check-source-predicate-python-p () + (and (executable-find "check.pex") + (buffer-file-name) + (string-match "src/source/.*\.py$" (buffer-file-name)))) + +(provide 'fcuny-common) diff --git a/emacs.d/custom/fcuny-docker.el b/emacs.d/custom/fcuny-docker.el new file mode 100644 index 0000000..be31098 --- /dev/null +++ b/emacs.d/custom/fcuny-docker.el @@ -0,0 +1,5 @@ +(use-package dockerfile-mode + :ensure t + :mode "Dockerfile[a-zA-Z.-]*\\'") + +(provide 'fcuny-docker) diff --git a/emacs.d/custom/fcuny-edit.el b/emacs.d/custom/fcuny-edit.el new file mode 100644 index 0000000..5df8196 --- /dev/null +++ b/emacs.d/custom/fcuny-edit.el @@ -0,0 +1,29 @@ +(use-package autorevert + :config + (setq global-auto-revert-non-file-buffers t) + (setq auto-revert-verbose nil) + (global-auto-revert-mode t)) + +(use-package whitespace + :custom + (whitespace-style '(face trailing)) + (show-trailing-whitespace t) + :hook (whitespace-mode)) + +(use-package electric-pair-mode + :commands electric-pair-mode + :init (add-hook 'prog-mode-hook 'electric-pair-mode)) + +(use-package paren + :ensure t + :custom + (show-paren-delay 0) + :config + (show-paren-mode 1)) + +(use-package general + :config + (general-define-key + "M-j" 'join-line)) + +(provide 'fcuny-edit) diff --git a/emacs.d/custom/fcuny-flycheck.el b/emacs.d/custom/fcuny-flycheck.el new file mode 100644 index 0000000..26e9b72 --- /dev/null +++ b/emacs.d/custom/fcuny-flycheck.el @@ -0,0 +1,67 @@ +(require 'fcuny-common) + +(use-package flycheck + :ensure t + :custom ((flycheck-idle-change-delay 2) + (flycheck-emacs-lisp-load-path 'inherit)) + :config + (progn + (use-package flycheck-pos-tip + :ensure t + :config + (flycheck-pos-tip-mode)) + + (add-hook 'prog-mode-hook 'flycheck-mode) + (setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc)) + (setq flycheck-highlighting-mode 'lines) + (setq flycheck-check-syntax-automatically '(mode-enabled save)) + + (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 fcuny/check-source-predicate-python-p + :modes (python-mode)) + (add-to-list 'flycheck-checkers 'source-check) + + (defface fc/flycheck-error + '((t (:foreground "#f40000"))) + "Face for flycheck error feedback in the modeline." + :group 'fc/flycheck) + (defface fc/flycheck-warning + '((t (:foreground "#724a09"))) + "Face for flycheck warning feedback in the modeline." + :group 'fc/flycheck) + ;;; errors are reported like this: + ;;; E241:ERROR <file name>:<line> <message> + (defface fc/flycheck-info + '((t (:foreground "#19baff"))) + "Face for flycheck info feedback in the modeline." + :group 'fc/flycheck) + (defface fc/flycheck-success + '((t (:foreground "#2cb250"))) + "Face for flycheck success feedback in the modeline." + :group 'fc/flycheck) + + (setq flycheck-mode-line + '(:eval + (pcase flycheck-last-status-change + (`running (propertize " ⟲ Running" 'face 'fc/flycheck-info)) + (`errored (propertize " ⚠ Error" 'face 'fc/flycheck-error)) + (`no-checker (propertize " ⚠ No Checker" 'face 'fc/flycheck-info)) + (`suspicious (propertize " ⚠ Suspicious" 'face 'fc/flycheck-warning)) + (`not-checked (propertize " ✖ Disabled" 'face 'fc/flycheck-info)) + (`interrupted (propertize " ⚠ Interrupted" 'face 'fc/flycheck-warning)) + (`finished + (let* ((error-counts (flycheck-count-errors flycheck-current-errors)) + (no-errors (cdr (assq 'error error-counts))) + (no-warnings (cdr (assq 'warning error-counts))) + (face (cond (no-errors 'fc/flycheck-error) + (no-warnings 'fc/flycheck-warning) + (t 'fc/flycheck-success)))) + (propertize (if (or no-errors no-warnings) (format " ✘ %s/%s Issues" (or no-errors 0) (or no-warnings 0)) " ✔ No Issues") 'face face)))))))) + +(provide 'fcuny-flycheck) diff --git a/emacs.d/custom/fcuny-git.el b/emacs.d/custom/fcuny-git.el new file mode 100644 index 0000000..d056896 --- /dev/null +++ b/emacs.d/custom/fcuny-git.el @@ -0,0 +1,14 @@ +(use-package gitconfig-mode + :ensure t + :defer 5) + +(use-package magit + :ensure t + :after (flyspell) + :hook ((magit-mode . hl-line-mode)) + :bind (("C-x g s" . magit-status)) + :config + (setq git-commit-summary-max-length 50) + (setq fill-column 72)) + +(provide 'fcuny-git) diff --git a/emacs.d/custom/fcuny-go.el b/emacs.d/custom/fcuny-go.el new file mode 100644 index 0000000..3926c9e --- /dev/null +++ b/emacs.d/custom/fcuny-go.el @@ -0,0 +1,13 @@ +(use-package go-mode + :ensure t + :after (exec-path-from-shell) + :hook (go-mode . fcuny/go-mode-setup) + :init + (defun fcuny/go-mode-setup () + (setq tab-width 4) + (add-hook 'before-save-hook 'gofmt-before-save)) + :config + (when (memq window-system '(mac ns)) + (exec-path-from-shell-copy-env "GOPATH"))) + +(provide 'fcuny-go) diff --git a/emacs.d/custom/fcuny-hygiene.el b/emacs.d/custom/fcuny-hygiene.el new file mode 100644 index 0000000..2d74c82 --- /dev/null +++ b/emacs.d/custom/fcuny-hygiene.el @@ -0,0 +1,14 @@ +(use-package midnight + :config + (midnight-mode t)) + +(use-package server + :hook (after-init . server-start)) + +(use-package exec-path-from-shell + :ensure t + :if (memq window-system '(mac ns)) + :config + (exec-path-from-shell-initialize)) + +(provide 'fcuny-hygiene) diff --git a/emacs.d/custom/fcuny-json.el b/emacs.d/custom/fcuny-json.el new file mode 100644 index 0000000..126ed03 --- /dev/null +++ b/emacs.d/custom/fcuny-json.el @@ -0,0 +1,14 @@ +(require 'fcuny-common) + +(use-package json-mode + :after (flyspell flycheck) + :custom + (json-reformat:indent-width 2) + (js-indent-level 2) + :hook ((json-mode . flyspell-prog-mode) + (json-mode . flycheck-mode)) + :init + (if (fcuny/check-work-machine-p) + (add-to-list 'auto-mode-alist '("\\.workflow$" . json-mode)))) + +(provide 'fcuny-json) diff --git a/emacs.d/custom/fcuny-lisp.el b/emacs.d/custom/fcuny-lisp.el new file mode 100644 index 0000000..08d55a4 --- /dev/null +++ b/emacs.d/custom/fcuny-lisp.el @@ -0,0 +1,6 @@ +(use-package lisp-mode + :bind + (("C-c C-e" . eval-buffer) + ("C-c C-r" . eval-region))) + +(provide 'fcuny-lisp) diff --git a/emacs.d/custom/fcuny-make.el b/emacs.d/custom/fcuny-make.el new file mode 100644 index 0000000..a031c46 --- /dev/null +++ b/emacs.d/custom/fcuny-make.el @@ -0,0 +1,5 @@ +(use-package make-mode + :config + (add-hook 'makefile-mode-hook (lambda () (setq-local tab-width 2)))) + +(provide 'fcuny-make) diff --git a/emacs.d/custom/fcuny-navigation.el b/emacs.d/custom/fcuny-navigation.el new file mode 100644 index 0000000..8073a8c --- /dev/null +++ b/emacs.d/custom/fcuny-navigation.el @@ -0,0 +1,67 @@ +(require 'fcuny-vars) + +(use-package ace-window + :ensure t + :bind (("C-x o" . ace-window))) + +(use-package ag + :ensure t + :bind (:map ag-mode-map + ("p" . compilation-previous-error) + ("n" . compilation-next-error) + ("N" . compilation-next-file) + ("P" . compilation-previous-file)) + :custom + (ag-highlight-search t) + (ag-reuse-buffers t) + (ag-reuse-window t)) + +(use-package bookmark + :custom + (bookmark-default-file (expand-file-name "bookmarks" fcuny-path-emacs-var)) + (bookmark-save-flag 1)) + +(use-package counsel + :ensure t + :init (counsel-mode 1) (ivy-mode 1) + :bind + (("M-x" . counsel-M-x) + ("C-s" . counsel-grep-or-swiper) + ("C-x C-f" . counsel-find-file) + ("C-x C-r" . counsel-recentf) + ("C-c f" . counsel-git) + ("C-c s" . counsel-git-grep) + ("C-c /" . counsel-ag) + ("C-x r l" . counsel-bookmark)) + :custom + (counsel-find-file-at-point t) + (ivy-use-virtual-buffers t) + (ivy-count-format "(%d/%d) ") + (ivy-height 10) + :config + (use-package swiper + :ensure t)) + +(use-package dired + :defer t + :bind (("C-x C-d" . dired) + ("C-x C-j" . dired-jump)) + :init + (setq-default dired-dwim-target t) + (setq-default dired-listing-switches "--group-directories-first -alh") + (setq dired-recursive-deletes 'always) + (setq dired-recursive-copies 'always) + + (let ((gls (executable-find "/opt/twitter/bin/gls"))) + (when gls (setq insert-directory-program gls)))) + +(use-package ibuffer + :bind ("C-x C-b" . ibuffer)) + +(use-package recentf + :config + (recentf-mode 1) + (setq recentf-max-saved-items 500 + recentf-save-file (expand-file-name "var/recentf" user-emacs-directory))) + +(provide 'fcuny-navigation) diff --git a/emacs.d/custom/fcuny-protobuf.el b/emacs.d/custom/fcuny-protobuf.el new file mode 100644 index 0000000..c344684 --- /dev/null +++ b/emacs.d/custom/fcuny-protobuf.el @@ -0,0 +1,7 @@ +(use-package protobuf-mode + :after (flyspell flycheck) + :ensure t + :hook ((protobuf-mode . flyspell-prog-mode) + (protobuf-mode . flycheck-mode))) + +(provide 'fcuny-protobuf) diff --git a/emacs.d/custom/fcuny-puppet.el b/emacs.d/custom/fcuny-puppet.el new file mode 100644 index 0000000..5d4a44e --- /dev/null +++ b/emacs.d/custom/fcuny-puppet.el @@ -0,0 +1,6 @@ +(use-package puppet-mode + :ensure t + :bind (:map puppet-mode-map + ("C-c |" . puppet-align-block))) + +(provide 'fcuny-puppet) diff --git a/emacs.d/custom/fcuny-python.el b/emacs.d/custom/fcuny-python.el new file mode 100644 index 0000000..a12c477 --- /dev/null +++ b/emacs.d/custom/fcuny-python.el @@ -0,0 +1,8 @@ +(use-package python + :mode (("\\.py$" . python-mode) + ("BUILD\\'" . python-mode)) + :commands python-mode + :hook ((python-mode . eldoc-mode)) + :custom (python-indent-offset 2)) + +(provide 'fcuny-python) diff --git a/emacs.d/custom/fcuny-settings.el b/emacs.d/custom/fcuny-settings.el new file mode 100644 index 0000000..4bdb447 --- /dev/null +++ b/emacs.d/custom/fcuny-settings.el @@ -0,0 +1,36 @@ +(require 'fcuny-vars) + +;; set utf-8 as the default encoding +(prefer-coding-system 'utf-8-unix) +(set-terminal-coding-system 'utf-8) +(set-keyboard-coding-system 'utf-8) + +;; alias yes-or-no to y-or-n +(fset 'yes-or-no-p 'y-or-n-p) + +(setq auto-save-default nil) ;; don't auto save files +(setq auto-save-list-file-prefix nil) ;; no backups +(setq create-lockfiles nil) ;; don't use a lock file +(setq custom-file fcuny/custom-settings) ;; where to save custom settings +(setq make-backup-files nil) ;; really no backups +(setq minibuffer-message-timeout 0.5) ;; How long to display an echo-area message +(setq next-screen-context-lines 5) ;; scroll 5 lines at a time +(setq require-final-newline t) ;; ensure newline exists at the end of the file +(setq ring-bell-function 'ignore) ;; really no bell +(setq tab-always-indent 'complete) ;; when using TAB, always indent +(setq visible-bell nil) ;; no bell +(setq column-number-mode t) ;; show column number in the mode line +(setq-default indent-tabs-mode nil) ;; turn off tab indentation +(setq-default cursor-type 'hbar) ;; cursor is a horizontal bar +(setq vc-handled-backends nil) ;; don't use the VC backend, it's too slow with source +(setq-default delete-by-moving-to-trash t) ;; delete files by moving them to the trash +(setq initial-scratch-message "") ;; empty scratch buffer + +(custom-set-variables + '(use-file-dialog nil) + '(use-dialog-box nil) + '(inhibit-startup-screen t) + '(inhibit-startup-message t) + '(inhibit-startup-echo-area-message t)) + +(provide 'fcuny-settings) diff --git a/emacs.d/custom/fcuny-shell.el b/emacs.d/custom/fcuny-shell.el new file mode 100644 index 0000000..5d41f92 --- /dev/null +++ b/emacs.d/custom/fcuny-shell.el @@ -0,0 +1,8 @@ +(use-package sh-script + :mode ("bashrc" . sh-mode) + :hook (after-save . executable-make-buffer-file-executable-if-script-p) + :config + (setq-default sh-indentation 2 + sh-basic-offset 2)) + +(provide 'fcuny-shell) diff --git a/emacs.d/custom/fcuny-text.el b/emacs.d/custom/fcuny-text.el new file mode 100644 index 0000000..37a1338 --- /dev/null +++ b/emacs.d/custom/fcuny-text.el @@ -0,0 +1,25 @@ +(use-package flyspell + :hook ((text-mode . flyspell-mode) + (prog-mode . flyspell-prog-mode)) + :config + (setq ispell-dictionary "en_US") + + (when (executable-find "aspell") + (setq ispell-program-name "aspell")) + + (use-package flyspell-correct + :after (flyspell) + :commands (flyspell-correct-word-generic + flyspell-correct-previous-word-generic) + :bind (:map flyspell-mode-map + ("C-;" . flyspell-correct-previous-word-generic)))) + +(use-package markdown-mode + :ensure t + :after (flyspell) + :commands (markdown-mode gfm-mode) + :mode (("README\\.md\\'" . gfm-mode) + ("\\.md\\'" . gfm-mode) + ("\\.markdown\\'" . gfm-mode))) + +(provide 'fcuny-text) diff --git a/emacs.d/custom/fcuny-ui.el b/emacs.d/custom/fcuny-ui.el new file mode 100644 index 0000000..54034f8 --- /dev/null +++ b/emacs.d/custom/fcuny-ui.el @@ -0,0 +1,37 @@ +(use-package fringe + :custom + (left-fringe-width 10) + (right-fringe-width 10)) + +(use-package scroll-bar + :config + (scroll-bar-mode -1)) + +(use-package tool-bar + :config + (tool-bar-mode -1)) + +(use-package frame + :bind (("C-c C-m" . toggle-frame-fullscreen)) + :config + (blink-cursor-mode -1) + (setq frame-title-format "%b") + (set-face-attribute 'default nil :height 160 :weight 'normal :width 'normal :font "Source Code Pro") + (when (memq window-system '(mac ns)) + (setq ns-use-native-fullscreen nil) + (setq mac-allow-anti-aliasing t))) + +(use-package hl-line + :config + (set-face-background 'hl-line "#E0EBF5") + (global-hl-line-mode t)) + +(use-package uniquify + :defer 5 + :config + (setq uniquify-ignore-buffers-re "^\\*") ; don't muck with special buffers + (setq uniquify-buffer-name-style 'forward) + (setq uniquify-separator "/")) + +(provide 'fcuny-ui) + diff --git a/emacs.d/custom/fcuny-vars.el b/emacs.d/custom/fcuny-vars.el new file mode 100644 index 0000000..d4ff49f --- /dev/null +++ b/emacs.d/custom/fcuny-vars.el @@ -0,0 +1,10 @@ +(defvar fcuny-path-emacs-var (expand-file-name "var" user-emacs-directory) + "Path to some files for Emacs.") + +(defvar fcuny/custom-settings (expand-file-name "emacs-custom.el" fcuny-path-emacs-var) + "Path to emacs custom variables.") + +(defvar fcuny-path-emacs-elpa (expand-file-name "elpa" fcuny-path-emacs-var) + "Path to elpa's local files.") + +(provide 'fcuny-vars) diff --git a/emacs.d/custom/fcuny-yaml.el b/emacs.d/custom/fcuny-yaml.el new file mode 100644 index 0000000..b84c041 --- /dev/null +++ b/emacs.d/custom/fcuny-yaml.el @@ -0,0 +1,4 @@ +(use-package yaml-mode + :ensure t) + +(provide 'fcuny-yaml) |