Improve some keybindings

This commit is contained in:
Bozhidar Batsov 2020-12-10 21:01:13 +02:00
parent 6236bfefd9
commit 446dc7dd3b
7 changed files with 23 additions and 17 deletions

View file

@ -26,6 +26,8 @@
* [Ruby] Don't auto-insert coding comments.
* Hide (via `diminish`) `editorconfig-mode`, `super-save`, `company`, `abbrev` and `ivy` in the modeline.
* Use `lsp-workspace-restart` function instead of deprecated `lsp-restart-workspace`.
* Bind all online search commands under `C-c C-/` to avoid a conflict with `counsel-git` or `magit-file-dispatch`.
* Bound `magit-file-mode` to `C-c g` (it's also bound to `C-c M-g` if you decide to utilize this keybinding for something else.
### Bugs fixed

View file

@ -77,10 +77,10 @@ PROMPT sets the `read-string prompt."
"Press <C-c p s g> to run grep on a project."
"Press <C-c p p> to switch between projects."
"Press <C-=> to expand the selected region."
"Press <C-c g> to search in Google."
"Press <C-c G> to search in GitHub."
"Press <C-c y> to search in YouTube."
"Press <C-c U> to search in DuckDuckGo."
"Press <C-c C-/ g> to search in Google."
"Press <C-c C-/ h> to search in GitHub."
"Press <C-c C-/ y> to search in YouTube."
"Press <C-c C-/ d> to search in DuckDuckGo."
"Press <C-c r> to rename the current buffer and the file it's visiting if any."
"Press <C-c t> to open a terminal in Emacs."
"Press <C-c k> to kill all the buffers, but the active one."

View file

@ -95,8 +95,9 @@
;; toggle menu-bar visibility
(global-set-key (kbd "<f12>") 'menu-bar-mode)
(global-set-key (kbd "C-x g") 'magit-status)
(global-set-key (kbd "C-x M-g") 'magit-dispatch)
;; Magit creates some global keybindings by default
;; but it's a nice to complement them with this one
(global-set-key (kbd "C-c g") 'magit-file-dispatch)
(global-set-key (kbd "C-=") 'er/expand-region)

View file

@ -36,10 +36,10 @@
(defvar prelude-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-c o") 'crux-open-with)
(define-key map (kbd "C-c g") 'prelude-google)
(define-key map (kbd "C-c G") 'prelude-github)
(define-key map (kbd "C-c y") 'prelude-youtube)
(define-key map (kbd "C-c U") 'prelude-duckduckgo)
(define-key map (kbd "C-c C-/ g") 'prelude-google)
(define-key map (kbd "C-c C-/ h") 'prelude-github)
(define-key map (kbd "C-c C-/ y") 'prelude-youtube)
(define-key map (kbd "C-c C-/ d") 'prelude-duckduckgo)
;; mimic popular IDEs binding, note that it doesn't work in a terminal session
(define-key map (kbd "C-a") 'crux-move-beginning-of-line)
(define-key map [(shift return)] 'crux-smart-open-line)
@ -78,8 +78,9 @@
(define-key map (kbd "s-o") 'crux-smart-open-line-above)
;; magit
(define-key map (kbd "s-m m") 'magit-status)
(define-key map (kbd "s-m l") 'magit-log)
(define-key map (kbd "s-m f") 'magit-log-buffer-file)
(define-key map (kbd "s-m j") 'magit-dispatch)
(define-key map (kbd "s-m k") 'magit-file-dispatch)
(define-key map (kbd "s-m l") 'magit-log-buffer-file)
(define-key map (kbd "s-m b") 'magit-blame)
;; misc
(define-key map (kbd "s-/") 'hippie-expand))

View file

@ -77,6 +77,7 @@
\item[<f12>] menu-bar-mode
\item[C-x g] magit-status
\item[C-x M-g] magit-dispatch
\item[C-c g] magit-file-dispatch
\end{keylist}
\subsection{prelude}
@ -84,10 +85,10 @@
\humanreadable{Keybindings defined in prelude mode}
\begin{keylist}
\item[C-c o] crux-open-with
\item[C-c g] prelude-google
\item[C-c G] prelude-github
\item[C-c y] prelude-youtube
\item[C-c U] prelude-duckduckgo
\item[C-c C-/ g] prelude-google
\item[C-c C-/ h] prelude-github
\item[C-c C-/ y] prelude-youtube
\item[C-c C-/ d] prelude-duckduckgo
\item[C-a] crux-move-beginning-of-line
\item[S-<return>] crux-smart-open-line
\item[M-o] crux-smart-open-line

View file

@ -72,6 +72,7 @@ Keybinding | Description
<kbd>F12</kbd> | Toggle the Emacs menu bar.
<kbd>C-x g</kbd> | Open Magit's status buffer.
<kbd>C-x M-g</kbd> | Open Magit's popup of popups.
<kbd>C-c g</kbd> | Open Magit's file-related commands.
<kbd>M-Z</kbd> | Zap up to char.
<kbd>C-=</kbd> | Run `expand-region` (incremental text selection).
<kbd>C-a</kbd> | Run `crux-move-beginning-of-line`. Read [this](http://emacsredux.com/blog/2013/05/22/smarter-navigation-to-the-beginning-of-a-line/) for details.

View file

@ -71,7 +71,7 @@
(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 g") 'counsel-git) ; will override the keybinding for `magit-file-dispatch'
(global-set-key (kbd "C-c j") 'counsel-git-grep)
(global-set-key (kbd "C-c a") 'counsel-ag)
(global-set-key (kbd "C-x l") 'counsel-locate)