I showed you my source code, pls respond
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

3.1 KiB

Evil

Transform Emacs into Vim.

Config

Emacs has some strange default keybindings, which given the age of the project, is not surprising. To overcome this nearly show-stopping hurdle, we transform Emacs into Vim with evil1, the Extensible VI Layer for Emacs.

(use-package evil
  :custom (evil-want-integration t)  ;; Required for `evil-collection'.
          (evil-want-keybinding nil) ;; Same as above
  :config (evil-mode +1))

Improvements

While covering substantial ground towards the goal, the default keybindings implemented in evil1 alone are lacking compared to what you would expect from Vim. There's a community curated package evil-collection2 that does a much better job implementing the proper keybindings.

(use-package evil-collection
  :after evil
  :config (evil-collection-init))

Surround text

Quickly and efficiently surround text with evil-surround3. Highlight blocks of text with function definitions, quotations, or any symbol you can input from your keyboard.

(use-package evil-surround
  :after evil
  :config (global-evil-surround-mode 1))

Line numbering

Relative line numbers are important when using VI emulation keys. You can prefix commands with a number, allowing you to perform that action that number of times. Useful when navigating around pages that are hundreds, or even thousands of lines long.

  5:
  4:
  3:
  2:
  1:
156: << CURRENT LINE >>
  1:
  2:
  3:
  4:
  5:

This behaviour is implemented with linum-relative4, hooking into the display-line-number-mode as the backend for good performance in the GUI or TTY.

(use-package linum-relative
  :commands (linum-relative-global-mode)
  :custom (linum-delay t)
          (linum-relative-backend 'display-line-numbers-mode))

Toggle comments

Toggle comments in a language agnostic manner with evil-nerd-commenter5. Add a custom binding to M-; to mimmic the behaviour in other popular Emacs configuration frameworks. What is M-? Called the Meta key in Emacs, it typically refers to Alt.

(use-package evil-nerd-commenter
  :after evil
  :bind ("M-;" . evilnc-comment-or-uncomment-lines))

Shortcuts

Toggle relative line numbers with SPC t l.

(dotfiles/leader
  "tl" '(linum-relative-global-mode :which-key "Lines"))

Footnotes