Compare commits
No commits in common. "bd450ea03467b985b4dbb2e7a32b26f377652d82" and "a6848f631f58784ef065984fccc828d9f8fd0eca" have entirely different histories.
bd450ea034
...
a6848f631f
@ -30,7 +30,10 @@
|
|||||||
company-dabbrev-ignore-case nil
|
company-dabbrev-ignore-case nil
|
||||||
company-dabbrev-downcase nil ; autocompletado case-sensitive.
|
company-dabbrev-downcase nil ; autocompletado case-sensitive.
|
||||||
company-global-modes '(not erc-mode message-mode help-mode
|
company-global-modes '(not erc-mode message-mode help-mode
|
||||||
gud-mode eshell-mode shell-mode))
|
gud-mode eshell-mode shell-mode)
|
||||||
|
company-backends '((company-capf :with company-yasnippet)
|
||||||
|
(company-dabbrev-code company-keywords company-files)
|
||||||
|
company-dabbrev))
|
||||||
:config
|
:config
|
||||||
(with-no-warnings
|
(with-no-warnings
|
||||||
;; Company anywhere
|
;; Company anywhere
|
||||||
@ -79,6 +82,49 @@
|
|||||||
(overlay-put company-preview-overlay 'display after-string)
|
(overlay-put company-preview-overlay 'display after-string)
|
||||||
(overlay-put company-preview-overlay 'after-string nil)))))
|
(overlay-put company-preview-overlay 'after-string nil)))))
|
||||||
(advice-add 'company-preview-show-at-point :after 'company-anywhere-preview-show-at-point)
|
(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))
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,53 +11,12 @@
|
|||||||
:straight t
|
:straight t
|
||||||
:hook (after-init . evil-mode)
|
:hook (after-init . evil-mode)
|
||||||
:config
|
:config
|
||||||
;; Configuraciones básicas
|
|
||||||
(setq evil-default-state 'emacs) ;; Modo por defecto en emacs
|
|
||||||
(setq evil-emacs-state-cursor 'bar) ;; Cursor de emacs state en bar
|
|
||||||
(evil-set-leader 'motion (kbd "SPC")) ;; Leader key
|
|
||||||
|
|
||||||
;; Habilitar atajos de de tecla de emacs en insert state
|
(setq evil-toggle-key "C-'")
|
||||||
(setq evil-insert-state-map (make-sparse-keymap))
|
(setq evil-default-state 'emacs)
|
||||||
(evil-define-key 'insert 'global (kbd "<escape>") 'evil-normal-state)
|
(setq evil-emacs-state-cursor 'bar)
|
||||||
|
|
||||||
;; Variales locales
|
(evil-define-key '(normal insert visual replace operator motion emacs) 'global (kbd "C-z") 'evil-undo)
|
||||||
(setq all-states '(normal insert visual replace operator motion emacs))
|
|
||||||
(setq vim-states '(normal insert visual replace operator motion))
|
|
||||||
|
|
||||||
(evil-define-key all-states 'global (kbd "C-z") 'evil-undo)
|
|
||||||
(evil-define-key vim-states 'global (kbd "C-'") 'evil-emacs-state)
|
|
||||||
(evil-define-key '(emacs) 'global (kbd "C-'") 'evil-normal-state)
|
|
||||||
|
|
||||||
;; Navegación entre frames
|
|
||||||
(evil-define-key 'motion 'global (kbd "<leader>wh") 'windmove-left)
|
|
||||||
(evil-define-key 'motion 'global (kbd "<leader>wj") 'windmove-down)
|
|
||||||
(evil-define-key 'motion 'global (kbd "<leader>wk") 'windmove-up)
|
|
||||||
(evil-define-key 'motion 'global (kbd "<leader>wl") 'windmove-right)
|
|
||||||
|
|
||||||
;; Atajos con leader key para frames
|
|
||||||
(evil-define-key 'motion 'global (kbd "<leader>0") 'delete-window)
|
|
||||||
(evil-define-key 'motion 'global (kbd "<leader>1") 'delete-other-windows)
|
|
||||||
(evil-define-key 'motion 'global (kbd "<leader>2") 'split-window-below)
|
|
||||||
(evil-define-key 'motion 'global (kbd "<leader>3") 'split-window-right)
|
|
||||||
(evil-define-key 'motion 'global (kbd "<leader>k") 'kill-buffer)
|
|
||||||
(evil-define-key 'motion 'global (kbd "<leader>wu") 'winner-undo)
|
|
||||||
(evil-define-key 'motion 'global (kbd "<leader>wr") 'winner-redo)
|
|
||||||
|
|
||||||
;; Cambios de modos
|
|
||||||
(evil-define-key 'normal 'global (kbd "<leader>mh") 'html-mode)
|
|
||||||
(evil-define-key 'normal 'global (kbd "<leader>mj") 'js-mode)
|
|
||||||
(evil-define-key 'normal 'global (kbd "<leader>mp") 'php-mode)
|
|
||||||
(evil-define-key 'normal 'global (kbd "<leader>mr") 'rust-mode)
|
|
||||||
(evil-define-key 'normal 'global (kbd "<leader>mw") 'web-mode)
|
|
||||||
|
|
||||||
;; Otros atajos
|
|
||||||
(evil-define-key 'motion 'global (kbd "<leader>b") 'ivy-switch-buffer)
|
|
||||||
(evil-define-key 'motion 'global (kbd "<leader>p") 'counsel-projectile)
|
|
||||||
(evil-define-key 'motion 'global (kbd "<leader>cp") 'projectile-switch-project)
|
|
||||||
(evil-define-key 'motion 'global (kbd "<leader>ff") 'counsel-find-file)
|
|
||||||
|
|
||||||
;; Iniciar en normal state si es un lenguaje de programación
|
|
||||||
(evil-set-initial-state 'prog-mode 'normal)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
(provide 'init-evil)
|
(provide 'init-evil)
|
||||||
|
@ -27,7 +27,7 @@ Saves to a temp file and puts the filename in the kill ring."
|
|||||||
|
|
||||||
;; Comentar línea o región
|
;; Comentar línea o región
|
||||||
(defun comment-or-uncomment-region-or-line ()
|
(defun comment-or-uncomment-region-or-line ()
|
||||||
"Comments or uncomments the region or the current line."
|
"Comments or uncomments the region or the current line if there's no active region."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let (beg end)
|
(let (beg end)
|
||||||
(if (region-active-p)
|
(if (region-active-p)
|
||||||
@ -39,7 +39,7 @@ Saves to a temp file and puts the filename in the kill ring."
|
|||||||
|
|
||||||
;; Duplicar la línea actual
|
;; Duplicar la línea actual
|
||||||
(defun duplicate-current-line (&optional n)
|
(defun duplicate-current-line (&optional n)
|
||||||
"Duplicate current line, make more than 1 copy given a numeric (N) argument."
|
"duplicate current line, make more than 1 copy given a numeric argument"
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(let ((nb (or n 1))
|
(let ((nb (or n 1))
|
||||||
|
@ -296,10 +296,29 @@
|
|||||||
:straight t
|
:straight t
|
||||||
:hook (after-init . winner-mode))
|
:hook (after-init . winner-mode))
|
||||||
|
|
||||||
;; Emacs Start Up Profiler
|
;; Permitir snippets
|
||||||
;; (use-package esup
|
(use-package yasnippet
|
||||||
;; :ensure t
|
:defer t
|
||||||
;; :straight t)
|
:straight t
|
||||||
|
:ensure t
|
||||||
|
:bind (:map yas-minor-mode-map
|
||||||
|
("TAB" . nil)
|
||||||
|
("<tab>" . nil)) ;; unbid tab for yasnippets
|
||||||
|
:custom
|
||||||
|
(yas-prompt-functions '(yas-completing-prompt))
|
||||||
|
: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
|
||||||
|
:straight t)
|
||||||
|
|
||||||
|
(use-package esup
|
||||||
|
:ensure t
|
||||||
|
:straight t)
|
||||||
|
|
||||||
(provide 'init-packages)
|
(provide 'init-packages)
|
||||||
;;; init-packages.el ends here
|
;;; init-packages.el ends here
|
||||||
|
Loading…
Reference in New Issue
Block a user