Keybindings, startup options, interface tweaks, etc. Works along the sensible-defaults.el
file.
(load-file "~/.emacs.d/sensible-defaults.el")
(sensible-defaults/use-all-settings)
(sensible-defaults/use-all-keybindings)
(sensible-defaults/backup-to-temp-directory)
(setq package-check-signature nil) ; Livin' dangerously :^)
(add-to-list 'default-frame-alist '(fullscreen . maximized))
(global-set-key (kbd "<f5>") 'revert-buffer)
(setq save-interprogram-paste-before-kill t) ; Keeps the clipboard contents of a killed buffer.
(setq split-height-threshold nil) ; Vertical instead of horizontal
(setq split-width-threshold 0)
Uses aspell dictionary. Tutorial on how to configure aspell. M-x ispell-change-dictionary | M-x flyspell-mode
(setq-default ispell-program-name "aspell")
(setq ispell-dictionary "spanish")
To test packages without having to install them. M-x try
(use-package try
:ensure t)
Displays the key bindings following a currently entered incomplete command.
(use-package which-key
:ensure t
:config (which-key-mode))
Buffer that lets you manipulate other buffers. C-x C-b
(defalias 'list-buffers 'ibuffer)
;; Or to show buffers in another window: 'ibuffer-other-window
Swiper is a better search. Counsel for completion powered by Ivy.
(use-package counsel
:ensure t
:bind
(("M-y" . counsel-yank-pop)
:map ivy-minibuffer-map
("M-y" . ivy-next-line)))
(use-package swiper
:ensure t
:config
(progn
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(global-set-key "\C-s" 'swiper)
(global-set-key (kbd "C-c C-r") 'ivy-resume)
(global-set-key (kbd "<f6>") 'ivy-resume)
(global-set-key (kbd "M-x") 'counsel-M-x)
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
(global-set-key (kbd "<f1> l") 'counsel-load-library)
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
(global-set-key (kbd "C-c k") 'counsel-ag)
(global-set-key (kbd "C-x l") 'counsel-locate)))
Flashes the cursor whenever you scroll, for visibility’s sake.
(use-package beacon
:ensure t
:config
(beacon-mode 1)
(setq beacon-color "#666600"))
Better, visual undo. Also adds redo, simply by adding shift to the undo. C-x u to use the visual undo tree. Move with arrow keys and exit with q.
(use-package undo-tree
:ensure t
:init
(global-undo-tree-mode))
(use-package auto-complete
:ensure t
:init
(progn
(ac-config-default)
(global-auto-complete-mode t)))
Makes sure that code you write stays indented.
(use-package aggressive-indent
:ensure t
:config
(global-aggressive-indent-mode 1))
Expands selection in semantic increments. C-= start function, then keep using = to select, - to contract and 0 to end the function.
(use-package expand-region
:ensure t
:config
(global-set-key (kbd "C-=") 'er/expand-region))
Select text, then narrows it then widens it with C-x n. Use iedit to refactor all words in a buffer with C-;
(use-package iedit
:ensure t)
(defun narrow-or-widen-dwim (p)
"Widen if buffer is narrowed, narrow-dwim otherwise.
Dwim means: region, org-src-block, org-subtree, or
defun, whichever applies first. Narrowing to
org-src-block actually calls `org-edit-src-code'.
With prefix P, don't widen, just narrow even if buffer
is already narrowed."
(interactive "P")
(declare (interactive-only))
(cond ((and (buffer-narrowed-p) (not p)) (widen))
((region-active-p)
(narrow-to-region (region-beginning)
(region-end)))
((derived-mode-p 'org-mode)
;; `org-edit-src-code' is not a real narrowing
;; command. Remove this first conditional if
;; you don't want it.
(cond ((ignore-errors (org-edit-src-code) t)
(delete-other-windows))
((ignore-errors (org-narrow-to-block) t))
(t (org-narrow-to-subtree))))
((derived-mode-p 'latex-mode)
(LaTeX-narrow-to-environment))
(t (narrow-to-defun))))
(define-key ctl-x-map "n" #'narrow-or-widen-dwim)
(add-hook 'LaTeX-mode-hook
(lambda ()
(define-key LaTeX-mode-map "\C-xn"
nil)))
C-c C-p
for running virtual python environment, then to run the code C-c C-c
On-the-fly syntax checking package.
(use-package flycheck
:ensure t
:init
(global-flycheck-mode t))
Provides more extensive completion for Python.
(use-package jedi
:ensure t
:init
(add-hook 'python-mode-hook 'jedi:setup)
(add-hook 'python-mode-hook 'jedi:ac-setup))
Block of elisp. <el TAB
(add-to-list 'org-structure-template-alist
'("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC"))
(setq org-src-fontify-natively t
org-src-tab-acts-natively t
org-confirm-babel-evaluate nil
org-edit-src-content-indentation 0)
(use-package org-ac
:ensure t
:config (org-ac/config-default))
Set ellipsis in mashed in there too, cuz why not.
(use-package org-bullets
:ensure t
:config
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
(setq org-ellipsis "⤵")
Framekwork for creating presentations in org-mode. Github page.
;(use-package ox-reveal
;:ensure ox-reveal)
;(setq org-reveal-root "https://cdn.jsdelivr.net/npm/reveal.js@3.6.0")
;(setq org-reveal-mathjax t)
(use-package htmlize
:ensure t)
Best search tool for Windows. M-x everything
(add-to-list 'load-path (expand-file-name "C:/Users/G t z/AppData/Roaming/.emacs.d/everything")) ;; Folder directory where 'everything.el' is
(setq everything-cmd (expand-file-name "F:/Program Files/Everything/es.exe")) ;; let 'everything.el' know where to find 'es.exe'
(require 'everything)