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 ...


6

I've stumbled upon the same issue of preference and as suggested before, evil-numbers is the package for that. But while trying to set it up, it was surprising that evil-numbers is already in spacemacs, just missing the keybinds. To activate, just add (define-key evil-normal-state-map (kbd "C-a") 'evil-numbers/inc-at-pt) (define-key evil-visual-state-map (...


3

Surprisingly enough, there is such a thing: https://github.com/cinsk/emacs-vim-modeline I'd recommend to add file-local or directory-local variables to the affected files though. Alternatively, using https://editorconfig.org/ for an editor-agnostic way to specify configuration.


3

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


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 ...


3

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 ...


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

In Vim, the . key repeats the last change made in normal mode. The slurping scenario you describe is some random function that is beyond evil. Your guess is as good as mine in regards to how that function works in relation to normal mode. Since it's not likely a bonafide normal mode operation, there's no guarantee that it will be repeatable with evil-...


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

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

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

(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

Emacs 26.1 does not define term-bind-key-alist. If you don't show us what you're doing with that, we can't see what the problem is. That said, it sounds like you're only binding keys in term-raw-map, and not in term-mode-map. n.b. For clarity, I do not believe "lambda only calls 1 of several functions called in body" is something which is happening. I ...


1

Thanks for the reply, @wasamasa. Seeing your reply, I moved (setq evil-want-abbrev-expand-on-insert-exit nil) to the line before (use-package evil :ensure t). (Previously, it was before (evil-mode 1) but after the use-package command.) The abbrev expansions now work as expected. Thanks for pointing me in the right direction.


1

This is abbrev, a way of expanding an abbreviation to a longer snippet of text. To trigger one, you must type a key that cannot possibly be part of the abbreviation, like SPC or ESC. See https://github.com/ProofGeneral/PG/blob/fb3b75dab55b6e6befffc53e136422558be5faa0/coq/coq-syntax.el#L287 and https://github.com/ProofGeneral/PG/blob/...


1

You could make the third keypress do what you want like this: (defun insert-a-or-umlaut () (interactive) (save-match-data (if (looking-back "aa") (progn (backward-delete-char 2) (insert "ä")) (self-insert-command 1)))) (global-set-key "a" 'insert-a-or-umlaut) To get the others you can modify this pattern. In order ...


1

Not a direct answer to your question of how to have tripled keys insert certain characters, but have you tried using an input method? For example, C-x RET C-\ german. An input method is a typical way to use a keyboard to insert characters for a different language. C-x RET C-\ (translated from C-x <return> C-\) runs the command set-input-method (...


1

I'm not sure why you expect :x or :wq to save and kill the buffer. From Vim's built-in help: :[range]x[it][!] [++opt] [file] Like ":wq", but write only when changes have been made. [...] :wq [++opt] Write the current file and quit. Writing fails when the file is read-only or the buffer does not have a name. ...


1

You might want to take a look at the General.el, which, as far as I know, was designed to work coherently with evil. Here are the examples for evil bindings. This is what might be relevant for you in terms of specifying both evil state and emacs major mode: (general-define-key :states ''motion :keymaps 'emacs-lisp-mode-map "-" 'deer)


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

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 ...


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