Merge pull request #6 from LionyxML/development

feat: add straight package manager
This commit is contained in:
Rahul M. Juliato
2025-04-09 20:10:44 -03:00
committed by GitHub
4 changed files with 367 additions and 326 deletions

1
.gitignore vendored
View File

@@ -55,4 +55,5 @@ history
ielm-history.eld
p/.extension/
savehist
straight/
var/

172
README.md
View File

@@ -6,7 +6,6 @@ setup, you don't need to leave behind your favorite terminal or tools
like `yazi`, `starship`, `lazygit`, and `lazydocker` just to
give Emacs a try.
Use Emacs the same way you'd use `Neovim`, seamlessly integrating it
into your workflow inside terminal multiplexers like `tmux` or
`Zellij`, while also enjoying modern features such as `treesitter`
@@ -14,13 +13,11 @@ and `LSP`—no hassle.
![Demo](doc/demo01.png)
**Emacs-Kick** isnt a full-fledged distribution but rather a
**starting point** for building your own Emacs configuration. Its
designed to be especially accessible for Vim/Neovim users, letting you
explore the power of Emacs without committing to its entire ecosystem.
You can take advantage of Emacs features without needing to master
every Emacs-specific workflow right away. And if you find yourself
enjoying it, you can:
@@ -32,15 +29,13 @@ enjoying it, you can:
OR...
- Just keep using it on TUI, it is all up to you!
With Emacs-Kick, the goal is to empower you to explore Emacs at your
own pace. The sky's the limit! 🌟
## Minimum Requirements
- Emacs version **>=30**
- You can verify your version by running:
- Emacs version **>=30.1**
- You can verify your installed Emacs version by running:
```bash
emacs --version
@@ -54,7 +49,6 @@ emacs --version
`~/.emacs.d`, please back it up before proceeding. You can do this
by renaming the directory:
```bash
mv ~/.emacs.d ~/.emacs.d.backup
```
@@ -65,7 +59,6 @@ files such as `~/.emacs.d`, `~/.emacs`, `~/.emacs~`,
`~/.config/emacs`, `~/.config/doom`, `~/.config/cache/emacs` and
any other related files.
After deleting/backing up, clone the repository:
```bash
@@ -74,7 +67,7 @@ git clone https://github.com/LionyxML/emacs-kick.git ~/.emacs.d
2. **Run the setup**:
After cloning, install the configuration by running:
After cloning, install the configuration by running:
```bash
emacs -nw --eval="(ek/first-install)"
@@ -90,13 +83,15 @@ cd ~/.emacs.d/ && ./ek-reinstall.sh
Both methods will install all necessary packages and apply the
configuration.
**NOTE**: You will be prompted to install Tree-sitter grammars and
download some fonts (this configuration uses Nerd Fonts by
default). While you can choose to do this later, it is highly
recommended to complete these steps during the installation process
for the best experience!
**NOTE**: During the initial setup, you'll be prompted to install Tree-sitter
grammars and download some fonts. This configuration uses **Nerd Fonts** by
default, so installing them now is highly recommended for the best experience.
On first launch, Emacs will also **native compile some external packages**,
which may take a little time. Additionally, the first time you perform certain
actions—like opening the tree explorer, Emacs may compile related components in
the background. This is completely normal and only happens once per feature.
You might notice a brief moment of sluggish performance during this initial
compilation.
3. **Set terminal mode by default**:
@@ -131,87 +126,87 @@ emacs
```
**Usage Tips**:
- **Leader Key**: The leader key is set to `SPC` (spacebar),
`which-key` is there to help you discover keybindings.
`which-key` is there to help you discover keybindings.
- **Help Commands**:
- `SPC h i` opens the Emacs info documentation (`M-x info`).
- `SPC h v` allows you to explore available variables.
- `SPC h f` lets you explore functions.
- `SPC h k` displays keybindings.
- `SPC h i` opens the Emacs info documentation (`M-x info`).
- `SPC h v` allows you to explore available variables.
- `SPC h f` lets you explore functions.
- `SPC h k` displays keybindings.
**Troubleshooting**:
- If you encounter any issues during installation, check the
`*Messages*` buffer for more information. You can switch between
buffers with `SPC SPC`, and navigate options using `C-p` and `C-n`.
- If you encounter any issues during installation, check the
`*Messages*` buffer for more information. You can switch between
buffers with `SPC SPC`, and navigate options using `C-p` and `C-n`.
## Available Commands
| 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 |
| `gd` | Goto definitions |
| `gr` | Goto references |
| 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 |
| `gd` | Goto definitions |
| `gr` | Goto references |
...and a lot more, discoverable with which-key :)
## Contributing
This package is intentionally designed with a specific vision in mind,
@@ -219,17 +214,14 @@ reflecting my own opinions and preferences. While contributions are
welcome, please understand that this configuration is quite
opinionated.
If you have suggestions or requests, they will be considered
carefully, but I cannot make any promises regarding implementation or
acceptance. Your input is valuable, and I appreciate any help or
feedback to improve the project.
To contribute, feel free to open an issue or submit a pull
request. Let's make this configuration even better together!
## About PRs
Always welcome, not a promise to accept though (see above). Please

