From 0883508433af04f25850813709f726c46bd67f07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Villagr=C3=A1?= Date: Sun, 5 Jun 2022 00:19:30 +0200 Subject: [PATCH] Commit inicial --- init.el | 229 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 229 insertions(+) create mode 100644 init.el diff --git a/init.el b/init.el new file mode 100644 index 0000000..50d7429 --- /dev/null +++ b/init.el @@ -0,0 +1,229 @@ + +;; Soporte para la carga de paquetes con straight +;; antes se hacía con package.el +;; https://github.com/raxod502/straight.el +(defvar bootstrap-version) +(let ((bootstrap-file + (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) + (bootstrap-version 5)) + (unless (file-exists-p bootstrap-file) + (with-current-buffer + (url-retrieve-synchronously + "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" + 'silent 'inhibit-cookies) + (goto-char (point-max)) + (eval-print-last-sexp))) + (load bootstrap-file nil 'nomessage)) + +(straight-use-package 'use-package) ;; carga el paquege use-package, + ;; que hace algunas gollerías como + ;; instalar paquetes + ;; automáticamente o configurarlo. + + +;; Configure use-package to use straight.el by default +(use-package straight + :custom (straight-use-package-by-default t)) + +;;(straight-use-package 'conda) +(use-package conda + :straight t + :config + (setq conda-anaconda-home (expand-file-name "~/miniforge3/")) + (setq conda-env-home-directory (expand-file-name "~/miniforge3/")) + (setq conda-env-subdirectory "envs")) + +(unless (getenv "CONDA_DEFAULT_ENV") + (conda-env-activate "base")) + + +(straight-use-package 'counsel) +(straight-use-package 'ivy) +(straight-use-package 'swiper) +(straight-use-package 'ace-window) +(straight-use-package 'magit) +(straight-use-package 'auctex) +(straight-use-package 'company-auctex) +(straight-use-package 'company-reftex) +(straight-use-package 'reftex) +(straight-use-package 'cdlatex) +(straight-use-package 'latex-extra) +(straight-use-package 'hydra) +(straight-use-package 'org) +;;(straight-use-package 'org-ref) +(straight-use-package 'org-ac) +(straight-use-package 'ess) +;(straight-use-package 'org-plus-contrib) + + +;; (use-package ox-odt +;; :straight (org-mode-ox-odt +;; :host github +;; :repo "kjambunathan/org-mode-ox-odt" +;; :nonrecursive t +;; :files ("lisp/ox-odt.el" +;; "etc" +;; "docs" +;; "contrib/odt/LibreOffice"))) + +;(straight-use-package 'capf) + +(straight-use-package 'yaml-mode) +;;(straight-use-package 'tramp) +(straight-use-package 'sudo-edit) + +(use-package company-org-block + :straight t + :custom + (company-org-block-edit-style 'auto) ;; 'auto, 'prompt, or 'inline + :hook ((org-mode . (lambda () + (setq-local company-backends '(company-org-block)) + (company-mode +1))))) + +;;(straigth-use-package 'helm) + +;; Hydras + +(defhydra hydra-zoom (global-map "") + "zoom" + ("+" text-scale-increase "in") + ("-" text-scale-decrease "out")) + +;;(defhydra hydra-org-navegacion (org-mode-map "C-c") +(defhydra hydra-org-navegacion () + "Navega adelante y atrás entre encabezados" + ("" org-next-visible-heading "Siguiente") + ("" org-previous-visible-heading "Anterior") + ("" org-forward-heading-same-level "Adelante") + ("" org-backward-heading-same-level "Atrás") + ("q" nil "quit") + ) +(define-key org-mode-map (kbd "C-c m") 'hydra-org-navegacion/body) + +;; (straight-use-package 'org-plus-contrib) + +;; (require 'package) +;; (package-initialize) + +;; (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) +;; (add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t) +;; (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. +;; '(package-selected-packages +;; (quote +;; (use-package conda ace-window org-plus-contrib cdlatex company-auctex magit auctex counsel ivy swiper)))) +;; (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. +;; ) + +;; IVY, Swiper Counsel +(ivy-mode 1) +(setq ivy-use-virtual-buffers t) +(setq enable-recursive-minibuffers t) +(global-set-key "\C-s" 'swiper) +(global-set-key (kbd "C-c C-r") 'ivy-resume) +(global-set-key (kbd "") '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 " f") 'counsel-describe-function) +(global-set-key (kbd " v") 'counsel-describe-variable) +(global-set-key (kbd " l") 'counsel-find-library) +(global-set-key (kbd " i") 'counsel-info-lookup-symbol) +(global-set-key (kbd " u") 'counsel-unicode-char) +(global-set-key (kbd "C-c g") 'counsel-git) +(global-set-key (kbd "C-c j") 'counsel-git-grep) +(global-set-key (kbd "C-c k") 'counsel-ag) +(global-set-key (kbd "C-x l") 'counsel-locate) +(global-set-key (kbd "C-S-o") 'counsel-rhythmbox) +(define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history) + +;; ¿acentos? ¿utf8? +(require 'iso-transl) + +;;Pijadas varias +(line-number-mode 't) ;;muestra el número de línea +(column-number-mode 't) ;; muestra el número de columna +(setq make-backup-files nil) ; don't make xxx~ files +(display-time) ;;muestra la hora +(setq make-backup-files nil) ;;no crea copias de seguridad (ficheros xxx~) +(setq kill-whole-line t) ;; C-k borra toda la línea +(savehist-mode 1) ;; guarda la historia del minibuffer + +;; Dracula theme +(add-to-list 'custom-theme-load-path "~/.emacs.d/themes") +(load-theme 'dracula t) + +;; ace window +(global-set-key (kbd "M-o") 'ace-window) + +;; +;;; Stefan Monnier . It is the opposite of fill-paragraph +(defun unfill-paragraph (&optional region) + "Takes a multi-line paragraph and makes it into a single line of text." + (interactive (progn (barf-if-buffer-read-only) '(t))) + (let ((fill-column (point-max)) + ;; This would override `fill-column' if it's an integer. + (emacs-lisp-docstring-fill-column t)) + (fill-paragraph nil region))) + +;; Handy key definition +(define-key global-map "\M-Q" 'unfill-paragraph) + + +;; org-mode +(setq org-support-shift-select 't) +;; active Babel languages +(org-babel-do-load-languages + 'org-babel-load-languages + '((R . t) + (latex - t) + (emacs-lisp . t) + (python . t) + (org . t) + (shell . t) + )) + +;; No pide confirmación al ejecutar código +(setq org-confirm-babel-evaluate nil) + +;; Muestra imágenes en el buffer de org +(add-hook 'org-babel-after-execute-hook 'org-display-inline-images) +(add-hook 'org-mode-hook 'org-display-inline-images) + +;; establece latexmk para la compilación +(setq org-latex-pdf-process (list "latexmk -f -pdf %f")) + +;; Carga lo necesario para exportar a beamer +(require 'ox-beamer) + +;; Ajusta automáticamente la imagen al alcho (casi) +(setq org-image-actual-width nil) + +;; activa orc-ac (autocompletado automático) +;; https://github.com/aki2o/org-ac +;;(org-ac/config-default) + +; Latex + +;; Inicializa el soporte para company en auctex automáticamente +;; (require 'company-auctex) ;; cargado antes con straight +(add-hook 'LaTeX-mode-hook (lambda ()(company-mode 1))) +(company-auctex-init) + +;; Activa el parser automático, para que funcione C-c C-a +(setq TeX-parse-self t) ; Enable parse on load. +(setq TeX-auto-save t) ; Enable parse on save. +;; RefTeX +(add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode +(setq reftex-plug-into-AUCTeX t) ; Conectar a AUC TeX con RefTeX +;; CDLaTeX +(add-hook 'LaTeX-mode-hook 'turn-on-cdlatex) ; with AUCTeX LaTeX mode +;; latex-extra +(add-hook 'LaTeX-mode-hook #'latex-extra-mode) +