feat: add straight package manager
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -55,4 +55,5 @@ history
|
||||
ielm-history.eld
|
||||
p/.extension/
|
||||
savehist
|
||||
straight/
|
||||
var/
|
||||
52
README.md
52
README.md
@@ -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.
|
||||
|
||||

|
||||
|
||||
|
||||
**Emacs-Kick** isn’t a full-fledged distribution but rather a
|
||||
**starting point** for building your own Emacs configuration. It’s
|
||||
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,24 +126,25 @@ 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 |
|
||||
@@ -211,7 +207,6 @@ emacs
|
||||
|
||||
...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
|
||||
|
||||
@@ -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 ..."
|
||||
|
||||
96
init.el
96
init.el
@@ -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.
|
||||
;; :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
|
||||
@@ -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
|
||||
@@ -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.
|
||||
@@ -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 ()
|
||||
@@ -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,6 +861,7 @@
|
||||
;; 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
|
||||
@@ -840,6 +883,7 @@
|
||||
;; experience.
|
||||
(use-package evil
|
||||
:ensure t
|
||||
:straight t
|
||||
:defer t
|
||||
:hook
|
||||
(after-init . evil-mode)
|
||||
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user