View File

@@ -5,7 +5,7 @@ echo ">>> (re)Installing Emacs Kick ..."
sleep 2
echo ">>> Deleting packages, grammars and native compilation cache ..."
rm -rf eln-cache/ elpa/ tree-sitter/
rm -rf eln-cache/ elpa/ tree-sitter/ straight/
sleep 2
echo ">>> Starting Emacs and auto-package fetching/installing ..."

206
init.el
View File

@@ -1,7 +1,8 @@
;;; init.el --- Emacs-Kick --- A feature rich Emacs config for (neo)vi(m)mers -*- lexical-binding: t; -*-
;; Author: Rahul Martim Juliato
;; Version: 0.1.3
;; Package-Requires: ((emacs "30.0"))
;; Version: 0.2.0
;; Package-Requires: ((emacs "30.1"))
;; License: GPL-2.0-or-later
;;; Commentary:
@@ -119,13 +120,38 @@
;; running Emacs as a server, such as 'What version of Node is my LSP using?'.
;; Again, this setup configures Emacs much like how a Vimmer would configure Neovim.
;; Emacs already comes with its on package manager.
;; Others are available, but let's stick with the defaults when it makes sense.
;;
;; Requires the default Emacs package manager, similar to an 'import' in other languages.
;; Emacs comes with a built-in package manager (`package.el'), and we'll use it
;; when it makes sense. However, `straight.el' is a bit more user-friendly and
;; reproducible, especially for newcomers and shareable configs like emacs-kick.
;; So we bootstrap it here.
(setq package-enable-at-startup nil) ;; Disables the default package manager.
;; Bootstraps `straight.el'
(setq straight-check-for-modifications nil)
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name
"straight/repos/straight.el/bootstrap.el"
(or (bound-and-true-p straight-base-dir)
user-emacs-directory)))
(bootstrap-version 7))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(straight-use-package '(project :type built-in))
(straight-use-package 'use-package)
;; In Emacs, a package is a collection of Elisp code that extends the editor's functionality,
;; much like plugins do in Neovim.
;; much like plugins do in Neovim. We need to import this package to add package archives.
(require 'package)
;; Add MELPA (Milkypostman's Emacs Lisp Package Archive) to the list of package archives.
;; This allows you to install packages from this widely-used repository, similar to how
;; pip works for Python or npm for Node.js. While Emacs comes with ELPA (Emacs Lisp
@@ -134,7 +160,6 @@
;; standard for Emacs users. You can also add more package archives later as needed.
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; Define a global customizable variable `ek-use-nerd-fonts' to control the use of
;; Nerd Fonts symbols throughout the configuration. This boolean variable allows
;; users to easily enable or disable the use of symbols from Nerd Fonts, providing
@@ -146,22 +171,24 @@
:group 'appearance)
;; From now on, you'll see configurations using the `use-package' macro, which
;; From now on, you'll see configurations using the `use-package` macro, which
;; allows us to organize our Emacs setup in a modular way. These configurations
;; look like this:
;;
;; (use-package some-package
;; :ensure t ;; Ensure the package is installed.
;; :config ;; Configuration settings for the package.
;; :ensure t ;; Ensure the package is installed (used with package.el).
;; :straight t ;; Use straight.el to install and manage this package.
;; :config ;; Configuration settings for the package.
;; ;; Additional settings can go here.
;; )
;;
;; This approach simplifies package management, enabling us to easily control
;; both built-in (first-party) and external (third-party) packages. While Emacs
;; is a vast and powerful editor, using `use-package' helps streamline our
;; configuration for better organization and customization. As we proceed,
;; you'll see smaller `use-package' declarations for specific packages, which
;; will help us enable the desired features and improve our workflow.
;; is a vast and powerful editor, using `use-package`—especially in combination
;; with `straight.el`—helps streamline our configuration for better organization,
;; reproducibility, and customization. As we proceed, you'll see smaller
;; `use-package` declarations for specific packages, which will help us enable
;; the desired features and improve our workflow.
;;; EMACS
@@ -202,8 +229,8 @@
;; this might be confusing for newcomers. This settings make sure ]b and [b will always load a
;; file buffer. To see all buffers use <leader> SPC, <leader> b l, or <leader> b i.
(defun skip-these-buffers (_window buffer _bury-or-kill)
"Function for `switch-to-prev-buffer-skip'."
(string-match "\\*[^*]+\\*" (buffer-name buffer)))
"Function for `switch-to-prev-buffer-skip'."
(string-match "\\*[^*]+\\*" (buffer-name buffer)))
(setq switch-to-prev-buffer-skip 'skip-these-buffers)
@@ -247,19 +274,19 @@
;; Add a hook to run code after Emacs has fully initialized.
(add-hook 'after-init-hook
(lambda ()
(message "Emacs has fully loaded. This code runs after startup.")
(lambda ()
(message "Emacs has fully loaded. This code runs after startup.")
;; Insert a welcome message in the *scratch* buffer displaying loading time and activated packages.
(with-current-buffer (get-buffer-create "*scratch*")
(insert (format
";; Welcome to Emacs!
;; Insert a welcome message in the *scratch* buffer displaying loading time and activated packages.
(with-current-buffer (get-buffer-create "*scratch*")
(insert (format
";; Welcome to Emacs!
;;
;; Loading time : %s
;; Packages : %s
"
(emacs-init-time)
(number-to-string (length package-activated-list))))))))
(emacs-init-time)
(number-to-string (length package-activated-list))))))))
;;; WINDOW
@@ -276,7 +303,7 @@
:custom
(display-buffer-alist
'(
;; ("\\*.*e?shell\\*"
;; ("\\*.*e?shell\\*"
;; (display-buffer-in-side-window)
;; (window-height . 0.25)
;; (side . bottom)
@@ -303,7 +330,7 @@
(window-height . 0.25)
(side . bottom)
(slot . 1))
)))
)))
;;; DIRED
@@ -451,7 +478,7 @@
:custom
(flymake-margin-indicators-string
'((error "" compilation-error) (warning "»" compilation-warning)
(note "»" compilation-info))))
(note "»" compilation-info))))
;;; ORG-MODE
@@ -500,6 +527,7 @@
;; it easier to choose the correct one without typing out the entire string.
(use-package vertico
:ensure t
:straight t
:hook
(after-init . vertico-mode) ;; Enable vertico after Emacs has initialized.
:custom
@@ -511,13 +539,13 @@
;; This will prefix the current candidate with “» ” to make it stand out.
;; Reference: https://github.com/minad/vertico/wiki#prefix-current-candidate-with-arrow
(advice-add #'vertico--format-candidate :around
(lambda (orig cand prefix suffix index _start)
(setq cand (funcall orig cand prefix suffix index _start))
(concat
(if (= vertico--index index)
(propertize "» " 'face '(:foreground "#80adf0" :weight bold))
" ")
cand))))
(lambda (orig cand prefix suffix index _start)
(setq cand (funcall orig cand prefix suffix index _start))
(concat
(if (= vertico--index index)
(propertize "» " 'face '(:foreground "#80adf0" :weight bold))
" ")
cand))))
;;; ORDERLESS
@@ -527,6 +555,7 @@
;; This combination provides a powerful and customizable completion experience.
(use-package orderless
:ensure t
:straight t
:defer t ;; Load Orderless on demand.
:after vertico ;; Ensure Vertico is loaded before Orderless.
:init
@@ -542,6 +571,7 @@
;; information, making it easier to choose the right option.
(use-package marginalia
:ensure t
:straight t
:hook
(after-init . marginalia-mode))
@@ -553,6 +583,7 @@
;; navigating buffers, files, and xrefs with ease.
(use-package consult
:ensure t
:straight t
:defer t
:init
;; Enhance register preview with thin lines and no mode line.
@@ -571,6 +602,7 @@
;; Just `<leader> .' over any text, explore it :)
(use-package embark
:ensure t
:straight t
:defer t)
@@ -579,6 +611,7 @@
;; that Consult commands, like previews, are available when using Embark.
(use-package embark-consult
:ensure t
:straight t
:hook
(embark-collect-mode . consult-preview-at-point-mode)) ;; Enable preview in Embark collect mode.
@@ -591,6 +624,7 @@
;; programming languages.
(use-package treesit-auto
:ensure t
:straight t
:after emacs
:custom
(treesit-auto-install 'prompt)
@@ -606,6 +640,7 @@
;; to use GitHub Flavored Markdown for enhanced compatibility.
(use-package markdown-mode
:defer t
:straight t
:ensure t
:mode ("README\\.md\\'" . gfm-mode) ;; Use gfm-mode for README.md files.
:init (setq markdown-command "multimarkdown")) ;; Set the Markdown processing command.
@@ -619,6 +654,7 @@
;; various modes and languages.
(use-package company
:defer t
:straight t
:ensure t
:custom
(company-tooltip-align-annotations t) ;; Align annotations with completions.
@@ -630,9 +666,9 @@
;; While using C-p C-n to select a completion candidate
;; C-y quickly shows help docs for the current candidate
(define-key company-active-map (kbd "C-y")
(lambda ()
(interactive)
(company-show-doc-buffer)))
(lambda ()
(interactive)
(company-show-doc-buffer)))
(define-key company-active-map [tab] 'company-complete-selection)
(define-key company-active-map (kbd "TAB") 'company-complete-selection)
(define-key company-active-map [ret] 'company-complete-selection)
@@ -657,6 +693,7 @@
;; https://emacs-lsp.github.io/lsp-mode/
(use-package lsp-mode
:ensure t
:straight t
:defer t
:hook (;; Replace XXX-mode with concrete major mode (e.g. python-mode)
(bash-ts-mode . lsp) ;; Enable LSP for Bash
@@ -717,6 +754,7 @@
;; different languages and frameworks.
(use-package lsp-tailwindcss
:ensure t
:straight t
:defer t
:config
(add-to-list 'lsp-language-id-configuration '(".*\\.erb$" . "html")) ;; Associate ERB files with HTML.
@@ -738,6 +776,7 @@
;; a comparable experience in Emacs with its own set of customizations.
(use-package diff-hl
:defer t
:straight t
:ensure t
:hook
(find-file . (lambda ()
@@ -747,10 +786,10 @@
:custom
(diff-hl-side 'left) ;; Set the side for diff indicators.
(diff-hl-margin-symbols-alist '((insert . "") ;; Customize symbols for each change type.
(delete . "-")
(change . "")
(unknown . "?")
(ignored . "i"))))
(delete . "-")
(change . "")
(unknown . "?")
(ignored . "i"))))
;;; Magit
@@ -770,6 +809,7 @@
;; extend the powerful capabilities that Magit offers in Emacs.
(use-package magit
:ensure t
:straight t
:defer t)
@@ -781,6 +821,7 @@
;; smooth workflow when working across multiple environments.
(use-package xclip
:ensure t
:straight t
:defer t
:hook
(after-init . xclip-mode)) ;; Enable xclip mode after initialization.
@@ -794,6 +835,7 @@
;; the code.
(use-package indent-guide
:defer t
:straight t
:ensure t
:hook
(prog-mode . indent-guide-mode) ;; Activate indent-guide in programming modes.
@@ -819,18 +861,19 @@
;; properly utilized.
(use-package add-node-modules-path
:ensure t
:straight t
:defer t
:custom
;; Makes sure you are using the local bin for your
;; node project. Local eslint, typescript server...
(eval-after-load 'typescript-ts-mode
'(add-hook 'typescript-ts-mode-hook #'add-node-modules-path))
'(add-hook 'typescript-ts-mode-hook #'add-node-modules-path))
(eval-after-load 'tsx-ts-mode
'(add-hook 'tsx-ts-mode-hook #'add-node-modules-path))
'(add-hook 'tsx-ts-mode-hook #'add-node-modules-path))
(eval-after-load 'typescriptreact-mode
'(add-hook 'typescriptreact-mode-hook #'add-node-modules-path))
'(add-hook 'typescriptreact-mode-hook #'add-node-modules-path))
(eval-after-load 'js-mode
'(add-hook 'js-mode-hook #'add-node-modules-path)))
'(add-hook 'js-mode-hook #'add-node-modules-path)))
;; EVIL
@@ -840,6 +883,7 @@
;; experience.
(use-package evil
:ensure t
:straight t
:defer t
:hook
(after-init . evil-mode)
@@ -934,28 +978,28 @@
;; Custom example. Formatting with prettier tool.
(evil-define-key 'normal 'global (kbd "<leader> m p")
(lambda ()
(interactive)
(shell-command (concat "prettier --write " (shell-quote-argument (buffer-file-name))))
(revert-buffer t t t)))
(lambda ()
(interactive)
(shell-command (concat "prettier --write " (shell-quote-argument (buffer-file-name))))
(revert-buffer t t t)))
;; LSP commands keybindings
(evil-define-key 'normal lsp-mode-map
;; (kbd "gd") 'lsp-find-definition ;; evil-collection already provides gd
(kbd "gr") 'lsp-find-references ;; Finds LSP references
(kbd "<leader> c a") 'lsp-execute-code-action ;; Execute code actions
(kbd "<leader> r n") 'lsp-rename ;; Rename symbol
(kbd "gI") 'lsp-find-implementation ;; Find implementation
(kbd "<leader> l f") 'lsp-format-buffer) ;; Format buffer via lsp
;; (kbd "gd") 'lsp-find-definition ;; evil-collection already provides gd
(kbd "gr") 'lsp-find-references ;; Finds LSP references
(kbd "<leader> c a") 'lsp-execute-code-action ;; Execute code actions
(kbd "<leader> r n") 'lsp-rename ;; Rename symbol
(kbd "gI") 'lsp-find-implementation ;; Find implementation
(kbd "<leader> l f") 'lsp-format-buffer) ;; Format buffer via lsp
(defun ek/lsp-describe-and-jump ()
"Show hover documentation and jump to *lsp-help* buffer."
(interactive)
(lsp-describe-thing-at-point)
(let ((help-buffer "*lsp-help*"))
"Show hover documentation and jump to *lsp-help* buffer."
(interactive)
(lsp-describe-thing-at-point)
(let ((help-buffer "*lsp-help*"))
(when (get-buffer help-buffer)
(switch-to-buffer-other-window help-buffer))))
(switch-to-buffer-other-window help-buffer))))
;; Open hover documentation
(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,
@@ -966,16 +1010,16 @@
;; Commenting functionality for single and multiple lines
(evil-define-key 'normal 'global (kbd "gcc")
(lambda ()
(interactive)
(if (not (use-region-p))
(comment-or-uncomment-region (line-beginning-position) (line-end-position)))))
(lambda ()
(interactive)
(if (not (use-region-p))
(comment-or-uncomment-region (line-beginning-position) (line-end-position)))))
(evil-define-key 'visual 'global (kbd "gc")
(lambda ()
(interactive)
(if (use-region-p)
(comment-or-uncomment-region (region-beginning) (region-end)))))
(lambda ()
(interactive)
(if (use-region-p)
(comment-or-uncomment-region (region-beginning) (region-end)))))
;; Enable evil mode
(evil-mode 1))
@@ -988,6 +1032,7 @@
;; commands to fit the `evil' style.
(use-package evil-collection
:defer t
:straight t
:ensure t
:custom
(evil-collection-want-find-usages-bindings t)
@@ -1008,6 +1053,7 @@
;; - https://github.com/emacs-evil/evil-surround?tab=readme-ov-file#examples
(use-package evil-surround
:ensure t
:straight t
:after evil-collection
:config
(global-evil-surround-mode 1))
@@ -1021,6 +1067,7 @@
;; Just use % for jumping between matching structures to check it out.
(use-package evil-matchit
:ensure t
:straight t
:after evil-collection
:config
(global-evil-matchit-mode 1))
@@ -1034,6 +1081,7 @@
(use-package undo-tree
:defer t
:ensure t
:straight t
:hook
(after-init . global-undo-tree-mode)
:init
@@ -1058,6 +1106,7 @@
;; a different color, making it easier to match pairs visually.
(use-package rainbow-delimiters
:defer t
:straight t
:ensure t
:hook
(prog-mode . rainbow-delimiters-mode))
@@ -1067,6 +1116,7 @@
;; A simple major mode to provide .env files with color highlighting
(use-package dotenv-mode
:defer t
:straight t
:ensure t
:config)
@@ -1079,6 +1129,7 @@
;; jumping to definitions.
(use-package pulsar
:defer t
:straight t
:ensure t
:hook
(after-init . pulsar-global-mode)
@@ -1106,6 +1157,7 @@
;; experience by displaying relevant information in a compact format.
(use-package doom-modeline
:ensure t
:straight t
:defer t
:custom
(doom-modeline-buffer-file-name-style 'buffer-name) ;; Set the buffer file name style to just the buffer name (without path).
@@ -1126,6 +1178,7 @@
;; and integrates with version control to show file states.
(use-package neotree
:ensure t
:straight t
:custom
(neo-show-hidden-files t) ;; By default shows hidden files (toggle with H)
(neo-theme 'nerd) ;; Set the default theme for Neotree to 'nerd' for a visually appealing look.
@@ -1144,6 +1197,7 @@
(use-package nerd-icons
:if ek-use-nerd-fonts ;; Load the package only if the user has configured to use nerd fonts.
:ensure t ;; Ensure the package is installed.
:straight t
:defer t) ;; Load the package only when needed to improve startup time.
@@ -1154,6 +1208,7 @@
(use-package nerd-icons-dired
:if ek-use-nerd-fonts ;; Load the package only if the user has configured to use nerd fonts.
:ensure t ;; Ensure the package is installed.
:straight t
:defer t ;; Load the package only when needed to improve startup time.
:hook
(dired-mode . nerd-icons-dired-mode))
@@ -1167,6 +1222,7 @@
(use-package nerd-icons-completion
:if ek-use-nerd-fonts ;; Load the package only if the user has configured to use nerd fonts.
:ensure t ;; Ensure the package is installed.
:straight t
:after (:all nerd-icons marginalia) ;; Load after `nerd-icons' and `marginalia' to ensure proper integration.
:config
(nerd-icons-completion-mode) ;; Activate nerd icons for completion interfaces.
@@ -1180,6 +1236,7 @@
;; with soft colors that are easy on the eyes.
(use-package catppuccin-theme
:ensure t
:straight t
:config
(custom-set-faces
;; Set the color for changes in the diff highlighting to blue.
@@ -1210,16 +1267,7 @@
(message ">>> Configuring Nerd Fonts...")
(require 'nerd-icons)
(nerd-icons-install-fonts) ;; Install all available nerd-fonts
(message ">>> Native compile 3rd-party packages...\n")
(require 'comp)
(native-compile-prune-cache) ;; Prune the native compilation cache to free up resources.
;; Iterate through all directories in the user's package directory.
(dolist (dir (directory-files package-user-dir t "^[^.]" t))
(when (file-directory-p dir) ;; Check if the current entry is a directory.
(byte-recompile-directory dir 0 t) ;; Byte compile all files in the directory.
(native-compile-async dir 'recursively))) ;; Asynchronously compile the directory and its subdirectories.
(message ">>> Emacs-Kick installed!!! Press any key to close the installer and open Emacs normally.") ;; Notify the user that the installation is complete.
(message ">>> Emacs-Kick installed! Press any key to close the installer and open Emacs normally. First boot will compile some extra stuff :)")
(read-key) ;; Wait for the user to press any key.
(kill-emacs)) ;; Close Emacs after installation is complete.