Commit graph

119 commits

Author SHA1 Message Date
Lucius Hu fd652fae0c
update spacemacs/declare-prefix usages (#15278)
Co-authored-by: Lucius Hu <lebensterben@users.noreply.github.com>
2022-02-04 05:36:11 +00:00
Daniel Nicolai bbd40f113f
Add C-o and C-i keybindings to evil-evilified-state-map (and remove from pdf-view-mode-map)
C-o and C-i are standard vim keybindings to jump back/forward between previous
locations. It is annoying and unnecessary that evilified buffers break that
flow, therefore these keybindings should be added to the
`evil-evilified-state-map` so that they are available automatically in all
evilified keymaps/modes. I assume that by just adding them to the map, all
required remappings will automatically be taken car of by the
`evilified-state-evilify-map` macro (anyway, it seems to work fine).
2022-01-08 03:54:30 +00:00
Daniel Nicolai b1fe17d370 Open special-mode buffer in motion-state (not evilified)
Special mode and its derived mode(s) buffers were made evilified in PRs #14995
and #15050. However, special-mode is too aggressive (as 'warned' for already in
 #14995); it makes it hard to overwrite its keybindings (e.g. `evil-local-set-key`,
or using `evil-evilified-state-map` on a derived map have no effect).

Therefore it makes more sense to open the buffers in motion-state instead. This
state also does not hijack the `q` keybindings as defined by special-mode (see
https://www.gnu.org/software/emacs/manual/html_node/elisp/Basic-Major-Modes.html),
although it does still hijack its `g` keybinding, but evil navigation is
considered to have higher priority than revert-buffer anyway.
2021-11-02 22:15:13 +01:00
Lucius Hu 696cfd47c1 Revert "Fix evil search prompt on mouse leave (#15002)"
This reverts commit d9c3dc678c.
2021-09-04 15:09:55 +02:00
Daniel Nicolai 8c931b9c86 Evilify special-mode by default
As special-mode is a read-only mode, it could be evilified by default.
I am not aware of any case where this is not desired.
2021-08-22 20:26:32 +02:00
duianto d9c3dc678c
Fix evil search prompt on mouse leave (#15002) 2021-08-21 01:49:40 -04:00
Moritz 95b683c0a5
Fixed bugs and refactor in new EXWM layer
Co-authored-by: Lucius Hu <lebensterben@users.noreply.github.com>

Closes #14802
2021-06-05 15:02:57 +00:00
Markus Bertheau 4acdf7733e
Fix one diminish pattern in a list in :spacediminish (#14810)
The code changed here wants to distinguish the cases of whether `arg` is a list
with one set of args to `spacemacs|diminish` or a list of a list of such args.
It used to look at the second element of `args` to make that distinction.
Consequently, if you want to specify a list of a list of args for
`:spacediminish`, you'd have to have at least two such lists of args in the list.

However in
38f582d785
a usage with a list of just one list of args was introduced.

This fixes changes the detection so that it looks at the first element of `arg`.
If that's a list, `arg` is assumed to be a list of lists of args to
`spacemacs|diminish`. If it's not, it's assumed to be just a list of args to
`spacemacs|diminish`. That works well because the first argument to
`spacemacs|diminish` is a symbol.

Fixes #14726
2021-05-31 04:39:16 +00:00
Lucius Hu d9132f8bc0
spacedminish: fixed bug
fixes https://github.com/syl20bnr/spacemacs/issues/14726
2021-05-28 02:10:15 +00:00
duianto 95280d15a8 [dired] Add ivy command and replace evil collection key
Fixes: vim layer key binding of "J" in dired mode #14614
https://github.com/syl20bnr/spacemacs/issues/14614

problem
The evil collection binds "J" to `dired-go-to-file`

It overrides the Spacemacs `helm` and `ivy` equivalent commands.
`spacemacs/helm-find-files' has fuzzy matching and other features
`spacemacs/counsel-find-file' has more `M-o' actions

And the `ivy` layer uses the `spacemacs/helm-find-files` command.

solution
Move the Spacemacs definitions of "J",
after the evil collection dired keys have been setup
from: `spacemacs-bootstrap/packages.el`
to: `spacemacs-evil/init-evil-collection`

And use `spacemacs/counsel-find-file` in the `ivy` layer.
2021-04-15 22:07:30 +02:00
Maximilian Wolff 38f582d785 [bootstrap] Fix depreciation warning for pcase `t case
and add first usage for reference
2021-04-08 19:43:30 +00:00
Lucius Hu 4836a2569b bootstrap: new :spacediminish keyword to use-package
Added a new keyword to `use-package`, `:spacediminish` which calls
`spacemacs|diminish`.

Supported patterns:
- nil
- SYMBOL
- STRING
- (SYMBOL STRING)
- (STRING STRING)
- (SYMBOL STRING STRING)
- List of patterns above

When `SYMBOL` is missing, it's inferred from the package name, e.g
`(use-package foo :spacediminish nil)` becomes
`(use-package foo :spacediminish foo-mode)`.

This PR aims to replace explict calls to `spacemacs|diminish` and brings more
declarative flavour to layer configuration.

For example, the following form

```elisp
(use-package highlight-indentation
  :config
  (progn
    (spacemacs|diminish highlight-indentation-mode " ⓗi" " hi")
    (spacemacs|diminish
     highlight-indentation-current-column-mode " ⓗc" " hc")))

```
can be replaced by

```elisp
(use-package highlight-indentation
  :spacediminish ((" ⓗi" " hi")
                  (highlight-indentation-current-column-mode " ⓗc" " hc")))
```
2021-04-08 19:08:13 +00:00
Lucius Hu 215b634981 spacemacs-bootstrap: refactor
- Replaced `(set (make-local-variable 'foo) bar)` with `(setq-local foo bar)`
- Replaced `(when (not foo) bar)` with `(unless foo bar)`
- Replaced unnecessary backquote construct with simple quotation
2021-04-04 12:48:21 +02:00
syl20bnr 97cd83e169 Apply GPLv3 terms explicitly to all elisp files 2021-03-25 22:59:32 -04:00
syl20bnr d55a9e2e67 Update header for year 2021 2021-03-25 22:59:32 -04:00
duianto 07f31743e7 [evilified] Visual state text objects, exchange point/mark
In evilified visual state.
- Add the inner: `i` and outer `a` text objects.
- Add `o` to exchange the point and mark
  (jump between the start and end of the region)
2021-03-15 19:56:33 +01:00
duianto de1425628c Revert "[evilified] Add evilified normal keys: yank, navigate"
This reverts commit 898e509273.

It broke org-agenda:
Evilified normal keys breaks "t" keabinding in agenda
https://github.com/syl20bnr/spacemacs/issues/14484
2021-03-14 12:12:18 +01:00
duianto 898e509273 [evilified] Add evilified normal keys: yank, navigate
evilified normal state is missing some useful keys:
y (evil-yank) and the common navigation keys:
f, F, t, T, w, W, b, B, $, ^

They are available in evilified visual state,
but it's useful to be able to copy text
without having to enter visual state first.

Adding `y` (`evil-yank`), makes the inner (`i`) and outer (`a`),
text objects available in evilified normal state.

This also adds the text objects to evilified visual state.
2021-03-14 00:32:34 +01:00
duianto 94585331ce Replace move-text with drag-stuff
Just like: https://github.com/emacsfodder/move-text

https://github.com/rejeep/drag-stuff.el
also drags one or more (region) lines up or down.

But it also allows for dragging left and right (across end of lines):
- a word: changing place with the next or previous word.
- a region: moving it one character at a time to the left or right.

Added a new key binding: `SPC x .`
that opens the:
```
Drag Stuff Transient State
[k/K] up    [h/H] left   [q] quit
[j/J] down  [l/L] right
```

The `move-text` package isn't removed, even though it isn't used anymore in
Spacemacs.

Because the `evil-unimpaired` elpa directory is generated from the local
Spacemacs `evil-unimpaired.el` file.
https://github.com/syl20bnr/spacemacs/blob/develop/layers/%2Bspacemacs/spacemacs-evil/local/evil-unimpaired/evil-unimpaired.el

Therefore the `evil-unimpaired` key bindings `[e` and `]e` still call the
`move-text` commands.

Until the `evil-unimpaired` elpa directory has been removed and regenerated by
restarting Spacemacs.

Then they will call the new `drag-stuff` commands.

I don't know if/when the `move-text` package can be removed in the future.
2021-03-14 00:29:46 +01:00
duianto 15decbc67d [evilified] Restore evil-surround
Enable `evil-surround-mode` when exiting evilified state.
If `evil-surround-mode` was enabled.

Currently it only disables `evil-surround-mode`.

This was discovered while exiting `edebug-mode`.

This also removes the unused variable:
`evilified-state--evil-surround`

It might have been intended for this purpose.

Otherwise it can be added back when
a use case for it is introduced.
2021-03-14 00:05:40 +01:00
duianto f853124578 Improve editing-style toggles
problem:
The toggle editing style prefix: SPC t E
always shows the same names:
e -> emacs (holy-mode)
h -> hybrid (hybrid-mode)

This causes some confusion about how to
switch to the vim (evil-mode) editing style,
from emacs or hybrid state.

solution:
Show which editing styles one will switch to:

In evil-mode:
e -> emacs (holy-mode)
h -> hybrid (hybrid-mode)

In holy-mode:
e -> vim (evil-mode)
h -> hybrid (hybrid-mode)

In hybrid-mode:
e -> emacs (holy-mode)
h -> vim (evil-mode)
2021-03-13 23:10:24 +01:00
duianto f4999e8242 Restore evil-visual-state-map on edebug exit
problem:
Exiting edebug-mode, leaves the evil-visual-state-map
with only the two key bindings that are defined in:
evilified-state--setup-visual-state-keymap
y       evil-yank
escape  evil-exit-visual-state

solution:
Restore the evil-visual-state-map when exiting edebug-mode.

Added an alias for the new exit function:
evilified-state--evilified-state-on-exit

called: evil-evilified-state-exit
the opposite of: evil-evilified-state
2021-02-20 07:49:43 +01:00
duianto b93bdbd4ad Handle when evil-set-undo-system is missing
problem:
updating Spacemacs without updating the evil package,
breaks Spacemacs on startup:
Symbol's function definition is void: evil-set-undo-system

solution:
make sure that evil-set-undo-system is bound.
2021-02-13 12:01:31 +01:00
Thanh Vuong ae65f3cedd
Fix #14213 remove dash and ht from core libs
- delete dash and ht in core
- reimplemented all ht functions we need in `spacemacs-ht.el` and use them
- add dash to spacemacs-bootstrap
2021-02-07 22:22:39 +01:00
Thanh Vuong a6d364e0f2 [spacemacs-evil] add evil-collection
It is impossible to ignore `evil-collection` anymore. `evil-magit` has been
deprecated recently and moved to `evil-collection`.

It will save time and effort for both Spacemacs and Evil to share and contribute
to `evil-collection` imo.

However I strongly prefer Spacemacs binding scheme over evil-collection's one.
We should only pick what we need from `evil-collection`.

This PR add mechanism to embrace `evil-collection` and apply it to shell layer (`vterm`)
and git layer.
2021-01-30 01:11:07 +00:00
Daniel Nicolai c23a190a72 Add toggles for specific persistent which-key keymaps
Sometimes it is handy to show keymaps persistently with which-key. For example,
to show navigation commands in Info-mode, gnus, eww etc. This PR implements
handy toggles and documentation for that.
2021-01-10 20:32:04 +01:00
duianto f62934620d [base] Fix evil undo
problem:
Pressing: u
in the spacemacs-base distribution, shows:
evil-undo: Symbol’s function definition is void: undo-tree-undo

cause:
The evil undo system is setup as: undo-tree
but undo-tree is loaded in the spacemacs-editing layer,
and the layer isn't used by default in the spacemacs-base distribution.

solution:
Set the evil undo system to undo-tree when the undo-tree package is used.

Now if undo-tree isn't setup, then:
- u   uses the default Emacs undo command.
- C-r says: Customize ‘evil-undo-system’ for redo functionality.
2020-12-30 20:46:20 +01:00
Keith Pinson af078784b8
[core] add z$ as Evil keybinding for set-selective-display (#14146)
* [core] add z$ as Evil keybinding for set-selective-display

This is a feature whose equivalent I had looked for previously and not found. I
bumped into it in [this excellent
article](https://karthinks.com/software/batteries-included-with-emacs/) which is
a survey of "batteries included" parts of Emacs. He mentions Spacemacs (in a
positive light) in the article, but the article is a lot about what you can do
_without_ distributions like Spacemacs, Doom, or Prelude. As such, this seems
like an opportunity to make Spacemacs even better---i.e. by making these
relatively unknown batteries that are already present in Emacs more discoverable
in Spacemacs.

I put it in the folding menu `z` because that fits its usecase. I used `$`
because:
* the out-of-the-box Emacs keybindings is `C-x $`.
* the menu is already fairly saturated
* I didn't know what else to base the mnemonic on because
  * I'm not aware of a Vim equivalent
  * The name of the Emacs function itself is nondescriptive of its behavior

I couldn't find any keybinding documentation table to add it to. Please let me
know if I missed something.

* [core] DWIM in z$ as suggested by @lebensterben
2020-11-21 07:25:22 +01:00
nanashi0x74 76849892e1 Fix three typos in various files
This commit fixes typos in doc/layers.org and the readme.org files of bootstrap and
java layers.
2020-10-19 11:48:51 +02:00
khjcph dad4406f70 Only set undo system if fun. exists.
The PR fixes an issue where spacemacs is in a bad state after upgrading. I
suppose what happens is that `evil-set-undo-system` is invoked before `evil` is necessarily the correct version.
2020-10-14 18:44:40 +02:00
duianto e096d6dd1e Set evil-undo-system to undo-tree 2020-10-10 21:55:06 +02:00
Robert O'Connor 9ada738efd update copyright year to 2020 2020-10-05 20:48:10 +02:00
Robert O'Connor 82ba73a1c0
update copyright to 2020 2020-09-23 21:25:01 +02:00
duianto 1e677bb532 Revert "[spacemacs-bootstrap] Fix mode-line evil state foreground"
This reverts commit 4562da2b56.

Revert reason:
emacsclient broken on develop branch by commit 4562da2b5
https://github.com/syl20bnr/spacemacs/issues/13766
2020-07-13 22:20:37 +02:00
duianto 4562da2b56 [spacemacs-bootstrap] Fix mode-line evil state foreground
The evil state foreground color on the mode-line was set to
the mode-line background color.

This caused problems with some themes.
[FEATURE REQUEST] Darker option for mode-line color codes #13731

Solution:
Set the evil state foreground color to the darker of the
mode-line face foreground or background colors.
2020-07-12 20:53:51 +02:00
duianto 78b45b4167 Fix typo in holy-mode latin function name
Noticed by phoe:
Typos in holy-mode.el · Issue #13576
https://github.com/syl20bnr/spacemacs/issues/13576
2020-06-18 13:02:06 +02:00
Steve Lorimer 464fed8757 [which-key] fixup for change to help text for "buffer-to-window-N" so which-key-replacement-alist works again 2020-06-11 00:52:08 +02:00
syl20bnr ab3511cfb5 [which-key] Improve readibility
* add column padding
* group prefixes together
* display a minimum of 6 lines
2020-03-05 21:04:51 -05:00
syl20bnr 9685095454 Use spacebind for keybaord macro key bindings 2020-03-05 21:04:51 -05:00
JAremko 0753287864 rename spacebind -> spacemacs|spacebind
Also fix stuff.
2020-03-05 12:21:01 +02:00
jaremko b83521edbb Add spacebind macro and tests for it 2020-02-27 21:48:40 -05:00
syl20bnr 978be09f6b [base] Refactor keyboard macro key bindings 2020-02-23 09:42:20 -05:00
Muneeb Shaikh 0ab1e45fe4 [evilified-state] Map C-w to evil-window-map
Fix https://github.com/syl20bnr/spacemacs/issues/13197

Motivation: https://github.com/syl20bnr/spacemacs/issues/13197#issuecomment-577051372
2020-01-22 09:36:19 +01:00
madand 37fdd1ef87 Toggleable hint for the Scrolling Transient State (~SPC N~)
By default the full hint is shown, which is consistent with the behavior before
this commit.
2019-12-25 08:20:50 +01:00
kimr da80634370
converted cl to cl-lib 2019-12-14 20:20:51 +00:00
duianto 9e184994ad Hide spacemacs// command prefixes in which-key
spacemacs/ was already hidden, but commands starting with
spacemacs// showed a leading slash: /<command name>
2019-11-24 22:14:02 +01:00
madand 89b006b432 Fix hybrid-mode error when dumping (fixes #11923) 2019-09-13 23:25:21 +02:00
syl20bnr 08dc9567b8 [dump] Delay holy and hybrid config after dump is loaded 2019-07-26 22:46:08 -04:00
duianto b9e61e6437 Add transient state keys _, j, k
Thanks sdwolfz for the suggestion to add underscore to the transient states,
then the shift key doesn't have to be released if it was held down to press `+`.

Added key bindings:
Evil numbers:
`SPC n _` decrease number under point
in the transient state:
`j` decrease number under point
`k` increase number under point

`SPC T T _` decrease transparency
`SPC z x _` scale down font
`SPC z f _` zoom out frame

Update documentation:
Zoom frame:
`q` quit transient state

Evil numbers:
`SPC n =` increase number under point
`SPC n _` decrease number under point
`0..9` add a number prefix argument
`q` quit transient state

Fixed a typo and made a small rewrite of the tip about using a prefix argument.

Added keys to transient states:
Font scaling:
Added `_` scale down
Reordered `k` assignment to match the order in the transient state

Frame transparency:
Added `_` decrease
Reordered `k` assignment to match the order in the transient state

Evil numbers:
Added `k` increase
Added `_` and `j` decrease

Zoom frame:
Added `_` zoom frame out
Reordered `k` assignment to match the order in the transient state

Which-key entries for Evil numbers `SPC n`:
Group together keys that call the same command:
From: + and =
To:   +,=

From: - and _
To:   -,_
2019-07-14 22:56:57 +02:00
duianto 9aaef2a22b Update Scrolling Transient State
Added new key bindings:
- In the Buffer column:
Added "g" and "G":
[</g] beg
[>/G] end
- In a new Other column:
[q] quit

Reordered the columns:
From: Large to small: buffer, full page, half page, line/column
To: Small to large: line/column, half page, full page, buffer

Reason: The most used (first listed) bindings are probably not scroll to the
"beginning" or "end" of the buffer.

Rearranged the half page columns two instances of "down/up" to one "down" and
one "up".

Reduced the TS width:
- Separated the line/column and full page keys to one "down" and one "up", and
the buffer keys to one "beginning" and one "end".
- Renamed "beginning" to "beg".

Reordered the key bindings (TS) logically: "up" above "down".

Reordered the key bindings (code):
Arranged them in the same order as the columns in the TS.
2019-06-13 00:49:43 +02:00