Quitar elementos visuales de más.
(when window-system
(blink-cursor-mode 0)
(scroll-bar-mode 0)
(tool-bar-mode 0)
(tooltip-mode 0))
Maximizar un buffer debería ser toggleable
(defun toggle-maximize-buffer ()
"Maximizes buffer."
(interactive)
(if (and (= 1 (length (window-list)))
(assoc ?_ register-alist))
(jump-to-register ?_)
(progn
(window-configuration-to-register ?_)
(delete-other-windows))))
(global-set-key (kbd "C-x 1") 'toggle-maximize-buffer)
Otros defaults en general.
(setq-default
ad-redefinition-action 'accept
auto-window-vscroll nil
confirm-kill-emacs 'yes-or-no-p
cursor-in-non-selected-windows t
fill-column 80
help-window-select t
indent-tabs-mode nil
inhibit-startup-screen t
initial-scratch-message ""
left-margin-width 1 right-margin-width 1
mouse-yank-at-point t
ns-use-srgb-colorspace nil
recenter-positions '(5 top bottom)
scroll-conservatively most-positive-fixnum
scroll-margin 10
select-enable-clipboard t
sentence-end-double-space nil
show-trailing-whitespace nil
split-height-threshold nil
split-width-threshold nil
tab-width 4
truncate-lines t
uniquify-buffer-name-style 'forward
window-combination-resize t
x-stretch-cursor t)
(cd "~/")
(delete-selection-mode 1)
(fringe-mode 0)
(fset 'yes-or-no-p 'y-or-n-p)
(menu-bar-mode 0)
(mouse-avoidance-mode 'banish)
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(set-default-coding-systems 'utf-8)
Que dispare el Garbage-Collector cuando el buffer no tenga el foco. Emacs se debería sentir más ágil
(add-hook 'focus-out-hook #'garbage-collect)
Indicarle a Emacs que carge las configuraciones en un archivo aparte,
en vez de agregarlas al final de este archivo (que encima está en org
y seguramente se rompa al agregar algo)
(setq-default custom-file (expand-file-name ".custom.el" user-emacs-directory))
(when (file-exists-p custom-file)
(load custom-file))
Así tengo los tokens fuera de versionado
(let ((secret.el (expand-file-name ".secret.el" user-emacs-directory)))
(when (file-exists-p secret.el)
(load secret.el)))
(use-package zerodark-theme)
(use-package silkworm-theme
:demand t)
Company is a text completion framework for Emacs. The name stands for “complete anything”. It uses pluggable back-ends and front-ends to retrieve and display completion candidates.
(use-package company
:defer 1
:delight
:bind
(:map company-active-map
("ESC" . company-cancel)
("RET" . nil)
([return] . nil)
("<C-return>" . company-complete-selection))
:config
(global-company-mode 1)
(setq-default
company-idle-delay .2
company-minimum-prefix-length 1
company-require-match nil
company-tooltip-align-annotations t))
Emacs crea automáticamente archivos terminados en ~ de backup. Me gusta la funcionalidad, pero no quiero tener todos los proyectos llenos de estos archivos, así que seteo que se dejen en otro lado
(setq backup-directory-alist '(("." . "~/.emacs.d/backup"))
backup-by-copying t ; No usar links
version-control t ; Usar número de versión en los backups
delete-old-versions t
kept-new-versions 20
kept-old-versions 5)
Which key es un paquete para que aparezca un buffer inferior contándote qué nuevo comando podés apretar cuando tipeás alguno
(use-package which-key
:delight " Ꙍ"
:defer 1
:config
(which-key-mode)
(setq-default
which-key-sort-order 'which-key-key-order-alpha
which-key--side-window-max-dimensions 0.33
which-key-idle-delay 0.05))
EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles. EditorConfig files are easily readable and they work nicely with version control systems.
(use-package editorconfig
:config
(editorconfig-mode 1))
(use-package magit
:delight auto-revert-mode
:defer 5
:bind
("C-x g" . 'magit-dispatch-popup)
("C-x G" . 'magit-status))
Para la interfaz de línea de comandos prefiero usar Ivy a Helm porque me parece más rápido y conceptualmente más copado
(use-package ivy
:defer 2
:delight
:config (ivy-mode 1)
:bind ("C-s" . 'swiper)
("C-S-s" . 'swiper-all)
("M-s" . 'swiper-thing-at-point)
("M-S-s" . 'swiper-all-thing-at-point))
(use-package counsel
:bind ("C-x t" . 'counsel-load-theme))
(use-package all-the-icons-ivy
:config
(all-the-icons-ivy-setup))
Multiple cursors for Emacs. This is some pretty crazy functionality, so yes, there are kinks. Don’t be afraid tho, I’ve been using it since 2011 with great success and much merriment.
(use-package multiple-cursors
:bind (("C-c m c" . mc/edit-lines)
("C->" . mc/mark-next-like-this)
("C-<" . mc/mark-previous-like-this)))
La filosofía de Parinfer es bien distinta a la de Paredit y busca, básicamente, que uno se olvide directamente de poner manualmente los paréntesis (llevándolo al punto de que apenas sean visibles en el fuente). La herramienta infiere cuántos paréntesis tiene que poner según el grado de indentación del texto.
(use-package parinfer
:delight
:config
(setq-default
parinfer-extensions '(defaults pretty-parens smart-yank)
parinfer-auto-switch-indent-mode t)
:hook
(emacs-lisp-mode . parinfer-mode)
(common-lisp-mode . parinfer-mode)
(lisp-mode . parinfer-mode)
(clojure-mode . parinfer-mode))
(use-package projectile
:defer 1
:init
(setq-default
projectile-cache-file (expand-file-name ".projectile-cache" user-emacs-directory)
projectile-keymap-prefix (kbd "C-c C-p")
projectile-known-projects-file (expand-file-name
".projectile-bookmarks" user-emacs-directory))
:config
(projectile-global-mode 1)
(setq-default
projectile-completion-system 'ivy
projectile-enable-caching t
projectile-mode-line '(:eval (projectile-project-name))))
(use-package restclient
:defer 1
:delight "rest-client"
:mode (("\\.http\\'" . restclient-mode)))
(use-package counsel-spotify
:bind-keymap ("C-x m" . counsel-spotify-map)
:bind (:map counsel-spotify-map
("SPC" . 'counsel-spotify-toggle-play-pause)
("<right>" . 'counsel-spotify-next)
("<left>" . 'counsel-spotify-previous)
("A" . 'counsel-spotify-search-artist)
("a" . 'counsel-spotify-search-album)
("t" . 'counsel-spotify-search-track))
:config
(defvar counsel-spotify-map (make-sparse-keymap))
(setq-default
counsel-spotify-client-id counsel-spotify-client-id
counsel-spotify-client-secret counsel-spotify-client-secret))
The default emacs undo has two limitations this package aims to resolve, Two actions are required to initiate redo. It’s easy to accidentally redo past the point where undo started making it inconvenient to restore the document to the point when undo began.
(use-package undo-fu
:commands (undo-fu-only-undo undo-fu-only-redo)
:bind
("C-z" . 'undo-fu-only-undo)
("C-S-z" . 'undo-fu-only-redo))
(use-package whitespace
:delight global-whitespace-mode
:init
(global-whitespace-mode)
:custom-face
(whitespace-space ((nil (:background nil :foreground "lightgray"))))
(whitespace-line ((nil (:background nil)))))
(use-package clojure-mode)
(use-package cider)
(use-package sly
:config (setq inferior-lisp-program "/usr/bin/sbcl"))
(use-package css-mode
:config (setq-default css-indent-offset 2))
(use-package scss-mode
:delight scss-mode "SCSS"
:mode ("\\.sass\\'" "\\.scss\\'"))
(use-package csv-mode
:config (setq-default csv-align-padding 2))
(use-package dockerfile-mode
:delight "Dockerfile"
:bind (:map dockerfile-mode-map
("C-c b" . dockerfile-build-buffer)
("C-c B" . dockerfile-build-no-cache-buffer))
:mode "Dockerfile\\'")
(use-package docker)
(use-package emacs-lisp-mode
:ensure nil
:delight emacs-lisp-mode "Emacs Lisp"
:config (delight 'lisp-interaction-mode "Lisp Interaction"))
(use-package elisp-slime-nav
:delight
:bind (:map elisp-slime-nav-mode-map
("C-c d" . elisp-slime-nav-describe-elisp-thing-at-point))
:hook (emacs-lisp-mode . elisp-slime-nav-mode))
(use-package eldoc
:delight)
(use-package js
:ensure nil
:delight js-mode "JS")
(use-package js2-mode
:delight js2-minor-mode " JS2"
:hook (js-mode . js2-minor-mode)
:config
(setq-default
js2-idle-time-delay 0
js2-mode-show-parse-errors nil
js2-mode-show-strict-warnings nil
js-indent-level 2)
:bind (:map js2-mode-map
("C-c C-C" . js-send-last-sexp)
("C-c b" . js-send-buffer)))
(use-package js2-refactor
:diminish (js2-refactor-mode yas-minor-mode)
:hook (js2-minor-mode . js2-refactor-mode)
:config
(setq-default js2-skip-preprocessors-directives t)
(js2r-add-keybindings-with-prefix "C-C C-r"))
(use-package mocha
:delight " mocha "
:bind (:map js2-mode-map
("C-c t" . mocha-test-at-point)
("C-c T" . mocha-test-project)))
(use-package markdown-mode
:commands (markdown-mode gfm-mode)
:mode (("README\\.md\\'" . gfm-mode)
("\\.md\\'" . markdown-mode)
("\\.markdown\\'" . markdown-mode)))
Tide - TypeScript Interactive Development Environment for Emacs
(use-package tide
:config
(tide-setup)
(flycheck-mode +1)
(eldoc-mode +1)
:bind (:map tide-mode-map
("C-c C-r" . tide-refactor)
("C-c ?" . tide-references)
("C-c r" . tide-rename-symbol)
("C-c o" . tide-organize-imports)
("C-c f" . tide-format)
("C-c SPC" . tide-fix))
:hook ((typescript-mode . tide-mode)
(typescript-mode . tide-hl-identifier-mode)
(before-save . tide-format-before-save)))
(use-package yaml-mode
:mode (("\\.yml\\'" . yaml-mode)
("\\.yaml\\'" . yaml-mode)))