Hot answers tagged

6

Spacemacs uses evil-mode which is a VI emulation layer. Evil-mode adds VI modal editing to spacemacs. In a nutshell modal editing has different modes where keybindings do different things. This is partly so that keybindings can remain short and easy to remember. In essence, the answer to your question is that you enter the space character by switching to ...


4

It's not documented well enough, and possibly poorly named, but the hideshow function hs-hide-level will collapse all the blocks within the current block. That is, if your cursor is on the class ... line (or below it) in your example input, it will give you something very similar to your desired output. Since hideshow works with indentation I've found that ...


3

Try up-list (which is a built-in Emacs function) It lets me jump out of strings, parens, brackets with any nesting.


3

M-| (M-x shell-command-on-region) runs a shell command using the region as stdin, display the output in the echo area, with a prefix arg, replace the region with the output. Unlike your shell in a terminal, each use of M-! or M-|: start a shell such as bash, run the shell command, then kill the shell. And the region is data passed to the shell command, the ...


3

I noticed the d key deleting a line on a single press as well. I am using Spacemacs v0.300.0@26.1 on the develop branch. I do not know if this is your case, but I had an incomplete search in progress. Steps to reproduce: In command mode, initiate a search by pressing the / key With the mouse, click on any text in your buffer Press the d key a single time ...


2

I have something like this in my config, inspired by spacemacs: (use-package evil :init (use-package evil-leader :commands (evil-leader-mode global-evil-leader-mode) :demand :config (evil-leader/set-leader "SPC") (global-evil-leader-mode t)) :config (evil-mode 1)) (evil-leader/set-key "bn" 'next-buffer "bp" 'previous-buffer) ...


2

I believe the method given in the question, although not efficient, is sufficient. Let me explain it in greater detail. Assuming you have evil-mode enabled: Toggle hs-minor-mode to enable folding Place your cursor at the first column of a def statement line. This can be done by pressing 0 Record a macro which folds the current section and then moves to ...


2

On the emacs wiki for evil there is a section about this: Managing keymaps > Overriding and intercept keymaps: Overriding and intercept keymaps There are Emacs modes that provide their own single letter key bindings, independent of Evil. BufferMenu, Ediff, and Edebug are a few examples. By default, Evil allows these modes’ keymaps to override Evil’...


1

If there's no such command in Vim, there won't be one in Evil either. If there is one, but it doesn't work right, consider reporting a bug. :wbd isn't a thing in my Vim, but it's not hard to recreate it with a bit of Emacs Lisp: (evil-define-command evil-write-and-kill-buffer (path) "Save and kill buffer." :repeat nil :move-point nil (interactive "&...


1

This works as expected: (evil-define-key 'normal 'global (kbd "SPC") (make-sparse-keymap)) (evil-define-key 'normal 'global (kbd "SPC TAB") #'ivy-switch-buffer) (evil-define-key 'normal Info-mode-map (kbd "SPC") (make-sparse-keymap)) (evil-define-key 'normal Info-mode-map (kbd "SPC SPC") #'Info-scroll-up) Notice that Info-mode-map is not quoted like it was ...


1

If I understood correctly, you want to press * to highlight the matches while keeping the cursor in the same place, and afterwards pressing n or N to move to next or previous match, right? You can do that with the following code: (defun my/star-keep-position () (interactive) (case evil-search-module (evil-search (progn (evil-ex-...


1

There is no such variable in the version of Emacs that you are using. Perhaps you are using a version of Evil that expects a different version of Emacs, where that variable is defined. In any case, please remove everything from the code you show that is not relevant to reproducing the problem. E.g., I'm guessing that the key-binding code is not relevant to ...


1

The following function should meet your goal: (defun my-insert-new-sibling-after-current (&optional force-heading) (interactive) (end-of-line) (if force-heading ; is set to t (cond ((org-on-heading-p) (org-insert-heading-after-current)) (t (progn (org-speed-move-safe (quote ...


1

(add-hook 'evil-insert-state-exit-hook (lambda () (call-interactively #'save-buffer))) This will call the underlying command of C-x C-s. You can also call evil-write if you prefer the :w command behaviour


1

This is impossible with Evil's current design. Here's roughly what happens for a normal Emacs command: Emacs waits for a complete keybinding You press a key Emacs looks it up in the currently active keymaps It finds a match for a prefix It waits for another key in that prefix map It looks it up again This repeats until a full keybinding has been read Emacs ...


1

All you need to do is assign your keybinding of choice to evil-window-map, whose docstring is: Prefix command (definition is a keymap associating keystrokes with commands). In your case, the following should work: (global-set-key (kbd "\C-c w") #'evil-window-map)


1

After using < or > to indent a selection in visual mode, you can use gv to restore the previous selection and do some other action. If you wish to selection to be restored automatically, you can create your own functions for that and rebind your keys, like this: (defun my/evil-shift-right () (interactive) (evil-shift-right evil-visual-beginning ...


1

Generally, I recommend to avoid key translating in emacs. I know it's common in vim but in emacs I think it's better to map your actions using modes and commands. That's because, in contrast to vim, everything in emacs is a command, so you don't really need to rely on key translation. You can check which command a key stroke is bound to with F1 k [key]. If ...


1

Same way you do it in Vim, by typing the amount of lines you want to scroll, then the command. Alternatively you can provide the numeric argument by typing any of C-1..C-9 or M-1..M-9 or using whatever Spacemacs has mapped the universal argument to, followed by numbers.


1

Edit, this is now a package which can be used for undo/redo with evil-mode - undo-fu. Adding answer to own question since I've been using evil w/o undo-tree for some time now. This works surprisingly well to undo/redo which wraps emacs undo without anything heavy like undo-tree or redo+. (global-undo-tree-mode -1) (defun simple-redo () (interactive) (...


1

Beside describe-keymap function which-key-dump-bindings can be useful what key-bindings my modes provides. which-key-dump-bindings answers the question Which key bindings I can use in this buffer?. Function will allow you understand which minor, major modes keys and global key bindings are active and can be used. Usage: Function will ask for prefix: If ...


1

I've submitted a pull request to fix this in the evil-tabs repo just now, so hopefully it will be applied soon. But in case it isn't or you don't want to wait (anyone coming here just now as I did) you can change evil-tab-sensitive-quit to be: (evil-define-command evil-tab-sensitive-quit (&optional bang) :repeat nil (interactive "<!>") (if (&...


Only top voted, non community-wiki answers of a minimum length are eligible