switch from helm to ivy, add windswap, remove unused, change bindings
This commit is contained in:
parent
ca7cac6898
commit
013241dbf1
236
init.el
236
init.el
@ -108,13 +108,6 @@
|
|||||||
:config
|
:config
|
||||||
(which-key-mode))
|
(which-key-mode))
|
||||||
|
|
||||||
;;; Helm version for `C-h b`.
|
|
||||||
|
|
||||||
(use-package helm-descbinds
|
|
||||||
:demand
|
|
||||||
:config
|
|
||||||
(helm-descbinds-mode))
|
|
||||||
|
|
||||||
;;; List of personal key bindings
|
;;; List of personal key bindings
|
||||||
|
|
||||||
(global-set-key (kbd "C-c h b") 'describe-personal-keybindings)
|
(global-set-key (kbd "C-c h b") 'describe-personal-keybindings)
|
||||||
@ -126,44 +119,34 @@
|
|||||||
|
|
||||||
(global-set-key "\C-cq" #'bury-buffer)
|
(global-set-key "\C-cq" #'bury-buffer)
|
||||||
|
|
||||||
(use-package helm
|
(use-package flx
|
||||||
:demand
|
:after ivy)
|
||||||
|
|
||||||
|
(use-package counsel
|
||||||
:init
|
:init
|
||||||
(setq helm-split-window-default-side 'other
|
(setq ivy-use-virtual-buffers t
|
||||||
helm-split-window-inside-p t
|
ivy-re-builders-alist
|
||||||
helm-swoop-split-with-multiple-windows t
|
'((counsel-git-grep . ivy--regex-plus)
|
||||||
helm-command-prefix-key "s-c")
|
(counsel-rg . ivy--regex-plus)
|
||||||
|
(swiper . ivy--regex-plus)
|
||||||
|
(swiper-all . ivy--regex-plus)
|
||||||
|
(t . ivy--regex-fuzzy)))
|
||||||
:config
|
:config
|
||||||
(require 'helm-config) ; required to setup "s-c" keymap
|
(counsel-mode 1)
|
||||||
(helm-mode 1)
|
|
||||||
(helm-autoresize-mode 1)
|
|
||||||
;; Only rebind M-x and C-x C-f on successful load of helm to remain
|
|
||||||
;; this basic operations if helm is not installed.
|
|
||||||
(bind-key "M-x" #'helm-M-x)
|
|
||||||
(bind-key "C-x C-f" #'helm-find-files)
|
|
||||||
:bind
|
:bind
|
||||||
(("M-y" . helm-show-kill-ring)
|
(("C-c E" . counsel-flycheck)
|
||||||
("C-c o" . helm-occur)
|
("C-c f" . counsel-fzf)
|
||||||
("C-x b" . helm-mini)
|
("C-c g" . counsel-git)
|
||||||
("C-x r b" . helm-bookmarks)
|
("C-c j" . counsel-git-grep)
|
||||||
("C-h a" . helm-apropos)
|
("C-c L" . counsel-locate)
|
||||||
("C-h d" . helm-info-at-point)
|
("C-c o" . counsel-outline)
|
||||||
("C-c a" . helm-all-mark-rings)
|
("C-c r" . counsel-rg)
|
||||||
("C-c h e" . helm-info-emacs)
|
("C-c R" . counsel-register)
|
||||||
("C-c h g" . helm-info-gnus)
|
("C-c T" . counsel-load-theme)))
|
||||||
("C-c R" . helm-register)
|
|
||||||
("s-P" . helm-run-external-command)
|
|
||||||
;; More key bindings in "s-c" keymap
|
|
||||||
:map helm-find-files-map
|
|
||||||
("<backtab>" . helm-select-action)
|
|
||||||
("C-i" . helm-execute-persistent-action)))
|
|
||||||
|
|
||||||
;;; Install [ripgrep](https://github.com/BurntSushi/ripgrep) (rg) and
|
;; Install [ripgrep](https://github.com/BurntSushi/ripgrep) (rg) for
|
||||||
;;; add
|
;; `counsel-rg` to work properly.
|
||||||
|
|
||||||
(use-package helm-rg
|
|
||||||
:bind
|
|
||||||
(("C-c r" . helm-rg)))
|
|
||||||
|
|
||||||
;;; File explorer sidebar
|
;;; File explorer sidebar
|
||||||
|
|
||||||
@ -176,34 +159,18 @@
|
|||||||
|
|
||||||
(use-package buffer-flip
|
(use-package buffer-flip
|
||||||
:bind
|
:bind
|
||||||
(("s-o" . buffer-flip)
|
(("H-f" . buffer-flip)
|
||||||
:map buffer-flip-map
|
:map buffer-flip-map
|
||||||
("s-o" . buffer-flip-forward)
|
("H-f" . buffer-flip-forward)
|
||||||
("s-O" . buffer-flip-backward)
|
("H-F" . buffer-flip-backward)
|
||||||
("C-g" . buffer-flip-abort)))
|
("C-g" . buffer-flip-abort)))
|
||||||
|
|
||||||
;;; [fzf](https://github.com/junegunn/fzf) and
|
|
||||||
;;; [lcd](https://github.com/lukpank/lcd) for finding files and
|
|
||||||
;;; directories
|
|
||||||
|
|
||||||
(defun my-lcd ()
|
|
||||||
(interactive)
|
|
||||||
(fzf/start default-directory
|
|
||||||
(fzf/grep-cmd "lcd" "-l %s")))
|
|
||||||
|
|
||||||
(use-package fzf
|
|
||||||
:commands fzf/start
|
|
||||||
:bind
|
|
||||||
(("C-c f" . fzf)
|
|
||||||
("C-c D" . my-lcd)))
|
|
||||||
|
|
||||||
|
|
||||||
;;; ### Window selection enhancements ###
|
;;; ### Window selection enhancements ###
|
||||||
|
|
||||||
|
|
||||||
(use-package ace-window
|
(use-package ace-window
|
||||||
:init
|
:init
|
||||||
(setq aw-scope 'frame ; limit to single frame (useful when using exwm)
|
(setq aw-scope 'frame ; limit to single frame
|
||||||
aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
|
aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
|
||||||
:bind
|
:bind
|
||||||
("C-x o" . ace-window))
|
("C-x o" . ace-window))
|
||||||
@ -211,22 +178,22 @@
|
|||||||
(use-package windmove
|
(use-package windmove
|
||||||
:demand
|
:demand
|
||||||
:bind
|
:bind
|
||||||
(("C-s-n" . windmove-down)
|
(("H-w j" . windmove-down)
|
||||||
("C-s-p" . windmove-up)
|
("H-w k" . windmove-up)
|
||||||
("C-s-b" . windmove-left)
|
("H-w h" . windmove-left)
|
||||||
("C-s-f" . windmove-right)
|
("H-w l" . windmove-right))
|
||||||
("C-s-j" . windmove-down)
|
|
||||||
("C-s-k" . windmove-up)
|
|
||||||
("C-s-h" . windmove-left)
|
|
||||||
("C-s-l" . windmove-right))
|
|
||||||
:config
|
:config
|
||||||
(windmove-default-keybindings))
|
(windmove-default-keybindings))
|
||||||
|
|
||||||
;;; Switch between window configurations
|
(use-package windswap
|
||||||
|
:demand
|
||||||
(use-package eyebrowse
|
:bind
|
||||||
|
(("H-w J" . windswap-down)
|
||||||
|
("H-w K" . windswap-up)
|
||||||
|
("H-w H" . windswap-left)
|
||||||
|
("H-w L" . windswap-right))
|
||||||
:config
|
:config
|
||||||
(eyebrowse-mode))
|
(windswap-default-keybindings))
|
||||||
|
|
||||||
;;; Allow for Undo/Redo of window manipulations (such as `C-x 1`)
|
;;; Allow for Undo/Redo of window manipulations (such as `C-x 1`)
|
||||||
|
|
||||||
@ -237,17 +204,17 @@
|
|||||||
|
|
||||||
;;; Improved in buffer search
|
;;; Improved in buffer search
|
||||||
|
|
||||||
(use-package helm-swoop
|
(use-package swiper
|
||||||
:bind
|
:bind
|
||||||
(("C-s" . helm-swoop-without-pre-input)
|
(("C-s" . swiper)
|
||||||
("C-S-s" . helm-swoop)))
|
("C-S-s" . swiper-thing-at-point)))
|
||||||
|
|
||||||
;;; Type substring and wait to select one of its visible occurrences
|
;;; Type substring and wait to select one of its visible occurrences
|
||||||
;;; (even in other windows) with a single or two letters.
|
;;; (even in other windows) with a single or two letters.
|
||||||
|
|
||||||
(use-package avy
|
(use-package avy
|
||||||
:bind
|
:bind
|
||||||
("s-." . avy-goto-char-timer))
|
("H-." . avy-goto-char-timer))
|
||||||
|
|
||||||
;;; Bind key `o` to selection of a link in help or info buffers by a
|
;;; Bind key `o` to selection of a link in help or info buffers by a
|
||||||
;;; single or two letters.
|
;;; single or two letters.
|
||||||
@ -317,20 +284,13 @@
|
|||||||
(setq shell-pop-full-span t)
|
(setq shell-pop-full-span t)
|
||||||
:bind (("C-c s" . shell-pop)))
|
:bind (("C-c s" . shell-pop)))
|
||||||
|
|
||||||
(use-package helm-mt
|
|
||||||
:bind (("C-c Z" . helm-mt))
|
|
||||||
;; hooks for fish shell (term-mode for Emacs 26 and term-exec for
|
|
||||||
;; Emacs 27)
|
|
||||||
:hook ((term-mode . toggle-truncate-lines)
|
|
||||||
(term-exec . toggle-truncate-lines)))
|
|
||||||
|
|
||||||
(use-package vterm
|
(use-package vterm
|
||||||
:defer)
|
:defer)
|
||||||
|
|
||||||
(use-package vterm-toggle
|
(use-package vterm-toggle
|
||||||
:bind (("C-c z" . vterm-toggle)
|
:bind (("H-z" . vterm-toggle)
|
||||||
("s-F" . vterm-toggle-forward)
|
("H-F" . vterm-toggle-forward)
|
||||||
("s-B" . vterm-toggle-backward)))
|
("H-B" . vterm-toggle-backward)))
|
||||||
|
|
||||||
|
|
||||||
;;; ### Git ###
|
;;; ### Git ###
|
||||||
@ -348,15 +308,6 @@
|
|||||||
(setq git-messenger:show-detail t
|
(setq git-messenger:show-detail t
|
||||||
git-messenger:use-magit-popup t))
|
git-messenger:use-magit-popup t))
|
||||||
|
|
||||||
(use-package helm-git-grep
|
|
||||||
:bind
|
|
||||||
(("C-c j" . helm-git-grep)
|
|
||||||
("C-c J" . helm-git-grep-at-point)))
|
|
||||||
|
|
||||||
(use-package helm-ls-git
|
|
||||||
:bind
|
|
||||||
(("C-c g" . helm-ls-git-ls)))
|
|
||||||
|
|
||||||
|
|
||||||
;;; ### Switching buffers ###
|
;;; ### Switching buffers ###
|
||||||
|
|
||||||
@ -382,7 +333,7 @@ of the key binding used to execute this command."
|
|||||||
(define-key my-switch-to-register-map
|
(define-key my-switch-to-register-map
|
||||||
(char-to-string character) #'my-switch-to-register))
|
(char-to-string character) #'my-switch-to-register))
|
||||||
|
|
||||||
(global-set-key (kbd "s-s") my-switch-to-register-map)
|
(global-set-key (kbd "H-r") my-switch-to-register-map)
|
||||||
|
|
||||||
|
|
||||||
;;; ### Yasnippet and abbrev mode ###
|
;;; ### Yasnippet and abbrev mode ###
|
||||||
@ -399,9 +350,9 @@ of the key binding used to execute this command."
|
|||||||
(use-package yasnippet-snippets
|
(use-package yasnippet-snippets
|
||||||
:defer)
|
:defer)
|
||||||
|
|
||||||
(use-package helm-c-yasnippet
|
(use-package ivy-yasnippet
|
||||||
:bind
|
:bind
|
||||||
(("C-c y" . helm-yas-complete)))
|
(("C-c y" . ivy-yasnippet)))
|
||||||
|
|
||||||
|
|
||||||
;;; Programming languages
|
;;; Programming languages
|
||||||
@ -422,7 +373,7 @@ of the key binding used to execute this command."
|
|||||||
:bind
|
:bind
|
||||||
(:map prog-mode-map
|
(:map prog-mode-map
|
||||||
("C-i" . company-indent-or-complete-common)
|
("C-i" . company-indent-or-complete-common)
|
||||||
("C-M-i" . completion-at-point)))
|
("C-M-i" . counsel-company)))
|
||||||
|
|
||||||
;;; For modes that also use Language Server Protocol from
|
;;; For modes that also use Language Server Protocol from
|
||||||
;;; [lsp-mode](https://github.com/emacs-lsp/lsp-mode) add
|
;;; [lsp-mode](https://github.com/emacs-lsp/lsp-mode) add
|
||||||
@ -447,10 +398,6 @@ of the key binding used to execute this command."
|
|||||||
|
|
||||||
(global-set-key "\C-ck" #'compile)
|
(global-set-key "\C-ck" #'compile)
|
||||||
|
|
||||||
(use-package helm-make
|
|
||||||
:bind
|
|
||||||
(("C-c K" . helm-make)))
|
|
||||||
|
|
||||||
|
|
||||||
;;; [my common settings for programming modes]: #common-settings-for-programming-modes
|
;;; [my common settings for programming modes]: #common-settings-for-programming-modes
|
||||||
|
|
||||||
@ -553,16 +500,13 @@ of the key binding used to execute this command."
|
|||||||
(use-package paren-face
|
(use-package paren-face
|
||||||
:defer)
|
:defer)
|
||||||
|
|
||||||
;; I do not want completion in extra frame
|
|
||||||
(setq helm-show-completion-display-function #'helm-default-display-buffer)
|
|
||||||
|
|
||||||
(defun my-emacs-lisp-mode-hook-fn ()
|
(defun my-emacs-lisp-mode-hook-fn ()
|
||||||
(set (make-local-variable 'lisp-indent-function) #'lisp-indent-function)
|
(set (make-local-variable 'lisp-indent-function) #'lisp-indent-function)
|
||||||
(paredit-mode 1)
|
(paredit-mode 1)
|
||||||
(local-set-key (kbd "C-c S") (global-key-binding (kbd "M-s")))
|
(local-set-key (kbd "C-c S") (global-key-binding (kbd "M-s")))
|
||||||
(local-set-key (kbd "C-c C-z")
|
(local-set-key (kbd "C-c C-z")
|
||||||
(lambda () (interactive) (switch-to-buffer "*scratch*")))
|
(lambda () (interactive) (switch-to-buffer "*scratch*")))
|
||||||
(local-set-key (kbd "C-M-i") #'helm-lisp-completion-at-point)
|
(local-set-key (kbd "C-M-i") #'counsel-company)
|
||||||
(show-paren-mode 1)
|
(show-paren-mode 1)
|
||||||
(paren-face-mode))
|
(paren-face-mode))
|
||||||
|
|
||||||
@ -646,10 +590,7 @@ inserted between the braces between the braces."
|
|||||||
(defun my-godoc-package ()
|
(defun my-godoc-package ()
|
||||||
"Display godoc for given package (with completion)."
|
"Display godoc for given package (with completion)."
|
||||||
(interactive)
|
(interactive)
|
||||||
(godoc (or (helm :sources (helm-build-sync-source "Go packages"
|
(godoc (ivy-read "Package: " (go-packages) :require-match t)))
|
||||||
:candidates (go-packages))
|
|
||||||
:buffer "*godoc packages*")
|
|
||||||
(signal 'quit nil))))
|
|
||||||
|
|
||||||
(use-package go-guru
|
(use-package go-guru
|
||||||
:after go-mode)
|
:after go-mode)
|
||||||
@ -738,28 +679,6 @@ inserted between the braces between the braces."
|
|||||||
(add-hook 'python-mode-hook #'my-python-mode-hook-fn)
|
(add-hook 'python-mode-hook #'my-python-mode-hook-fn)
|
||||||
|
|
||||||
|
|
||||||
;;; ### Nim ###
|
|
||||||
|
|
||||||
(use-package lsp-mode
|
|
||||||
:commands lsp
|
|
||||||
:config
|
|
||||||
;; Register `nimlsp` from https://github.com/PMunch/nimlsp
|
|
||||||
(add-to-list 'lsp-language-id-configuration '(nim-mode . "nim"))
|
|
||||||
(lsp-register-client
|
|
||||||
(make-lsp-client :new-connection (lsp-stdio-connection '("nimlsp"))
|
|
||||||
:major-modes '(nim-mode)
|
|
||||||
:server-id 'nim-ls)))
|
|
||||||
|
|
||||||
(use-package highlight-indent-guides
|
|
||||||
:defer
|
|
||||||
:init
|
|
||||||
(setq highlight-indent-guides-method 'character))
|
|
||||||
|
|
||||||
(use-package nim-mode
|
|
||||||
:hook ((nim-mode . highlight-indent-guides-mode)
|
|
||||||
(nim-mode . lsp)))
|
|
||||||
|
|
||||||
|
|
||||||
;;; ### Rust ###
|
;;; ### Rust ###
|
||||||
|
|
||||||
;;; If you have Emacs 26 than you need [Rustup] and using Rustup you
|
;;; If you have Emacs 26 than you need [Rustup] and using Rustup you
|
||||||
@ -987,12 +906,9 @@ inserted between the braces between the braces."
|
|||||||
("EWW" . eww-browse-url)))
|
("EWW" . eww-browse-url)))
|
||||||
|
|
||||||
(defun my-browse-url (&rest args)
|
(defun my-browse-url (&rest args)
|
||||||
"Select the prefered browser from a helm menu before opening the URL."
|
"Select the prefered browser from a menu before opening the URL."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((browser (or (helm :sources (helm-build-sync-source "WWW browsers"
|
(let ((browser (ivy-read "WWW browser: " my-browsers :require-match t)))
|
||||||
:candidates (mapcar 'car my-browsers))
|
|
||||||
:buffer "*my browsers*")
|
|
||||||
(signal 'quit nil))))
|
|
||||||
(apply (cdr (assoc browser my-browsers)) args)))
|
(apply (cdr (assoc browser my-browsers)) args)))
|
||||||
|
|
||||||
(setq browse-url-browser-function #'my-browse-url)
|
(setq browse-url-browser-function #'my-browse-url)
|
||||||
@ -1050,12 +966,7 @@ inserted between the braces between the braces."
|
|||||||
"Set font to one of the fonts from `my-font-list'
|
"Set font to one of the fonts from `my-font-list'
|
||||||
Argument FRAMES has the same meaning as for `set-frame-font'"
|
Argument FRAMES has the same meaning as for `set-frame-font'"
|
||||||
(interactive
|
(interactive
|
||||||
(list (or (helm :prompt "Font name: "
|
(list (ivy-read "Font name: " my-font-list)
|
||||||
:resume 'noresume
|
|
||||||
:sources (helm-build-sync-source "Fonts"
|
|
||||||
:candidates my-font-list)
|
|
||||||
:buffer "*font selection*")
|
|
||||||
(signal 'quit nil))
|
|
||||||
(read-number "Font size: ")))
|
(read-number "Font size: ")))
|
||||||
(set-frame-font
|
(set-frame-font
|
||||||
(format "%s:pixelsize=%d:antialias=true:autohint=true" font-name size)
|
(format "%s:pixelsize=%d:antialias=true:autohint=true" font-name size)
|
||||||
@ -1064,19 +975,6 @@ Argument FRAMES has the same meaning as for `set-frame-font'"
|
|||||||
(global-set-key (kbd "C-c F") #'my-set-frame-font)
|
(global-set-key (kbd "C-c F") #'my-set-frame-font)
|
||||||
|
|
||||||
|
|
||||||
;;; ### Easy switching between themes ###
|
|
||||||
|
|
||||||
(defun my-helm-themes-after ()
|
|
||||||
(set-face-background 'scroll-bar "#908070"))
|
|
||||||
|
|
||||||
(use-package helm-themes
|
|
||||||
:bind
|
|
||||||
(("C-c T" . helm-themes))
|
|
||||||
:config
|
|
||||||
;; need to update powerline after changing theme
|
|
||||||
(advice-add 'helm-themes :after #'my-helm-themes-after))
|
|
||||||
|
|
||||||
|
|
||||||
;;; ### Toggle between dark and light themes with a key ###
|
;;; ### Toggle between dark and light themes with a key ###
|
||||||
|
|
||||||
;;; Toggle between [my own dark and light
|
;;; Toggle between [my own dark and light
|
||||||
@ -1095,8 +993,7 @@ Argument FRAMES has the same meaning as for `set-frame-font'"
|
|||||||
|
|
||||||
(defun my-select-theme (theme)
|
(defun my-select-theme (theme)
|
||||||
(mapc #'disable-theme custom-enabled-themes)
|
(mapc #'disable-theme custom-enabled-themes)
|
||||||
(load-theme theme t)
|
(load-theme theme t))
|
||||||
(my-helm-themes-after))
|
|
||||||
|
|
||||||
(defun my-toggle-theme ()
|
(defun my-toggle-theme ()
|
||||||
"Toggle between dark and light themes"
|
"Toggle between dark and light themes"
|
||||||
@ -1122,17 +1019,18 @@ Argument FRAMES has the same meaning as for `set-frame-font'"
|
|||||||
(add-hook 'window-setup-hook #'my-frame-setup-fn)
|
(add-hook 'window-setup-hook #'my-frame-setup-fn)
|
||||||
|
|
||||||
|
|
||||||
;;; ### My customization for some used themes ###
|
;;; ### Hyper bindings
|
||||||
|
|
||||||
(eval-after-load 'firebelly-theme
|
(dolist (k '(("H-1" . "C-x 1")
|
||||||
'(custom-theme-set-faces
|
("H-2" . "C-x 2")
|
||||||
'firebelly
|
("H-3" . "C-x 3")
|
||||||
'(font-lock-comment-delimiter-face ((t (:foreground "#505050"))))))
|
("H-0" . "C-x 0")
|
||||||
|
("H-b" . "C-x b")
|
||||||
(eval-after-load 'nimbus-theme
|
("H-g" . "C-x g")
|
||||||
'(custom-theme-set-faces
|
("H-k" . "C-x k")
|
||||||
'nimbus
|
("H-o" . "C-x o")))
|
||||||
'(region ((t (:background "#505050"))))))
|
(global-set-key (kbd (car k))
|
||||||
|
(lookup-key (current-global-map) (kbd (cdr k)))))
|
||||||
|
|
||||||
|
|
||||||
;;; ### Use separate custom file ###
|
;;; ### Use separate custom file ###
|
||||||
|
@ -44,10 +44,7 @@ inserted between the braces between the braces."
|
|||||||
(defun my-godoc-package ()
|
(defun my-godoc-package ()
|
||||||
"Display godoc for given package (with completion)."
|
"Display godoc for given package (with completion)."
|
||||||
(interactive)
|
(interactive)
|
||||||
(godoc (or (helm :sources (helm-build-sync-source "Go packages"
|
(godoc (ivy-read "Package: " (go-packages) :require-match t)))
|
||||||
:candidates (go-packages))
|
|
||||||
:buffer "*godoc packages*")
|
|
||||||
(signal 'quit nil))))
|
|
||||||
|
|
||||||
(use-package flycheck
|
(use-package flycheck
|
||||||
:defer)
|
:defer)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user