Skip to content

Instantly share code, notes, and snippets.

@AyakoGFX
Created June 24, 2026 13:12
Show Gist options
  • Select an option

  • Save AyakoGFX/aa3399161126a3cc20f5c907687e24bd to your computer and use it in GitHub Desktop.

Select an option

Save AyakoGFX/aa3399161126a3cc20f5c907687e24bd to your computer and use it in GitHub Desktop.
base stater emacs configurationi
;; ==========================================
;; 1. PACKAGE MANAGEMENT SETUP
;; ==========================================
(require 'package)
(setq package-enable-at-startup nil)
;; Define where Emacs should look to download external packages
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
("nongnu" . "https://elpa.nongnu.org/nongnu/")
("elpa-devel" . "https://elpa.gnu.org/devel/")
("gnu" . "https://elpa.gnu.org/packages/")))
(package-initialize)
;; Automatically download and install 'use-package' if it's not already installed
;; 'use-package' is used further down to cleanly install and configure packages
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
;; ==========================================
;; 2. BASIC INTERFACE & UTILITY MODES
;; ==========================================
;; (global-hl-line-mode 1) ; Highlight the current line (currently turned off)
(context-menu-mode 1) ; Enable right-click mouse menus
(electric-pair-mode 1) ; Automatically close brackets/parentheses: typing ( inserts ()
(tool-bar-mode -1) ; Hide the graphical tool bar icon row to save space
(menu-bar-mode -1) ; Hide the file/edit menu bar at the top
(scroll-bar-mode -1) ; Hide the window scrollbars for a cleaner look
(global-visual-line-mode t) ; Enable word-wrap so long lines don't wrap off-screen
(global-display-line-numbers-mode 1) ; Show line numbers on the left side
(save-place-mode 1) ; Remember where the cursor was when you reopen a closed file
(global-auto-revert-mode 1) ; Automatically refresh a file if it changes outside of Emacs
(horizontal-scroll-bar-mode -1) ; Hide horizontal scroll bars
(delete-selection-mode t) ; Typing over highlighted text replaces/deletes it
;; ==========================================
;; 3. SYSTEM & BEHAVIOR TWEAKS
;; ==========================================
(setq ring-bell-function 'ignore ; Turn off the annoying alert/error bell noise
make-backup-files nil ; Stop Emacs from creating "file~" backup files
use-dialog-box nil ; Use the keyboard/minibuffer prompt instead of mouse popups
auto-save-default nil ; Stop Emacs from creating "#file#" auto-save files
create-lockfiles nil ; Disable creation of system lockfiles (.#file)
inhibit-startup-message t ; Skip the default Emacs splash/welcome screen
global-auto-revert-non-file-buffers t ; Auto-refresh special screens (like Dired file managers)
ibuffer-expert t ; Don't ask for confirmation when killing buffers in ibuffer
column-number-mode t ; Show the exact column number in the bottom status bar
initial-scratch-message "Emacs > Neovim") ; Start the *scratch* buffer completely blank
;; Clipboard integration: share copy/paste smoothly with your operating system
(setq x-select-enable-clipboard t
save-interprogram-paste-before-kill t
yank-pop-change-selection t)
;; Short answers: accept 'y' or 'n' instead of typing out the full 'yes' or 'no'
(defalias 'yes-or-no-p 'y-or-n-p)
(setq-default use-short-answers t)
;; Tabs & Indentation
(setq-default indent-tabs-mode nil) ;; Insert spaces instead of hard tabs when pressing Tab
(setq-default tab-width 4) ;; Make 1 tab equal to 4 spaces
;; Quick Tip for your friend:
;; Convert Tabs to Spaces: Use M-x untabify
;; Convert Spaces to Tabs: Use M-x tabify
;; Text Encoding: Force everything to use modern UTF-8 encoding
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(fringe-mode 0) ;; Remove the left and right empty side gutters for a wider view area
;; ==========================================
;; 4. EXTERNAL PACKAGES & BETTER SEARCHING
;; ==========================================
;; Compatibility library for packages
(use-package compat
:ensure t)
;; Vertical completion UI for minibuffer
(use-package vertico
:ensure t
:custom
(vertico-resize t)
:init
(vertico-mode))
;; Folder navigation tweaks for Vertico
(use-package vertico-directory
:after vertico
:ensure nil
:bind (:map vertico-map
("RET" . vertico-directory-enter)
("DEL" . vertico-directory-delete-char)
("M-DEL" . vertico-directory-delete-word))
:hook (rfn-eshadow-update-overlay . vertico-directory-tidy))
;; Save minibuffer history across restarts
(use-package savehist
:ensure t
:init
(savehist-mode 1))
;; Built-in Emacs completion configurations
(use-package emacs
:ensure t
:custom
(enable-recursive-minibuffers t)
(read-extended-command-predicate #'command-completion-default-include-p)
:init
(defun crm-indicator (args)
(cons (format "[CRM%s] %s"
(replace-regexp-in-string
"\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
crm-separator)
(car args))
(cdr args)))
(advice-add #'completing-read-multiple :filter-args #'crm-indicator))
;; Case-insensitive completion
(setq read-file-name-completion-ignore-case t
read-buffer-completion-ignore-case t
completion-ignore-case t)
;; Add annotations to completion candidates
(use-package marginalia
:ensure t
:config
(marginalia-mode 1))
;; Use out-of-order pattern matching for searches
(use-package orderless
:ensure t
:custom
(completion-styles '(orderless basic))
(completion-category-defaults nil)
(completion-category-overrides '((file (styles partial-completion)))))
@AyakoGFX

Copy link
Copy Markdown
Author

add and Configuring theme

(use-package catppuccin-theme
  :ensure t)

(setq catppuccin-flavor 'mocha) ;; or 'latte, 'macchiato, or 'mocha or frappe
(catppuccin-reload)

other way
M-x customize-themes RET

@AyakoGFX

Copy link
Copy Markdown
Author

relative line numbers

(setq display-line-numbers-type 'relative) 
(global-display-line-numbers-mode 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment