From 10fe3626219809dc9283a464ad79c3354e0af780 Mon Sep 17 00:00:00 2001 From: Muha Aliss Date: Wed, 15 Nov 2023 16:33:04 +0300 Subject: [PATCH] changed helm to ivy --- emacs.d/init.el | 114 +++++++++++++++++++++++++++++------------------- 1 file changed, 68 insertions(+), 46 deletions(-) diff --git a/emacs.d/init.el b/emacs.d/init.el index 562c382..4e51f50 100755 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -1,7 +1,7 @@ ;;; ===================== ;;; ;;; Author: Muha Aliss ;;; ;;; Mail: muhaaliss@pm.me ;;; -;;; Edit: 15/10/2023 ;;; +;;; Edit: 15/11/2023 ;;; ;;; ===================== ;;; @@ -25,20 +25,17 @@ '(gnu-elpa gnu-elpa-keyring-update use-package - doom-themes - bookmark - avy which-key - helm-xref + counsel all-the-icons all-the-icons-dired - helm-icons)) + )) ;; Search packages in installed packages, (when (cl-find-if-not #'package-installed-p package-selected-packages) - ; refresh packages list, + ;; refresh packages list, (package-refresh-contents) - ; install the packages. + ;; install the packages. (mapc #'package-install package-selected-packages)) @@ -72,26 +69,32 @@ ;; org mode syntax color embeded source code (setq org-src-fontify-natively t) -;; Enable file icons -(use-package all-the-icons - :if (display-graphic-p)) +;; ivy rich icons +(use-package all-the-icons-ivy-rich + :ensure t + :init (all-the-icons-ivy-rich-mode 1)) +(use-package ivy-rich + :ensure t + :init (ivy-rich-mode 1) + :config + (setcdr (assq t ivy-format-functions-alist) #'ivy-format-function-line)) ;; Set a theme (use-package doom-themes :ensure t :config - ; Global settings (defaults) - (setq doom-themes-enable-bold t ; if nil, bold is universally disabled - doom-themes-enable-italic t) ; if nil, italics is universally disabled + ;; Global settings (defaults) + (setq doom-themes-enable-bold t ;; if nil, bold is universally disabled + doom-themes-enable-italic t) ;; if nil, italics is universally disabled (load-theme 'doom-one t) - ; Enable flashing mode-line on errors + ;; Enable flashing mode-line on errors (doom-themes-visual-bell-config) - ; Enable custom neotree theme (all-the-icons must be installed!) + ;; Enable custom neotree theme (all-the-icons must be installed!) (doom-themes-neotree-config) - ; or for treemacs users - (setq doom-themes-treemacs-theme "doom-atom") ; use "doom-colors" for less minimal icon theme + ;; or for treemacs users + (setq doom-themes-treemacs-theme "doom-atom") ;; use "doom-colors" for less minimal icon theme (doom-themes-treemacs-config) - ; Corrects (and improves) org-mode's native fontification. + ;; Corrects (and improves) org-mode's native fontification. (doom-themes-org-config)) ;; Set default window size @@ -100,8 +103,8 @@ (setq initial-frame-alist '( (tool-bar-lines . 0) - (width . 110) ; chars - (height . 40) ; lines + (width . 110) ;; chars + (height . 40) ;; lines (left . 787) (top . 0))) (setq default-frame-alist @@ -117,13 +120,13 @@ ;; Set default font (cond - ((string-equal system-type "windows-nt") ; Microsoft Windows + ((string-equal system-type "windows-nt") ;; Microsoft Windows (when (member "Consolas" (font-family-list)) (set-frame-font "Consolas-12" t t))) - ((string-equal system-type "darwin") ; macOS + ((string-equal system-type "darwin") ;; macOS (when (member "Menlo" (font-family-list)) (set-frame-font "Menlo-12" t t))) - ((string-equal system-type "gnu/linux") ; linux + ((string-equal system-type "gnu/linux") ;; linux (when (member "Source Code Pro" (font-family-list)) (set-frame-font "Source Code Pro-12" t t)))) @@ -158,11 +161,11 @@ "make some word display as Unicode symbols" (setq prettify-symbols-alist '( - ("->" . 8594) ; → 8594 - ("lambda" . 955) ; λ 955 - ("--->" . 10230) ; ⟶ 10230 - ("=>" . 8658) ; ⇒ 8658 - ("map" . 8614) ; ↦ 8614 + ("->" . 8594) ;; → 8594 + ("lambda" . 955) ;; λ 955 + ("--->" . 10230) ;; ⟶ 10230 + ("=>" . 8658) ;; ⇒ 8658 + ("map" . 8614) ;; ↦ 8614 ))) ;; Hippie expand to words only @@ -170,15 +173,10 @@ '( try-expand-dabbrev try-expand-dabbrev-all-buffers - ;; try-expand-dabbrev-from-kill try-complete-lisp-symbol-partially try-complete-lisp-symbol try-complete-file-name-partially - try-complete-file-name - ;; try-expand-all-abbrevs - ;; try-expand-list - ;; try-expand-line - )) + try-complete-file-name)) @@ -186,14 +184,16 @@ ;;; Buffer ;;; ;;; ===================== ;;; -;; Complete file names, buffer names, or any other Emacs interactions -(helm-mode) -(helm-icons-enable) - -;; Change the functionality of some default functions. -(define-key global-map [remap find-file] #'helm-find-files) -(define-key global-map [remap execute-extended-command] #'helm-M-x) -(define-key global-map [remap switch-to-buffer] #'helm-mini) +;; ivy config +(use-package ivy + :ensure t + :config + (ivy-mode) + (setq ivy-use-virtual-buffers t) + (setq enable-recursive-minibuffers t) + ;; enable this if you want `swiper' to use it + ;; (setq search-default-mode #'char-fold-to-regexp) + (define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)) ;; Shows key assignments in a mini window. (which-key-mode) @@ -227,9 +227,9 @@ (global-set-key (kbd "M-") 'move-line-down) ;; Copy or cut current line if no selection keybindings -(global-set-key (kbd "") 'xah-cut-line-or-region) ; cut -(global-set-key (kbd "") 'xah-copy-line-or-region) ; copy -(global-set-key (kbd "") 'yank) ; paste +(global-set-key (kbd "") 'xah-cut-line-or-region) ;; cut +(global-set-key (kbd "") 'xah-copy-line-or-region) ;; copy +(global-set-key (kbd "") 'yank) ;; paste ;; Select current line keybinding (global-set-key (kbd "M-7") 'xah-select-line) @@ -242,9 +242,31 @@ (global-set-key (kbd "M-") 'xah-goto-matching-bracket) (global-set-key (kbd "M-") 'xah-goto-matching-bracket) +;; ivy +(global-set-key "\C-s" 'swiper) +(global-set-key (kbd "M-x") 'counsel-M-x) +(global-set-key (kbd "C-x C-f") 'counsel-find-file) +(global-set-key (kbd " f") 'counsel-describe-function) +(global-set-key (kbd " v") 'counsel-describe-variable) +(global-set-key (kbd " o") 'counsel-describe-symbol) +(global-set-key (kbd " l") 'counsel-find-library) +(global-set-key (kbd "") 'ivy-resume) ;;; ===================== ;;; ;;; Load other .el files ;;; ;;; ===================== ;;; (load "~/.emacs.d/xah") +(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 + '(doom-themes all-the-icons-ivy-rich gnu-elpa gnu-elpa-keyring-update use-package which-key counsel all-the-icons all-the-icons-dired))) +(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. + )