consult namesto counsel in swiper, genreal define key

deblo
Jurij Podgoršek 2024-12-15 17:37:10 +01:00
parent c38db07448
commit 3755344f7c
2 changed files with 45 additions and 33 deletions

View File

@ -139,7 +139,6 @@ bližnjici (~[~ in ~]~ za prejšnji / naslednji buffer).
#+begin_src emacs-lisp #+begin_src emacs-lisp
(start/leader-keys (start/leader-keys
"b" '(:ignore t :wk "buffer") "b" '(:ignore t :wk "buffer")
"b b" 'switch-to-buffer
"b p" 'previous-buffer "b p" 'previous-buffer
"b n" 'next-buffer "b n" 'next-buffer
"b s" (defun scratch-buffer () "Show scratch buffer" (interactive) (switch-to-buffer "*scratch*")) "b s" (defun scratch-buffer () "Show scratch buffer" (interactive) (switch-to-buffer "*scratch*"))
@ -178,7 +177,6 @@ Bližnjice za delo z datotekami se začnejo s ~f~.
"f f" 'counsel-find-file "f f" 'counsel-find-file
"f c" 'odpri-konfiguracijo :wk "odpri konfiguracijo (config.org)" "f c" 'odpri-konfiguracijo :wk "odpri konfiguracijo (config.org)"
"f i" 'odpri-init :wk "odpri init.el" "f i" 'odpri-init :wk "odpri init.el"
"f r" 'recentf :wk "nedavno odprto"
"f z" 'odpri-zapiske "f z" 'odpri-zapiske
"f t" 'odpri-todo) "f t" 'odpri-todo)
#+end_src #+end_src
@ -192,8 +190,10 @@ Emacs nudi kup uporabnih funkcij, ki so nepogrešljive na poti učenja o funkcio
"d" '(:ignore :t :wk "describe") "d" '(:ignore :t :wk "describe")
"d f" 'describe-function "d f" 'describe-function
"d k" 'describe-key "d k" 'describe-key
"d l" 'find-library
"d m" 'describe-mode
"d s" 'describe-symbol "d s" 'describe-symbol
"d m" 'describe-mode) "d v" 'describe-variable)
#+end_src #+end_src
** Info ** Info
@ -347,37 +347,24 @@ Paket za dopolnjevanje, nadomestek ~ivy~. Nudi nekoliko lepšo iskušnjo priporo
** Iskanje ** Iskanje
~swiper~ je ivy-jev iskalnik po bufferjih, ki nudi lep vmesnik s predogledom rezultatov, nastavimo ga na ~C-S~. ~consult~ pa nudi kup zamenjav privzetih emacs ukazov/operacij za prijetnejša opravila. Nastavimo nekaj bližnjic za njih. Recimo ~M-x~ menjava ki kaže predoglede v minibuferju, ~SPC RET~ za shranjevanje in menjavo med zaznamki, ~SPC /~ za ripgrep rekurzivno iskanje po vsebini datotek (potrebuje nameščen ~ripgrep~!).
@TODO raziskat več o morebitno uporabni ~consult~ funkcionalnosti.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package swiper (use-package consult
:config
(global-set-key "\C-s" 'swiper))
#+end_src
~counsel~ pa nudi kup zamenjav privzetih emacs ukazov/operacij za prijetnejša opravila. Nastavimo nekaj bližnjic za njih. Recimo ~M-x~ menjava ki kaže predoglede v minibuferju, ~SPC RET~ za shranjevanje in menjavo med zaznamki, ~SPC /~ za ripgrep rekurzivno iskanje po vsebini datotek (potrebuje nameščen ~ripgrep~!).
@TODO zamenjamo raje s ~consult~?
#+begin_src emacs-lisp
(use-package counsel
:config :config
(general-define-key
;(global-set-key (kbd "M-x") 'counsel-M-x) ;(global-set-key (kbd "M-x") 'counsel-M-x)
(global-set-key (kbd "C-x C-f") 'counsel-find-file) "C-s" 'consult-line
(global-set-key (kbd "<f1> f") 'counsel-describe-function) "C-c j" 'consult-git-grep
(global-set-key (kbd "<f1> v") 'counsel-describe-variable) "C-c k" 'consult-ag
(global-set-key (kbd "<f1> o") 'counsel-describe-symbol) "C-x l" 'consult-locate)
(global-set-key (kbd "<f1> l") 'counsel-find-library)
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
(global-set-key (kbd "C-c g") 'counsel-git)
(global-set-key (kbd "C-c j") 'counsel-git-grep)
(global-set-key (kbd "C-c k") 'counsel-ag)
(global-set-key (kbd "C-x l") 'counsel-locate)
(define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)
(start/leader-keys (start/leader-keys
"RET" 'counsel-bookmark "RET" 'consult-bookmark
"/" 'counsel-projectile-rg) "/" 'consult-ripgrep
"b b" 'consult-buffer
"f r" 'consult-recent-file :wk "nedavno odprto")
#+end_src #+end_src
~counsel-M-x~ poganjalnik ukazov doplnimo s paketom ~smex~ za prikazovanje nedavno uporabljenih ukazov pri vrhu. ~counsel-M-x~ poganjalnik ukazov doplnimo s paketom ~smex~ za prikazovanje nedavno uporabljenih ukazov pri vrhu.
@ -505,10 +492,9 @@ Nekoliko bolj prijazen elisp REPL, ki ima med drugim zgodovino.
";" 'ielm) ";" 'ielm)
:config :config
(advice-add 'ielm-send-input :after 'g-ielm-write-history) (advice-add 'ielm-send-input :after 'g-ielm-write-history)
(define-key inferior-emacs-lisp-mode-map (kbd "C-l") (general-define-key
'comint-clear-buffer) :keymaps 'inferior-emacs-list-mode-map
(define-key inferior-emacs-lisp-mode-map (kbd "C-r") "C-l" 'comint-clear-buffer)
'helm-comint-input-ring))
#+end_src #+end_src
* ORG * ORG

View File

@ -81,6 +81,32 @@
'("ba323a013c25b355eb9a0550541573d535831c557674c8d59b9ac6aa720c21d3" '("ba323a013c25b355eb9a0550541573d535831c557674c8d59b9ac6aa720c21d3"
default)) default))
'(helm-minibuffer-history-key "M-p") '(helm-minibuffer-history-key "M-p")
'(package-selected-packages
'(a arduino-mode benchmark-init bui cider company consult
counsel-projectile crdt dashboard diminish direnv doom-modeline
drupal-mode editorconfig evil-collection evil-org
extempore-mode faceup fluxus-mode flycheck format-all geben
geiser-guile general gruvbox-theme helm helpful htmlize jq-mode
list-utils loop lsp-mode magit magit-popup marginalia mu4e
mu4e-dashboard mu4e-marker-icons nerd-icons-completion
nyan-mode ob-mermaid openwith orderless org-bullets org-caldav
org-present org-projectile page-break-lines paredit pkg-info
pos-tip pretty-sha-path pyvenv racket-mode rainbow-delimiters
restclient rjsx-mode sclang-extensions shut-up slime
smartparens smex subed svg-icon tidal toml-mode
treemacs-projectile treesit-auto undo-tree use-package vertico
vue-mode w3m web-beautify web-mode which-key writeroom-mode
yaml-mode zone-nyan))
'(package-vc-selected-packages '(package-vc-selected-packages
'((svg-icon :url "https://github.com/rougier/emacs-svg-icon"))) '((svg-icon :url "https://github.com/rougier/emacs-svg-icon")))
'(sclang-indent-level 2)) '(sclang-indent-level 2))
(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.
'(org-document-title ((t (:inherit default :weight bold :family "Sans Serif" :height 2.0 :underline nil))))
'(org-level-1 ((t (:inherit default :weight bold :family "Sans Serif" :height 1.75))))
'(org-level-2 ((t (:inherit default :weight bold :family "Sans Serif" :height 1.45))))
'(org-level-3 ((t (:inherit default :weight bold :family "Sans Serif" :height 1.25))))
'(org-level-4 ((t (:inherit default :weight bold :family "Sans Serif" :height 1.1)))))