Update config.org
This commit is contained in:
parent
13692442b4
commit
59ae5744a2
734
config.org
734
config.org
|
@ -2,159 +2,342 @@
|
||||||
#+AUTHOR: Abraham Raji
|
#+AUTHOR: Abraham Raji
|
||||||
#+EMAIL: abrahamraji99@gmail.com
|
#+EMAIL: abrahamraji99@gmail.com
|
||||||
|
|
||||||
* User Info
|
* Personal Settings
|
||||||
Name and Email.
|
** User Info
|
||||||
#+BEGIN_SRC emacs-lisp
|
Name and Email.
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
(setq user-full-name "Abraham Raji"
|
(setq user-full-name "Abraham Raji"
|
||||||
user-email "abrahamraji99@gmail.com")
|
user-email "abrahamraji99@gmail.com")
|
||||||
#+END_SRC
|
|
||||||
* Startup
|
|
||||||
- Start maximized
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(setq frame-resize-pixelwise t
|
|
||||||
x-frame-normalize-before-maximize t)
|
|
||||||
(add-to-list 'initial-frame-alist '(fullscreen . fullheight))
|
|
||||||
#+END_SRC
|
|
||||||
- Set UTF-8 encoding
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(setq locale-coding-system 'utf-8)
|
|
||||||
(set-terminal-coding-system 'utf-8)
|
|
||||||
(set-keyboard-coding-system 'utf-8)
|
|
||||||
(set-selection-coding-system 'utf-8)
|
|
||||||
(prefer-coding-system 'utf-8)
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
- Inhibit startup screen
|
** Set UTF-8 encoding
|
||||||
#+begin_src emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(setq inhibit-startup-message t)
|
(setq locale-coding-system 'utf-8)
|
||||||
#+end_src
|
(set-terminal-coding-system 'utf-8)
|
||||||
* Package Management
|
(set-keyboard-coding-system 'utf-8)
|
||||||
- Sources
|
(set-selection-coding-system 'utf-8)
|
||||||
This piece of code tells emacs where to find packages from
|
(prefer-coding-system 'utf-8)
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+END_SRC
|
||||||
|
** Package Management
|
||||||
|
- Sources
|
||||||
|
This piece of code tells emacs where to find packages from
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
(require 'package)
|
(require 'package)
|
||||||
(setq package-archives
|
(setq package-archives
|
||||||
'(("melpa" . "https://melpa.org/packages/")
|
'(("melpa" . "https://melpa.org/packages/")
|
||||||
("gnu" . "https://elpa.gnu.org/packages/")
|
("gnu" . "https://elpa.gnu.org/packages/")
|
||||||
("org" . "http://orgmode.org/elpa/")))
|
("org" . "http://orgmode.org/elpa/")))
|
||||||
(package-initialize)
|
(package-initialize)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
- use-package command and its configs.
|
- use-package command and its configs.
|
||||||
For installing packages
|
For installing packages
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(unless (package-installed-p 'use-package)
|
(unless (package-installed-p 'use-package)
|
||||||
(package-install 'use-package)
|
(package-install 'use-package)
|
||||||
(setq load-prefer-newer t))
|
(setq load-prefer-newer t))
|
||||||
(setq use-package-verbose t)
|
(setq use-package-verbose t)
|
||||||
(setq use-package-always-ensure t)
|
(setq use-package-always-ensure t)
|
||||||
(require 'use-package)
|
(require 'use-package)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* Quickly visit Emacs configuration
|
** Quickly visit Emacs configuration
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(defun 4br/visit-emacs-config ()
|
(defun 4br/visit-emacs-config ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(find-file "~/.emacs.d/config.org"))
|
(find-file "~/.emacs.d/config.org"))
|
||||||
(global-set-key (kbd "C-c e") '4br/visit-emacs-config)
|
(global-set-key (kbd "C-c e") '4br/visit-emacs-config)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* Themes
|
** Themes
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package liso-theme
|
(use-package liso-theme
|
||||||
:ensure t)
|
:ensure t)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
** eshell stuff
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
|
||||||
|
(use-package shell-switcher
|
||||||
|
:ensure t
|
||||||
|
:config
|
||||||
|
(setq shell-switcher-mode t)
|
||||||
|
:bind (("C-'" . shell-switcher-switch-buffer)
|
||||||
|
("C-x 4 '" . shell-switcher-switch-buffer-other-window)
|
||||||
|
("C-M-'" . shell-switcher-new-shell)))
|
||||||
|
|
||||||
|
|
||||||
|
;; Visual commands
|
||||||
|
(setq eshell-visual-commands '("vi" "screen" "top" "less" "more" "lynx"
|
||||||
|
"ncftp" "pine" "tin" "trn" "elm" "vim"
|
||||||
|
"nmtui" "alsamixer" "htop" "el" "elinks"
|
||||||
|
))
|
||||||
|
(setq eshell-visual-subcommands '(("git" "log" "diff" "show")))
|
||||||
|
(setq eshell-list-files-after-cd t)
|
||||||
|
(defun eshell-clear-buffer ()
|
||||||
|
"Clear terminal"
|
||||||
|
(interactive)
|
||||||
|
(let ((inhibit-read-only t))
|
||||||
|
(erase-buffer)
|
||||||
|
(eshell-send-input)))
|
||||||
|
(add-hook 'eshell-mode-hook
|
||||||
|
'(lambda()
|
||||||
|
(local-set-key (kbd "C-l") 'eshell-clear-buffer)))
|
||||||
|
|
||||||
|
(defun eshell/magit ()
|
||||||
|
"Function to open magit-status for the current directory"
|
||||||
|
(interactive)
|
||||||
|
(magit-status default-directory)
|
||||||
|
nil)
|
||||||
|
|
||||||
|
;; smart display stuff
|
||||||
|
(require 'eshell)
|
||||||
|
(require 'em-smart)
|
||||||
|
(setq eshell-where-to-jump 'begin)
|
||||||
|
(setq eshell-review-quick-commands nil)
|
||||||
|
(setq eshell-smart-space-goes-to-end t)
|
||||||
|
|
||||||
|
(add-hook 'eshell-mode-hook
|
||||||
|
(lambda ()
|
||||||
|
(eshell-smart-initialize)))
|
||||||
|
;; eshell here
|
||||||
|
(defun eshell-here ()
|
||||||
|
"Opens up a new shell in the directory associated with the
|
||||||
|
current buffer's file. The eshell is renamed to match that
|
||||||
|
directory to make multiple eshell windows easier."
|
||||||
|
(interactive)
|
||||||
|
(let* ((parent (if (buffer-file-name)
|
||||||
|
(file-name-directory (buffer-file-name))
|
||||||
|
default-directory))
|
||||||
|
(height (/ (window-total-height) 3))
|
||||||
|
(name (car (last (split-string parent "/" t)))))
|
||||||
|
(split-window-vertically (- height))
|
||||||
|
(other-window 1)
|
||||||
|
(eshell "new")
|
||||||
|
(rename-buffer (concat "*eshell: " name "*"))
|
||||||
|
|
||||||
|
(insert (concat "ls"))
|
||||||
|
(eshell-send-input)))
|
||||||
|
|
||||||
|
(global-set-key (kbd "C-!") 'eshell-here)
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
Eshell prompt
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defcustom dotemacs-eshell/prompt-git-info
|
||||||
|
t
|
||||||
|
"Turns on additional git information in the prompt."
|
||||||
|
:group 'dotemacs-eshell
|
||||||
|
:type 'boolean)
|
||||||
|
|
||||||
|
;; (epe-colorize-with-face "abc" 'font-lock-comment-face)
|
||||||
|
(defmacro epe-colorize-with-face (str face)
|
||||||
|
`(propertize ,str 'face ,face))
|
||||||
|
|
||||||
|
(defface epe-venv-face
|
||||||
|
'((t (:inherit font-lock-comment-face)))
|
||||||
|
"Face of python virtual environment info in prompt."
|
||||||
|
:group 'epe)
|
||||||
|
|
||||||
|
(setq eshell-prompt-function
|
||||||
|
(lambda ()
|
||||||
|
(concat (propertize (abbreviate-file-name (eshell/pwd)) 'face 'eshell-prompt)
|
||||||
|
(when (and dotemacs-eshell/prompt-git-info
|
||||||
|
(fboundp #'vc-git-branches))
|
||||||
|
(let ((branch (car (vc-git-branches))))
|
||||||
|
(when branch
|
||||||
|
(concat
|
||||||
|
(propertize " [" 'face 'font-lock-keyword-face)
|
||||||
|
(propertize branch 'face 'font-lock-function-name-face)
|
||||||
|
(let* ((status (shell-command-to-string "git status --porcelain"))
|
||||||
|
(parts (split-string status "\n" t " "))
|
||||||
|
(states (mapcar #'string-to-char parts))
|
||||||
|
(added (count-if (lambda (char) (= char ?A)) states))
|
||||||
|
(modified (count-if (lambda (char) (= char ?M)) states))
|
||||||
|
(deleted (count-if (lambda (char) (= char ?D)) states)))
|
||||||
|
(when (> (+ added modified deleted) 0)
|
||||||
|
(propertize (format " +%d ~%d -%d" added modified deleted) 'face 'font-lock-comment-face)))
|
||||||
|
(propertize "]" 'face 'font-lock-keyword-face)))))
|
||||||
|
(when (and (boundp #'venv-current-name) venv-current-name)
|
||||||
|
(concat
|
||||||
|
(epe-colorize-with-face " [" 'epe-venv-face)
|
||||||
|
(propertize venv-current-name 'face `(:foreground "#2E8B57" :slant italic))
|
||||||
|
(epe-colorize-with-face "]" 'epe-venv-face)))
|
||||||
|
(propertize " $ " 'face 'font-lock-constant-face))))
|
||||||
|
#+END_SRC
|
||||||
|
#+RESULTS:
|
||||||
|
: t
|
||||||
|
** Code blocks
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(defun org-src-color-blocks-light ()
|
||||||
|
"Colors the block headers and footers to make them stand out more for lighter themes"
|
||||||
|
(interactive)
|
||||||
|
(custom-set-faces
|
||||||
|
'(org-block-begin-line
|
||||||
|
((t (:underline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF"))))
|
||||||
|
'(org-block-background
|
||||||
|
((t (:background "#FFFFEA"))))
|
||||||
|
'(org-block
|
||||||
|
((t (:background "#FFFFEA"))))
|
||||||
|
'(org-block-end-line
|
||||||
|
((t (:overline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF"))))
|
||||||
|
|
||||||
|
'(mode-line-buffer-id ((t (:foreground "#005000" :bold t))))
|
||||||
|
'(which-func ((t (:foreground "#008000"))))))
|
||||||
|
|
||||||
|
(defun org-src-color-blocks-dark ()
|
||||||
|
"Colors the block headers and footers to make them stand out more for dark themes"
|
||||||
|
(interactive)
|
||||||
|
(custom-set-faces
|
||||||
|
'(org-block-begin-line
|
||||||
|
((t (:foreground "#008ED1" :background "#002E41"))))
|
||||||
|
'(org-block-background
|
||||||
|
((t (:background "#000000"))))
|
||||||
|
'(org-block
|
||||||
|
((t (:background "#000000"))))
|
||||||
|
'(org-block-end-line
|
||||||
|
((t (:foreground "#008ED1" :background "#002E41"))))
|
||||||
|
|
||||||
|
'(mode-line-buffer-id ((t (:foreground "black" :bold t))))
|
||||||
|
'(which-func ((t (:foreground "green"))))))
|
||||||
|
#+end_src
|
||||||
|
** Backups
|
||||||
|
|
||||||
|
This is one of the things people usually want to change right away. By
|
||||||
|
default, Emacs saves backup files in the current directory. These are
|
||||||
|
the files ending in =~= that are cluttering up your directory lists.
|
||||||
|
The following code stashes them all in =~/.emacs.d/backups=, where I
|
||||||
|
can find them with =C-x C-f= (=find-file=) if I really need to.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(setq backup-directory-alist '(("." . "~/.emacs.d/backups")))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
Disk space is cheap. Save lots.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(setq delete-old-versions -1)
|
||||||
|
(setq version-control t)
|
||||||
|
(setq vc-make-backup-files t)
|
||||||
|
(setq auto-save-file-name-transforms '((".*" "~/.emacs.d/auto-save-list/" t)))
|
||||||
|
#+end_src
|
||||||
* Auto Compile
|
* Auto Compile
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package auto-compile
|
(use-package auto-compile
|
||||||
:config (auto-compile-on-load-mode))
|
:config (auto-compile-on-load-mode))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* Async
|
* Async
|
||||||
Lets us use asynchronous processes wherever possible, pretty useful.
|
Lets us use asynchronous processes wherever possible, pretty useful.
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package async
|
(use-package async
|
||||||
:ensure t
|
:ensure t
|
||||||
:init (dired-async-mode 1))
|
:init (dired-async-mode 1))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* auto-complete
|
* auto-complete
|
||||||
- Lets you use the auto-complete package
|
- Lets you use the auto-complete package
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package auto-complete
|
(use-package auto-complete
|
||||||
:ensure t)
|
:ensure t)
|
||||||
(require 'auto-complete)
|
(require 'auto-complete)
|
||||||
(global-auto-complete-mode t)
|
(global-auto-complete-mode t)
|
||||||
(add-to-list 'ac-modes 'org-mode)
|
(add-to-list 'ac-modes 'org-mode)
|
||||||
(ac-config-default)
|
(ac-config-default)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* flycheck
|
* flycheck
|
||||||
- Checks for spelling and syntax errors
|
- Checks for spelling and syntax errors
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package flycheck
|
(use-package flycheck
|
||||||
:ensure t
|
:ensure t
|
||||||
:init
|
:init
|
||||||
(global-flycheck-mode t))
|
(global-flycheck-mode t))
|
||||||
(add-hook 'elpy-mode-hook 'flycheck-mode);This creates a flycheck
|
(add-hook 'elpy-mode-hook 'flycheck-mode);This creates a flycheck
|
||||||
;checker that runs proselint
|
;checker that runs proselint
|
||||||
;in texty buffers and displays my errors.
|
;in texty buffers and displays my errors.
|
||||||
(flycheck-define-checker proselint
|
(flycheck-define-checker proselint
|
||||||
"A linter for prose."
|
"A linter for prose."
|
||||||
:command ("proselint" source-inplace)
|
:command ("proselint" source-inplace)
|
||||||
:error-patterns
|
:error-patterns
|
||||||
((warning line-start (file-name) ":" line ":" column ": "
|
((warning line-start (file-name) ":" line ":" column ": "
|
||||||
(id (one-or-more (not (any " "))))
|
(id (one-or-more (not (any " "))))
|
||||||
(message (one-or-more not-newline)
|
(message (one-or-more not-newline)
|
||||||
(zero-or-more "\n" (any " ") (one-or-more not-newline)))
|
(zero-or-more "\n" (any " ") (one-or-more not-newline)))
|
||||||
line-end))
|
line-end))
|
||||||
:modes (text-mode markdown-mode gfm-mode org-mode))
|
:modes (text-mode markdown-mode gfm-mode org-mode))
|
||||||
;flycheck in the appropriate buffers
|
;flycheck in the appropriate buffers
|
||||||
(add-to-list 'flycheck-checkers 'proselint)
|
(add-to-list 'flycheck-checkers 'proselint)
|
||||||
(add-hook 'markdown-mode-hook #'flycheck-mode)
|
(add-hook 'markdown-mode-hook #'flycheck-mode)
|
||||||
(add-hook 'gfm-mode-hook #'flycheck-mode)
|
(add-hook 'gfm-mode-hook #'flycheck-mode)
|
||||||
(add-hook 'text-mode-hook #'flycheck-mode)
|
(add-hook 'text-mode-hook #'flycheck-mode)
|
||||||
(add-hook 'org-mode-hook #'flycheck-mode)
|
(add-hook 'org-mode-hook #'flycheck-mode)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* Title frame format
|
* Title frame format
|
||||||
This Line will give you this title: [filename]- GNU Emacs 26.1 (I use emacs26.1)
|
This Line will give you this title: [filename]- GNU Emacs 26.1 (I use emacs26.1)
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(setq frame-title-format (list "%b- %F " emacs-version)
|
(setq frame-title-format (list "%b- %F " emacs-version)
|
||||||
icont-title-format(list "%b- GNU %F " emacs-version))
|
icont-title-format(list "%b- GNU %F " emacs-version))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* One-line Settings
|
* One-line Settings
|
||||||
#+BEGIN_SRC emacs-lisp
|
- Inhibit Startup Message
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
(setq inhibit-startup-message t)
|
(setq inhibit-startup-message t)
|
||||||
|
#+END_SRC
|
||||||
|
- Lists buffers in ibuffer
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
(defalias 'list-buffers 'ibuffer)
|
(defalias 'list-buffers 'ibuffer)
|
||||||
|
#+END_SRC
|
||||||
|
- Disables Toolbar
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
(tool-bar-mode -1)
|
(tool-bar-mode -1)
|
||||||
|
#+END_SRC
|
||||||
|
- Numbers on lines
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
(global-linum-mode t)
|
(global-linum-mode t)
|
||||||
(allout-mode) ;;outlining
|
#+END_SRC
|
||||||
(global-font-lock-mode 1) ;;syntax highlighting
|
- Outlining
|
||||||
(global-visual-line-mode t)
|
#+BEGIN_SRC emacs-lisp
|
||||||
(windmove-default-keybindings)
|
(allout-mode)
|
||||||
(global-set-key (kbd "C-c <left>") 'windmove-left)
|
#+END_SRC
|
||||||
(global-set-key (kbd "C-c <right>") 'windmove-right)
|
- Syntax Highlighting
|
||||||
(global-set-key (kbd "C-c <up>") 'windmove-up)
|
#+BEGIN_SRC emacs-lisp
|
||||||
(global-set-key (kbd "C-c <down>") 'windmove-down)
|
(global-font-lock-mode 1)
|
||||||
;; Use y/n instead of yes/no
|
#+END_SRC
|
||||||
(fset 'yes-or-no-p 'y-or-n-p)
|
- Windmove
|
||||||
;; make home and end behave
|
#+BEGIN_SRC emacs-lisp
|
||||||
(global-set-key (kbd "<home>") 'move-beginning-of-line)
|
(windmove-default-keybindings)
|
||||||
(global-set-key (kbd "<end>") 'move-end-of-line)
|
(global-set-key (kbd "C-c <left>") 'windmove-left)
|
||||||
;; indicate visual-line-mode wrap
|
(global-set-key (kbd "C-c <right>") 'windmove-right)
|
||||||
(setq visual-line-fringe-indicators '(left-curly-arrow right-curly-arrow))
|
(global-set-key (kbd "C-c <up>") 'windmove-up)
|
||||||
|
(global-set-key (kbd "C-c <down>") 'windmove-down)
|
||||||
|
#+END_SRC
|
||||||
|
- Use y/n instead of yes/no
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(fset 'yes-or-no-p 'y-or-n-p)
|
||||||
|
#+END_SRC
|
||||||
|
- make home and end buttons do their job
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(global-set-key (kbd "<home>") 'move-beginning-of-line)
|
||||||
|
(global-set-key (kbd "<end>") 'move-end-of-line)
|
||||||
|
#+END_SRC
|
||||||
|
- Indicate visual-line-mode wrap
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(global-visual-line-mode t)
|
||||||
|
(setq visual-line-fringe-indicators '(left-curly-arrow right-curly-arrow))
|
||||||
(setq visual-line-fringe-indicators '(left-curly-arrow right-curly-arrow))
|
(setq visual-line-fringe-indicators '(left-curly-arrow right-curly-arrow))
|
||||||
;; but be gentle
|
;; but be gentle
|
||||||
(defface visual-line-wrap-face
|
(defface visual-line-wrap-face
|
||||||
'((t (:foreground "gray")))
|
'((t (:foreground "gray")))
|
||||||
"Face for visual line indicators.")
|
"Face for visual line indicators.")
|
||||||
(set-fringe-bitmap-face 'left-curly-arrow 'visual-line-wrap-face)
|
(set-fringe-bitmap-face 'left-curly-arrow 'visual-line-wrap-face)
|
||||||
(set-fringe-bitmap-face 'right-curly-arrow 'visual-line-wrap-face)
|
(set-fringe-bitmap-face 'right-curly-arrow 'visual-line-wrap-face)
|
||||||
|
#+END_SRC
|
||||||
;; don't require two spaces for sentence end.
|
- don't require two spaces for sentence end.
|
||||||
(setq sentence-end-double-space nil)
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq sentence-end-double-space nil)
|
||||||
;; The beeping can be annoying--turn it off
|
#+END_SRC
|
||||||
(setq visible-bell t
|
- The beeping can be annoying--turn it off
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq visible-bell t
|
||||||
ring-bell-function #'ignore)
|
ring-bell-function #'ignore)
|
||||||
|
#+END_SRC
|
||||||
#+END_SRC
|
|
||||||
* Menu bar
|
* Menu bar
|
||||||
Toggles reveal and hide menubar with the f10 key
|
Toggles reveal and hide menubar with the f10 key
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(menu-bar-mode -1)
|
(menu-bar-mode -1)
|
||||||
(defun my-menu-bar-open-after ()
|
(defun my-menu-bar-open-after ()
|
||||||
(remove-hook 'pre-command-hook 'my-menu-bar-open-after)
|
(remove-hook 'pre-command-hook 'my-menu-bar-open-after)
|
||||||
|
@ -170,76 +353,91 @@
|
||||||
(setq menu-bar-mode 42)
|
(setq menu-bar-mode 42)
|
||||||
(add-hook 'pre-command-hook 'my-menu-bar-open-after))))
|
(add-hook 'pre-command-hook 'my-menu-bar-open-after))))
|
||||||
(global-set-key [f10] 'my-menu-bar-open)
|
(global-set-key [f10] 'my-menu-bar-open)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* Text
|
* Text
|
||||||
- Fancy symbols
|
- Fancy symbols
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(global-prettify-symbols-mode t)
|
(global-prettify-symbols-mode t)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
- Highlight current line
|
- Highlight current line
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(when window-system (add-hook 'prog-mode-hook 'hl-line-mode))
|
(global-hl-line-mode t)
|
||||||
; (set-face-attribute 'hl-line nil :inherit nil :background "#1e2224")
|
(set-face-attribute 'hl-line nil :inherit nil :background "#1e2224")
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
- Fancy Font
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
;; Set default font
|
||||||
|
(set-face-attribute 'default nil
|
||||||
|
:family "Roboto Mono"
|
||||||
|
:height 110
|
||||||
|
:weight 'normal
|
||||||
|
:width 'normal)
|
||||||
|
#+END_SRC
|
||||||
* matlab
|
* matlab
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(add-to-list 'load-path "/home/guyfawkes/.emacs.d/matlab-emacs-master")
|
(add-to-list 'load-path "/home/guyfawkes/.emacs.d/matlab-emacs-master")
|
||||||
(load-library "matlab-load")
|
(load-library "matlab-load")
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* ido mode
|
* ido mode
|
||||||
-Makes things more interactive
|
-Makes things more interactive
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(setq indo-enable-flex-matching t)
|
(setq indo-enable-flex-matching t)
|
||||||
(setq ido-eveywhere t)
|
(setq ido-eveywhere t)
|
||||||
(ido-mode 1)
|
(ido-mode 1)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
* PDF tools
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package pdf-tools
|
||||||
|
:ensure t)
|
||||||
|
(use-package org-pdfview
|
||||||
|
:ensure t)
|
||||||
|
|
||||||
|
(require 'pdf-tools)
|
||||||
|
(require 'org-pdfview)
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
* Scrolling
|
* Scrolling
|
||||||
- System Scroll bars.
|
- System Scroll bars.
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(scroll-bar-mode -1)
|
(scroll-bar-mode -1)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
- Mini-buffer Scroll bars.
|
- Mini-buffer Scroll bars.
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(set-window-scroll-bars (minibuffer-window) nil nil)
|
(set-window-scroll-bars (minibuffer-window) nil nil)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
- Scroll Conservatively
|
- Scroll Conservatively
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(setq scroll-conservatively 100)
|
(setq scroll-conservatively 100)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* css-mode
|
* css-mode
|
||||||
#+BEGIN_SRC elisp
|
#+BEGIN_SRC elisp
|
||||||
(use-package css-mode)
|
(use-package css-mode)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* elpy
|
* elpy
|
||||||
For python development
|
For python development
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package elpy
|
(use-package elpy
|
||||||
:ensure t
|
:ensure t
|
||||||
:config
|
:config
|
||||||
(elpy-enable))
|
(elpy-enable))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* htmlize
|
* htmlize
|
||||||
Converts org documents into html files.
|
Converts org documents into html files.
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package htmlize
|
(use-package htmlize
|
||||||
:ensure t)
|
:ensure t)
|
||||||
(setq org-html-postamble nil)
|
(setq org-html-postamble nil)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* ox-reveal
|
* ox-reveal
|
||||||
Makes org documents into presentations using js.
|
Makes org documents into presentations using js.
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
; (add-to-list 'load-path "~/.emacs.d/ox-reveal")
|
|
||||||
; (require 'ox-reveal)
|
|
||||||
;(setq org-reveal-root "http://cdn.jsdelivr.net/reveal.js/3.0.0/")
|
|
||||||
; (setq org-reveal-mathjax t)
|
|
||||||
(use-package ox-reveal
|
(use-package ox-reveal
|
||||||
:ensure ox-reveal)
|
:ensure ox-reveal)
|
||||||
|
|
||||||
(setq org-reveal-root "http://cdn.jsdelivr.net/reveal.js/3.0.0/")
|
(setq org-reveal-root "http://cdn.jsdelivr.net/reveal.js/3.0.0/")
|
||||||
(setq org-reveal-mathjax t)
|
(setq org-reveal-mathjax t)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* Dired
|
* Dired
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
;(use-package dired-details)
|
;(use-package dired-details)
|
||||||
;(use-package dired)
|
;(use-package dired)
|
||||||
;(use-package dired-open
|
;(use-package dired-open
|
||||||
|
@ -250,39 +448,44 @@
|
||||||
("mp4" . "vlc")
|
("mp4" . "vlc")
|
||||||
("avi" . "vlc")))
|
("avi" . "vlc")))
|
||||||
;)
|
;)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
* Org
|
* Org
|
||||||
** Trigger
|
** Trigger
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(global-set-key [kbd "C-c C-o"] 'org-mode)
|
|
||||||
#+END_SRC
|
|
||||||
** Replacing (...)
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(setq org-ellipsis "↴")
|
|
||||||
#+END_SRC
|
|
||||||
** Display preferences
|
|
||||||
I like to see an outline of pretty bullets instead of a list of asterisks.
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package org-bullets
|
(global-set-key [kbd "C-c o"] 'org-mode)
|
||||||
:init
|
#+END_SRC
|
||||||
(add-hook 'org-mode-hook #'org-bullets-mode))
|
** Replacing (...)
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq org-ellipsis "↴")
|
||||||
|
#+END_SRC
|
||||||
|
** Display preferences
|
||||||
|
- Set firefox as default
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setenv "BROWSER" "firefox")
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
Enable spell-checking in Org-mode.
|
- I like to see an outline of pretty bullets instead of a list of asterisks.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package org-bullets
|
||||||
|
:init
|
||||||
|
(add-hook 'org-mode-hook #'org-bullets-mode))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
- Enable spell-checking in Org-mode.
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(add-hook 'org-mode-hook 'flyspell-mode)
|
(add-hook 'org-mode-hook 'flyspell-mode)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
Record the time that a todo was archived.
|
- Record the time that a todo was archived.
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(setq org-log-done 'time)
|
(setq org-log-done 'time)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
When refiling an item, I'd like to use ido for completion.
|
- When refiling an item, I'd like to use ido for completion.
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(setq org-refile-use-outline-path t)
|
(setq org-refile-use-outline-path t)
|
||||||
|
@ -313,13 +516,13 @@
|
||||||
(setq org-export-with-smart-quotes t)
|
(setq org-export-with-smart-quotes t)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
- Exporting to HTML
|
- Exporting to HTML
|
||||||
|
|
||||||
Don't include a footer with my contact and publishing information at the bottom
|
Don't include a footer with my contact and publishing information at the bottom
|
||||||
of every exported HTML document.
|
of every exported HTML document.
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(setq org-html-postamble nil)
|
(setq org-html-postamble nil)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
Exporting to HTML and opening the results triggers =/usr/bin/sensible-browser=,
|
Exporting to HTML and opening the results triggers =/usr/bin/sensible-browser=,
|
||||||
|
@ -327,10 +530,10 @@
|
||||||
I'd like to always use Firefox, so:
|
I'd like to always use Firefox, so:
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(setq browse-url-browser-function 'browse-url-generic
|
(setq browse-url-browser-function 'browse-url-generic
|
||||||
browse-url-generic-program "firefox")
|
browse-url-generic-program "firefox")
|
||||||
|
|
||||||
(setenv "BROWSER" "firefox")
|
(setenv "BROWSER" "firefox")
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
** TeX configuration
|
** TeX configuration
|
||||||
|
|
||||||
|
@ -355,6 +558,9 @@
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(add-hook 'org-mode-hook
|
(add-hook 'org-mode-hook
|
||||||
'(lambda ()
|
'(lambda ()
|
||||||
|
(auto-mode . emacs)
|
||||||
|
("\\.x?html?\\'" . "/usr/bin/firefox %s")
|
||||||
|
("\\.mm\\'" . default)
|
||||||
(delete '("\\.pdf\\'" . default) org-file-apps)
|
(delete '("\\.pdf\\'" . default) org-file-apps)
|
||||||
(add-to-list 'org-file-apps '("\\.pdf\\'" . "qpdfview %s"))))
|
(add-to-list 'org-file-apps '("\\.pdf\\'" . "qpdfview %s"))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
@ -369,3 +575,219 @@
|
||||||
(LaTeX-math-mode)
|
(LaTeX-math-mode)
|
||||||
(setq TeX-master t)))
|
(setq TeX-master t)))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
* History
|
||||||
|
|
||||||
|
From http://www.wisdomandwonder.com/wordpress/wp-content/uploads/2014/03/C3F.html
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(setq savehist-file "~/.emacs.d/savehist")
|
||||||
|
(savehist-mode 1)
|
||||||
|
(setq history-length t)
|
||||||
|
(setq history-delete-duplicates t)
|
||||||
|
(setq savehist-save-minibuffer-history 1)
|
||||||
|
(setq savehist-additional-variables
|
||||||
|
'(kill-ring
|
||||||
|
search-ring
|
||||||
|
regexp-search-ring))
|
||||||
|
#+end_src
|
||||||
|
* Mode line format
|
||||||
|
|
||||||
|
Display a more compact mode line
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package smart-mode-line
|
||||||
|
:init
|
||||||
|
(progn
|
||||||
|
(setq-default
|
||||||
|
mode-line-format
|
||||||
|
'("%e"
|
||||||
|
mode-line-front-space
|
||||||
|
mode-line-mule-info
|
||||||
|
mode-line-client
|
||||||
|
mode-line-modified
|
||||||
|
mode-line-remote
|
||||||
|
mode-line-frame-identification
|
||||||
|
mode-line-buffer-identification
|
||||||
|
" "
|
||||||
|
mode-line-position
|
||||||
|
(vc-mode vc-mode)
|
||||||
|
" "
|
||||||
|
mode-line-modes
|
||||||
|
mode-line-misc-info
|
||||||
|
mode-line-end-spaces))))
|
||||||
|
#+end_src
|
||||||
|
* Web browsing
|
||||||
|
Browse within emacs.
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(setq browse-url-browser-function 'eww-browse-url)
|
||||||
|
#+end_src
|
||||||
|
* Swiper
|
||||||
|
- Swiper gives us a really efficient incremental search with regular expressions
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package swiper
|
||||||
|
:ensure t
|
||||||
|
:bind (("C-s" . swiper)
|
||||||
|
("C-r" . swiper))
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
(ivy-mode 1)
|
||||||
|
(setq ivy-use-virtual-buffers t)
|
||||||
|
(setq ivy-display-style 'fancy)
|
||||||
|
(define-key read-expression-map (kbd "C-r") 'counsel-expression-history)
|
||||||
|
))
|
||||||
|
#+END_SRC
|
||||||
|
* try
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package try
|
||||||
|
:ensure t)
|
||||||
|
#+END_SRC
|
||||||
|
* Helm - interactive completion
|
||||||
|
|
||||||
|
Helm makes it easy to complete various things. I find it to be easier
|
||||||
|
to configure than ido in order to get completion in as many places as
|
||||||
|
possible, although I prefer ido's way of switching buffers.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package helm
|
||||||
|
:init
|
||||||
|
(progn
|
||||||
|
(require 'helm-config)
|
||||||
|
(setq helm-candidate-number-limit 100)
|
||||||
|
;; From https://gist.github.com/antifuchs/9238468
|
||||||
|
(setq helm-idle-delay 0.0 ; update fast sources immediately (doesn't).
|
||||||
|
helm-input-idle-delay 0.01 ; this actually updates things
|
||||||
|
; reeeelatively quickly.
|
||||||
|
helm-quick-update t
|
||||||
|
helm-M-x-requires-pattern nil
|
||||||
|
helm-ff-skip-boring-files t)
|
||||||
|
(helm-mode 1))
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
;; I don't like the way switch-to-buffer uses history, since
|
||||||
|
;; that confuses me when it comes to buffers I've already
|
||||||
|
;; killed. Let's use ido instead.
|
||||||
|
(add-to-list 'helm-completing-read-handlers-alist '(switch-to-buffer . ido)))
|
||||||
|
(global-set-key (kbd "M-x") 'helm-M-x)
|
||||||
|
:bind (("C-c h" . helm-mini)))
|
||||||
|
(ido-mode -1) ;; Turn off ido mode in case I enabled it accidentally
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package helm
|
||||||
|
:ensure t
|
||||||
|
:init
|
||||||
|
(progn
|
||||||
|
(require 'helm-config)
|
||||||
|
;; limit max number of matches displayed for speed
|
||||||
|
(setq helm-candidate-number-limit 100)
|
||||||
|
;; ignore boring files like .o and .a
|
||||||
|
(setq helm-ff-skip-boring-files t)
|
||||||
|
;; replace locate with spotlight on Mac
|
||||||
|
(setq helm-locate-command "mdfind -name %s %s"))
|
||||||
|
:bind (("C-x f" . helm-for-files)))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
Fix problem with org-capture and helm.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(setcdr (assoc 'org-capture helm-completing-read-handlers-alist) nil)
|
||||||
|
#+end_src
|
||||||
|
* Beacon
|
||||||
|
- flashes the cursor's line when you scroll
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package beacon
|
||||||
|
:ensure t
|
||||||
|
:config
|
||||||
|
(beacon-mode 1)
|
||||||
|
)
|
||||||
|
#+END_SRC
|
||||||
|
* Multiple Cursors
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package multiple-cursors
|
||||||
|
:ensure t)
|
||||||
|
#+END_SRC
|
||||||
|
* Web Mode
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package web-mode
|
||||||
|
:ensure t
|
||||||
|
:config
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.vue?\\'" . web-mode))
|
||||||
|
(setq web-mode-engines-alist
|
||||||
|
'(("django" . "\\.html\\'")))
|
||||||
|
(setq web-mode-ac-sources-alist
|
||||||
|
'(("css" . (ac-source-css-property))
|
||||||
|
("vue" . (ac-source-words-in-buffer ac-source-abbrev))
|
||||||
|
("html" . (ac-source-words-in-buffer ac-source-abbrev))))
|
||||||
|
(setq web-mode-enable-auto-closing t))
|
||||||
|
(setq web-mode-enable-auto-quoting t) ; this fixes the quote problem I mentioned
|
||||||
|
#+END_SRC
|
||||||
|
* Magit
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package magit
|
||||||
|
:ensure t
|
||||||
|
:init
|
||||||
|
(progn
|
||||||
|
(bind-key "C-x g" 'magit-status)
|
||||||
|
))
|
||||||
|
#+END_SRC
|
||||||
|
* Better Shell
|
||||||
|
#+BEGIN_SRC emacs-lisp :tangle no
|
||||||
|
(use-package better-shell
|
||||||
|
:ensure t
|
||||||
|
:bind (("C-\"" . better-shell-shell)
|
||||||
|
("C-:" . better-shell-remote-open)))
|
||||||
|
#+END_SRC
|
||||||
|
* c++
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package ggtags
|
||||||
|
:ensure t
|
||||||
|
:config
|
||||||
|
(add-hook 'c-mode-common-hook
|
||||||
|
(lambda ()
|
||||||
|
(when (derived-mode-p 'c-mode 'c++-mode 'java-mode)
|
||||||
|
(ggtags-mode 1))))
|
||||||
|
)
|
||||||
|
#+END_SRC
|
||||||
|
* Origami folding
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package origami
|
||||||
|
:ensure t)
|
||||||
|
#+END_SRC
|
||||||
|
* Treemacs
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package treemacs
|
||||||
|
:ensure t
|
||||||
|
:defer t
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
|
||||||
|
(setq treemacs-follow-after-init t
|
||||||
|
treemacs-width 35
|
||||||
|
treemacs-indentation 2
|
||||||
|
treemacs-git-integration t
|
||||||
|
treemacs-collapse-dirs 3
|
||||||
|
treemacs-silent-refresh nil
|
||||||
|
treemacs-change-root-without-asking nil
|
||||||
|
treemacs-sorting 'alphabetic-desc
|
||||||
|
treemacs-show-hidden-files t
|
||||||
|
treemacs-never-persist nil
|
||||||
|
treemacs-is-never-other-window nil
|
||||||
|
treemacs-goto-tag-strategy 'refetch-index)
|
||||||
|
|
||||||
|
(treemacs-follow-mode t)
|
||||||
|
(treemacs-filewatch-mode t))
|
||||||
|
:bind
|
||||||
|
(:map global-map
|
||||||
|
([f8] . treemacs-toggle)
|
||||||
|
([f9] . treemacs-projectile-toggle)
|
||||||
|
("<C-M-tab>" . treemacs-toggle)
|
||||||
|
("M-0" . treemacs-select-window)
|
||||||
|
("C-c 1" . treemacs-delete-other-windows)
|
||||||
|
))
|
||||||
|
(use-package treemacs-projectile
|
||||||
|
:defer t
|
||||||
|
:ensure t
|
||||||
|
:config
|
||||||
|
(setq treemacs-header-function #'treemacs-projectile-create-header)
|
||||||
|
)
|
||||||
|
#+END_SRC
|
||||||
|
|
Loading…
Reference in New Issue