Improve keybindings for text-region counting.

Emacs provides a `count-words-region' which is badly named as it counts
not only words, but also characters and lines. The current keybinding
for this function `SPC x w c' implies it's referring to words only. The
new mapping `SPC x c` is more coherent since it means counting text,
whether it is characters, words or lines. An alias `count-region` is
created to be less confusing in which-key description.

`SPC x w c` being free, `spacemacs/count-words-analysis` is remapped to
it instead of `SPC x w C` to save one keystroke.
This commit is contained in:
Fabien Dubosson 2015-09-28 20:50:58 +02:00 committed by syl20bnr
parent 1c06e2369c
commit b1fc99bdee
2 changed files with 6 additions and 4 deletions

View File

@ -2086,6 +2086,7 @@ Text related commands (start with ~x~):
| ~SPC x a =~ | align region at = |
| ~SPC x a &~ | align region at & |
| ~SPC x a ¦~ | align region at ¦ |
| ~SPC x c~ | count the number of chars/words/lines in the selection region |
| ~SPC x d w~ | delete trailing whitespaces |
| ~SPC x g l~ | set languages used by translate commands |
| ~SPC x g t~ | translate current word using Google Translate |
@ -2097,8 +2098,7 @@ Text related commands (start with ~x~):
| ~SPC x t c~ | swap (transpose) the current character with the previous one |
| ~SPC x t w~ | swap (transpose) the current word with the previous one |
| ~SPC x t l~ | swap (transpose) the current line with the previous one |
| ~SPC x w c~ | count the number of words in the selection region |
| ~SPC x w C~ | count the number of occurrences per word in the select region |
| ~SPC x w c~ | count the number of occurrences per word in the select region |
| ~SPC x w d~ | show dictionary entry of word from wordnik.com |
*** Searching and inserting Unicode characters

View File

@ -329,6 +329,8 @@ Ensure that helm is required before calling FUNC."
"w/" 'split-window-right
"w=" 'balance-windows)
;; text -----------------------------------------------------------------------
(defalias 'count-region 'count-words-region)
(evil-leader/set-key
"xaa" 'align
"xar" 'spacemacs/align-repeat
@ -342,6 +344,7 @@ Ensure that helm is required before calling FUNC."
"xa|" 'spacemacs/align-repeat-bar
"xa(" 'spacemacs/align-repeat-left-paren
"xa)" 'spacemacs/align-repeat-right-paren
"xc" 'count-region
"xdw" 'delete-trailing-whitespace
"xls" 'spacemacs/sort-lines
"xlu" 'spacemacs/uniquify-lines
@ -350,8 +353,7 @@ Ensure that helm is required before calling FUNC."
"xtw" 'transpose-words
"xU" 'upcase-region
"xu" 'downcase-region
"xwC" 'spacemacs/count-words-analysis
"xwc" 'count-words-region)
"xwc" 'spacemacs/count-words-analysis)
;; google translate -----------------------------------------------------------
(evil-leader/set-key
"xgl" 'spacemacs/set-google-translate-languages)