From 760ffc3023f86a8b4cd48fdd839b75214bc00f21 Mon Sep 17 00:00:00 2001 From: jason Date: Mon, 19 Jun 2017 15:38:52 -0600 Subject: Add python and magit support --- init.el | 421 ++++++++++++++++++++------------------ local-lib/python-conf.el | 15 ++ local-lib/version-control-conf.el | 16 ++ 3 files changed, 249 insertions(+), 203 deletions(-) create mode 100644 local-lib/python-conf.el create mode 100644 local-lib/version-control-conf.el diff --git a/init.el b/init.el index a7db81f..f6ed00a 100644 --- a/init.el +++ b/init.el @@ -1,203 +1,218 @@ -;;; init.el --- emacs start up -;; Author: jason -;; Created: 15 Jun 2017 -;; Version: 2 -;; Keywords: -;; X-URL: https://beehive.io/jason/emacs.d/ -;;; Commentary: -;; -;;; Code: -(defconst emacs-start-time (current-time)) -(setq inhibit-startup-screen t ;; Hide the default startup screen - savehist-file "~/.emacs.d/savehist" - ;; Define where to store recovery files - backup-directory-alist '(("." . "~/.emacs.d/backups")) - ;; Use version numbers for backups. - version-control t - ;; Number of newest versions to keep. - kept-new-versions 10 - ;; Number of oldest versions to keep. - kept-old-versions 0 - ;; Don't ask to delete excess backup versions. - delete-old-versions -1 - ;; Copy all files, don't rename them. - backup-by-copying t - ;; Make backups files under version control. - vc-make-backup-files t - ;; Don't confirm following when opening a symlink - vc-follow-symlinks t) - -(setq package-archives '(("elpa" . "http://elpa.gnu.org/packages/") - ;; For org-mode - ("org" . "http://orgmode.org/elpa/") - ;; melpa builds git repositories and can be unstable - ("melpa" . "http://melpa.org/packages/") - ;; marmalade has maintainers upload versions - ;; ("marmalade" . "https://marmalade-repo.org/packages/") - ;; melpa-stable builds from git tags but may be missing dependencies - ;; ("melpa-stable" . "https://stable.melpa.org/packages/") - ;; Elpy packages for the Python language - ;; ("elpy" . "https://jorgenschaefer.github.io/packages/") - )) - -;; Initializes installed packages -(package-initialize) - -;; Packages are managed by the use-package package, so we need to make sure it's installed -(unless (package-installed-p 'use-package) - (package-refresh-contents) - (package-install 'use-package)) -(eval-when-compile - (require 'use-package)) -;; slight optimization for use-package's :bind directive -(require 'bind-key) - -;; Add local library to the load path -(add-to-list 'load-path "~/.emacs.d/local-lib/") -;; Usernames and passwords are stored in a file that isn't sync'd to VC -(load "~/.emacs.d/secrets" t) - -;; My misc functions -(require 'zzq-funcs) - -(add-hook 'after-init-hook - (lambda () - (progn - ;; Maximize the frame on startup - (toggle-frame-maximized) - ;; Always ensure packages are installed if they are defined with use-package - ;; (setq use-package-always-ensure t) - - ;; Set default encoding to UTF-8 - (set-language-environment "UTF-8") - (set-default-coding-systems 'utf-8) - ;; Hide the toolbar - (tool-bar-mode -1) - ;; Hide the scrollbar - (scroll-bar-mode -1) - ;; no beep and no blinking cursor - (setq ring-bell-function 'ignore - visible-bell nil - ;; display the full file path in the titlebar - frame-title-format - (list (format "%s %%S: %%j " (system-name)) - '(buffer-file-name "%f" (dired-directory dired-directory "%b")))) - - ;; Show matched parens - (show-paren-mode t) - ;; Allow undoing/redoing of window layouts with C-c left/right arrows - (winner-mode 1) - ;; Let y and n be good enough for yes and no questions - (fset 'yes-or-no-p 'y-or-n-p) - ;; Auto-refresh files changed on the file system - (global-auto-revert-mode 1) - ;; Save commands and their history - (savehist-mode +1) - (setq savehist-save-minibuffer-history +1) - (setq savehist-additional-variables - '(kill-ring - search-ring - regexp-search-ring)) - ;; Allow mouse support in xterm - (xterm-mouse-mode 1) - ;; Automatically close parens when opening them - (electric-pair-mode 1) - ;; Ovewrite selected regions with what you're typing/pasting/etc - (delete-selection-mode 1) - ;; A region is only active when it is highlighted (mimics other editors) - (transient-mark-mode 1) - ;;;;;;;;;;; - ;; Hooks ;; - ;;;;;;;;;;; - (add-hook 'write-file-hooks - '(lambda () - ;; delete trailing whitespace from all files - (delete-trailing-whitespace))) - ;;;;;;;;;;;; - ;; Themes ;; - ;;;;;;;;;;;; - (use-package jbeans-theme - :ensure t - :config - (load-theme 'jbeans)) - ;;;;;;;;;;;;;; - ;; Packages ;; - ;;;;;;;;;;;;;; - ;; paradox - A better emacs package manager - (use-package paradox - :ensure t - :config - ;; Use paradox as the default package manager - (paradox-enable)) - ;; which-key - Displays a pop up with hints when pushing key bindings - (use-package which-key - :ensure t - :diminish which-key-mode - :init - (setq which-key-special-keys nil - which-key-use-C-h-commands t - which-key-echo-keystrokes 0.02 - which-key-max-description-length 32 - which-key-sort-order 'which-key-key-order-alpha) - :config - (which-key-mode)) - ;; Ivy, swiper, and counsel for autocompleting emacs things - (use-package ivy - :ensure t - :pin elpa - :diminish ivy-mode - :bind (("C-s" . swiper) - ("M-x" . counsel-M-x) - ("C-x C-f" . counsel-find-file)) - :init - ;; Remove the ^ prefix - (setq ivy-initial-inputs-alist nil - ;; Display recently opened files when switching buffers - ivy-use-virtual-buffers t - ;; Use ivy for magit - magit-completing-read-function 'ivy-completing-read - ;; Use ivy for projectile - projectile-completion-system 'ivy) - :config - (ivy-mode 1)) - ;; avy - A quick way to jump around buffers - (use-package avy - :ensure t - :bind (("C-:" . avy-goto-line))) - - ;; Other packages - ;; autocompletion - auto-completion for programming languages - (require 'autocompletion-conf) - ;; persp - virtual workspaces - (require 'persp-conf) - ;; powerline - prettier modeline - (require 'powerline-conf) - ;; projectile - utilities for working with projects - (require 'projectile-conf) - - ;; Languages - (require 'rust-conf) - - (message "Emacs loaded in %.3fs" - (/ (- (zzq/time-to-msec (current-time)) (zzq/time-to-msec emacs-start-time)) 1000.0)) - ))) ;; End progn/lambda/add-hook after-init-hook - -(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. - '(custom-safe-themes - (quote - ("64f2981274fd8740b794bce9feee7949ed87b88fc0b4654bd98594e1aa81abcd" default))) - '(package-selected-packages - (quote - (racer cargo rust-mode company-quickhelp company projectile persp-mode avy ivy powerline which-key paradox use-package jbeans-theme))) - '(paradox-github-token t)) - -(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. - '(default ((t (:family "Inconsolata" :foundry "outline" :slant normal :weight normal :height 79 :width normal))))) +;;; init.el --- emacs start up +;; Author: jason +;; Created: 15 Jun 2017 +;; Version: 2 +;; Keywords: +;; X-URL: https://beehive.io/jason/emacs.d/ +;;; Commentary: +;; +;;; Code: +(defconst emacs-start-time (current-time)) +(setq inhibit-startup-screen t ;; Hide the default startup screen + savehist-file "~/.emacs.d/savehist" + ;; Define where to store recovery files + backup-directory-alist '(("." . "~/.emacs.d/backups")) + ;; Use version numbers for backups. + version-control t + ;; Number of newest versions to keep. + kept-new-versions 10 + ;; Number of oldest versions to keep. + kept-old-versions 0 + ;; Don't ask to delete excess backup versions. + delete-old-versions -1 + ;; Copy all files, don't rename them. + backup-by-copying t + ;; Make backups files under version control. + vc-make-backup-files t + ;; Don't confirm following when opening a symlink + vc-follow-symlinks t) + +(setq package-archives '(("elpa" . "http://elpa.gnu.org/packages/") + ;; For org-mode + ("org" . "http://orgmode.org/elpa/") + ;; melpa builds git repositories and can be unstable + ("melpa" . "http://melpa.org/packages/") + ;; marmalade has maintainers upload versions + ;; ("marmalade" . "https://marmalade-repo.org/packages/") + ;; melpa-stable builds from git tags but may be missing dependencies + ;; ("melpa-stable" . "https://stable.melpa.org/packages/") + ;; Elpy packages for the Python language + ;; ("elpy" . "https://jorgenschaefer.github.io/packages/") + )) + +;; Initializes installed packages +(package-initialize) + +;; Packages are managed by the use-package package, so we need to make sure it's installed +(unless (package-installed-p 'use-package) + (package-refresh-contents) + (package-install 'use-package)) +(eval-when-compile + (require 'use-package)) +;; slight optimization for use-package's :bind directive +(require 'bind-key) + +;; Add local library to the load path +(add-to-list 'load-path "~/.emacs.d/local-lib/") +;; Usernames and passwords are stored in a file that isn't sync'd to VC +(load "~/.emacs.d/secrets" t) + +;; My misc functions +(require 'zzq-funcs) + +(add-hook 'after-init-hook + (lambda () + (progn + ;; Maximize the frame on startup + (toggle-frame-maximized) + ;; Always ensure packages are installed if they are defined with use-package + ;; (setq use-package-always-ensure t) + + ;; Set default encoding to UTF-8 + (set-language-environment "UTF-8") + (set-default-coding-systems 'utf-8) + (setq default-buffer-file-coding-system 'utf-8-unix) + ;; Hide the toolbar + (tool-bar-mode -1) + ;; Hide the scrollbar + (scroll-bar-mode -1) + ;; no beep and no blinking cursor + (setq ring-bell-function 'ignore + visible-bell nil + ;; display the full file path in the titlebar + frame-title-format + (list (format "%s %%S: %%j " (system-name)) + '(buffer-file-name "%f" (dired-directory dired-directory "%b")))) + + ;; Show matched parens + (show-paren-mode t) + ;; Allow undoing/redoing of window layouts with C-c left/right arrows + (winner-mode 1) + ;; Let y and n be good enough for yes and no questions + (fset 'yes-or-no-p 'y-or-n-p) + ;; Auto-refresh files changed on the file system + (global-auto-revert-mode 1) + ;; Save commands and their history + (savehist-mode +1) + (setq savehist-save-minibuffer-history +1) + (setq savehist-additional-variables + '(kill-ring + search-ring + regexp-search-ring)) + ;; Allow mouse support in xterm + (xterm-mouse-mode 1) + ;; Automatically close parens when opening them + (electric-pair-mode 1) + ;; Ovewrite selected regions with what you're typing/pasting/etc + (delete-selection-mode 1) + ;; A region is only active when it is highlighted (mimics other editors) + (transient-mark-mode 1) + ;; Kill the current buffer by default + (global-set-key (kbd "C-x k") 'kill-this-buffer) + ;; Use ibuffer for the buffer list + (global-set-key (kbd "C-x C-b") 'ibuffer) + ;;;;;;;;;;; + ;; Hooks ;; + ;;;;;;;;;;; + (add-hook 'write-file-hooks + '(lambda () + ;; delete trailing whitespace from all files + (delete-trailing-whitespace))) + ;;;;;;;;;;;; + ;; Themes ;; + ;;;;;;;;;;;; + (use-package jbeans-theme + :ensure t + :config + (load-theme 'jbeans)) + ;;;;;;;;;;;;;; + ;; Packages ;; + ;;;;;;;;;;;;;; + ;; paradox - A better emacs package manager + (use-package paradox + :ensure t + :config + ;; Use paradox as the default package manager + (paradox-enable)) + ;; which-key - Displays a pop up with hints when pushing key bindings + (use-package which-key + :ensure t + :diminish which-key-mode + :init + (setq which-key-special-keys nil + which-key-use-C-h-commands t + which-key-echo-keystrokes 0.02 + which-key-max-description-length 32 + which-key-sort-order 'which-key-key-order-alpha) + :config + (which-key-mode)) + ;; Ivy, swiper, and counsel for autocompleting emacs things + (use-package ivy + :ensure t + :pin elpa + :diminish ivy-mode + :bind (("C-s" . swiper) + ("M-x" . counsel-M-x) + ("C-x C-f" . counsel-find-file)) + :init + ;; Remove the ^ prefix + (setq ivy-initial-inputs-alist nil + ;; Display recently opened files when switching buffers + ivy-use-virtual-buffers t + ;; Use ivy for magit + magit-completing-read-function 'ivy-completing-read + ;; Use ivy for projectile + projectile-completion-system 'ivy) + :config + (ivy-mode 1)) + ;; avy - A quick way to jump around buffers + (use-package avy + :ensure t + :bind (("C-:" . avy-goto-line))) + + ;; Other packages + ;; autocompletion - auto-completion for programming languages + (require 'autocompletion-conf) + ;; persp - virtual workspaces + (require 'persp-conf) + ;; powerline - prettier modeline + (require 'powerline-conf) + ;; projectile - utilities for working with projects + (require 'projectile-conf) + (require 'version-control-conf) + + ;; Languages + (require 'python-conf) + (require 'rust-conf) + + (message "Emacs loaded in %.3fs" + (/ (- (zzq/time-to-msec (current-time)) (zzq/time-to-msec emacs-start-time)) 1000.0)) + ))) ;; End progn/lambda/add-hook after-init-hook + +(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. + '(custom-safe-themes + (quote + ("64f2981274fd8740b794bce9feee7949ed87b88fc0b4654bd98594e1aa81abcd" default))) + '(package-selected-packages + (quote + (magit elpy racer cargo rust-mode company-quickhelp company projectile persp-mode avy ivy powerline which-key paradox use-package jbeans-theme))) + '(paradox-github-token t) + '(safe-local-variable-values + (quote + ((eval let + ((virtualenv "~/.virtualenvs/eb")) + (setq-local pythonic-environment virtualenv) + (my/advise-pythonic-activate virtualenv))))) + '(show-paren-mode t) + '(tool-bar-mode nil)) + +(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. + '(default ((t (:family "Inconsolata" :foundry "PfEd" :slant normal :weight normal :height 98 :width normal))))) diff --git a/local-lib/python-conf.el b/local-lib/python-conf.el new file mode 100644 index 0000000..9c6fd1f --- /dev/null +++ b/local-lib/python-conf.el @@ -0,0 +1,15 @@ +;;; python-conf.el --- configuration for the python language +;; Author: jason +;; Created: 16 Jun 2017 +;;; Commentary: +;; +;;; Code: +(add-to-list 'package-archives + '("elpy" . "http://jorgenschaefer.github.io/packages/")) + +(use-package elpy + :ensure t + :config + (elpy-enable)) + +(provide 'python-conf) diff --git a/local-lib/version-control-conf.el b/local-lib/version-control-conf.el new file mode 100644 index 0000000..a5e41df --- /dev/null +++ b/local-lib/version-control-conf.el @@ -0,0 +1,16 @@ +;;; version-control-conf.el --- configuration for version control +;; Author: jason +;; Created: 16 Jun 2017 +;;; Commentary: +;; +;; Configures version control (magit) +;; +;;; Code: +(use-package magit + :ensure t + :commands (magit-status magit-blame magit-log-buffer-file) + :bind (("C-c v s" . magit-status) + ("C-c v B" . magit-blame) + ("C-c v L" . magit-log-buffer-file))) + +(provide 'version-control-conf) -- cgit v1.2.1