65 lines
2.7 KiB
EmacsLisp
65 lines
2.7 KiB
EmacsLisp
;;; init-evil.el --- VIM dentro de emacs -*- lexical-binding: t -*-
|
|
|
|
;; Author: kj <webmaster@outcontrol.net>
|
|
;; URL: https://git.kj2.me/kj/confi-emacs-actual
|
|
|
|
;;; Commentary:
|
|
|
|
;;; Code:
|
|
(use-package evil
|
|
:defer t
|
|
: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
|
|
|
|
;; 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)
|
|
|
|
;; 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)
|
|
;;; init-evil.el ends here
|