Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (package-initialize) ;; Comes first
- (require 'package)
- (let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
- (not (gnutls-available-p))))
- (proto (if no-ssl "http" "https")))
- ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
- (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
- ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
- (when (< emacs-major-version 24)
- ;; For important compatibility libraries like cl-lib
- (add-to-list 'package-archives '("gnu" . (concat proto "://elpa.gnu.org/packages/")))))
- ;; Automatically install use-package if not installed
- (unless (package-installed-p 'use-package)
- (package-refresh-contents)
- (package-install 'use-package))
- ;; Calls use-package as compiled .elc
- (eval-when-compile
- (require 'use-package))
- (use-package dashboard
- :config (dashboard-setup-startup-hook))
- ;; Allow pasting selection outside of Emacs
- (setq x-select-enable-clipboard t)
- ;; Auto refresh buffers
- (global-auto-revert-mode 1)
- ;; Also auto refresh dired, but be quiet about it
- (setq global-auto-revert-non-file-buffers t)
- (setq auto-revert-verbose nil)
- ;; Show keystrokes in progress
- (setq echo-keystrokes 0.1)
- ;; Move files to trash when deleting
- (setq delete-by-moving-to-trash t)
- ;; Real emacs knights don't use shift to mark things
- (setq shift-select-mode nil)
- ;; Transparently open compressed files
- (auto-compression-mode t)
- ;; Enable syntax highlighting for older Emacsen that have it off
- (global-font-lock-mode t)
- ;; Answering just 'y' or 'n' will do
- (defalias 'yes-or-no-p 'y-or-n-p)
- ;; UTF-8 please
- (setq locale-coding-system 'utf-8) ; pretty
- (set-terminal-coding-system 'utf-8) ; pretty
- (set-keyboard-coding-system 'utf-8) ; pretty
- (set-selection-coding-system 'utf-8) ; please
- (prefer-coding-system 'utf-8) ; with sugar on top
- ;; Show active region
- (transient-mark-mode 1)
- (make-variable-buffer-local 'transient-mark-mode)
- (put 'transient-mark-mode 'permanent-local t)
- (setq-default transient-mark-mode t)
- ;; Remove text in active region if inserting text
- (delete-selection-mode 1)
- ;; Don't highlight matches with jump-char - it's distracting
- (setq jump-char-lazy-highlight-face nil)
- ;; Always display line and column numbers
- (setq line-number-mode t)
- (setq column-number-mode t)
- ;; Lines should be 80 characters wide, not 72
- (setq fill-column 80)
- ;; Save a list of recent files visited. (open recent file with C-x f)
- (recentf-mode 1)
- (setq recentf-max-saved-items 100) ;; just 20 is too recent
- ;; Save minibuffer history
- (savehist-mode 1)
- (setq history-length 1000)
- ;; Undo/redo window configuration with C-c <left>/<right>
- (winner-mode 1)
- ;; Never insert tabs
- (set-default 'indent-tabs-mode nil)
- ;; Show me empty lines after buffer end
- (set-default 'indicate-empty-lines t)
- ;; Easily navigate sillycased words
- (global-subword-mode 1)
- ;; Don't break lines for me, please
- (setq-default truncate-lines t)
- ;; Keep cursor away from edges when scrolling up/down
- (require 'smooth-scrolling)
- ;; Allow recursive minibuffers
- (setq enable-recursive-minibuffers t)
- ;; Don't be so stingy on the memory, we have lots now. It's the distant future.
- (setq gc-cons-threshold 20000000)
- ;; org-mode: Don't ruin S-arrow to switch windows please (use M-+ and M-- instead to toggle)
- (setq org-replace-disputed-keys t)
- ;; Fontify org-mode code blocks
- (setq org-src-fontify-natively t)
- ;; Represent undo-history as an actual tree (visualize with C-x u)
- (setq undo-tree-mode-lighter "")
- (require 'undo-tree)
- (global-undo-tree-mode)
- ;; Sentences do not need double spaces to end. Period.
- (set-default 'sentence-end-double-space nil)
- ;; 80 chars is a good width.
- (set-default 'fill-column 80)
- ;; Add parts of each file's directory to the buffer name if not unique
- (require 'uniquify)
- (setq uniquify-buffer-name-style 'forward)
- ;; A saner ediff
- (setq ediff-diff-options "-w")
- (setq ediff-split-window-function 'split-window-horizontally)
- (setq ediff-window-setup-function 'ediff-setup-windows-plain)
- ;; No electric indent
- (setq electric-indent-mode nil)
- ;; Nic says eval-expression-print-level needs to be set to nil (turned off) so
- ;; that you can always see what's happening.
- (setq eval-expression-print-level nil)
- ;; When popping the mark, continue popping until the cursor actually moves
- ;; Also, if the last command was a copy - skip past all the expand-region cruft.
- (defadvice pop-to-mark-command (around ensure-new-position activate)
- (let ((p (point)))
- (when (eq last-command 'save-region-or-current-line)
- ad-do-it
- ad-do-it
- ad-do-it)
- (dotimes (i 10)
- (when (= p (point)) ad-do-it))))
- (setq set-mark-command-repeat-pop t)
- ;; Offer to create parent directories if they do not exist
- ;; http://iqbalansari.github.io/blog/2014/12/07/automatically-create-parent-directories-on-visiting-a-new-file-in-emacs/
- (defun my-create-non-existent-directory ()
- (let ((parent-directory (file-name-directory buffer-file-name)))
- (when (and (not (file-exists-p parent-directory))
- (y-or-n-p (format "Directory `%s' does not exist! Create it?" parent-directory)))
- (make-directory parent-directory t))))
- (add-to-list 'find-file-not-found-functions 'my-create-non-existent-directory)
- (provide 'sane-defaults)
- (use-package org
- :config
- (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 "DejaVu Sans" :foundry "PfEd" :slant normal :weight normal :height 203 :width normal))))
- '(org-agenda-done ((t nil)))
- '(org-done ((t (:foreground "cyan" :weight bold))))
- '(org-todo ((t (:foreground "dark orange" :weight bold))))))
- (use-package org-bullets
- :hook :hook (org-bullet . org-mode))
- (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-enabled-themes (quote (ahungry)))
- '(custom-safe-themes
- (quote
- ("20bf9f519f78b247da9ccf974c31d3537bee613ff11579f539b2781246dee73b" default))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement