Bankrupt: Better buffer management, vertico tweaks, unbind company

This commit is contained in:
Joseph Ferano 2022-08-24 13:40:59 +07:00
parent 329e6863f7
commit 4163eb4053

View File

@ -147,10 +147,6 @@ This avoids those annoying *#backup#* files that get added and eventually slow d
kept-new-versions 6 kept-new-versions 6
kept-old-versions 2 kept-old-versions 2
version-control t) version-control t)
(global-set-key (kbd "C-x k") #'kill-this-buffer)
(global-set-key (kbd "C-x M-k") #'kill-buffer)
#+END_SRC #+END_SRC
** Visuals ** Visuals
*** Dashboard *** Dashboard
@ -265,6 +261,37 @@ Setup other stuff
(add-hook 'before-save-hook 'whitespace-cleanup) (add-hook 'before-save-hook 'whitespace-cleanup)
#+end_src #+end_src
** Buffers
#+begin_src emacs-lisp
(global-set-key (kbd "C-x k") #'kill-this-buffer)
(global-set-key (kbd "C-x M-k") #'kill-buffer)
(straight-use-package 'all-the-icons-ibuffer)
(add-hook 'ibuffer-mode-hook #'all-the-icons-ibuffer-mode)
(global-set-key [remap list-buffers] 'ibuffer)
(global-set-key (kbd "C-x B") 'ibuffer)
(global-set-key (kbd "C-x C-b") 'switch-to-buffer)
(defun joe/switch-other-buffer ()
"Switch to other buffer"
(interactive)
(switch-to-buffer (other-buffer)))
(global-set-key (kbd "C-x b") 'joe/switch-other-buffer)
#+end_src
The theme of `C-x 4` bindings is that they operate on other windows, so this function matches that behavior.
#+begin_src emacs-lisp
(defun joe/kill-other-buffer-and-window ()
"Kill other buffer and window"
(interactive)
(other-window 1)
(kill-buffer-and-window))
(global-set-key (kbd "C-x 4 0") 'joe/kill-other-buffer-and-window)
(global-set-key (kbd "C-x C-0") 'kill-buffer-and-window)
#+end_src
** Org Mode ** Org Mode
#+begin_src emacs-lisp #+begin_src emacs-lisp
(straight-use-package 'org-bullets) (straight-use-package 'org-bullets)
@ -287,12 +314,17 @@ Vertico Embark Marginalia Consult Orderless
(require 'all-the-icons) (require 'all-the-icons)
(straight-use-package 'all-the-icons-completion) (straight-use-package 'all-the-icons-completion)
(straight-use-package '(vertico :files (:defaults "extensions/*") :includes (vertico-directory))) (straight-use-package '(vertico :files (:defaults "extensions/*") :includes (vertico-directory vertico-reverse)))
;; :bind (:map vertico-map ;; :bind (:map vertico-map
;; ("\M-G" . vertico-multiform-mode) ;; ("\M-G" . vertico-multiform-mode)
;; ("\M-e" . embark-act))) ;; ("\M-e" . embark-act)))
(vertico-mode) (vertico-mode)
(vertico-reverse-mode)
(setq vertico-count 17
vertico-resize t
vertico-cycle t)
(require 'savehist) (require 'savehist)
(savehist-mode) (savehist-mode)
(straight-use-package 'vertico-directory) (straight-use-package 'vertico-directory)
@ -326,7 +358,7 @@ Vertico Embark Marginalia Consult Orderless
(global-set-key (kbd "C-h f") #'helpful-callable) (global-set-key (kbd "C-h f") #'helpful-callable)
(global-set-key (kbd "C-h v") #'helpful-variable) (global-set-key (kbd "C-h v") #'helpful-variable)
(global-set-key (kbd "C-h k") #'helpful-key) (global-set-key (kbd "C-h k") #'helpful-key)
(global-set-key (kbd "C-c C-d") #'helpful-at-point) (global-set-key (kbd "C-h C-d") #'helpful-at-point)
(global-set-key (kbd "C-h F") #'helpful-function) (global-set-key (kbd "C-h F") #'helpful-function)
(global-set-key (kbd "C-h C") #'helpful-command) (global-set-key (kbd "C-h C") #'helpful-command)
#+end_src #+end_src
@ -369,7 +401,7 @@ Vertico Embark Marginalia Consult Orderless
(define-key global-map (kbd "C-c t t") #'multi-vterm) (define-key global-map (kbd "C-c t t") #'multi-vterm)
(define-key global-map (kbd "C-c t p") #'multi-vterm-prev) (define-key global-map (kbd "C-c t p") #'multi-vterm-prev)
(define-key global-map (kbd "C-c t n") #'multi-vterm-next) (define-key global-map (kbd "C-c t n") #'multi-vterm-next)
(add-hook 'vterm-mode-hook (lambda () (setq-local global-hl-line-mode nil)))
#+end_src #+end_src
** Undo Tree ** Undo Tree
@ -584,8 +616,8 @@ Emacs is an great operating system, if only it had a good text editor...
;; (add-to-list 'completion-at-point-functions #'cape-symbol) ;; (add-to-list 'completion-at-point-functions #'cape-symbol)
;; (add-to-list 'completion-at-point-functions #'cape-file) ;; (add-to-list 'completion-at-point-functions #'cape-file)
;; (add-to-list 'completion-at-point-functions #'cape-dabbrev) ;; (add-to-list 'completion-at-point-functions #'cape-dabbrev)
;; (straight-use-package 'kind-icon) (straight-use-package 'kind-icon)
;; (require 'kind-icon) (require 'kind-icon)
(straight-use-package 'company) (straight-use-package 'company)
(require 'company) (require 'company)
@ -595,11 +627,13 @@ Emacs is an great operating system, if only it had a good text editor...
company-frontends '(company-preview-frontend company-echo-metadata-frontend) company-frontends '(company-preview-frontend company-echo-metadata-frontend)
;; company-frontends '(company-text-icons-margin company-echo-metadata-frontend) ;; company-frontends '(company-text-icons-margin company-echo-metadata-frontend)
company-backends '((company-capf company-files))) company-backends '((company-capf company-files)))
(setq company-transformers '(company-sort-by-occurrence)) (setq company-transformers '(company-sort-by-occurrence))
;; (setq company-transformers '()) ;; (setq company-transformers '())
(add-to-list 'completion-at-point-functions #'elisp-completion-at-point) (add-to-list 'completion-at-point-functions #'elisp-completion-at-point)
(with-eval-after-load 'company (with-eval-after-load 'company
(define-key company-active-map (kbd "C-n") nil)
(define-key company-active-map (kbd "C-p") nil)
(define-key company-active-map (kbd "RET") nil)
(define-key company-active-map (kbd "C-f") #'company-complete-selection) (define-key company-active-map (kbd "C-f") #'company-complete-selection)
(define-key company-active-map [tab] #'company-complete-common-or-cycle) (define-key company-active-map [tab] #'company-complete-common-or-cycle)
(define-key company-active-map (kbd "<backtab>") (lambda () (interactive) (company-complete-common-or-cycle -1)))) (define-key company-active-map (kbd "<backtab>") (lambda () (interactive) (company-complete-common-or-cycle -1))))