Ad more evil configurations.

This commit is contained in:
kj 2022-11-29 03:46:08 -04:00
parent e1775bda51
commit bd450ea034

View File

@ -11,12 +11,53 @@
:straight t
:hook (after-init . evil-mode)
: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
(setq evil-toggle-key "C-'")
(setq evil-default-state 'emacs)
(setq evil-emacs-state-cursor 'bar)
;; Habilitar atajos de de tecla de emacs en insert state
(setq evil-insert-state-map (make-sparse-keymap))
(evil-define-key 'insert 'global (kbd "<escape>") 'evil-normal-state)
(evil-define-key '(normal insert visual replace operator motion emacs) 'global (kbd "C-z") 'evil-undo)
;; Variales locales
(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)