feat: undo-tree is integrated, more rc candy

This commit is contained in:
Rahul Martim Juliato
2024-10-08 17:05:10 -03:00
parent 9a98218f0a
commit 5585790ebb
2 changed files with 100 additions and 17 deletions

View File

@@ -6,6 +6,7 @@ setup, you don't need to leave behind your favorite terminal or tools
like `yazi`, `starship`, `lazygit`, and `lazydocker` just to like `yazi`, `starship`, `lazygit`, and `lazydocker` just to
give Emacs a try. give Emacs a try.
Use Emacs the same way you'd use `Neovim`, seamlessly integrating it Use Emacs the same way you'd use `Neovim`, seamlessly integrating it
into your workflow inside terminal multiplexers like `tmux` or into your workflow inside terminal multiplexers like `tmux` or
`Zellij`, while also enjoying modern features such as `treesitter` `Zellij`, while also enjoying modern features such as `treesitter`
@@ -13,21 +14,23 @@ and `LSP`—no hassle.
![Demo](doc/demo01.png) ![Demo](doc/demo01.png)
`Emacs-Kick` is not a distribution, but a starting point for your `Emacs-Kick` is not a distribution, but a starting point for your
own configuration. Its designed to be accessible to Vim/Neovim users own configuration. Its designed to be accessible to Vim/Neovim users
without needing to adopt all of Emacs' ecosystem. You can still enjoy without needing to adopt all of Emacs' ecosystem. You can still enjoy
the power of Emacs without having to learn every Emacs-specific the power of Emacs without having to learn every Emacs-specific
workflow. workflow.
**Minimum Requirements**: **Minimum Requirements**:
- Emacs version **29+** - Emacs version **>=30**
- You can verify your version by running: - You can verify your version by running:
```bash ```bash
emacs --version emacs --version
``` ```
**Installation Instructions**: ## Installation Instructions
1. **Clone the repository**: 1. **Clone the repository**:
@@ -35,6 +38,7 @@ emacs --version
`~/.emacs.d`, please back it up before proceeding. You can do this `~/.emacs.d`, please back it up before proceeding. You can do this
by renaming the directory: by renaming the directory:
```bash ```bash
mv ~/.emacs.d ~/.emacs.d.backup mv ~/.emacs.d ~/.emacs.d.backup
``` ```
@@ -45,7 +49,8 @@ mv ~/.emacs.d ~/.emacs.d.backup
`~/.config/emacs`, `~/.config/doom`, `~/.config/cache/emacs` and `~/.config/emacs`, `~/.config/doom`, `~/.config/cache/emacs` and
any other related files. any other related files.
After backing up, clone the repository:
After deleting/backing up, clone the repository:
```bash ```bash
git clone https://github.com/LionyxML/emacs-kick.git ~/.emacs.d git clone https://github.com/LionyxML/emacs-kick.git ~/.emacs.d
@@ -115,25 +120,85 @@ emacs
`*Messages*` buffer for more information. You can switch between `*Messages*` buffer for more information. You can switch between
buffers with `SPC SPC`, and navigate options using `C-p` and `C-n`. buffers with `SPC SPC`, and navigate options using `C-p` and `C-n`.
---
This configuration is tailored for Vim/Neovim users looking to explore ## Available Commands
Emacs while keeping their existing workflow intact. Feel free to
explore and customize it further as you go.
Enjoy your Emacs experience! | Keybinding | Action |
|---------------------|-------------------------------------------|
| `SPC` | Leader key |
| `C-d` | Scroll down |
| `C-u` | Scroll up |
| `<leader> s f` | Find file |
| `<leader> s g` | Grep |
| `<leader> s G` | Git grep |
| `<leader> s r` | Ripgrep |
| `<leader> s h` | Consult info |
| `<leader> /` | Consult line |
| `<leader> x x` | Consult Flymake |
| `] d` | Next Flymake error |
| `[ d` | Previous Flymake error |
| `<leader> x d` | Dired |
| `<leader> x j` | Dired jump |
| `<leader> x f` | Find file |
| `] c` | Next diff hunk |
| `[ c` | Previous diff hunk |
| `<leader> e e` | Toggle NeoTree |
| `<leader> g g` | Open Magit status |
| `<leader> g l` | Show current log |
| `<leader> g d` | Show diff for current file |
| `<leader> g D` | Show diff for hunk |
| `<leader> g b` | Annotate buffer with version control info |
| `] b` | Switch to next buffer |
| `[ b` | Switch to previous buffer |
| `<leader> b i` | Consult buffer list |
| `<leader> b b` | Open Ibuffer |
| `<leader> b d` | Kill current buffer |
| `<leader> b k` | Kill current buffer |
| `<leader> b x` | Kill current buffer |
| `<leader> b s` | Save buffer |
| `<leader> b l` | Consult buffer |
| `<leader>SPC` | Consult buffer |
| `<leader> p b` | Consult project buffer |
| `<leader> p p` | Switch project |
| `<leader> p f` | Find file in project |
| `<leader> p g` | Find regexp in project |
| `<leader> p k` | Kill project buffers |
| `<leader> p D` | Dired for project |
| `P` | Yank from kill ring |
| `<leader> P` | Yank from kill ring |
| `<leader> .` | Embark act |
| `<leader> u` | Undo tree visualize |
| `<leader> h m` | Describe current mode |
| `<leader> h f` | Describe function |
| `<leader> h v` | Describe variable |
| `<leader> h k` | Describe key |
| `] t` | Go to next tab |
| `[ t` | Go to previous tab |
| `<leader> m p` | Format with Prettier |
| `<leader> c a` | Execute code action |
| `<leader> r n` | Rename symbol |
| `gI` | Find implementation |
| `<leader> l f` | Format buffer via LSP |
| `K` | Show hover documentation |
| `gcc` | Comment/uncomment current line |
| `gc` | Comment/uncomment selected region |
# Contributing ...and a lot more, discoverable with which-key :)
## Contributing
This package is intentionally designed with a specific vision in mind, This package is intentionally designed with a specific vision in mind,
reflecting my own opinions and preferences. While contributions are reflecting my own opinions and preferences. While contributions are
welcome, please understand that this configuration is quite welcome, please understand that this configuration is quite
opinionated. opinionated.
If you have suggestions or requests, they will be considered If you have suggestions or requests, they will be considered
carefully, but I cannot make any promises regarding implementation or carefully, but I cannot make any promises regarding implementation or
acceptance. Your input is valuable, and I appreciate any help or acceptance. Your input is valuable, and I appreciate any help or
feedback to improve the project. feedback to improve the project.
To contribute, feel free to open an issue or submit a pull To contribute, feel free to open an issue or submit a pull
request. Let's make this configuration even better together! request. Let's make this configuration even better together!

