Change from package.el to straight.el.

This commit is contained in:
kj 2022-05-27 17:04:28 -04:00
parent fb890c4ceb
commit 7ee9bd4492
9 changed files with 95 additions and 168 deletions

6
.gitignore vendored
View File

@ -1,8 +1,7 @@
elpa elpa
transient transient
eln-cache eln-cache
private/.* private/
private/cache
bookmarks bookmarks
.lsp-session* .lsp-session*
projectile-bookmarks.eld projectile-bookmarks.eld
@ -10,4 +9,5 @@ projectile-bookmarks.eld
org-roam.db org-roam.db
lsp-cache/ lsp-cache/
.cache/ .cache/
url/ url/
straight/

View File

@ -8,11 +8,14 @@
;;; Code: ;;; Code:
;; Iconos principalmente para ser usados por neotree ;; Iconos principalmente para ser usados por neotree
(use-package all-the-icons :defer t) (use-package all-the-icons
:defer t
:straight t)
;; Iconos en Ivy (allthe icons) ;; Iconos en Ivy (allthe icons)
(use-package all-the-icons-ivy-rich (use-package all-the-icons-ivy-rich
:defer t :defer t
:straight t
:ensure t :ensure t
:init :init
(all-the-icons-ivy-rich-mode 1) (all-the-icons-ivy-rich-mode 1)
@ -22,30 +25,16 @@
;; Reemplazar y buscar mejorado ;; Reemplazar y buscar mejorado
(use-package anzu (use-package anzu
:ensure t :ensure t
:straight t
:config :config
(global-anzu-mode +1) (global-anzu-mode +1)
(global-set-key [remap query-replace] 'anzu-query-replace) (global-set-key [remap query-replace] 'anzu-query-replace)
(global-set-key [remap query-replace-regexp] 'anzu-query-replace-regexp)) (global-set-key [remap query-replace-regexp] 'anzu-query-replace-regexp))
;; Auto-actualizar los paquetes
(use-package auto-package-update
:defer t
:custom
(auto-package-update-interval 7)
(auto-package-update-prompt-before-update t)
(auto-package-update-hide-results t)
:config
(auto-package-update-at-time "06:00")
:init
(setq
auto-package-update-last-update-day-filename
(expand-file-name ".last-package-update-day" private-dir))
(setq use-package-always-ensure t)
(auto-package-update-maybe))
;; Automcompletado ;; Automcompletado
(use-package company (use-package company
:defer t :defer t
:straight t
:init :init
(global-company-mode) (global-company-mode)
:config :config
@ -60,15 +49,18 @@
;; Hacer que el autocompletado se vea más bonito con íconos ;; Hacer que el autocompletado se vea más bonito con íconos
(use-package company-box (use-package company-box
:straight t
:defer t :defer t
:hook (company-mode . company-box-mode)) :init
(company-box-mode 1))
;; Usar autocompletado con ctags y company ;; Usar autocompletado con ctags y company
(use-package company-ctags :defer t) (use-package company-ctags :defer t :straight t)
;; Poner la info acerca del autocompletado del autocompletado mas rápido ;; Poner la info acerca del autocompletado del autocompletado mas rápido
(use-package company-quickhelp (use-package company-quickhelp
:defer t :defer t
:straight t
:ensure t :ensure t
:custom :custom
(company-quickhelp-delay 2) (company-quickhelp-delay 2)
@ -77,22 +69,25 @@
;; Autocompletado para shell scripting. ;; Autocompletado para shell scripting.
(use-package company-shell (use-package company-shell
:defer t :defer t
:straight t
:config :config
(add-to-list 'company-backends '(company-shell company-shell-env company-fish-shell)) (add-to-list 'company-backends '(company-shell company-shell-env company-fish-shell))
) )
;; Autocompletado para el minibuffer (counsel e ivy) ;; Autocompletado para el minibuffer (counsel e ivy)
(use-package counsel :defer t) (use-package counsel :straight t :defer t)
;; Autocompletado de proyectos en counsel (projectile) ;; Autocompletado de proyectos en counsel (projectile)
(use-package counsel-projectile (use-package counsel-projectile
:defer t :defer t
:straight t
:config :config
(counsel-projectile-mode)) (counsel-projectile-mode))
;; Un bonito y sencillo panel de inicio ;; Un bonito y sencillo panel de inicio
(use-package dashboard (use-package dashboard
:defer t :defer t
:straight t
:init :init
(dashboard-setup-startup-hook) (dashboard-setup-startup-hook)
:config :config
@ -110,6 +105,7 @@
;; Mover líneas o regiones ;; Mover líneas o regiones
(use-package drag-stuff (use-package drag-stuff
:defer t :defer t
:straight t
:init :init
(drag-stuff-global-mode 1) (drag-stuff-global-mode 1)
:config :config
@ -118,6 +114,7 @@
;; La línea bonita esa de abajo ;; La línea bonita esa de abajo
(use-package doom-modeline (use-package doom-modeline
:defer t :defer t
:straight t
:ensure t :ensure t
:init (doom-modeline-mode 1) :init (doom-modeline-mode 1)
:config :config
@ -131,29 +128,34 @@
;; Emmet - Una ayuda para escribir HTML rápidamente (escribre doc, luego preciona C-j y lo entenderás) ;; Emmet - Una ayuda para escribir HTML rápidamente (escribre doc, luego preciona C-j y lo entenderás)
(use-package emmet-mode (use-package emmet-mode
:defer t :defer t
:straight t
:hook (html-mode . emmet-mode)) :hook (html-mode . emmet-mode))
;; Revisar sintaxis en vivo ;; Revisar sintaxis en vivo
(use-package flycheck (use-package flycheck
;; :diminish flycheck-mode ;; :diminish flycheck-mode
:defer t :defer t
:straight t
:hook (after-init . global-flycheck-mode) ; Habilitar flycheck en todos los modos :hook (after-init . global-flycheck-mode) ; Habilitar flycheck en todos los modos
) )
;; Mostrar los errores de flycheck en un pop up ;; Mostrar los errores de flycheck en un pop up
(use-package flycheck-popup-tip (use-package flycheck-popup-tip
:defer t :defer t
:straight t
:hook (flycheck-mode . flycheck-popup-tip-mode)) :hook (flycheck-mode . flycheck-popup-tip-mode))
;; Git Gutter - Marca a la izq. si una linea ha sido agregada, editada o eliminada desde el último commit. ;; Git Gutter - Marca a la izq. si una linea ha sido agregada, editada o eliminada desde el último commit.
(use-package git-gutter (use-package git-gutter
:defer t :defer t
:straight t
:init :init
(global-git-gutter-mode +1)) (global-git-gutter-mode +1))
;; Highlight en los números. ;; Highlight en los números.
(use-package highlight-numbers (use-package highlight-numbers
:defer t :defer t
:straight t
:ensure t :ensure t
:hook :hook
(prog-mode . highlight-numbers-mode)) (prog-mode . highlight-numbers-mode))
@ -161,6 +163,7 @@
;; Mostrar info del panel inferior de otra manera ;; Mostrar info del panel inferior de otra manera
(use-package ivy (use-package ivy
:defer t :defer t
:straight t
:config :config
(ivy-mode 1) (ivy-mode 1)
(setq ivy-use-virtual-buffers nil) (setq ivy-use-virtual-buffers nil)
@ -168,6 +171,7 @@
(use-package ivy-rich (use-package ivy-rich
:defer t :defer t
:straight t
:ensure t :ensure t
:config :config
(ivy-rich-mode 1)) (ivy-rich-mode 1))
@ -175,32 +179,41 @@
;; Languaje server protocol ;; Languaje server protocol
(use-package lsp-mode (use-package lsp-mode
:defer t :defer t
:straight t
:custom :custom
(lsp-headerline-breadcrumb-enable nil) (lsp-headerline-breadcrumb-enable nil)
:config :config
(setq lsp-completion-provider :none)) (setq lsp-completion-provider :none))
;; Interface para lsp ;; Interface para lsp
(use-package lsp-ui :defer t) (use-package lsp-ui
:defer t
:straight t)
;; Magia para git ;; Magia para git
(use-package magit :defer t) (use-package magit
:defer t
:straight t)
;; Modo markdown ;; Modo markdown
(use-package markdown-mode :defer t) (use-package markdown-mode
:defer t
:straight t)
;; Multiple vterm ;; Multiple vterm
(use-package multi-vterm :ensure t :defer t) (use-package multi-vterm :ensure t :defer t :straight t)
;; Code Folding ;; Code Folding
(use-package origami (use-package origami
:defer t :defer t
:straight t
:init :init
(global-origami-mode)) (global-origami-mode))
;; Paquete para manejo de proyectos ;; Paquete para manejo de proyectos
(use-package projectile (use-package projectile
:defer t :defer t
:straight t
:diminish projectile-mode :diminish projectile-mode
:custom ((projectile-completion-system 'ivy)) :custom ((projectile-completion-system 'ivy))
:init :init
@ -234,6 +247,7 @@
;; Recentf - Guarda registro de los archivos abiertos recientemente ;; Recentf - Guarda registro de los archivos abiertos recientemente
(use-package recentf (use-package recentf
:defer t :defer t
:straight t
:config :config
(setq recentf-save-file (setq recentf-save-file
(recentf-expand-file-name (concat temp-dir "/recentf"))) (recentf-expand-file-name (concat temp-dir "/recentf")))
@ -242,6 +256,7 @@
;; Guardar la posición del cursor en un archivo para volver allí cuando se lo vuelva a abrir. ;; Guardar la posición del cursor en un archivo para volver allí cuando se lo vuelva a abrir.
(use-package saveplace (use-package saveplace
:defer t :defer t
:straight t
:init :init
(save-place-mode 1) (save-place-mode 1)
:config :config
@ -250,12 +265,14 @@
;; Autocompletado de parentesis, corchetes, llaves, etc. ;; Autocompletado de parentesis, corchetes, llaves, etc.
(use-package smartparens (use-package smartparens
:defer t :defer t
:straight t
:init :init
(smartparens-global-mode t)) (smartparens-global-mode t))
;; Mejorando el scroll ;; Mejorando el scroll
(use-package smooth-scrolling (use-package smooth-scrolling
:defer t :defer t
:straight t
:init :init
(smooth-scrolling-mode 1) (smooth-scrolling-mode 1)
:config :config
@ -264,38 +281,42 @@
(setq mouse-wheel-progressive-speed nil) ; Deshabilita la velocidad progresiva del scroll (mientras más scroll haces, mas rápido va) (setq mouse-wheel-progressive-speed nil) ; Deshabilita la velocidad progresiva del scroll (mientras más scroll haces, mas rápido va)
) )
;; use-package - No necesita presentación ;; use-package - No
(use-package use-package :defer t) (use-package use-package :defer t :straight t)
;; Terminal ;; Terminal
(use-package vterm :ensure t :defer t) (use-package vterm :ensure t :defer t :straight t)
;; Cuando iniicias un atajo de teclas te muestra las posibilidades ;; Cuando iniicias un atajo de teclas te muestra las posibilidades
(use-package which-key (use-package which-key
:defer t :defer t
:straight t
:init :init
(which-key-mode)) (which-key-mode))
;; Restaurar el estado de los frames ;; Restaurar el estado de los frames
(use-package winner (use-package winner
:defer t :defer t
:straight t
:init :init
(winner-mode 1)) (winner-mode 1))
;; Permitir snippets ;; Permitir snippets
(use-package yasnippet (use-package yasnippet
:defer t :defer t
:straight t
:ensure t :ensure t
:custom :custom
(yas-prompt-functions '(yas-completing-prompt)) (yas-prompt-functions '(yas-completing-prompt))
:config
(yas-reload-all)
:hook :hook
((prog-mode feature-mode) . yas-minor-mode-on) ((prog-mode feature-mode) . yas-minor-mode-on)
(html-mode . yas-minor-mode)) (html-mode . yas-minor-mode))
;; Coleción de snippets ;; Coleción de snippets
(use-package yasnippet-snippets :ensure t :defer t) (use-package yasnippet-snippets
:ensure t
:defer t
:straight t)
;; Org-Mode ;; Org-Mode
(require 'org-config) (require 'org-config)

View File

@ -23,33 +23,47 @@
(setq package-native-compile t) (setq package-native-compile t)
)) ))
;; Instalar straight.el (reemplpazando package.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))
;; Initialize package sources ;; Initialize package sources
(require 'package) ;; (require 'package)
(setq package-archives '(("melpa" . "https://melpa.org/packages/") ;; (setq package-archives '(("melpa" . "https://melpa.org/packages/")
("org" . "https://orgmode.org/elpa/") ;; ("org" . "https://orgmode.org/elpa/")
("elpa" . "https://elpa.gnu.org/packages/"))) ;; ("elpa" . "https://elpa.gnu.org/packages/")))
(package-initialize) ;; (package-initialize)
;; Actualizar repositorios si aún no esta actualizados ;; Actualizar repositorios si aún no esta actualizados
(unless package-archive-contents ;; (unless package-archive-contents
(package-refresh-contents)) ;; (package-refresh-contents))
;; Instalar use-package si no está instalado ;; Instalar use-package si no está instalado
(unless (package-installed-p 'use-package) (straight-use-package 'use-package)
(package-install 'use-package))
;; Theme ;; Theme
(use-package dracula-theme (use-package dracula-theme
:straight t
:config :config
(load-theme 'dracula t) (load-theme 'dracula t)
(set-face-attribute 'default nil :font "Fira Code Retina" :height 112) ; Font (set-face-attribute 'default nil :font "Fira Code Retina" :height 112) ; Font
) )
;; Instalar use-package en caso de no tenerlo ;; Instalar use-package en caso de no tenerlo
(unless (package-installed-p 'use-package) ;;(unless (package-installed-p 'use-package)
(package-install 'use-package)) ;; (package-install 'use-package))
(defconst private-dir (expand-file-name "private" user-emacs-directory)) (defconst private-dir (expand-file-name "private" user-emacs-directory))
(defconst temp-dir (format "%s/cache" private-dir) (defconst temp-dir (format "%s/cache" private-dir)

View File

@ -8,6 +8,7 @@
;;; Code: ;;; Code:
(use-package go-mode (use-package go-mode
:straight t
:defer t) :defer t)
(provide 'lang-go) (provide 'lang-go)

View File

@ -9,6 +9,7 @@
(use-package js (use-package js
:defer t :defer t
:straight t
:mode :mode
("\\.js$" . js-mode) ("\\.js$" . js-mode)
:config :config
@ -17,6 +18,7 @@
;; json-mode ;; json-mode
(use-package json-mode (use-package json-mode
:defer t :defer t
:straight t
:ensure t :ensure t
:mode :mode
("\\.json$" . json-mode) ("\\.json$" . json-mode)

View File

@ -12,17 +12,19 @@
(use-package php-mode (use-package php-mode
:defer t :defer t
:hook (php-mode . lsp) :straight t
:hook (php-mode . (lambda () :hook ((php-mode . (lambda ()
(local-set-key (kbd "C-c d b") 'php-doc-block) ;; atajo para docblock (local-set-key (kbd "C-c d b") 'php-doc-block) ;; atajo para docblock
(company-mode t) ; habilita company mode (company-mode t) ; habilita company mode
;;(ac-php-core-eldoc-setup) ; habilita soporte para ELDoc ;;(ac-php-core-eldoc-setup) ; habilita soporte para ELDoc
;;(add-to-list 'company-backends '(company-capf company-ac-php-backend :with company-yasnippet)) ; Agregar ac-php para a company ;;(add-to-list 'company-backends '(company-capf company-ac-php-backend :with company-yasnippet)) ; Agregar ac-php para a company
)) ))
(php-mode . lsp)
)
) )
(use-package php-doc-block (use-package php-doc-block
:load-path (lambda() (concat private-dir "/packages/php-doc-block")) :straight (php-doc-block :type git :host github :repo "moskalyovd/emacs-php-doc-block")
) )
(provide 'lang-php) (provide 'lang-php)

View File

@ -9,12 +9,14 @@
(use-package rust-mode (use-package rust-mode
:defer t :defer t
:straight t
:ensure t :ensure t
:config :config
(setq rust-format-on-save t)) (setq rust-format-on-save t))
(use-package rustic (use-package rustic
:defer t :defer t
:straight t
:ensure t :ensure t
:config :config
;;(setq rustic-lsp-server 'rls) ;;(setq rustic-lsp-server 'rls)

View File

@ -37,7 +37,8 @@
(use-package org (use-package org
:defer t :defer t
:pin org :ensure t
:straight (:type built-in)
:hook :hook
(org-mode . kj/org-hook) (org-mode . kj/org-hook)
:config :config
@ -127,10 +128,12 @@
(use-package org-bullets (use-package org-bullets
:defer t :defer t
:straight t
:hook :hook
(org-mode . org-bullets-mode)) (org-mode . org-bullets-mode))
(use-package visual-fill-column (use-package visual-fill-column
:straight t
:config :config
;; Tamaño de la columna ;; Tamaño de la columna
(setq-default visual-fill-column-width 150) (setq-default visual-fill-column-width 150)
@ -140,6 +143,7 @@
(use-package org-roam (use-package org-roam
:defer t :defer t
:straight t
:ensure t :ensure t
:init :init
(setq org-roam-v2-ack t) (setq org-roam-v2-ack t)
@ -152,6 +156,7 @@
(use-package org-roam-ui (use-package org-roam-ui
:defer t :defer t
:straight t
:ensure t :ensure t
:config :config
(setq org-roam-ui-sync-theme t (setq org-roam-ui-sync-theme t

View File

@ -1,120 +0,0 @@
;;; php-doc-block.el --- Php DocBlock generator
;; Copyright (C) 2016 Dmitriy Moskalyov
;; Author: Dmitriy Moskalyov <moskalyovd@gmail.com>
;; Keywords: php docblock
;; Version: 0.0.1
;; URL: https://github.com/moskalyovd/emacs-php-doc-block
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; This package provides php DocBlock generator.
;; How to use:
;; Clone repository from https://github.com/moskalyovd/emacs-php-doc-block
;; and add to your .emacs(or init.el) file:
;; (add-to-list 'load-path "~/.emacs.d/emacs-php-doc-block")
;; (require 'php-doc-block)
;; Then bind command 'php-doc-block to any key you like:
;; (add-hook 'php-mode-hook
;; (lambda ()
;; (local-set-key (kbd "<C-tab>") 'php-doc-block)))
;;; Code:
(defun insert-to-prev-line-and-indent (text)
"Insert TEXT to the previous line with indentation."
(beginning-of-line)
(open-line 1)
(insert text)
(indent-according-to-mode))
(defun insert-to-next-line-and-indent (text)
"Insert TEXT to the next line with indentation."
(end-of-line)
(newline-and-indent)
(insert text)
(indent-according-to-mode))
(defun php-doc-block-var-or-attr (tag-type type name value is-nullable)
"Insert doc block for a property or an attribute"
(cond
((and value (= (string-width type) 0))
(cond
((string-match "^=\s*\\(array(.*)\\|\\[\.*\]\\)" value) (setq type "array"))
((string-match "^=\s*\[0-9\]*\\.\[0-9\]+$" value) (setq type "float"))
((string-match "^=\s*\[0-9\]+$" value) (setq type "int"))
((string-match "^=\s*\['\"]" value) (setq type "string"))
((string-match "^=\s*\\(true\\|false\\)" value) (setq type "bool"))))
((and (= (string-width type) 0) (not value))
(setq type "mixed")))
(when (equal is-nullable "?")
(setq type (concat type "|null")))
(insert-to-next-line-and-indent (concat "* @" tag-type " " type " " name)))
(defun php-doc-block-function (name arguments return-type is-return-nullable)
"Insert php docblock for function"
(insert-to-next-line-and-indent (concat "* " name))
(when (> (string-width arguments) 0)
(insert-to-next-line-and-indent "*")
(dolist (arg (split-string arguments "\s*,\s*"))
(string-match "\s*\\(\[\?\]?\\)\s*\\(\[\\\]?\[a-zA-Z0-9_\]*\\)?\s*\\($\[a-zA-Z0-9_\]+\\)\s*\\(=.*\\)?" arg)
(php-doc-block-var-or-attr "param" (match-string 2 arg) (match-string 3 arg) (match-string 4 arg) (match-string 1 arg))))
(when (> (string-width return-type) 0)
(insert-to-next-line-and-indent "*")
(when (equal is-return-nullable "?")
(setq return-type (concat return-type "|null")))
(insert-to-next-line-and-indent (concat "* @return " return-type))))
(defun php-doc-block-class (type name)
"Insert php doc block for class, interface etc."
(insert-to-next-line-and-indent (concat "* " name " " type)))
(defun php-doc-block ()
"Insert php docblock."
(interactive)
(let ((line (thing-at-point 'line)))
(insert-to-prev-line-and-indent "/**")
(cond
((string-match "function\s*" line)
(beginning-of-line)
(let ((line (thing-at-point 'line)) (func-defun "") (s-point (point)) (e-point (re-search-forward ";\\|{" nil '(nil))))
(goto-char s-point)
(if e-point
(setq func-defun (replace-regexp-in-string "{\\|\n" "" (buffer-substring s-point e-point)))
(progn
(end-of-line)
(setq func-defun (buffer-substring s-point (point))))
)
(when (string-match "function\s+\\([A-Za-z0-9_]+\\)\s*(\\(.*\\))\s*:*\s*\\(\[\?\]?\\)\s*\\(\[A-Za-z0-9_\\\]*\\)" func-defun)
(php-doc-block-function (match-string 1 func-defun) (match-string 2 func-defun) (match-string 4 func-defun) (match-string 3 func-defun)))))
((string-match "\s*\\([a-zA-Z0-9_]+\\)?\s*\\($\[a-zA-Z0-9_\]+\\)\s*\\(=\[^;\]*\\)?" line)
(php-doc-block-var-or-attr "var" "" (match-string 2 line) (match-string 3 line) ""))
((string-match "\\(class\\|interface\\|trait\\|abstract class\\)\s+\\(\[a-zA-Z0-9_\]+\\)" line)
(php-doc-block-class (match-string 1 line) (match-string 2 line))))
(insert-to-next-line-and-indent "*/")))
(provide 'php-doc-block)
;;; php-doc-block.el ends here