dotfiles/emacs/.emacs.d/init.el

197 lines
6.4 KiB
EmacsLisp

;; Alamat host email
(setq mail-host-address "mrfirmansyah.my.id")
;; Auto-save
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
;; Mode minor global
(global-visual-line-mode t)
(setq electric-indent-mode nil)
;; Menampilkan buffer scratch kosong saat memulai
(setq inhibit-startup-screen t)
(setq initial-scratch-message nil)
;; Arsip-arsip paket dan prioritasnya
(require 'package)
(setq package-archives
'(("gnu" . "https://elpa.gnu.org/packages/")
("nongnu" . "https://elpa.nongnu.org/nongnu/")
("melpa-stable" . "http://stable.melpa.org/packages/")
("melpa" . "http://melpa.org/packages/")))
(setq package-archive-priorities '(("melpa-stable" . 20) ("gnu" . 10) ("melpa" . 0)))
(package-initialize)
;; Spell-checker
(setq ispell-program-name "hunspell")
(setq ispell-dictionary "id_ID")
(add-to-list 'ispell-skip-region-alist '("^#+BEGIN_SRC" . "^#+END_SRC"))
(add-hook 'text-mode-hook 'flyspell-mode)
(add-hook 'prog-mode-hook 'flyspell-prog-mode)
;; Tema
(load-theme 'modus-operandi :no-confirm)
(tool-bar-mode -1)
(setq-default cursor-type 'bar)
;; Org mode
(global-set-key (kbd "C-c c") #'org-capture)
(global-set-key (kbd "C-c l") #'org-store-link)
(setq org-directory "/media/Data/Dokumen/")
(setq org-capture-templates '(("c" "Catatan singkat" entry (file "Catatan.org") "* %?")))
(setq org-startup-with-inline-images t)
(setq org-id-get-create t)
;; Paket-paket
(use-package company
:config (global-company-mode t))
(use-package company-box
:hook (company-mode . company-box-mode))
(use-package consult
:bind (("C-c M-x" . consult-mode-command)
("C-c h" . consult-history)
("C-c k" . consult-kmacro)
("C-c m" . consult-man)
("C-c i" . consult-info)
([remap Info-search] . consult-info)
("C-x M-:" . consult-complex-command)
("C-x b" . consult-buffer)
("C-x 4 b" . consult-buffer-other-window)
("C-x 5 b" . consult-buffer-other-frame)
("C-x t b" . consult-buffer-other-tab)
("C-x r b" . consult-bookmark)
("C-x p b" . consult-project-buffer)
("M-#" . consult-register-load)
("M-'" . consult-register-store)
("C-M-#" . consult-register)
("M-y" . consult-yank-pop)
("M-g e" . consult-compile-error)
("M-g f" . consult-flymake)
("M-g g" . consult-goto-line)
("M-g M-g" . consult-goto-line)
("M-g o" . consult-outline)
("M-g m" . consult-mark)
("M-g k" . consult-global-mark)
("M-g i" . consult-imenu)
("M-g I" . consult-imenu-multi)
("M-s d" . consult-find)
("M-s c" . consult-locate)
("M-s g" . consult-grep)
("M-s G" . consult-git-grep)
("M-s r" . consult-ripgrep)
("M-s l" . consult-line)
("M-s L" . consult-line-multi)
("M-s k" . consult-keep-lines)
("M-s u" . consult-focus-lines)
("M-s e" . consult-isearch-history)
:map isearch-mode-map
("M-e" . consult-isearch-history)
("M-s e" . consult-isearch-history)
("M-s l" . consult-line)
("M-s L" . consult-line-multi)
:map minibuffer-local-map
("M-s" . consult-history)
("M-r" . consult-history))
:hook (completion-list-mode . consult-preview-at-point-mode)
:init
(setq register-preview-delay 0.5
register-preview-function #'consult-register-format)
(advice-add #'register-preview :override #'consult-register-window)
(setq xref-show-xrefs-function #'consult-xref
xref-show-definitions-function #'consult-xref)
:config
(consult-customize
consult-theme :preview-key '(:debounce 0.2 any)
consult-ripgrep consult-git-grep consult-grep
consult-bookmark consult-recent-file consult-xref
consult--source-bookmark consult--source-file-register
consult--source-recent-file consult--source-project-recent-file
:preview-key '(:debounce 0.4 any))
(setq consult-narrow-key "<"))
(use-package consult-projectile
:bind ("C-c p" . consult-projectile))
(use-package embark
:init (setq prefix-help-command #'embark-prefix-help-command)
:config
(add-to-list 'display-buffer-alist
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
nil
(window-parameters (mode-line-format . none)))))
(use-package embark-consult
:hook
(embark-collect-mode . consult-preview-at-point-mode))
(use-package marginalia
:init (marginalia-mode))
(use-package modus-themes
:init
(require 'modus-themes)
(customize-set-variable 'modus-themes-common-palette-overrides
'((bg-hover bg-active)
(bg-mode-line-active bg-inactive)
(bg-mode-line-inactive bg-dim)
(bg-region bg-completion)
(border-mode-line-active unspecified)
(border-mode-line-inactive unspecified))))
(use-package orderless
:custom
(completion-styles '(orderless basic))
(completion-category-defaults nil)
(completion-category-overrides '((file (styles basic partial-completion)))))
(use-package org-roam
:custom
(org-roam-directory "~/.emacs.d/org-roam/")
(org-roam-capture-templates '(("c" "Catatan" plain "%?" :target (file+head "${slug}.org" "#+title: ${title}") nil nil)))
:bind (("C-c n c" . org-roam-capture)
("C-c n f" . org-roam-node-find)
("C-c n i" . org-roam-node-insert)
("C-c n l" . org-roam-buffer-toggle))
:config
(org-roam-db-autosync-mode))
(use-package org-roam-ui
:config
(setq org-roam-ui-sync-theme t
org-roam-ui-follow t
org-roam-ui-update-on-save t
org-roam-ui-open-on-start t))
(use-package projectile
:init
(projectile-mode))
(use-package vertico
:init
(vertico-mode))
(use-package which-key
:init
(which-key-mode))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages
'(company-go company-web company-box company which-key magit consult-projectile projectile embark-consult embark marginalia orderless consult vertico modus-themes org-roam-ui org-roam magit-section emacsql-sqlite use-package)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)