34
init.el
View File

@@ -1,6 +1,6 @@
;;; init.el --- Emacs-Kick --- A feature rich Emacs config for (neo)vi(m)mers -*- lexical-binding: t; -*- ;;; init.el --- Emacs-Kick --- A feature rich Emacs config for (neo)vi(m)mers -*- lexical-binding: t; -*-
;; Author: Rahul Martim Juliato ;; Author: Rahul Martim Juliato
;; Version: 0.1.0-rc2 ;; Version: 0.1.0-rc3
;; Package-Requires: ((emacs "30.0")) ;; Package-Requires: ((emacs "30.0"))
;; License: GPL-2.0-or-later ;; License: GPL-2.0-or-later
@@ -447,7 +447,11 @@
(use-package flymake (use-package flymake
:ensure nil ;; This is built-in, no need to fetch it. :ensure nil ;; This is built-in, no need to fetch it.
:defer t :defer t
:hook (prog-mode . flymake-mode)) :hook (prog-mode . flymake-mode)
:custom
(flymake-margin-indicators-string
'((error "" compilation-error) (warning "»" compilation-warning)
(note "»" compilation-info))))
;;; ORG-MODE ;;; ORG-MODE
@@ -836,9 +840,11 @@
(setq evil-want-integration t) ;; Integrate `evil' with other Emacs features (optional as it's true by default). (setq evil-want-integration t) ;; Integrate `evil' with other Emacs features (optional as it's true by default).
(setq evil-want-keybinding nil) ;; Disable default keybinding to set custom ones. (setq evil-want-keybinding nil) ;; Disable default keybinding to set custom ones.
:config :config
(evil-set-undo-system 'undo-tree) ;; Uses the undo-tree package as the default undo system
;; Set the leader key to space for easier access to custom commands. (setq evil-want-leader t) ;; Set the leader key to space for easier access to custom commands. (setq evil-want-leader t)
(setq evil-leader/in-all-states t) ;; Make the leader key available in all states. (setq evil-leader/in-all-states t) ;; Make the leader key available in all states.
(setq evil-undo-system 'undo-tree) ;; Use `undo-tree' for better visual undo history. (setq evil-want-fine-undo t) ;; Evil uses finer grain undoing steps
;; Define the leader key as Space ;; Define the leader key as Space
(evil-set-leader 'normal (kbd "SPC")) (evil-set-leader 'normal (kbd "SPC"))
@@ -932,7 +938,7 @@
(evil-define-key 'normal lsp-mode-map (evil-define-key 'normal lsp-mode-map
;; (kbd "gd") 'lsp-find-definition ;; Emacs already provides a better gd ;; (kbd "gd") 'lsp-find-definition ;; Emacs already provides a better gd
;; (kbd "gr") 'lsp-find-references ;; Emacs already provides a better gr ;; (kbd "gr") 'lsp-find-references ;; Emacs already provides a better gr
(kbd "<leader> c a") 'lsp-describe-thing-at-point ;; Show hover documentation (kbd "<leader> c a") 'lsp-execute-code-action ;; Execute code actions
(kbd "<leader> r n") 'lsp-rename ;; Rename symbol (kbd "<leader> r n") 'lsp-rename ;; Rename symbol
(kbd "gI") 'lsp-find-implementation ;; Find implementation (kbd "gI") 'lsp-find-implementation ;; Find implementation
(kbd "<leader> l f") 'lsp-format-buffer) ;; Format buffer via lsp (kbd "<leader> l f") 'lsp-format-buffer) ;; Format buffer via lsp
@@ -947,7 +953,11 @@
(switch-to-buffer-other-window help-buffer)))) (switch-to-buffer-other-window help-buffer))))
;; Open hover documentation ;; Open hover documentation
(evil-define-key 'normal 'global (kbd "K") 'ek/lsp-describe-and-jump) (evil-define-key 'normal 'global (kbd "K") 'ek/lsp-describe-and-jump)
;; Yeah, on terminals, Emacs doesn't support (YET), the use of floating windows,
;; thus, this will open a small buffer bellow your window.
;; This floating frames are called "child frames" and some recent effort is being put
;; into having a translation of those marvelous GUI stuff to terminal. Let's hope
;; we add this to Emacs Kick soom :)
;; Commenting functionality for single and multiple lines ;; Commenting functionality for single and multiple lines
(evil-define-key 'normal 'global (kbd "gcc") (evil-define-key 'normal 'global (kbd "gcc")
@@ -1019,6 +1029,14 @@
(prog-mode . rainbow-delimiters-mode)) (prog-mode . rainbow-delimiters-mode))
;;; DOTENV
;; A simple major mode to provide .env files with color highlighting
(use-package dotenv-mode
:defer t
:ensure t
:config)
;;; PULSAR ;;; PULSAR
;; The `pulsar' package enhances the user experience in Emacs by providing ;; The `pulsar' package enhances the user experience in Emacs by providing
;; visual feedback through pulsating highlights. This feature is especially ;; visual feedback through pulsating highlights. This feature is especially
@@ -1131,15 +1149,15 @@
:config :config
(custom-set-faces (custom-set-faces
;; Set the color for changes in the diff highlighting to blue. ;; Set the color for changes in the diff highlighting to blue.
`(diff-hl-change ((t (:background nil :foreground ,(catppuccin-get-color 'blue)))))) `(diff-hl-change ((t (:background unspecified :foreground ,(catppuccin-get-color 'blue))))))
(custom-set-faces (custom-set-faces
;; Set the color for deletions in the diff highlighting to red. ;; Set the color for deletions in the diff highlighting to red.
`(diff-hl-delete ((t (:background nil :foreground ,(catppuccin-get-color 'red)))))) `(diff-hl-delete ((t (:background unspecified :foreground ,(catppuccin-get-color 'red))))))
(custom-set-faces (custom-set-faces
;; Set the color for insertions in the diff highlighting to green. ;; Set the color for insertions in the diff highlighting to green.
`(diff-hl-insert ((t (:background nil :foreground ,(catppuccin-get-color 'green)))))) `(diff-hl-insert ((t (:background unspecified :foreground ,(catppuccin-get-color 'green))))))
;; Load the Catppuccin theme without prompting for confirmation. ;; Load the Catppuccin theme without prompting for confirmation.
(load-theme 'catppuccin :no-confirm)) (load-theme 'catppuccin :no-confirm))