From 3ee51377c27f5db71a248a2b4a54ceb720127b35 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 15 Oct 2018 08:42:00 -0700 Subject: [emacs] Customize appearance. A few tweaks to the default UI: - modeline is blue - highlighted line is blue - transparent title window on OSX - ensure fonts are using antialiasing --- configs/rcs/emacs.d/init.el | 161 +++++++++++++++++++------------------------- 1 file changed, 69 insertions(+), 92 deletions(-) (limited to 'configs') diff --git a/configs/rcs/emacs.d/init.el b/configs/rcs/emacs.d/init.el index f7ed8eb..b16080e 100644 --- a/configs/rcs/emacs.d/init.el +++ b/configs/rcs/emacs.d/init.el @@ -80,18 +80,14 @@ (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 use-package-always-ensure t) ;; always ensure packages are present (setq-default indent-tabs-mode nil) ;; turn off tab indentation (setq-default cursor-type 'hbar) ;; cursor is a horizontal bar (setq bookmark-default-file fcuny-bookmarks-dir) ;; where to save bookmarks (setq bookmark-save-flag 1) ;; save bookmarks when emacs qui (setq vc-handled-backends nil) ;; don't use the VC backend, it's too slow with source -(setq-default frame-title-format "%b (%f)") ;; set full path in the frame title (setq-default delete-by-moving-to-trash t) ;; delete files by moving them to the trash (setq initial-scratch-message "") ;; empty scratch buffer -(fringe-mode '(10 . 10)) ;; size of the fringe - (custom-set-variables '(tool-bar-mode nil) '(scroll-bar-mode nil) @@ -103,13 +99,36 @@ '(inhibit-startup-echo-area-message t)) (use-package frame - :ensure nil :bind (("C-c C-m" . toggle-frame-fullscreen)) :config - ;; when using darwin I don't want to use the native full screen mode, as it opens a new work space - (when (eq system-type 'darwin) - (setq ns-use-native-fullscreen nil)) - (set-face-attribute 'default nil :height 130 :weight 'normal :width 'normal)) + (progn + (defun fc/setup-frame(&optional frame) + (fringe-mode '(10 . 10)) + (set-face-attribute 'fringe nil + :foreground (face-foreground 'default) + :background (face-background 'default)) + (set-face-attribute 'mode-line nil :overline "#203e6f" :box nil) + (set-face-foreground 'mode-line "#203e6f") + (set-face-background 'mode-line "#b2cefb") + + (set-face-attribute 'mode-line-inactive nil :overline "#94bbf9" :box nil) + (set-face-foreground 'mode-line-inactive "#94bbf9") + (set-face-background 'mode-line-inactive "#d8e6fd") + + (setq-default frame-title-format "%b (%f)") + + (set-face-attribute 'default nil :height 150 :weight 'normal :width 'normal :font "Source Code Pro") + + (custom-set-faces + '(hl-line + ((((background dark)) :background "#484c5c") (t (:background "#DEEDFF"))))) + + (when (eq system-type 'darwin) + (add-to-list 'default-frame-alist '(ns-transparent-titlebar . t)) + (add-to-list 'default-frame-alist '(ns-appearance . 'nil)) + (setq ns-use-native-fullscreen nil) + (setq mac-allow-anti-aliasing t))) + (fc/setup-frame))) (use-package general :config @@ -123,10 +142,10 @@ (midnight-mode t)) (use-package server - :no-require :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) @@ -137,6 +156,10 @@ ;;; general editing +(use-package ace-window + :ensure t + :bind (("C-x o" . ace-window))) + (use-package recentf :config (recentf-mode 1) @@ -149,24 +172,31 @@ (setq auto-revert-verbose nil) (global-auto-revert-mode t)) -;;; packages management +(use-package swiper + :ensure t + :config (ivy-mode 1)) -(use-package auto-package-update +(use-package counsel + :ensure t + :after (ivy swiper) + :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 b" . counsel-bookmark) + ("C-c s" . counsel-git-grep) + ("C-c /" . counsel-ag) + ("C-c C-x" . counsel-command-history) + ("C-c y" . counsel-yank-pop)) :custom - (auto-package-update-delete-old-versions t) - (auto-package-update-hide-results t) - (auto-package-update-last-update-day-filename (expand-file-name "last-package-update-day" fcuny-path-emacs-var)) - :hook - (after-init . auto-package-update-maybe)) - -;;; visual + (counsel-find-file-at-point t)) (use-package hl-line :config (global-hl-line-mode t)) (use-package uniquify - :ensure nil :defer 5 :config (setq uniquify-ignore-buffers-re "^\\*") ; don't muck with special buffers @@ -176,6 +206,7 @@ ;;; files navigation (use-package ag + :ensure t :bind (:map ag-mode-map ("p" . compilation-previous-error) ("n" . compilation-next-error) @@ -187,11 +218,9 @@ (ag-reuse-window t)) (use-package dired - :ensure nil :defer t :bind (("C-x C-d" . dired) ("C-x C-j" . dired-jump)) - :diminish dired-omit-mode :init (setq-default dired-dwim-target t) (setq-default dired-listing-switches "--group-directories-first -alh") @@ -207,6 +236,7 @@ ;;; general text editing (use-package flyspell + :ensure t :hook ((text-mode . flyspell-mode) (prog-mode . flyspell-prog-mode)) :config @@ -221,11 +251,7 @@ :commands (flyspell-correct-word-generic flyspell-correct-previous-word-generic) :bind (:map flyspell-mode-map - ("C-;" . flyspell-correct-previous-word-generic))) - - (use-package flyspell-correct-ivy - :commands (flyspell-correct-ivy) - :init (setq flyspell-correct-interface #'flyspell-correct-ivy))) + ("C-;" . flyspell-correct-previous-word-generic)))) (use-package whitespace :custom @@ -234,11 +260,11 @@ :hook (whitespace-mode)) (use-package electric-pair-mode - :ensure nil :commands electric-pair-mode :init (add-hook 'prog-mode-hook 'electric-pair-mode)) (use-package paren + :ensure t :custom (show-paren-delay 0) :config @@ -247,6 +273,7 @@ ;;; text formats (use-package markdown-mode + :ensure t :after (flyspell) :commands (markdown-mode gfm-mode) :mode (("README\\.md\\'" . gfm-mode) @@ -256,6 +283,7 @@ ;;; source control (use-package magit + :ensure t :after (flyspell) :hook ((magit-mode . hl-line-mode)) :bind (("C-x g s" . magit-status)) @@ -265,54 +293,10 @@ (setq git-commit-fill-column 72) (setq git-commit-turn-on-auto-fill t)) -;;; project management - -(use-package counsel - :after (projectile ivy) - :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 s" . counsel-git-grep) - ("C-c C-x" . counsel-command-history) - ("C-c /" . counsel-ag) - ("C-c y" . counsel-yank-pop)) - :custom - (counsel-find-file-at-point t) - :config - (use-package swiper) - (use-package counsel-projectile - :config - (counsel-projectile-mode))) - -(use-package projectile - :bind - ("C-c p" . projectile-command-map) - :init - (add-hook 'after-init-hook #'projectile-mode) - :config - (setq projectile-switch-project-action 'projectile-dired - projectile-enable-caching t - projectile-completion-system 'ivy - projectile-known-projects-file (expand-file-name "var/projectile-bookmarks.eld" user-emacs-directory) - projectile-cache-file (expand-file-name "var/projectile.cache" user-emacs-directory) - projectile-globally-ignored-directories (append fcuny-projects-ignored-dirs - projectile-globally-ignored-directories) - projectile-globally-ignored-files (append projectile-globally-ignored-files))) - ;;; prog mode -(use-package company - :commands company-mode fcuny/company - :bind (("C-/" . company-complete)) - :config - (setq company-idle-delay .25) - (global-company-mode) - :init - (add-hook 'prog-mode-hook (lambda () (company-mode t)))) - (use-package flycheck + :ensure t :custom (flycheck-idle-change-delay 2) :config @@ -320,7 +304,6 @@ (global-flycheck-mode)) (use-package lisp-mode - :ensure nil :bind (("C-c C-e" . eval-buffer) ("C-c C-r" . eval-region))) @@ -330,21 +313,20 @@ (add-hook 'makefile-mode-hook (lambda () (setq-local tab-width 2)))) (use-package go-mode + :ensure t :preface (defun fcuny/go-mode-setup () (setq-default) - (setq tab-width 2)) + (setq tab-width 2) + (add-hook 'before-save-hook 'gofmt-before-save)) :config (add-hook 'go-mode-hook #'fcuny/go-mode-setup)) (use-package python - :mode (("\\.py$" . python-mode) - ("\\.wsgi$" . python-mode)) + :mode (("\\.py$" . python-mode)) :commands python-mode :custom (python-indent-offset 2)) -(use-package scala-mode) - (use-package sh-script :after (flycheck) :mode ("bashrc" . sh-mode) @@ -355,29 +337,23 @@ ;;; configurations -(use-package docker - :bind ("C-c d" . docker) - :diminish) - -(use-package docker-compose-mode - :mode "docker-compose.*\.yml\\'") - -(use-package docker-tramp - :after tramp - :defer 5) - (use-package dockerfile-mode + :ensure t :mode "Dockerfile[a-zA-Z.-]*\\'") (use-package gitconfig-mode + :ensure t :defer 5) -(use-package puppet-mode) +(use-package puppet-mode + :ensure t) -(use-package yaml-mode) +(use-package yaml-mode + :ensure t) (use-package json-mode :after (flyspell) + :ensure t :custom (json-reformat:indent-width 2) (js-indent-level 2) @@ -388,4 +364,5 @@ (use-package protobuf-mode :after (flyspell) + :ensure t :hook ((protobuf-mode . flyspell-prog-mode))) -- cgit 1.4.1