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
transient
eln-cache
private/.*
private/cache
private/
bookmarks
.lsp-session*
projectile-bookmarks.eld
@ -10,4 +9,5 @@ projectile-bookmarks.eld
org-roam.db
lsp-cache/
.cache/
url/
url/
straight/

View File

@ -8,11 +8,14 @@
;;; Code:
;; 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)
(use-package all-the-icons-ivy-rich
:defer t
:straight t
:ensure t
:init
(all-the-icons-ivy-rich-mode 1)
@ -22,30 +25,16 @@
;; Reemplazar y buscar mejorado
(use-package anzu
:ensure t
:straight t
:config
(global-anzu-mode +1)
(global-set-key [remap query-replace] 'anzu-query-replace)
(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
(use-package company
:defer t
:straight t
:init
(global-company-mode)
:config
@ -60,15 +49,18 @@
;; Hacer que el autocompletado se vea más bonito con íconos
(use-package company-box
:straight t
:defer t
:hook (company-mode . company-box-mode))
:init
(company-box-mode 1))
;; 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
(use-package company-quickhelp
:defer t
:straight t
:ensure t
:custom
(company-quickhelp-delay 2)
@ -77,22 +69,25 @@
;; Autocompletado para shell scripting.
(use-package company-shell
:defer t
:straight t
:config
(add-to-list 'company-backends '(company-shell company-shell-env company-fish-shell))
)
;; 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)
(use-package counsel-projectile
:defer t
:straight t
:config
(counsel-projectile-mode))
;; Un bonito y sencillo panel de inicio
(use-package dashboard
:defer t
:straight t
:init
(dashboard-setup-startup-hook)
:config
@ -110,6 +105,7 @@
;; Mover líneas o regiones
(use-package drag-stuff
:defer t
:straight t
:init
(drag-stuff-global-mode 1)
:config
@ -118,6 +114,7 @@
;; La línea bonita esa de abajo
(use-package doom-modeline
:defer t
:straight t
:ensure t
:init (doom-modeline-mode 1)
:config
@ -131,29 +128,34 @@
;; Emmet - Una ayuda para escribir HTML rápidamente (escribre doc, luego preciona C-j y lo entenderás)
(use-package emmet-mode
:defer t
:straight t
:hook (html-mode . emmet-mode))
;; Revisar sintaxis en vivo
(use-package flycheck
;; :diminish flycheck-mode
:defer t
:straight t
:hook (after-init . global-flycheck-mode) ; Habilitar flycheck en todos los modos
)
;; Mostrar los errores de flycheck en un pop up
(use-package flycheck-popup-tip
:defer t
:straight t
: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.
(use-package git-gutter
:defer t
:straight t
:init
(global-git-gutter-mode +1))
;; Highlight en los números.
(use-package highlight-numbers
:defer t
:straight t
:ensure t
:hook
(prog-mode . highlight-numbers-mode))
@ -161,6 +163,7 @@
;; Mostrar info del panel inferior de otra manera
(use-package ivy
:defer t
:straight t
:config
(ivy-mode 1)
(setq ivy-use-virtual-buffers nil)
@ -168,6 +171,7 @@
(use-package ivy-rich
:defer t
:straight t
:ensure t
:config
(ivy-rich-mode 1))
@ -175,32 +179,41 @@
;; Languaje server protocol
(use-package lsp-mode
:defer t
:straight t
:custom
(lsp-headerline-breadcrumb-enable nil)
:config
(setq lsp-completion-provider :none))
;; Interface para lsp
(use-package lsp-ui :defer t)
(use-package lsp-ui
:defer t
:straight t)
;; Magia para git
(use-package magit :defer t)
(use-package magit
:defer t
:straight t)
;; Modo markdown
(use-package markdown-mode :defer t)
(use-package markdown-mode
:defer t
:straight t)
;; Multiple vterm
(use-package multi-vterm :ensure t :defer t)
(use-package multi-vterm :ensure t :defer t :straight t)
;; Code Folding
(use-package origami
:defer t
:straight t
:init
(global-origami-mode))
;; Paquete para manejo de proyectos
(use-package projectile
:defer t
:straight t
:diminish projectile-mode
:custom ((projectile-completion-system 'ivy))
:init
@ -234,6 +247,7 @@
;; Recentf - Guarda registro de los archivos abiertos recientemente
(use-package recentf
:defer t
:straight t
:config
(setq recentf-save-file
(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.
(use-package saveplace
:defer t
:straight t
:init
(save-place-mode 1)
:config
@ -250,12 +265,14 @@
;; Autocompletado de parentesis, corchetes, llaves, etc.
(use-package smartparens
:defer t
:straight t
:init
(smartparens-global-mode t))
;; Mejorando el scroll
(use-package smooth-scrolling
:defer t
:straight t
:init
(smooth-scrolling-mode 1)
: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)
)
;; use-package - No necesita presentación
(use-package use-package :defer t)
;; use-package - No
(use-package use-package :defer t :straight t)
;; 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
(use-package which-key
:defer t
:straight t
:init
(which-key-mode))
;; Restaurar el estado de los frames
(use-package winner
:defer t
:straight t
:init
(winner-mode 1))
;; Permitir snippets
(use-package yasnippet
:defer t
:straight t
:ensure t
:custom
(yas-prompt-functions '(yas-completing-prompt))
:config
(yas-reload-all)
:hook
((prog-mode feature-mode) . yas-minor-mode-on)
(html-mode . yas-minor-mode))
;; Coleción de snippets
(use-package yasnippet-snippets :ensure t :defer t)
(use-package yasnippet-snippets
:ensure t
:defer t
:straight t)
;; Org-Mode
(require 'org-config)

View File

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

View File

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

View File

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

View File

@ -12,17 +12,19 @@
(use-package php-mode
:defer t
:hook (php-mode . lsp)
:hook (php-mode . (lambda ()
:straight t
:hook ((php-mode . (lambda ()
(local-set-key (kbd "C-c d b") 'php-doc-block) ;; atajo para docblock
(company-mode t) ; habilita company mode
;;(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
))
(php-mode . lsp)
)
)
(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)

View File

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

View File

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