(setf dired-kill-when-opening-new-dired-buffer t)
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
(global-set-key (kbd "M-;")
'sensible-defaults/comment-or-uncomment-region-or-line)
(setq gc-cons-threshold 20000000)
(delete-selection-mode t)
(setq-default dired-listing-switches "-alh")
(fset 'yes-or-no-p 'y-or-n-p)
(global-auto-revert-mode t)
(setq visible-bell t)
(setq sentence-end-double-space nil)
(setq isearch-wrap-pause 'no
isearch-repeat-on-direction-change t
search-ring-max 100)
(setq scroll-preserve-screen-position t)
(global-set-key (kbd "<home>") 'move-beginning-of-line)
(global-set-key (kbd "<end>") 'move-end-of-line)
(defun sensible-defaults/comment-or-uncomment-region-or-line ()
"Comments or uncomments the region or the current line if
there's no active region."
(interactive)
(let (beg end)
(if (region-active-p)
(setq beg (region-beginning) end (region-end))
(setq beg (line-beginning-position) end (line-end-position)))
(comment-or-uncomment-region beg end)))
(global-set-key (kbd "M-;")
'sensible-defaults/comment-or-uncomment-region-or-line)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(add-hook 'before-save-hook
(lambda ()
(when buffer-file-name
(let ((dir (file-name-directory buffer-file-name)))
(when (and (not (file-exists-p dir))
(y-or-n-p (format "Directory %s does not exist. Create it?" dir)))
(make-directory dir t))))))
** Setup package.el to work with MELPA
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(package-refresh-contents)
(package-initialize)
** Installing use-package
(unless (package-installed-p 'use-package)
(package-install 'use-package))
(use-package expand-region :ensure t :bind ("C-;" . er/expand-region))
(use-package move-text :ensure t)
(move-text-default-bindings)
(use-package hungry-delete :ensure t)
(global-hungry-delete-mode 1)
(setq hungry-delete-join-reluctantly t)
This will replace find-file and find-file-other-window with the dired-x equivalents This will allow multiple files to be opened at once
(with-eval-after-load 'dired
(require 'dired-x))
Harry’s dotfiles I like to see an outline of pretty bullets instead of a list of asterisks.
(use-package org-superstar :ensure t
:config
(setq org-superstar-special-todo-items t)
(setq org-hide-leading-stars t)
(add-hook 'org-mode-hook (lambda ()
(org-superstar-mode 1))))
This hides the slashes and stars that denote emphasis and bold text unless point is on said text.
(setq org-hide-emphasis-markers t)
(use-package org-appear :ensure t
:hook (org-mode . org-appear-mode))
Visibly render mathematical symbols.
(setq org-pretty-entities t)
Show linked images directly in my Org document. Don’t fully expand enormous images; instead, use imagemagick
to display them at a manageable size.
(setq org-startup-with-inline-images t
org-image-actual-width '(600))
Use syntax highlighting in source blocks while editing.
(setq org-src-fontify-natively t)
Make TAB act as if it were issued in a buffer of the language’s major mode.
(setq org-src-tab-acts-natively t)
When editing a code snippet, use the current window rather than popping open a new one (which shows the same information).
(setq org-src-window-setup 'current-window)
Quickly insert a block of elisp:
(add-to-list 'org-structure-template-alist
'("el" . "src emacs-lisp"))
Don’t indent newly expanded blocks, even if they’re under a heading.
(setq org-adapt-indentation nil)
When hitting C-<return>
to create a new heading, don’t insert the heading
between the current heading and its content, but instead append it after the
content.
(setq org-insert-heading-respect-content t)
Variable font Display different fonts
;; Highlight Line Colors
(add-hook 'org-mode-hook (lambda ()
(set-face-attribute 'org-level-1 nil :font "SauceCodePro Nerd Font" :height 220 :foreground "#FDF0ED")
(set-face-attribute 'org-level-2 nil :font "Ubuntu Nerd Font" :height 200 :foreground "#25B2BC")
(set-face-attribute 'org-level-3 nil :font "Ubuntu Nerd Font" :height 180)
(set-face-attribute 'org-level-4 nil :font "Ubuntu Nerd Font" :height 160 :italic nil)
))
Format of date and validation fields when exported to html.
(setq org-html-metadata-timestamp-format "%Y-%m-%d")
(setq org-html-validation-link nil)
Emacs dashboard is an extensible startup screen showing you recent files, bookmarks, agenda items, and an Emacs banner.
(use-package all-the-icons :ensure t) ;;Make sure all-the-icons package is installed
;;Ensure to run the command: all-the-icons-install-fonts
(use-package dashboard
:ensure t ;;install dashboard if not installed
:init ;; tweak dashboard's configuration before loading it
(setq dashboard-set-heading-icons t)
(setq dashboard-set-file-icons t)
(setq dashboard-banner-logo-title "Keep Walking!")
(setq dashboard-startup-banner "~/.emacs.d/keep-walking.png")
(setq dashboard-center-content nil)
(setq dashboard-items '(
(recents . 10)
(agenda . 5)
(bookmarks . 5)
(registers . 5)
))
:config
(dashboard-setup-startup-hook)
(dashboard-modify-heading-icons '(
(recents. "file-text")
(bookmarks . "book"))))
;;This is for client mode
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
Use Ctrl = and Ctrl - to increase and decrease scale
(global-set-key (kbd "C-=") 'text-scale-increase)
(global-set-key (kbd "C--") 'text-scale-decrease)
(global-set-key (kbd "C-0") (lambda () (interactive) (text-scale-adjust 0)))
(global-set-key (kbd "<C-wheel-up>") 'text-scale-increase)
(global-set-key (kbd "<C-wheel-down>") 'text-scale-decrease)
**All menu bars, tools bars
(setq lazy-highlight-cleanup nil) ;;This is to retain search highlight after searching is complete
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(global-display-line-numbers-mode 1)
(setq-default line-spacing 0.10)
(setq display-line-numbers-type 'relative)
(use-package beacon
:ensure t)
(beacon-mode 1)
(use-package volatile-highlights :ensure t)
(volatile-highlights-mode t)
(use-package highlight-numbers :ensure t)
(add-hook 'prog-mode-hook 'highlight-numbers-mode)
(add-hook 'sql-mode-hook 'highlight-numbers-mode)
**give all the commands bound to a prefix key
(use-package which-key
:ensure t)
(which-key-mode)
(which-key-setup-side-window-bottom)
(use-package magit :ensure t)
(setq magit-clone-set-remote-head t) ;;Preserve git's default of setting remote head, instead of magit's delete
https://www.youtube.com/watch?v=L9GcNrhx-iE **Modes and tools for web development
(use-package keycast :ensure t)
;; (keycast-mode) ;; Disable keycast mode by default
(use-package company :ensure t)
(company-mode 1)
(add-hook 'after-init-hook 'global-company-mode)
(setq completion-ignore-case t)
(setq read-file-name-completion-ignore-case t)
(setq read-buffer-completion-ignore-case t)
(savehist-mode 1)
(use-package projectile
:ensure t
:config
(projectile-global-mode 1))
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
**Modes and tools for web development
(use-package js2-mode :ensure t)
(use-package emmet-mode :ensure t)
(use-package markdown-mode :ensure t)
(use-package web-mode :ensure t)
(use-package prettier :ensure t)
(electric-pair-mode 1)
(emmet-mode 1)
All fonts can be found at https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/SourceCodePro/Regular/complete https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/Ubuntu/Regular/complete For windows, the font name should be different. This name can be found in the font manager against the tag Font Name. For instance, the below mentioned fonts will be “SauceCodePro NF 11” and “Ubuntu NF 11”
(set-face-attribute 'default nil
:font "SauceCodePro Nerd Font 11"
:weight 'medium)
(set-face-attribute 'variable-pitch nil
:font "Ubuntu Nerd Font 11"
:weight 'medium)
(set-face-attribute 'fixed-pitch nil
:font "SauceCodePro Nerd Font 11"
:weight 'medium)
;;Needed for client
(add-to-list 'default-frame-alist '(font . "SauceCodePro Nerd Font 11"))
** Doom emacs
(use-package doom-themes
:ensure t)
(setq doom-themes-enable-bold t doom-themes-enable-italic t)
(load-theme 'doom-shades-of-purple t)
(use-package doom-modeline
:ensure t)
(doom-modeline-mode 1)
;;(setq-default ispell-program-name "D:/prog/hunspell/bin/hunspell.exe")