Mixed changes.
- Rename org-config.el to base-org.el. - Enable lsp by default. - Improve lsp. - Add citre package (ctags IDE). - Add ripgrep search. - Add pomidor (pomodoro timer). - Move keybinding for improve load time (some are deleted or changed). - Add C-x C-r keybinding for recent files. - And more...
This commit is contained in:
parent
7ee9bd4492
commit
a7045d3b30
6
.gitignore
vendored
6
.gitignore
vendored
@ -10,4 +10,8 @@ org-roam.db
|
||||
lsp-cache/
|
||||
.cache/
|
||||
url/
|
||||
straight/
|
||||
straight/
|
||||
amx-items
|
||||
projects
|
||||
speed-type/
|
||||
var/
|
350
configs/base-company.el
Normal file
350
configs/base-company.el
Normal file
@ -0,0 +1,350 @@
|
||||
;;; base-company.el --- Autocompletado con company-mode -*- lexical-binding: t -*-
|
||||
|
||||
;; Author: kj <webmaster@outcontrol.net>
|
||||
;; URL: https://git.kj2.me/kj/confi-emacs-actual
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(use-package company
|
||||
:defer t
|
||||
:straight t
|
||||
:defines (company-dabbrev-ignore-case company-dabbrev-downcase)
|
||||
:custom-face
|
||||
(company-tooltip-annotation ((t (:inherit completions-annotations :foreground nil))))
|
||||
(company-box-selection ((t (:inherit company-tooltip :weight semibold :extend t))))
|
||||
:hook (after-init . global-company-mode)
|
||||
:bind (
|
||||
:map company-active-map
|
||||
("<tab>" . company-indent-or-complete-common) ; Completar con tab como en la terminal de linux
|
||||
("<escape>" . company-abort) ; Cerrar company con ESC
|
||||
)
|
||||
:init
|
||||
(setq company-tooltip-align-annotations t
|
||||
company-tooltip-limit 12
|
||||
company-idle-delay 0 ; mostrar autocompletado lo más rápido posible
|
||||
company-echo-delay (if (display-graphic-p) nil 0)
|
||||
company-minimum-prefix-length 1 ; mostrar autocompletado desde que se coloca la primera letra.
|
||||
company-icon-margin 3
|
||||
company-require-match nil
|
||||
company-dabbrev-ignore-case nil
|
||||
company-dabbrev-downcase nil ; autocompletado case-sensitive.
|
||||
company-global-modes '(not erc-mode message-mode help-mode
|
||||
gud-mode eshell-mode shell-mode)
|
||||
company-backends '((company-capf :with company-yasnippet)
|
||||
(company-dabbrev-code company-keywords company-files)
|
||||
company-dabbrev))
|
||||
:config
|
||||
(with-no-warnings
|
||||
;; Company anywhere
|
||||
;; @see https://github.com/zk-phi/company-anywhere
|
||||
(defun company-anywhere-after-finish (completion)
|
||||
(when (and (stringp completion)
|
||||
(looking-at "\\(?:\\sw\\|\\s_\\)+")
|
||||
(save-match-data
|
||||
(string-match (regexp-quote (match-string 0)) completion)))
|
||||
(delete-region (match-beginning 0) (match-end 0))))
|
||||
(add-hook 'company-after-completion-hook 'company-anywhere-after-finish)
|
||||
|
||||
(defun company-anywhere-grab-word (_)
|
||||
(buffer-substring (point) (save-excursion (skip-syntax-backward "w") (point))))
|
||||
(advice-add 'company-grab-word :around 'company-anywhere-grab-word)
|
||||
|
||||
(defun company-anywhere-grab-symbol (_)
|
||||
(buffer-substring (point) (save-excursion (skip-syntax-backward "w_") (point))))
|
||||
(advice-add 'company-grab-symbol :around 'company-anywhere-grab-symbol)
|
||||
|
||||
(defun company-anywhere-dabbrev-prefix (_)
|
||||
(company-grab-line (format "\\(?:^\\| \\)[^ ]*?\\(\\(?:%s\\)*\\)" company-dabbrev-char-regexp) 1))
|
||||
(advice-add 'company-dabbrev--prefix :around 'company-anywhere-dabbrev-prefix)
|
||||
|
||||
(defun company-anywhere-capf (fn command &rest args)
|
||||
(if (eq command 'prefix)
|
||||
(let ((res (company--capf-data)))
|
||||
(when res
|
||||
(let ((length (plist-get (nthcdr 4 res) :company-prefix-length))
|
||||
(prefix (buffer-substring-no-properties (nth 1 res) (point))))
|
||||
(cond
|
||||
(length (cons prefix length))
|
||||
(t prefix)))))
|
||||
(apply fn command args)))
|
||||
(advice-add 'company-capf :around 'company-anywhere-capf)
|
||||
|
||||
(defun company-anywhere-preview-show-at-point (pos completion)
|
||||
(when (and (save-excursion
|
||||
(goto-char pos)
|
||||
(looking-at "\\(?:\\sw\\|\\s_\\)+"))
|
||||
(save-match-data
|
||||
(string-match (regexp-quote (match-string 0)) completion)))
|
||||
(move-overlay company-preview-overlay (overlay-start company-preview-overlay) (match-end 0))
|
||||
(let ((after-string (overlay-get company-preview-overlay 'after-string)))
|
||||
(when after-string
|
||||
(overlay-put company-preview-overlay 'display after-string)
|
||||
(overlay-put company-preview-overlay 'after-string nil)))))
|
||||
(advice-add 'company-preview-show-at-point :after 'company-anywhere-preview-show-at-point)
|
||||
|
||||
;; `yasnippet' integration
|
||||
(with-eval-after-load 'yasnippet
|
||||
(defun my-company-yasnippet ()
|
||||
"Hide the current completeions and show snippets."
|
||||
(interactive)
|
||||
(company-cancel)
|
||||
(call-interactively 'company-yasnippet))
|
||||
|
||||
(defun company-backend-with-yas (backend)
|
||||
"Add `yasnippet' to company backend."
|
||||
(if (and (listp backend) (member 'company-yasnippet backend))
|
||||
backend
|
||||
(append (if (consp backend) backend (list backend))
|
||||
'(:with company-yasnippet))))
|
||||
|
||||
(defun my-company-enbale-yas (&rest _)
|
||||
"Enable `yasnippet' in `company'."
|
||||
(setq company-backends (mapcar #'company-backend-with-yas company-backends)))
|
||||
|
||||
(defun my-lsp-fix-company-capf ()
|
||||
"Remove redundant `comapny-capf'."
|
||||
(setq company-backends
|
||||
(remove 'company-backends (remq 'company-capf company-backends))))
|
||||
(advice-add #'lsp-completion--enable :after #'my-lsp-fix-company-capf)
|
||||
|
||||
(defun my-company-yasnippet-disable-inline (fn cmd &optional arg &rest _ignore)
|
||||
"Enable yasnippet but disable it inline."
|
||||
(if (eq cmd 'prefix)
|
||||
(when-let ((prefix (funcall fn 'prefix)))
|
||||
(unless (memq (char-before (- (point) (length prefix)))
|
||||
'(?. ?< ?> ?\( ?\) ?\[ ?{ ?} ?\" ?' ?`))
|
||||
prefix))
|
||||
(progn
|
||||
(when (and (bound-and-true-p lsp-mode)
|
||||
arg (not (get-text-property 0 'yas-annotation-patch arg)))
|
||||
(let* ((name (get-text-property 0 'yas-annotation arg))
|
||||
(snip (format "%s (Snippet)" name))
|
||||
(len (length arg)))
|
||||
(put-text-property 0 len 'yas-annotation snip arg)
|
||||
(put-text-property 0 len 'yas-annotation-patch t arg)))
|
||||
(funcall fn cmd arg))))
|
||||
(advice-add #'company-yasnippet :around #'my-company-yasnippet-disable-inline))
|
||||
))
|
||||
|
||||
|
||||
;; Better sorting
|
||||
(use-package prescient
|
||||
:defer t
|
||||
:straight t
|
||||
:commands prescient-persist-mode)
|
||||
|
||||
(use-package company-prescient
|
||||
:defer t
|
||||
:straight t
|
||||
:hook (after-init . company-prescient-mode))
|
||||
|
||||
;; Hacer que el autocompletado se vea más bonito con íconos
|
||||
(use-package company-box
|
||||
:defer t
|
||||
:straight t
|
||||
:diminish
|
||||
:defines company-box-icons-all-the-icons
|
||||
:hook (company-mode . company-box-mode)
|
||||
:init (setq company-box-backends-colors nil
|
||||
company-box-doc-delay 0.1
|
||||
company-box-scrollbar 'right)
|
||||
:config
|
||||
(with-no-warnings
|
||||
;; Prettify icons
|
||||
(defun my-company-box-icons--elisp (candidate)
|
||||
(when (or (derived-mode-p 'emacs-lisp-mode) (derived-mode-p 'lisp-mode))
|
||||
(let ((sym (intern candidate)))
|
||||
(cond ((fboundp sym) 'Function)
|
||||
((featurep sym) 'Module)
|
||||
((facep sym) 'Color)
|
||||
((boundp sym) 'Variable)
|
||||
((symbolp sym) 'Text)
|
||||
(t . nil)))))
|
||||
(advice-add #'company-box-icons--elisp :override #'my-company-box-icons--elisp)
|
||||
|
||||
;; Display borders and optimize performance
|
||||
(defun my-company-box--display (string on-update)
|
||||
"Display the completions."
|
||||
(company-box--render-buffer string on-update)
|
||||
|
||||
(let ((frame (company-box--get-frame))
|
||||
(border-color (face-foreground 'font-lock-comment-face nil t)))
|
||||
(unless frame
|
||||
(setq frame (company-box--make-frame))
|
||||
(company-box--set-frame frame))
|
||||
(company-box--compute-frame-position frame)
|
||||
(company-box--move-selection t)
|
||||
(company-box--update-frame-position frame)
|
||||
(unless (frame-visible-p frame)
|
||||
(make-frame-visible frame))
|
||||
(company-box--update-scrollbar frame t)
|
||||
(set-face-background 'internal-border border-color frame)
|
||||
(when (facep 'child-frame-border)
|
||||
(set-face-background 'child-frame-border border-color frame)))
|
||||
(with-current-buffer (company-box--get-buffer)
|
||||
(company-box--maybe-move-number (or company-box--last-start 1))))
|
||||
(advice-add #'company-box--display :override #'my-company-box--display)
|
||||
|
||||
(setq company-box-doc-frame-parameters '((vertical-scroll-bars . nil)
|
||||
(horizontal-scroll-bars . nil)
|
||||
(internal-border-width . 1)
|
||||
(left-fringe . 8)
|
||||
(right-fringe . 8)))
|
||||
|
||||
(defun my-company-box-doc--make-buffer (object)
|
||||
(let* ((buffer-list-update-hook nil)
|
||||
(inhibit-modification-hooks t)
|
||||
(string (cond ((stringp object) object)
|
||||
((bufferp object) (with-current-buffer object (buffer-string))))))
|
||||
(when (and string (> (length (string-trim string)) 0))
|
||||
(with-current-buffer (company-box--get-buffer "doc")
|
||||
(erase-buffer)
|
||||
(insert (propertize "\n" 'face '(:height 0.5)))
|
||||
(insert string)
|
||||
(insert (propertize "\n\n" 'face '(:height 0.5)))
|
||||
|
||||
;; Handle hr lines of markdown
|
||||
;; @see `lsp-ui-doc--handle-hr-lines'
|
||||
(let (bolp next before after)
|
||||
(goto-char 1)
|
||||
(while (setq next (next-single-property-change (or next 1) 'markdown-hr))
|
||||
(when (get-text-property next 'markdown-hr)
|
||||
(goto-char next)
|
||||
(setq bolp (bolp)
|
||||
before (char-before))
|
||||
(delete-region (point) (save-excursion (forward-visible-line 1) (point)))
|
||||
(setq after (char-after (1+ (point))))
|
||||
(insert
|
||||
(concat
|
||||
(and bolp (not (equal before ?\n)) (propertize "\n" 'face '(:height 0.5)))
|
||||
(propertize "\n" 'face '(:height 0.5))
|
||||
(propertize " "
|
||||
'display '(space :height (1))
|
||||
'company-box-doc--replace-hr t
|
||||
'face `(:background ,(face-foreground 'font-lock-comment-face)))
|
||||
(propertize " " 'display '(space :height (1)))
|
||||
(and (not (equal after ?\n)) (propertize " \n" 'face '(:height 0.5))))))))
|
||||
|
||||
(setq mode-line-format nil
|
||||
display-line-numbers nil
|
||||
header-line-format nil
|
||||
show-trailing-whitespace nil
|
||||
cursor-in-non-selected-windows nil)
|
||||
(current-buffer)))))
|
||||
(advice-add #'company-box-doc--make-buffer :override #'my-company-box-doc--make-buffer)
|
||||
|
||||
;; Display the border and fix the markdown header properties
|
||||
(defun my-company-box-doc--show (selection frame)
|
||||
(cl-letf (((symbol-function 'completing-read) #'company-box-completing-read)
|
||||
(window-configuration-change-hook nil)
|
||||
(inhibit-redisplay t)
|
||||
(display-buffer-alist nil)
|
||||
(buffer-list-update-hook nil))
|
||||
(-when-let* ((valid-state (and (eq (selected-frame) frame)
|
||||
company-box--bottom
|
||||
company-selection
|
||||
(company-box--get-frame)
|
||||
(frame-visible-p (company-box--get-frame))))
|
||||
(candidate (nth selection company-candidates))
|
||||
(doc (or (company-call-backend 'quickhelp-string candidate)
|
||||
(company-box-doc--fetch-doc-buffer candidate)))
|
||||
(doc (company-box-doc--make-buffer doc)))
|
||||
(let ((frame (frame-local-getq company-box-doc-frame))
|
||||
(border-color (face-foreground 'font-lock-comment-face nil t)))
|
||||
(unless (frame-live-p frame)
|
||||
(setq frame (company-box-doc--make-frame doc))
|
||||
(frame-local-setq company-box-doc-frame frame))
|
||||
(set-face-background 'internal-border border-color frame)
|
||||
(when (facep 'child-frame-border)
|
||||
(set-face-background 'child-frame-border border-color frame))
|
||||
(company-box-doc--set-frame-position frame)
|
||||
|
||||
;; Fix hr props. @see `lsp-ui-doc--fix-hr-props'
|
||||
(with-current-buffer (company-box--get-buffer "doc")
|
||||
(let (next)
|
||||
(while (setq next (next-single-property-change (or next 1) 'company-box-doc--replace-hr))
|
||||
(when (get-text-property next 'company-box-doc--replace-hr)
|
||||
(put-text-property next (1+ next) 'display
|
||||
'(space :align-to (- right-fringe 1) :height (1)))
|
||||
(put-text-property (1+ next) (+ next 2) 'display
|
||||
'(space :align-to right-fringe :height (1)))))))
|
||||
|
||||
(unless (frame-visible-p frame)
|
||||
(make-frame-visible frame))))))
|
||||
(advice-add #'company-box-doc--show :override #'my-company-box-doc--show)
|
||||
|
||||
(defun my-company-box-doc--set-frame-position (frame)
|
||||
(-let* ((frame-resize-pixelwise t)
|
||||
|
||||
(box-frame (company-box--get-frame))
|
||||
(box-position (frame-position box-frame))
|
||||
(box-width (frame-pixel-width box-frame))
|
||||
(box-height (frame-pixel-height box-frame))
|
||||
(box-border-width (frame-border-width box-frame))
|
||||
|
||||
(window (frame-root-window frame))
|
||||
((text-width . text-height) (window-text-pixel-size window nil nil
|
||||
(/ (frame-pixel-width) 2)
|
||||
(/ (frame-pixel-height) 2)))
|
||||
(border-width (or (alist-get 'internal-border-width company-box-doc-frame-parameters) 0))
|
||||
|
||||
(x (- (+ (car box-position) box-width) border-width))
|
||||
(space-right (- (frame-pixel-width) x))
|
||||
(space-left (car box-position))
|
||||
(fringe-left (or (alist-get 'left-fringe company-box-doc-frame-parameters) 0))
|
||||
(fringe-right (or (alist-get 'right-fringe company-box-doc-frame-parameters) 0))
|
||||
(width (+ text-width border-width fringe-left fringe-right))
|
||||
(x (if (> width space-right)
|
||||
(if (> space-left width)
|
||||
(- space-left width)
|
||||
space-left)
|
||||
x))
|
||||
(y (cdr box-position))
|
||||
(bottom (+ company-box--bottom (frame-border-width)))
|
||||
(height (+ text-height (* 2 border-width)))
|
||||
(y (cond ((= x space-left)
|
||||
(if (> (+ y box-height height) bottom)
|
||||
(+ (- y height) border-width)
|
||||
(- (+ y box-height) border-width)))
|
||||
((> (+ y height) bottom)
|
||||
(- (+ y box-height) height))
|
||||
(t y))))
|
||||
(set-frame-position frame (max x 0) (max y 0))
|
||||
(set-frame-size frame text-width text-height t)))
|
||||
(advice-add #'company-box-doc--set-frame-position :override #'my-company-box-doc--set-frame-position)
|
||||
|
||||
(when (icon-displayable-p)
|
||||
(setq company-box-icons-all-the-icons
|
||||
`((Unknown . ,(all-the-icons-material "find_in_page" :height 1.0 :v-adjust -0.2))
|
||||
(Text . ,(all-the-icons-faicon "text-width" :height 1.0 :v-adjust -0.02))
|
||||
(Method . ,(all-the-icons-faicon "cube" :height 1.0 :v-adjust -0.02 :face 'all-the-icons-purple))
|
||||
(Function . ,(all-the-icons-faicon "cube" :height 1.0 :v-adjust -0.02 :face 'all-the-icons-purple))
|
||||
(Constructor . ,(all-the-icons-faicon "cube" :height 1.0 :v-adjust -0.02 :face 'all-the-icons-purple))
|
||||
(Field . ,(all-the-icons-octicon "tag" :height 1.1 :v-adjust 0 :face 'all-the-icons-lblue))
|
||||
(Variable . ,(all-the-icons-octicon "tag" :height 1.1 :v-adjust 0 :face 'all-the-icons-lblue))
|
||||
(Class . ,(all-the-icons-material "settings_input_component" :height 1.0 :v-adjust -0.2 :face 'all-the-icons-orange))
|
||||
(Interface . ,(all-the-icons-material "share" :height 1.0 :v-adjust -0.2 :face 'all-the-icons-lblue))
|
||||
(Module . ,(all-the-icons-material "view_module" :height 1.0 :v-adjust -0.2 :face 'all-the-icons-lblue))
|
||||
(Property . ,(all-the-icons-faicon "wrench" :height 1.0 :v-adjust -0.02))
|
||||
(Unit . ,(all-the-icons-material "settings_system_daydream" :height 1.0 :v-adjust -0.2))
|
||||
(Value . ,(all-the-icons-material "format_align_right" :height 1.0 :v-adjust -0.2 :face 'all-the-icons-lblue))
|
||||
(Enum . ,(all-the-icons-material "storage" :height 1.0 :v-adjust -0.2 :face 'all-the-icons-orange))
|
||||
(Keyword . ,(all-the-icons-material "filter_center_focus" :height 1.0 :v-adjust -0.2))
|
||||
(Snippet . ,(all-the-icons-material "format_align_center" :height 1.0 :v-adjust -0.2))
|
||||
(Color . ,(all-the-icons-material "palette" :height 1.0 :v-adjust -0.2))
|
||||
(File . ,(all-the-icons-faicon "file-o" :height 1.0 :v-adjust -0.02))
|
||||
(Reference . ,(all-the-icons-material "collections_bookmark" :height 1.0 :v-adjust -0.2))
|
||||
(Folder . ,(all-the-icons-faicon "folder-open" :height 1.0 :v-adjust -0.02))
|
||||
(EnumMember . ,(all-the-icons-material "format_align_right" :height 1.0 :v-adjust -0.2))
|
||||
(Constant . ,(all-the-icons-faicon "square-o" :height 1.0 :v-adjust -0.1))
|
||||
(Struct . ,(all-the-icons-material "settings_input_component" :height 1.0 :v-adjust -0.2 :face 'all-the-icons-orange))
|
||||
(Event . ,(all-the-icons-octicon "zap" :height 1.0 :v-adjust 0 :face 'all-the-icons-orange))
|
||||
(Operator . ,(all-the-icons-material "control_point" :height 1.0 :v-adjust -0.2))
|
||||
(TypeParameter . ,(all-the-icons-faicon "arrows" :height 1.0 :v-adjust -0.02))
|
||||
(Template . ,(all-the-icons-material "format_align_left" :height 1.0 :v-adjust -0.2)))
|
||||
company-box-icons-alist 'company-box-icons-all-the-icons))))
|
||||
|
||||
(provide 'base-company)
|
||||
;;; base-company.el ends here
|
66
configs/base-ctags.el
Normal file
66
configs/base-ctags.el
Normal file
@ -0,0 +1,66 @@
|
||||
;;; base-ctags.el --- Configuracíón de TAGS -*- lexical-binding: t -*-
|
||||
|
||||
;; Author: kj <webmaster@outcontrol.net>
|
||||
;; URL: https://git.kj2.me/kj/confi-emacs-actual
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
;; Ctags IDE on the True Editor
|
||||
;; @see https://github.com/universal-ctags/citre#quick-start
|
||||
|
||||
(use-package citre
|
||||
:defer t
|
||||
:straight t
|
||||
:diminish
|
||||
:bind (("C-x c j" . citre-jump+)
|
||||
("C-x c k" . citre-jump-back)
|
||||
("C-x c p" . citre-peek)
|
||||
("C-x c a" . citre-ace-peek)
|
||||
("C-x c u" . citre-update-this-tags-file))
|
||||
:init
|
||||
(require 'citre-config)
|
||||
(setq citre-auto-enable-citre-mode-modes '(prog-mode))
|
||||
:config
|
||||
(with-no-warnings
|
||||
(with-eval-after-load 'projectile
|
||||
(setq citre-project-root-function #'projectile-project-root))
|
||||
|
||||
;; Integrate with `lsp-mode' and `eglot'
|
||||
(define-advice xref--create-fetcher (:around (fn &rest args) fallback)
|
||||
(let ((fetcher (apply fn args))
|
||||
(citre-fetcher
|
||||
(let ((xref-backend-functions '(citre-xref-backend t)))
|
||||
(ignore xref-backend-functions)
|
||||
(apply fn args))))
|
||||
(lambda ()
|
||||
(or (with-demoted-errors "%s, fallback to citre"
|
||||
(funcall fetcher))
|
||||
(funcall citre-fetcher)))))
|
||||
|
||||
(defun lsp-citre-capf-function ()
|
||||
"A capf backend that tries lsp first, then Citre."
|
||||
(let ((lsp-result (pcase centaur-lsp
|
||||
('lsp-mode
|
||||
(and (fboundp #'lsp-completion-at-point)
|
||||
(lsp-completion-at-point)))
|
||||
('eglot
|
||||
(and (fboundp #'eglot-completion-at-point)
|
||||
(eglot-completion-at-point))))))
|
||||
(if (and lsp-result
|
||||
(try-completion
|
||||
(buffer-substring (nth 0 lsp-result)
|
||||
(nth 1 lsp-result))
|
||||
(nth 2 lsp-result)))
|
||||
lsp-result
|
||||
(citre-completion-at-point))))
|
||||
|
||||
(defun enable-lsp-citre-capf-backend ()
|
||||
"Enable the lsp + Citre capf backend in current buffer."
|
||||
(add-hook 'completion-at-point-functions #'lsp-citre-capf-function nil t))
|
||||
|
||||
(add-hook 'citre-mode-hook #'enable-lsp-citre-capf-backend)))
|
||||
|
||||
(provide 'base-ctags)
|
||||
;;; base-ctags.el ends here
|
@ -1,4 +1,4 @@
|
||||
;;; base-extensions.el --- Extenciones/paquetes instalados y su configuración
|
||||
;;; base-extensions.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
|
||||
@ -12,84 +12,21 @@
|
||||
: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)
|
||||
:config
|
||||
(setq all-the-icons-ivy-rich-color-icon t))
|
||||
|
||||
;; Reemplazar y buscar mejorado
|
||||
;; Reemplazar mejorado
|
||||
(use-package anzu
|
||||
:defer
|
||||
:ensure t
|
||||
:straight t
|
||||
:hook (after-init . global-anzu-mode)
|
||||
: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))
|
||||
|
||||
;; Automcompletado
|
||||
(use-package company
|
||||
:defer t
|
||||
:straight t
|
||||
:init
|
||||
(global-company-mode)
|
||||
:config
|
||||
(setq company-dabbrev-downcase nil) ; autocompletado case-sensitive.
|
||||
(setq company-idle-delay 0) ; mostrar autocompletado lo más rápido posible
|
||||
(setq company-minimum-prefix-length 1) ; mostrar autocompletado desde que se coloca la primera letra.
|
||||
(setq company-backends '((company-capf :with company-yasnippet)
|
||||
(company-files :with company-yasnippet)
|
||||
(company-dabbrev-code company-ctags company-keywords :with company-yasnippet)
|
||||
(company-dabbrev :with company-yasnippet)))
|
||||
)
|
||||
|
||||
;; Hacer que el autocompletado se vea más bonito con íconos
|
||||
(use-package company-box
|
||||
:straight t
|
||||
:defer t
|
||||
:init
|
||||
(company-box-mode 1))
|
||||
|
||||
;; Usar autocompletado con ctags y company
|
||||
(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)
|
||||
(company-quickhelp-mode))
|
||||
|
||||
;; 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 :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)
|
||||
:hook (after-init . dashboard-setup-startup-hook)
|
||||
:config
|
||||
(setq dashboard-set-file-icons t)
|
||||
(setq dashboard-set-heading-icons t)
|
||||
@ -106,8 +43,8 @@
|
||||
(use-package drag-stuff
|
||||
:defer t
|
||||
:straight t
|
||||
:init
|
||||
(drag-stuff-global-mode 1)
|
||||
:hook
|
||||
(after-init . drag-stuff-global-mode)
|
||||
:config
|
||||
(drag-stuff-define-keys))
|
||||
|
||||
@ -116,7 +53,7 @@
|
||||
:defer t
|
||||
:straight t
|
||||
:ensure t
|
||||
:init (doom-modeline-mode 1)
|
||||
:hook (after-init . doom-modeline-mode)
|
||||
:config
|
||||
(setq doom-modeline-project-detection 'auto
|
||||
doom-modeline-buffer-file-name-style 'relative-from-project
|
||||
@ -149,46 +86,16 @@
|
||||
(use-package git-gutter
|
||||
:defer t
|
||||
:straight t
|
||||
:init
|
||||
(global-git-gutter-mode +1))
|
||||
:hook
|
||||
(after-init . global-git-gutter-mode))
|
||||
|
||||
;; Highlight en los números.
|
||||
(use-package highlight-numbers
|
||||
:defer t
|
||||
:straight t
|
||||
:ensure t
|
||||
:hook
|
||||
(prog-mode . highlight-numbers-mode))
|
||||
|
||||
;; 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)
|
||||
)
|
||||
|
||||
(use-package ivy-rich
|
||||
:defer t
|
||||
:straight t
|
||||
:ensure t
|
||||
:config
|
||||
(ivy-rich-mode 1))
|
||||
|
||||
;; 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
|
||||
:straight t)
|
||||
;; (use-package highlight-numbers
|
||||
;; :defer t
|
||||
;; :straight t
|
||||
;; :ensure t
|
||||
;; :hook
|
||||
;; (prog-mode . highlight-numbers-mode))
|
||||
|
||||
;; Magia para git
|
||||
(use-package magit
|
||||
@ -201,29 +108,86 @@
|
||||
:straight t)
|
||||
|
||||
;; Multiple vterm
|
||||
(use-package multi-vterm :ensure t :defer t :straight t)
|
||||
(use-package multi-vterm
|
||||
:defer t
|
||||
:straight t
|
||||
:bind* (("C-x tt" . multi-vterm-dedicated-toggle)
|
||||
("C-x tf" . multi-vterm)
|
||||
("C-x tp" . multi-vterm-project)
|
||||
;;("<tab>" . vterm-send-tab)
|
||||
)
|
||||
:ensure t)
|
||||
|
||||
;; Mecanografía
|
||||
(use-package speed-type
|
||||
:straight t
|
||||
:diminish
|
||||
:config
|
||||
(setq speed-type-gb-book-list '(46201 66867 66866 66591 57303 49063 13608 16132 17974 28430 59797 28929)
|
||||
speed-type-min-chars 500
|
||||
speed-type-max-chars 600))
|
||||
|
||||
;; Code Folding
|
||||
(use-package origami
|
||||
:defer t
|
||||
:straight t
|
||||
:bind (("C-<tab>" . origami-toggle-node)
|
||||
("C-<iso-lefttab>" . origami-toggle-all-nodes))
|
||||
:hook
|
||||
(after-init . global-origami-mode))
|
||||
|
||||
;; Pomodoro en emacs :D
|
||||
(use-package pomidor
|
||||
:defer t
|
||||
:straight t
|
||||
:bind ("<f12>" . pomidor)
|
||||
:init
|
||||
(global-origami-mode))
|
||||
;; (setq alert-default-style 'mode-line)
|
||||
(setq alert-default-style 'libnotify)
|
||||
|
||||
(with-eval-after-load 'all-the-icons
|
||||
(setq alert-severity-faces
|
||||
'((urgent . all-the-icons-red)
|
||||
(high . all-the-icons-orange)
|
||||
(moderate . all-the-icons-yellow)
|
||||
(normal . all-the-icons-green)
|
||||
(low . all-the-icons-blue)
|
||||
(trivial . all-the-icons-purple))
|
||||
alert-severity-colors
|
||||
`((urgent . ,(face-foreground 'all-the-icons-red))
|
||||
(high . ,(face-foreground 'all-the-icons-orange))
|
||||
(moderate . ,(face-foreground 'all-the-icons-yellow))
|
||||
(normal . ,(face-foreground 'all-the-icons-green))
|
||||
(low . ,(face-foreground 'all-the-icons-blue))
|
||||
(trivial . ,(face-foreground 'all-the-icons-purple)))))
|
||||
;; (setq pomidor-sound-tick nil
|
||||
;; pomidor-sound-tack nil) ; Deshabilitar el sonido de reloj de pomidor
|
||||
(setq pomidor-play-sound-file
|
||||
(lambda (file)
|
||||
(start-process "pomidor-play-sound"
|
||||
nil
|
||||
"playsound"
|
||||
file)))
|
||||
)
|
||||
|
||||
;; Paquete para manejo de proyectos
|
||||
(use-package projectile
|
||||
:defer t
|
||||
:straight t
|
||||
:bind ("C-c p" . projectile-command-map)
|
||||
:diminish projectile-mode
|
||||
:custom ((projectile-completion-system 'ivy))
|
||||
:hook (after-init . projectile-mode)
|
||||
:init
|
||||
(projectile-mode)
|
||||
(setq projectile-mode-line-prefix ""
|
||||
projectile-sort-order 'recentf
|
||||
projectile-use-git-grep t)
|
||||
: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))
|
||||
;; Carpetas donde tienes tus proyectos (deben tener un archivo .projectile o un repro git iniciado).
|
||||
;; Carpetas donde tienes tus proyectos (deben tener un archivo .projectile o un repro git inicio).
|
||||
(when (file-directory-p "~/Proyectos")
|
||||
(setq projectile-project-search-path '("~/Proyectos")))
|
||||
(when (file-directory-p "~/mnt/Nginx")
|
||||
@ -248,17 +212,35 @@
|
||||
(use-package recentf
|
||||
:defer t
|
||||
:straight t
|
||||
:bind ("C-x C-r" . recentf-open-files)
|
||||
:config
|
||||
(setq recentf-save-file
|
||||
(recentf-expand-file-name (concat temp-dir "/recentf")))
|
||||
(recentf-mode 1))
|
||||
|
||||
;; Busqueda rápida con ripgrep
|
||||
(use-package rg
|
||||
:defer t
|
||||
:straight t
|
||||
:defines projectile-command-map
|
||||
:hook (after-init . rg-enable-default-bindings)
|
||||
:bind (:map rg-global-map
|
||||
("c" . rg-dwim-current-dir)
|
||||
("f" . rg-dwim-current-file)
|
||||
("m" . rg-menu))
|
||||
:init (setq rg-group-result t
|
||||
rg-show-columns t)
|
||||
:config
|
||||
(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.
|
||||
(use-package saveplace
|
||||
:defer t
|
||||
:straight t
|
||||
:init
|
||||
(save-place-mode 1)
|
||||
:hook (after-init . save-place-mode)
|
||||
:config
|
||||
(setq save-place-file (locate-user-emacs-file (concat temp-dir "/places"))))
|
||||
|
||||
@ -266,23 +248,30 @@
|
||||
(use-package smartparens
|
||||
:defer t
|
||||
:straight t
|
||||
:init
|
||||
(smartparens-global-mode t))
|
||||
:hook (after-init . smartparens-global-mode))
|
||||
|
||||
;; Mejorando el scroll
|
||||
(use-package smooth-scrolling
|
||||
:defer t
|
||||
:straight t
|
||||
:init
|
||||
(smooth-scrolling-mode 1)
|
||||
:hook (after-init . smooth-scrolling-mode)
|
||||
:config
|
||||
(setq mouse-wheel-scroll-amount
|
||||
'(8 ((shift) . 1) ((control) . nil))) ; Cambia el scroll a 8 líneas a la vez, 1 cuando se preciona SHIFT y saltos de página cuando presionas CTRL
|
||||
(setq mouse-wheel-progressive-speed nil) ; Deshabilita la velocidad progresiva del scroll (mientras más scroll haces, mas rápido va)
|
||||
)
|
||||
|
||||
;; use-package - No
|
||||
(use-package use-package :defer t :straight t)
|
||||
(use-package tree-sitter
|
||||
:defer t
|
||||
:straight t
|
||||
:hook (after-init . global-tree-sitter-mode)
|
||||
:config
|
||||
(add-to-list 'tree-sitter-major-mode-language-alist '(rustic-mode . rust))
|
||||
)
|
||||
|
||||
(use-package tree-sitter-langs
|
||||
:straight t
|
||||
:after tree-sitter)
|
||||
|
||||
;; Terminal
|
||||
(use-package vterm :ensure t :defer t :straight t)
|
||||
@ -291,15 +280,13 @@
|
||||
(use-package which-key
|
||||
:defer t
|
||||
:straight t
|
||||
:init
|
||||
(which-key-mode))
|
||||
:hook (after-init . which-key-mode))
|
||||
|
||||
;; Restaurar el estado de los frames
|
||||
(use-package winner
|
||||
:defer t
|
||||
:straight t
|
||||
:init
|
||||
(winner-mode 1))
|
||||
:hook (after-init . winner-mode))
|
||||
|
||||
;; Permitir snippets
|
||||
(use-package yasnippet
|
||||
@ -318,8 +305,9 @@
|
||||
:defer t
|
||||
:straight t)
|
||||
|
||||
;; Org-Mode
|
||||
(require 'org-config)
|
||||
(use-package esup
|
||||
:ensure t
|
||||
:straight t)
|
||||
|
||||
(provide 'base-extensions)
|
||||
;;; base-extensions.el ends here
|
||||
|
@ -1,4 +1,4 @@
|
||||
;;; base-functions.el --- Configuración de org-mode
|
||||
;;; base-functions.el --- Configuración de org-mode -*- lexical-binding: t -*-
|
||||
|
||||
;; Author: kj <webmaster@outcontrol.net>
|
||||
;; URL: https://git.kj2.me/kj/confi-emacs-actual
|
||||
@ -21,19 +21,6 @@
|
||||
;; Borrar espacios, tabs y saltos de línea innecesarios al guardar
|
||||
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
||||
|
||||
|
||||
;; Generar archivo TAGS
|
||||
(defun create-tags (dir-name)
|
||||
"Create tags file in DIR-NAME."
|
||||
(interactive "DDirectory: ")
|
||||
(shell-command
|
||||
(format "cd '%s' && ctags -f TAGS -e -R --exclude=*.min.js"
|
||||
(directory-file-name (file-truename dir-name))
|
||||
)
|
||||
)
|
||||
(message "Archivo TAGS generado.")
|
||||
)
|
||||
|
||||
;; Hacer emacs transparente (no funciona perfecto, pero sirve)
|
||||
(defun toggle-transparency ()
|
||||
"Cambia la transparencia de Emacs (es un poco useless)."
|
||||
@ -53,5 +40,11 @@
|
||||
(interactive "nTransparency Value 0 - 100 opaque:")
|
||||
(set-frame-parameter (selected-frame) 'alpha value))
|
||||
|
||||
(defun icon-displayable-p ()
|
||||
"Return non-nil if icons are displayable."
|
||||
(and (display-graphic-p) (daemonp)
|
||||
(or (featurep 'all-the-icons)
|
||||
(require 'all-the-icons nil t))))
|
||||
|
||||
(provide 'base-functions)
|
||||
;;; base-functions.el ends here.
|
||||
|
440
configs/base-ivy.el
Normal file
440
configs/base-ivy.el
Normal file
@ -0,0 +1,440 @@
|
||||
;;; base-ivy.el --- Ayuditas y autocompletado del minibufer -*- lexical-binding: t -*-
|
||||
|
||||
;; Author: kj <webmaster@outcontrol.net>
|
||||
;; URL: https://git.kj2.me/kj/confi-emacs-actual
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
|
||||
;; Autocompletado para el minibuffer (counsel e ivy)
|
||||
(use-package counsel
|
||||
:defer t
|
||||
:straight t
|
||||
:diminish ivy-mode counsel-mode
|
||||
:bind (("C-s" . swiper-isearch)
|
||||
("C-r" . swiper-isearch-backward)
|
||||
("s-f" . swiper)
|
||||
("C-S-s" . swiper-all)
|
||||
|
||||
("C-c C-r" . ivy-resume)
|
||||
("C-c v p" . ivy-push-view)
|
||||
("C-c v o" . ivy-pop-view)
|
||||
("C-c v ." . ivy-switch-view)
|
||||
|
||||
:map counsel-mode-map
|
||||
([remap swiper] . counsel-grep-or-swiper)
|
||||
([remap swiper-backward] . counsel-grep-or-swiper-backward)
|
||||
([remap dired] . counsel-dired)
|
||||
([remap set-variable] . counsel-set-variable)
|
||||
([remap insert-char] . counsel-unicode-char)
|
||||
([remap recentf-open-files] . counsel-recentf)
|
||||
([remap org-capture] . counsel-org-capture)
|
||||
|
||||
("C-c c B" . counsel-bookmarked-directory)
|
||||
("C-c c F" . counsel-faces)
|
||||
("C-c c L" . counsel-load-library)
|
||||
("C-c c K" . counsel-ace-link)
|
||||
("C-c c O" . counsel-find-file-extern)
|
||||
("C-c c P" . counsel-package)
|
||||
("C-c c R" . counsel-list-processes)
|
||||
("C-c c a" . counsel-apropos)
|
||||
("C-c c e" . counsel-colors-emacs)
|
||||
("C-c c f" . counsel-find-library)
|
||||
("C-c c g" . counsel-grep)
|
||||
("C-c c h" . counsel-command-history)
|
||||
("C-c c i" . counsel-git)
|
||||
("C-c c j" . counsel-git-grep)
|
||||
("C-c c l" . counsel-git-log)
|
||||
("C-c c m" . counsel-minibuffer-history)
|
||||
("C-c c o" . counsel-outline)
|
||||
("C-c c p" . counsel-pt)
|
||||
("C-c c r" . counsel-rg)
|
||||
("C-c c s" . counsel-ag)
|
||||
("C-c c t" . counsel-load-theme)
|
||||
("C-c c u" . counsel-unicode-char)
|
||||
("C-c c w" . counsel-colors-web)
|
||||
("C-c c v" . counsel-set-variable)
|
||||
("C-c c z" . counsel-fzf)
|
||||
|
||||
:map ivy-minibuffer-map
|
||||
("C-w" . ivy-yank-word)
|
||||
("<tab>" . ivy-partial)
|
||||
("<escape>" . minibuffer-keyboard-quit)
|
||||
|
||||
:map counsel-find-file-map
|
||||
("C-h" . counsel-up-directory)
|
||||
|
||||
:map swiper-map
|
||||
("M-s" . swiper-isearch-toggle)
|
||||
("M-%" . swiper-query-replace)
|
||||
|
||||
:map isearch-mode-map
|
||||
("M-s" . swiper-isearch-toggle))
|
||||
:hook ((after-init . ivy-mode)
|
||||
(ivy-mode . counsel-mode))
|
||||
:init
|
||||
(setq enable-recursive-minibuffers t) ; Allow commands in minibuffers
|
||||
|
||||
(setq ivy-height 12
|
||||
ivy-use-selectable-prompt t
|
||||
ivy-use-virtual-buffers t ; Enable bookmarks and recentf
|
||||
ivy-fixed-height-minibuffer t
|
||||
ivy-count-format "(%d/%d) "
|
||||
ivy-ignore-buffers '("\\` " "\\`\\*tramp/" "\\`\\*xref" "\\`\\*helpful "
|
||||
"\\`\\*.+-posframe-buffer\\*" "\\` ?\\*company-.+\\*")
|
||||
ivy-on-del-error-function #'ignore
|
||||
ivy-initial-inputs-alist nil)
|
||||
|
||||
;; Use orderless regex strategy
|
||||
(setq ivy-re-builders-alist '((t . ivy--regex-ignore-order)))
|
||||
|
||||
;; Set minibuffer height for different commands
|
||||
(setq ivy-height-alist '((counsel-evil-registers . 5)
|
||||
(counsel-yank-pop . 8)
|
||||
(counsel-git-log . 4)
|
||||
(swiper . 15)
|
||||
(counsel-projectile-ag . 15)
|
||||
(counsel-projectile-rg . 15)))
|
||||
|
||||
|
||||
(setq swiper-action-recenter t)
|
||||
|
||||
(setq counsel-find-file-at-point t
|
||||
counsel-preselect-current-file t
|
||||
counsel-yank-pop-separator "\n────────\n")
|
||||
(add-hook 'counsel-grep-post-action-hook #'recenter)
|
||||
|
||||
;; Use the faster search tools
|
||||
(when (executable-find "rg")
|
||||
(setq counsel-grep-base-command "rg -S --no-heading --line-number --color never '%s' '%s'"))
|
||||
(when (executable-find "fd")
|
||||
(setq counsel-fzf-cmd
|
||||
"fd --type f --hidden --follow --exclude .git --color never '%s'"))
|
||||
|
||||
:config
|
||||
(with-no-warnings
|
||||
;; persist views
|
||||
(with-eval-after-load 'savehist
|
||||
(add-to-list 'savehist-additional-variables 'ivy-views))
|
||||
|
||||
;; Highlight the selected item
|
||||
(defun my-ivy-format-function (cands)
|
||||
"Transform CANDS into a string for minibuffer."
|
||||
(if (display-graphic-p)
|
||||
(ivy-format-function-line cands)
|
||||
(ivy-format-function-arrow cands)))
|
||||
(setf (alist-get 't ivy-format-functions-alist) #'my-ivy-format-function)
|
||||
|
||||
;; Pre-fill search keywords
|
||||
;; @see https://www.reddit.com/r/emacs/comments/b7g1px/withemacs_execute_commands_like_marty_mcfly/
|
||||
(defvar my-ivy-fly-commands
|
||||
'(query-replace-regexp
|
||||
flush-lines keep-lines ivy-read
|
||||
swiper swiper-backward swiper-all
|
||||
swiper-isearch swiper-isearch-backward
|
||||
lsp-ivy-workspace-symbol lsp-ivy-global-workspace-symbol
|
||||
counsel-grep-or-swiper counsel-grep-or-swiper-backward
|
||||
counsel-grep counsel-ack counsel-ag counsel-rg counsel-pt))
|
||||
|
||||
(defvar my-ivy-fly-back-commands
|
||||
'(self-insert-command
|
||||
ivy-forward-char ivy-delete-char delete-forward-char kill-word kill-sexp
|
||||
end-of-line mwim-end-of-line mwim-end-of-code-or-line mwim-end-of-line-or-code
|
||||
yank ivy-yank-word ivy-yank-char ivy-yank-symbol counsel-yank-pop))
|
||||
|
||||
(defvar-local my-ivy-fly--travel nil)
|
||||
(defun my-ivy-fly-back-to-present ()
|
||||
(cond ((and (memq last-command my-ivy-fly-commands)
|
||||
(equal (this-command-keys-vector) (kbd "M-p")))
|
||||
;; repeat one time to get straight to the first history item
|
||||
(setq unread-command-events
|
||||
(append unread-command-events
|
||||
(listify-key-sequence (kbd "M-p")))))
|
||||
((or (memq this-command my-ivy-fly-back-commands)
|
||||
(equal (this-command-keys-vector) (kbd "M-n")))
|
||||
(unless my-ivy-fly--travel
|
||||
(delete-region (point) (point-max))
|
||||
(when (memq this-command '(ivy-forward-char
|
||||
ivy-delete-char delete-forward-char
|
||||
kill-word kill-sexp
|
||||
end-of-line mwim-end-of-line
|
||||
mwim-end-of-code-or-line
|
||||
mwim-end-of-line-or-code))
|
||||
(insert (ivy-cleanup-string ivy-text))
|
||||
(when (memq this-command '(ivy-delete-char
|
||||
delete-forward-char
|
||||
kill-word kill-sexp))
|
||||
(beginning-of-line)))
|
||||
(setq my-ivy-fly--travel t)))))
|
||||
|
||||
(defun my-ivy-fly-time-travel ()
|
||||
(when (memq this-command my-ivy-fly-commands)
|
||||
(insert (propertize
|
||||
(save-excursion
|
||||
(set-buffer (window-buffer (minibuffer-selected-window)))
|
||||
(ivy-thing-at-point))
|
||||
'face 'shadow))
|
||||
(add-hook 'pre-command-hook 'my-ivy-fly-back-to-present nil t)
|
||||
(beginning-of-line)))
|
||||
|
||||
(add-hook 'minibuffer-setup-hook #'my-ivy-fly-time-travel)
|
||||
(add-hook 'minibuffer-exit-hook
|
||||
(lambda ()
|
||||
(remove-hook 'pre-command-hook 'my-ivy-fly-back-to-present t)))
|
||||
|
||||
;;
|
||||
;; Improve search experience of `swiper' and `counsel'
|
||||
;;
|
||||
(defun my-ivy-switch-to-swiper (&rest _)
|
||||
"Switch to `swiper' with the current input."
|
||||
(swiper ivy-text))
|
||||
|
||||
(defun my-ivy-switch-to-swiper-isearch (&rest _)
|
||||
"Switch to `swiper-isearch' with the current input."
|
||||
(swiper-isearch ivy-text))
|
||||
|
||||
(defun my-ivy-switch-to-swiper-all (&rest _)
|
||||
"Switch to `swiper-all' with the current input."
|
||||
(swiper-all ivy-text))
|
||||
|
||||
(defun my-ivy-switch-to-rg-dwim (&rest _)
|
||||
"Switch to `rg-dwim' with the current input."
|
||||
(ivy-quit-and-run (rg-dwim default-directory)))
|
||||
|
||||
(defun my-ivy-switch-to-counsel-rg (&rest _)
|
||||
"Switch to `counsel-rg' with the current input."
|
||||
(counsel-rg ivy-text default-directory))
|
||||
|
||||
(defun my-ivy-switch-to-counsel-git-grep (&rest _)
|
||||
"Switch to `counsel-git-grep' with the current input."
|
||||
(counsel-git-grep ivy-text default-directory))
|
||||
|
||||
(defun my-ivy-switch-to-counsel-find-file (&rest _)
|
||||
"Switch to `counsel-find-file' with the current input."
|
||||
(counsel-find-file ivy-text))
|
||||
|
||||
(defun my-ivy-switch-to-counsel-fzf (&rest _)
|
||||
"Switch to `counsel-fzf' with the current input."
|
||||
(counsel-fzf ivy-text default-directory))
|
||||
|
||||
(defun my-ivy-switch-to-counsel-git (&rest _)
|
||||
"Switch to `counsel-git' with the current input."
|
||||
(counsel-git ivy-text))
|
||||
|
||||
(defun my-ivy-switch-to-list-bookmarks (&rest _)
|
||||
"Switch to `list-bookmarks'."
|
||||
(ivy-quit-and-run (call-interactively #'list-bookmarks)))
|
||||
|
||||
(defun my-ivy-switch-to-list-colors (&rest _)
|
||||
"Switch to `list-colors-display'."
|
||||
(ivy-quit-and-run (list-colors-display)))
|
||||
|
||||
(defun my-ivy-switch-to-list-packages (&rest _)
|
||||
"Switch to `list-packages'."
|
||||
(ivy-quit-and-run (list-packages)))
|
||||
|
||||
(defun my-ivy-switch-to-list-processes (&rest _)
|
||||
"Switch to `list-processes'."
|
||||
(ivy-quit-and-run (list-processes)))
|
||||
|
||||
(defun my-ivy-copy-library-path (lib)
|
||||
"Copy the full path of LIB."
|
||||
(let ((path (find-library-name lib)))
|
||||
(kill-new path)
|
||||
(message "Copied path: \"%s\"." path)))
|
||||
|
||||
;; @see https://emacs-china.org/t/swiper-swiper-isearch/9007/12
|
||||
(defun my-swiper-toggle-counsel-rg ()
|
||||
"Toggle `counsel-rg' and `swiper'/`swiper-isearch' with the current input."
|
||||
(interactive)
|
||||
(ivy-quit-and-run
|
||||
(if (memq (ivy-state-caller ivy-last) '(swiper swiper-isearch))
|
||||
(my-ivy-switch-to-counsel-rg)
|
||||
(my-ivy-switch-to-swiper-isearch))))
|
||||
(bind-key "<C-return>" #'my-swiper-toggle-counsel-rg swiper-map)
|
||||
(bind-key "<C-return>" #'my-swiper-toggle-counsel-rg counsel-ag-map)
|
||||
|
||||
(with-eval-after-load 'rg
|
||||
(defun my-swiper-toggle-rg-dwim ()
|
||||
"Toggle `rg-dwim' with the current input."
|
||||
(interactive)
|
||||
(ivy-quit-and-run
|
||||
(rg-dwim default-directory)))
|
||||
(bind-key "<M-return>" #'my-swiper-toggle-rg-dwim swiper-map)
|
||||
(bind-key "<M-return>" #'my-swiper-toggle-rg-dwim counsel-ag-map))
|
||||
|
||||
(defun my-swiper-toggle-swiper-isearch ()
|
||||
"Toggle `swiper' and `swiper-isearch' with the current input."
|
||||
(interactive)
|
||||
(ivy-quit-and-run
|
||||
(if (eq (ivy-state-caller ivy-last) 'swiper-isearch)
|
||||
(swiper ivy-text)
|
||||
(swiper-isearch ivy-text))))
|
||||
(bind-key "<s-return>" #'my-swiper-toggle-swiper-isearch swiper-map)
|
||||
|
||||
(defun my-counsel-find-file-toggle-fzf ()
|
||||
"Toggle `counsel-fzf' with the current `counsel-find-file' input."
|
||||
(interactive)
|
||||
(ivy-quit-and-run
|
||||
(counsel-fzf (or ivy-text "") default-directory)))
|
||||
(bind-key "<C-return>" #'my-counsel-find-file-toggle-fzf counsel-find-file-map)
|
||||
|
||||
(defun my-counsel-toggle ()
|
||||
"Toggle `counsel' commands and original commands."
|
||||
(interactive)
|
||||
(pcase (ivy-state-caller ivy-last)
|
||||
('counsel-bookmark (my-ivy-switch-to-list-bookmarks))
|
||||
('counsel-colors-emacs (my-ivy-switch-to-list-colors))
|
||||
('counsel-colors-web (my-ivy-switch-to-list-colors))
|
||||
('counsel-list-processes (my-ivy-switch-to-list-processes))
|
||||
('counsel-package (my-ivy-switch-to-list-packages))
|
||||
(_ (ignore))))
|
||||
(bind-key "<C-return>" #'my-counsel-toggle ivy-minibuffer-map)
|
||||
|
||||
;; More actions
|
||||
(ivy-add-actions
|
||||
#'swiper-isearch
|
||||
'(("r" my-ivy-switch-to-counsel-rg "rg")
|
||||
("d" my-ivy-switch-to-rg-dwim "rg dwim")
|
||||
("s" my-ivy-switch-to-swiper "swiper")
|
||||
("a" my-ivy-switch-to-swiper-all "swiper all")))
|
||||
|
||||
(ivy-add-actions
|
||||
#'swiper
|
||||
'(("r" my-ivy-switch-to-counsel-rg "rg")
|
||||
("d" my-ivy-switch-to-rg-dwim "rg dwim")
|
||||
("s" my-ivy-switch-to-swiper-isearch "swiper isearch")
|
||||
("a" my-ivy-switch-to-swiper-all "swiper all")))
|
||||
|
||||
(ivy-add-actions
|
||||
#'swiper-all
|
||||
'(("g" my-ivy-switch-to-counsel-git-grep "git grep")
|
||||
("r" my-ivy-switch-to-counsel-rg "rg")
|
||||
("d" my-ivy-switch-to-rg-dwim "rg dwim")
|
||||
("s" my-swiper-toggle-swiper-isearch "swiper isearch")
|
||||
("S" my-ivy-switch-to-swiper "swiper")))
|
||||
|
||||
(ivy-add-actions
|
||||
#'counsel-rg
|
||||
'(("s" my-ivy-switch-to-swiper-isearch "swiper isearch")
|
||||
("S" my-ivy-switch-to-swiper "swiper")
|
||||
("a" my-ivy-switch-to-swiper-all "swiper all")
|
||||
("d" my-ivy-switch-to-rg-dwim "rg dwim")))
|
||||
|
||||
(ivy-add-actions
|
||||
#'counsel-git-grep
|
||||
'(("s" my-ivy-switch-to-swiper-isearch "swiper isearch")
|
||||
("S" my-ivy-switch-to-swiper "swiper")
|
||||
("r" my-ivy-switch-to-rg-dwim "rg")
|
||||
("d" my-ivy-switch-to-rg-dwim "rg dwim")
|
||||
("a" my-ivy-switch-to-swiper-all "swiper all")))
|
||||
|
||||
(ivy-add-actions
|
||||
#'counsel-find-file
|
||||
'(("g" my-ivy-switch-to-counsel-git "git")
|
||||
("z" my-ivy-switch-to-counsel-fzf "fzf")))
|
||||
|
||||
(ivy-add-actions
|
||||
#'counsel-git
|
||||
'(("f" my-ivy-switch-to-counsel-find-file "find file")
|
||||
("z" my-ivy-switch-to-counsel-fzf "fzf")))
|
||||
|
||||
(ivy-add-actions
|
||||
'counsel-fzf
|
||||
'(("f" my-ivy-switch-to-counsel-find-file "find file")
|
||||
("g" my-ivy-switch-to-counsel-git "git")))
|
||||
|
||||
(ivy-add-actions
|
||||
'counsel-find-library
|
||||
'(("p" my-ivy-copy-library-path "copy path")))
|
||||
|
||||
(ivy-add-actions
|
||||
'counsel-load-library
|
||||
'(("p" my-ivy-copy-library-path "copy path")))
|
||||
|
||||
(ivy-add-actions
|
||||
#'counsel-bookmark
|
||||
'(("l" my-ivy-switch-to-list-bookmarks "list")))
|
||||
|
||||
(ivy-add-actions
|
||||
#'counsel-colors-emacs
|
||||
'(("l" my-ivy-switch-to-list-colors "list")))
|
||||
|
||||
(ivy-add-actions
|
||||
#'counsel-colors-web
|
||||
'(("l" my-ivy-switch-to-list-colors "list")))
|
||||
|
||||
(ivy-add-actions
|
||||
#'counsel-package
|
||||
'(("l" my-ivy-switch-to-list-packages "list packages")))
|
||||
|
||||
(ivy-add-actions
|
||||
#'counsel-list-processes
|
||||
'(("l" my-ivy-switch-to-list-processes "list")))))
|
||||
|
||||
;; Autocompletado de proyectos en counsel (projectile)
|
||||
(use-package counsel-projectile
|
||||
:defer t
|
||||
:straight t
|
||||
:bind*
|
||||
("C-x p" . counsel-projectile)
|
||||
:hook (counsel-mode . counsel-projectile-mode)
|
||||
:init (setq counsel-projectile-grep-initial-input '(ivy-thing-at-point)))
|
||||
|
||||
|
||||
;; Enhance M-x
|
||||
(use-package amx
|
||||
:defer t
|
||||
:straight t
|
||||
:bind (("M-x" . amx)
|
||||
("<menu>" . amx))
|
||||
:init (setq amx-history-length 20))
|
||||
|
||||
;; Avy integration
|
||||
(use-package ivy-avy
|
||||
:defer t
|
||||
:straight t
|
||||
:bind (:map ivy-minibuffer-map
|
||||
("C-'" . ivy-avy)))
|
||||
|
||||
(use-package ivy
|
||||
:defer t
|
||||
:straight t
|
||||
:hook (after-init . ivy-mode)
|
||||
:config
|
||||
(setq ivy-use-virtual-buffers nil))
|
||||
|
||||
(use-package ivy-rich
|
||||
:defer t
|
||||
:straight t
|
||||
:ensure t
|
||||
:hook ((counsel-projectile-mode . ivy-rich-mode) ; MUST after `counsel-projectile'
|
||||
(ivy-rich-mode . ivy-rich-project-root-cache-mode)
|
||||
(ivy-rich-mode . (lambda ()
|
||||
"Use abbreviate in `ivy-rich-mode'."
|
||||
(setq ivy-virtual-abbreviate
|
||||
(or (and ivy-rich-mode 'abbreviate) 'name)))))
|
||||
:init
|
||||
;; For better performance
|
||||
(setq ivy-rich-parse-remote-buffer nil))
|
||||
|
||||
;; Iconos en Ivy (allthe icons)
|
||||
(use-package all-the-icons-ivy-rich
|
||||
:defer t
|
||||
:straight t
|
||||
:ensure t
|
||||
:hook (ivy-mode . all-the-icons-ivy-rich-mode)
|
||||
:config
|
||||
(setq all-the-icons-ivy-rich-color-icon t))
|
||||
|
||||
|
||||
;; Integrate yasnippet
|
||||
(use-package ivy-yasnippet
|
||||
:defer t
|
||||
:straight t
|
||||
:bind ("C-c C-y" . ivy-yasnippet))
|
||||
|
||||
(provide 'base-ivy)
|
||||
;;; base-ivy.el ends here
|
@ -1,4 +1,4 @@
|
||||
;;; base-keys.el --- Archivo de configuración de atajos
|
||||
;;; base-keys.el --- Archivo de configuración de atajos -*- lexical-binding: t -*-
|
||||
|
||||
;; Author: kj <webmaster@outcontrol.net>
|
||||
;; URL: https://git.kj2.me/kj/confi-emacs-actual
|
||||
@ -19,13 +19,8 @@
|
||||
(global-set-key (kbd "C-x c c")
|
||||
'comment-or-uncomment-region) ; Comentar/descomentar en lote
|
||||
|
||||
(global-set-key (kbd "C-<f6>") 'create-tags) ; Generar o Regeneral el archivo TAGS
|
||||
|
||||
(global-set-key (kbd "C-<f11>") 'toggle-frame-maximized) ; Maximizar / restaurar
|
||||
|
||||
(global-set-key (kbd "C-c a") 'org-agenda) ; Abrir la agenda.
|
||||
(global-set-key (kbd "C-c c") 'org-capture) ; Abrir la crear una entrada.
|
||||
|
||||
;; Cambios rápidos de major modes
|
||||
(global-set-key (kbd "C-x m") nil) ; Unbind mail on C-x m
|
||||
(global-set-key (kbd "C-x mh") 'html-mode)
|
||||
@ -33,51 +28,12 @@
|
||||
(global-set-key (kbd "C-x mp") 'php-mode)
|
||||
(global-set-key (kbd "C-x mr") 'rust-mode)
|
||||
|
||||
;; Vterm
|
||||
(global-set-key (kbd "C-x tt") 'multi-vterm-dedicated-toggle)
|
||||
(global-set-key (kbd "C-x tf") 'multi-vterm)
|
||||
(global-set-key (kbd "C-x tp") 'multi-vterm-project)
|
||||
|
||||
;; Atajos de windmove
|
||||
(global-set-key (kbd "C-x <left>") 'windmove-left)
|
||||
(global-set-key (kbd "C-x <right>") 'windmove-right)
|
||||
(global-set-key (kbd "C-x <up>") 'windmove-up)
|
||||
(global-set-key (kbd "C-x <down>") 'windmove-down)
|
||||
|
||||
;; Atajos para reemplazar (los por fedecto no van bien para el teclado en español)
|
||||
(global-set-key (kbd "C-x /") 'query-replace-regexp)
|
||||
(global-set-key (kbd "M-/") 'query-replace)
|
||||
|
||||
;; Atajo para origami-mode
|
||||
(global-set-key (kbd "C-<tab>") 'origami-toggle-node)
|
||||
(global-set-key (kbd "C-<iso-lefttab>") 'origami-toggle-all-nodes)
|
||||
|
||||
;; Atajo para counsel-proyectile
|
||||
(global-set-key (kbd "C-x p") 'counsel-projectile)
|
||||
|
||||
;; Atajos de Ivy
|
||||
(global-set-key (kbd "C-x s") 'swiper)
|
||||
(global-set-key (kbd "C-x C-r") 'ivy-resume)
|
||||
(global-set-key (kbd "C-x b") 'ivy-switch-buffer)
|
||||
(global-set-key (kbd "C-x C-b") 'ivy-switch-buffer)
|
||||
(define-key ivy-minibuffer-map (kbd "TAB") 'ivy-partial)
|
||||
(define-key ivy-minibuffer-map (kbd "<escape>") 'minibuffer-keyboard-quit)
|
||||
|
||||
;; Atajos projectile
|
||||
(global-set-key (kbd "C-c p") 'projectile-command-map)
|
||||
|
||||
;; Atajos counsel
|
||||
(global-set-key (kbd "M-x") 'counsel-M-x)
|
||||
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
|
||||
(global-set-key (kbd "M-y") 'counsel-yank-pop)
|
||||
(define-key company-active-map (kbd "<tab>") 'company-indent-or-complete-common) ; autocompletar con tab como se haría en bash-competition en la terminal de linux
|
||||
(define-key company-active-map (kbd "<escape>") 'company-abort) ; cerrar las sugerencias de autocompletado precionando escape.
|
||||
|
||||
;; Atajos org-roam
|
||||
(global-set-key (kbd "C-c r i") 'org-roam-node-insert)
|
||||
(global-set-key (kbd "C-c r f") 'org-roam-node-find)
|
||||
(global-set-key (kbd "C-c r t") 'org-roam-buffer-toggle)
|
||||
|
||||
;; Meta atajos (atajos de atajos)
|
||||
(global-set-key (kbd "C-c l d") "\C-a\C- \C-n\M-w\C-y") ; Duplicar línea
|
||||
|
||||
|
106
configs/base-lsp.el
Normal file
106
configs/base-lsp.el
Normal file
@ -0,0 +1,106 @@
|
||||
;;; base-lsp.el --- Languaje server protocol. -*- lexical-binding: t -*-
|
||||
|
||||
;; Author: kj <webmaster@outcontrol.net>
|
||||
;; URL: https://git.kj2.me/kj/confi-emacs-actual
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
;; Performace tuning
|
||||
;; @see https://emacs-lsp.github.io/lsp-mode/page/performance/
|
||||
(setq read-process-output-max (* 1024 1024)) ;; 1MB
|
||||
(setenv "LSP_USE_PLISTS" "true")
|
||||
|
||||
(use-package lsp-mode
|
||||
:defer t
|
||||
:straight t
|
||||
:diminish
|
||||
:commands (lsp-enable-which-key-integration
|
||||
lsp-format-buffer
|
||||
lsp-organize-imports
|
||||
lsp-install-server)
|
||||
:hook ((prog-mode . (lambda ()
|
||||
(unless (derived-mode-p 'emacs-lisp-mode 'lisp-mode 'makefile-mode)
|
||||
(lsp-deferred))))
|
||||
(markdown-mode . lsp-deferred)
|
||||
(lsp-mode . lsp-enable-which-key-integration))
|
||||
:custom
|
||||
(lsp-headerline-breadcrumb-enable nil)
|
||||
:init (setq lsp-keymap-prefix "C-c l"
|
||||
lsp-keep-workspace-alive nil
|
||||
lsp-signature-auto-activate nil
|
||||
lsp-modeline-code-actions-enable nil
|
||||
lsp-modeline-diagnostics-enable nil
|
||||
lsp-modeline-workspace-status-enable nil
|
||||
lsp-headerline-breadcrumb-enable nil
|
||||
|
||||
lsp-enable-file-watchers nil
|
||||
lsp-enable-folding nil
|
||||
lsp-enable-symbol-highlighting nil
|
||||
lsp-enable-text-document-color nil
|
||||
|
||||
lsp-enable-indentation nil
|
||||
lsp-enable-on-type-formatting nil)
|
||||
:config
|
||||
(with-no-warnings
|
||||
;; Disable `lsp-mode' in `git-timemachine-mode'
|
||||
(defun my-lsp--init-if-visible (fn &rest args)
|
||||
(unless (bound-and-true-p git-timemachine-mode)
|
||||
(apply fn args)))
|
||||
(advice-add #'lsp--init-if-visible :around #'my-lsp--init-if-visible)
|
||||
|
||||
;; Enable `lsp-mode' in sh/bash/zsh
|
||||
(defun my-lsp-bash-check-sh-shell (&rest _)
|
||||
(and (eq major-mode 'sh-mode)
|
||||
(memq sh-shell '(sh bash zsh))))
|
||||
(advice-add #'lsp-bash-check-sh-shell :override #'my-lsp-bash-check-sh-shell)
|
||||
|
||||
;; Only display icons in GUI
|
||||
(defun my-lsp-icons-get-symbol-kind (fn &rest args)
|
||||
(and (icon-displayable-p) (apply fn args)))
|
||||
(advice-add #'lsp-icons-get-by-symbol-kind :around #'my-lsp-icons-get-symbol-kind)
|
||||
|
||||
(defun my-lsp-icons-get-by-file-ext (fn &rest args)
|
||||
(and (icon-displayable-p) (apply fn args)))
|
||||
(advice-add #'lsp-icons-get-by-file-ext :around #'my-lsp-icons-get-by-file-ext)
|
||||
|
||||
(defun my-lsp-icons-all-the-icons-material-icon (icon-name face fallback &optional feature)
|
||||
(if (and (icon-displayable-p)
|
||||
(lsp-icons--enabled-for-feature feature))
|
||||
(all-the-icons-material icon-name
|
||||
:face face)
|
||||
(propertize fallback 'face face)))
|
||||
(advice-add #'lsp-icons-all-the-icons-material-icon
|
||||
:override #'my-lsp-icons-all-the-icons-material-icon))
|
||||
|
||||
)
|
||||
|
||||
;; Interface para lsp
|
||||
(use-package lsp-ui
|
||||
:defer t
|
||||
:straight t
|
||||
:bind (("<f1>" . lsp-ui-doc-glance))
|
||||
:hook (lsp-mode . lsp-ui-mode)
|
||||
|
||||
:init
|
||||
(setq lsp-ui-sideline-show-diagnostics nil
|
||||
lsp-ui-sideline-ignore-duplicate t
|
||||
lsp-ui-doc-delay 0.1
|
||||
lsp-ui-imenu-colors `(,(face-foreground 'font-lock-keyword-face)
|
||||
,(face-foreground 'font-lock-string-face)
|
||||
,(face-foreground 'font-lock-constant-face)
|
||||
,(face-foreground 'font-lock-variable-name-face)))
|
||||
;; Set correct color to borders
|
||||
(defun my-lsp-ui-doc-set-border ()
|
||||
"Set the border color of lsp doc."
|
||||
(setq lsp-ui-doc-border
|
||||
(if (facep 'posframe-border)
|
||||
(face-background 'posframe-border nil t)
|
||||
(face-foreground 'shadow nil t))))
|
||||
(my-lsp-ui-doc-set-border)
|
||||
(add-hook 'after-load-theme-hook #'my-lsp-ui-doc-set-border t)
|
||||
)
|
||||
|
||||
(provide 'base-lsp)
|
||||
;;; base-lsp.el ends here
|
@ -1,4 +1,4 @@
|
||||
;;; org-config.el --- Configuración de org-mode
|
||||
;;; base-config.el --- Configuración de org-mode -*- lexical-binding: t -*-
|
||||
|
||||
;; Author: kj <webmaster@outcontrol.net>
|
||||
;; URL: https://git.kj2.me/kj/confi-emacs-actual
|
||||
@ -39,6 +39,8 @@
|
||||
:defer t
|
||||
:ensure t
|
||||
:straight (:type built-in)
|
||||
:bind (("C-c a" . org-agenda)
|
||||
("C-c c" . org-capture))
|
||||
:hook
|
||||
(org-mode . kj/org-hook)
|
||||
:config
|
||||
@ -145,6 +147,8 @@
|
||||
:defer t
|
||||
:straight t
|
||||
:ensure t
|
||||
:bind (("<f4>" . org-roam-node-insert)
|
||||
("<f3>" . org-roam-node-find))
|
||||
:init
|
||||
(setq org-roam-v2-ack t)
|
||||
(setq org-roam-completion-system 'ivy)
|
||||
@ -164,5 +168,5 @@
|
||||
org-roam-ui-update-on-save t
|
||||
org-roam-ui-open-on-start t))
|
||||
|
||||
(provide 'org-config)
|
||||
;;; org-config.el ends here
|
||||
(provide 'base-org)
|
||||
;;; base-org.el ends here
|
@ -1,4 +1,4 @@
|
||||
;;; base.el --- Configuración base de emacs
|
||||
;;; base.el --- Configuración base de emacs -*- lexical-binding: t -*-
|
||||
|
||||
;; Author: kj <webmaster@outcontrol.net>
|
||||
;; URL: https://git.kj2.me/kj/confi-emacs-actual
|
||||
@ -10,10 +10,6 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
;; The default is 800 kilobytes. Measured in bytes.
|
||||
(setq gc-cons-threshold (* 50 1024 1024))
|
||||
(setq read-process-output-max (* 1024 1024))
|
||||
|
||||
;; Native compilation
|
||||
(when (and (fboundp 'native-comp-available-p)
|
||||
(native-comp-available-p))
|
||||
|
@ -1,4 +1,4 @@
|
||||
;;; lang-go.el --- Configuración para el lenguaje go
|
||||
;;; lang-go.el --- Configuración para el lenguaje go -*- lexical-binding: t -*-
|
||||
|
||||
;; Author: kj <webmaster@outcontrol.net>
|
||||
;; URL: https://git.kj2.me/kj/confi-emacs-actual
|
||||
|
@ -1,4 +1,4 @@
|
||||
;;; lang-js.el --- Configuración para el lenguaje Javascript
|
||||
;;; lang-js.el --- Configuración para el lenguaje Javascript -*- lexical-binding: t -*-
|
||||
|
||||
;; Author: kj <webmaster@outcontrol.net>
|
||||
;; URL: https://git.kj2.me/kj/confi-emacs-actual
|
||||
|
@ -1,4 +1,4 @@
|
||||
;;; lang-php.el --- Configuración para el lenguaje PHP
|
||||
;;; lang-php.el --- Configuración para el lenguaje PHP -*- lexical-binding: t -*-
|
||||
|
||||
;; Author: kj <webmaster@outcontrol.net>
|
||||
;; URL: https://git.kj2.me/kj/confi-emacs-actual
|
||||
@ -7,19 +7,14 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;(use-package company-php :defer t)
|
||||
;;(use-package ac-php :defer t)
|
||||
|
||||
(use-package php-mode
|
||||
:defer t
|
||||
: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)
|
||||
;;(php-mode . lsp)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
;;; lang-rust.el --- Configuración para el lenguaje PHP
|
||||
;;; lang-rust.el --- Configuración para el lenguaje PHP -*- lexical-binding: t -*-
|
||||
|
||||
;; Author: kj <webmaster@outcontrol.net>
|
||||
;; URL: https://git.kj2.me/kj/confi-emacs-actual
|
||||
@ -21,7 +21,7 @@
|
||||
:config
|
||||
;;(setq rustic-lsp-server 'rls)
|
||||
;;(setq rustic-lsp-client 'lsp)
|
||||
(setq rustic-lsp-client nil)
|
||||
;;(setq rustic-lsp-client nil)
|
||||
(push 'rustic-clippy flycheck-checkers))
|
||||
|
||||
(provide 'lang-rust)
|
||||
|
43
early-init.el
Normal file
43
early-init.el
Normal file
@ -0,0 +1,43 @@
|
||||
;;; early-init.el --- Early startup code -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2021 Ryan C. Thompson
|
||||
|
||||
;; Filename: early-init.el
|
||||
;; Author: Ryan C. Thompson
|
||||
;; Created: Sat Nov 27 13:40:59 2021 (-0500)
|
||||
|
||||
;; This file is NOT part of GNU Emacs.
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
|
||||
;; This file contains code that must be executed early during Emacs'
|
||||
;; startup for proper initialization, as described here:
|
||||
;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Early-Init-File.html
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;; Disable GC during init
|
||||
(put 'gc-cons-percentage 'original-value-before-init gc-cons-percentage)
|
||||
(put 'gc-cons-percentage 'value-during-init 0.6)
|
||||
(defun restore-gc-cons-percentage-after-init ()
|
||||
(let ((expected-value (get 'gc-cons-percentage 'value-during-init))
|
||||
(value-to-restore (get 'gc-cons-percentage 'original-value-before-init)))
|
||||
(when (and value-to-restore (equal gc-cons-percentage expected-value))
|
||||
(message "Setting `gc-cons-percentage' back to starting value %s" value-to-restore)
|
||||
(setq gc-cons-percentage value-to-restore))))
|
||||
(add-hook 'after-init-hook #'restore-gc-cons-percentage-after-init)
|
||||
(setq gc-cons-percentage (get 'gc-cons-percentage 'value-during-init))
|
||||
|
||||
;; Recommended by
|
||||
;; https://github.com/raxod502/straight.el#getting-started to prevent
|
||||
;; pacakge.el stepping on straight's toes.
|
||||
(setq package-enable-at-startup nil)
|
||||
|
||||
;; Cache eln (native-comp)
|
||||
(setq native-compile-target-directory (expand-file-name "private/cache/eln" user-emacs-directory))
|
||||
|
||||
;;; early-init.el ends here
|
36
init.el
36
init.el
@ -1,4 +1,4 @@
|
||||
;;; init.el --- Init de emacs ordenado
|
||||
;;; init.el --- Init de emacs ordenado -*- lexical-binding: t -*-
|
||||
|
||||
;; Author: kj <webmaster@outcontrol.net>
|
||||
;; URL: https://git.kj2.me/kj/confi-emacs-actual
|
||||
@ -9,13 +9,47 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
;; Mejorar el tiempo de carga
|
||||
(setq auto-mode-case-fold nil)
|
||||
|
||||
(unless (or (daemonp) noninteractive)
|
||||
(let ((old-file-name-handler-alist file-name-handler-alist))
|
||||
;; If `file-name-handler-alist' is nil, no 256 colors in TUI
|
||||
;; @see https://emacs-china.org/t/spacemacs-centaur-emacs/3802/839
|
||||
(setq file-name-handler-alist
|
||||
(unless (display-graphic-p)
|
||||
'(("\\(?:\\.tzst\\|\\.zst\\|\\.dz\\|\\.txz\\|\\.xz\\|\\.lzma\\|\\.lz\\|\\.g?z\\|\\.\\(?:tgz\\|svgz\\|sifz\\)\\|\\.tbz2?\\|\\.bz2\\|\\.Z\\)\\(?:~\\|\\.~[-[:alnum:]:#@^._]+\\(?:~[[:digit:]]+\\)?~\\)?\\'" . jka-compr-handler))))
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
"Recover file name handlers."
|
||||
(setq file-name-handler-alist
|
||||
(delete-dups (append file-name-handler-alist
|
||||
old-file-name-handler-alist)))))))
|
||||
|
||||
(setq gc-cons-threshold most-positive-fixnum
|
||||
gc-cons-percentage 0.5)
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
"Recover GC values after startup."
|
||||
(setq gc-cons-threshold 800000
|
||||
gc-cons-percentage 0.1)))
|
||||
|
||||
;; Cargar configuraciones
|
||||
|
||||
(add-to-list 'load-path (concat user-emacs-directory "configs"))
|
||||
|
||||
;; Paquetes base
|
||||
(require 'base)
|
||||
(require 'base-extensions)
|
||||
(require 'base-functions)
|
||||
(require 'base-org)
|
||||
(require 'base-lsp)
|
||||
(require 'base-company)
|
||||
(require 'base-ctags)
|
||||
(require 'base-ivy)
|
||||
(require 'base-keys)
|
||||
|
||||
;; Lenguajes
|
||||
(require 'lang-php)
|
||||
(require 'lang-js)
|
||||
(require 'lang-go)
|
||||
|
Loading…
Reference in New Issue
Block a user