Compare commits

..

No commits in common. "a1aab4a3fc726dab044567e514be3195848c141e" and "954cfe64c7713759a479a1ccf86f9e6b1dcced68" have entirely different histories.

4 changed files with 106 additions and 32 deletions

View File

@ -100,8 +100,8 @@
;; Otros atajos ;; Otros atajos
(evil-define-key 'motion 'global (kbd "<leader>xb") 'consult-buffer) ;; Cambiar de buffer (evil-define-key 'motion 'global (kbd "<leader>xb") 'consult-buffer) ;; Cambiar de buffer
(evil-define-key 'motion 'global (kbd "<leader>xp") 'consult-project-extra-find) ;; Archivos del proyecto (o abrir proyecto si no hay alguno) (evil-define-key 'motion 'global (kbd "<leader>xp") 'consult-projectile) ;; Archivos del proyecto (o abrir proyecto si no hay alguno)
(evil-define-key 'motion 'global (kbd "<leader>cp") 'project-switch-project) ;; Cambiar proyecto (evil-define-key 'motion 'global (kbd "<leader>cp") 'projectile-switch-project) ;; Cambiar proyecto
(evil-define-key 'motion 'global (kbd "<leader>xf") 'find-file) ;; Abrir archivo (evil-define-key 'motion 'global (kbd "<leader>xf") 'find-file) ;; Abrir archivo
(evil-define-key 'motion 'global (kbd "<leader>xr") 'consult-recent-file) ;; Lista de archivos recientes (evil-define-key 'motion 'global (kbd "<leader>xr") 'consult-recent-file) ;; Lista de archivos recientes
(evil-define-key 'motion 'global (kbd "<leader>rg") 'consult-ripgrep) ;; Búsqueda rápida con ripgrep (evil-define-key 'motion 'global (kbd "<leader>rg") 'consult-ripgrep) ;; Búsqueda rápida con ripgrep

View File

@ -45,8 +45,7 @@
("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame ("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
("C-x r b" . consult-bookmark) ;; orig. bookmark-jump ("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
("C-c p b" . consult-project-buffer) ;; orig. project-switch-to-buffer ("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
("C-c p p" . project-switch-project) ;; orig. project-switch-to-buffer
;; Custom M-# bindings for fast register access ;; Custom M-# bindings for fast register access
("M-#" . consult-register-load) ("M-#" . consult-register-load)
("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated) ("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
@ -63,10 +62,14 @@
("M-g i" . consult-imenu) ("M-g i" . consult-imenu)
("M-g I" . consult-imenu-multi) ("M-g I" . consult-imenu-multi)
;; M-s bindings in `search-map' ;; M-s bindings in `search-map'
("M-s f" . consult-find) ("M-s d" . consult-find)
("M-s l" . consult-locate) ("M-s D" . consult-locate)
("M-s L" . consult-line-multi) ("M-s L" . consult-line-multi)
("M-s k" . consult-keep-lines) ("M-s k" . consult-keep-lines)
("M-s u" . consult-focus-lines)
;; Isearch integration
:map isearch-mode-map
("M-e" . consult-isearch-history) ;; orig. isearch-edit-string
;; Minibuffer history ;; Minibuffer history
:map minibuffer-local-map :map minibuffer-local-map
@ -127,12 +130,10 @@
:defer t :defer t
:hook (ibuffer-mode . nerd-icons-ibuffer-mode)) :hook (ibuffer-mode . nerd-icons-ibuffer-mode))
;; Integración entre consult y project ;; Integración entre consult y projectile
(use-package consult-project-extra (use-package consult-projectile
:ensure t :defer t
:bind :bind ("C-x p" . consult-projectile))
(("C-x p" . consult-project-extra-find)
("C-c p o" . consult-project-extra-find-other-window)))
;; Descripciones en el minibufer ;; Descripciones en el minibufer
(use-package marginalia (use-package marginalia

View File

@ -262,37 +262,46 @@
(use-package prettier (use-package prettier
:defer t) :defer t)
(use-package project ;; Paquete para manejo de proyectos
(use-package projectile
:defer t :defer t
:ensure nil :bind ("C-c p" . projectile-command-map)
:hook (elpaca-after-init . projectile-mode)
:init
(setq projectile-mode-line-prefix ""
projectile-sort-order 'recentf
projectile-use-git-grep t)
:config :config
;; Rutas de archivos temporales.
(setq projectile-cache-file (expand-file-name "projectile.cache" temp-dir))
(setq projectile-known-projects-file (expand-file-name
"projectile-bookmarks.eld" temp-dir))
(defun kj/project-name (&optional project) ;; Cambiar el título de la ventana de emacs
"Return the name for PROJECT.
If PROJECT is not specified, assume current project root."
(when-let (root (or project (kj/project-root)))
(file-name-nondirectory
(directory-file-name
(file-name-directory root)))))
(defun kj/project-root ()
"Return the current project root."
(when-let (project (project-current))
(project-root project)))
;; Colocamos un título del frame más bonito y útil que el por defecto
(setq frame-title-format (setq frame-title-format
'( '(
(:eval (:eval
(let ((project-name (kj/project-name))) (let ((project-name (projectile-project-name)))
(unless (null project-name) (unless (string= "-" project-name)
(format "[%s] " project-name)))) (format "[%s] " project-name))))
"%b" "%b"
" - Emacs") " - Emacs")
) )
)
(defun projectile-desktop-save-hook ()
"Nombres de los archivos de desktop-save según el nombre del proyecto."
(setq desktop-hash
(secure-hash 'md5 (concat (projectile-project-root))))
(setq
desktop-base-file-name (concat ".emacs-" desktop-hash ".desktop")
desktop-base-lock-name (concat ".emacs-" desktop-hash ".desktop" ".lock"))
)
(add-hook 'projectile-after-switch-project-hook #'projectile-desktop-save-hook)
)
;; 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
@ -308,6 +317,7 @@ If PROJECT is not specified, assume current project root."
;; Busqueda rápida con ripgrep ;; Busqueda rápida con ripgrep
(use-package rg (use-package rg
:defer t :defer t
:defines projectile-command-map
:hook (elpaca-after-init . rg-enable-default-bindings) :hook (elpaca-after-init . rg-enable-default-bindings)
:bind (:map rg-global-map :bind (:map rg-global-map
("c" . rg-dwim-current-dir) ("c" . rg-dwim-current-dir)
@ -316,7 +326,10 @@ If PROJECT is not specified, assume current project root."
:init (setq rg-group-result t :init (setq rg-group-result t
rg-show-columns t) rg-show-columns t)
:config :config
(cl-pushnew '("tmpl" . "*.tmpl") rg-custom-type-aliases)) (cl-pushnew '("tmpl" . "*.tmpl") rg-custom-type-aliases)
(with-eval-after-load 'projectile
(bind-key "s R" #'rg-project projectile-command-map)))
;; 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

60
configs/init-treemacs.el Normal file
View File

@ -0,0 +1,60 @@
;;; init-treemacs.el --- Extensiones/paquetes instalados y su configuración -*- lexical-binding: t -*-
;; Author: kj <webmaster@outcontrol.net>
;; URL: https://git.kj2.me/kj/confi-emacs-actual
;;; Commentary:
;; Aquí se encuentran las configuraciones y paquetes relacionados
;; con treemacs.
;;
;; treemacs es esa barra lateral con los archivos en modo árbol.
;;; Code:
(use-package treemacs
:defer t
:commands (treemacs-follow-mode
treemacs-filewatch-mode
treemacs-fringe-indicator-mode
treemacs-git-mode)
:custom-face
(cfrs-border-color ((t (:background ,(face-foreground 'font-lock-comment-face nil t)))))
:bind (([f9] . treemacs)
([f8] . treemacs-display-current-project-exclusively)
:map treemacs-mode-map
([mouse-1] . treemacs-single-click-expand-action))
:config
(setq treemacs-collapse-dirs (if treemacs-python-executable 3 0)
treemacs-missing-project-action 'remove
treemacs-sorting 'alphabetic-asc
treemacs-follow-after-init t
treemacs-width 30)
:config
(treemacs-follow-mode t)
(treemacs-filewatch-mode t)
(pcase (cons (not (null (executable-find "git")))
(not (null (executable-find "python3"))))
(`(t . t)
(treemacs-git-mode 'deferred))
(`(t . _)
(treemacs-git-mode 'simple))))
(use-package treemacs-projectile
:defer t
:after (treemacs projectile)
:bind (:map projectile-command-map
("h" . treemacs-projectile)))
(use-package treemacs-magit
:defer t
:after magit
:commands treemacs-magit--schedule-update
:hook ((magit-post-commit
git-commit-post-finish
magit-post-stage
magit-post-unstage)
. treemacs-magit--schedule-update))
(provide 'init-treemacs)
;;; init-treemacs.el ends here