Hot answers tagged

3

I don't use evil mode, so I've no idea if its regexes are different from ordinary Emacs regexes or not. But if you use M-x re-builder, you'll see that "\\((?\\w*)?\\) *।" is a perfectly fine regex that matches all of your examples, with the group matching exactly what you want.


2

Try: M-x profiler-start and select cpu from the prompt do the thing that is slow M-x profiler-stop M-x profiler-report Look for the cpu hogs and drill down in to them by hitting TAB on them to find what's slowing down your Emacs. Also consider using so-long, which is now part of Emacs (as of Emacs version 27).


2

There are several ways of persisting data in Emacs, such as using desktop.el or savehist. If you have enabled savehist-mode in your init file (like by adding (add-hook 'after-init-hook 'savehist-mode)), it's a matter of defining one extra variable to save: (setq savehist-additional-variables '(register-alist))


2

Doesn't quite answer the OP's question but thought I'd put this here for completeness. I also like evil's default behavior (esp. for python and lisp-dialects where I might only want to change part of a name) UNLESS I'm searching for a word under the cursor, i.e. with "*" or "#", in which case I'd like to search for the symbol under the ...


2

I faced this exact problem and solved it by using evil-collection just on refTeX. Installed it as an additional package in my dotspacemacs/layers() (setq-default ... dotspacemacs-addtional-packages '(... evil-collection ...) ... ) And initialised it only for refTeX in my user-config() through (evil-collection-init 'reftex)


2

Since answering this question, evil now supports pluggable undo systems. So if you want to use undo-fu instead of undo-tree you can do this as follows. (use-package evil :init (setq evil-undo-system 'undo-fu)) (use-package undo-fu)


2

Something like this should work: (with-temp-buffer (emacs-version t) (call-process-region (point-min) (point-max) "foo")) It creates a temp buffer, inserts the output of emacs-version into the temp buffer (the t argument of emacs-version) and then calls the script foo passing it the contents of the buffer on its stdin. You may have to season ...


1

(setq hs-hide-comments-when-hiding-all nil) evil relies on hs-minor-mode for folding comments. and hs-minor-mode provides hs-hide-comments-when-hiding-all option to control whether hide comments.


1

This code should do that. (set-register ?" (get-register ?*)) If you want that in a command: (defun foo () (interactive) (set-register ?" (get-register ?*))) Or if you want a command that reads the register names: (defun copy-register-to-register (from to) (interactive (list (register-read-with-preview "From register: ") ...


1

Is this what you want(?): ❯ emacs --batch --eval '(prin1 (emacs-version))' | xclip How about this: (async-shell-command (format "echo '%s' | xclip" (emacs-version))) ;;; The following freezes don't know why... (shell-command-to-string (format "echo '%s' | xclip" (emacs-version)))


1

Found it; the package was objed! As quoted from the Github README: A global minor-mode to navigate and edit text objects. Objed also enables modal editing and composition of commands. It combines ideas of versor-mode and other Editors like Vim or Kakoune and tries to align them with regular Emacs conventions.


1

If I understand you correctly, most importantly, you would like <tab> to work as <escape> in various "evil states". With emacs, the way I see it, you are offered with more freedom than merely "switching" these two key strokes. To rebind <tab> for common evil states, you can first checkout with C-h k <escape> while ...


1

Do C-h v evil-want-change-word-to-end RET, then customize that variable from t to nil. Reference: evil-want-change-word-to-end is a variable defined in ‘evil-vars.el’. Its value is t You can customize this variable. Documentation: Whether ‘cw’ behaves like ‘ce’.


1

Evil prevents the cursor from moving to the last position in a line when in normal mode, which causes the cursor to be placed inside of the last word on the line instead of after it. This makes forward-word think it needs to move to the end of the line, but because it can't, it doesn't move at all. To fix this, set evil-move-beyond-eol to t, which will allow ...


1

this seems to be a package that fits the description: emacs-splash it is pretty self-explanatory -- it is a single elisp that puts on a simple startup screen and only after either a key is pressed or some time passes then it switches to the default about buffer or the scratch buffer. No mode-line, no toolbar etc. Very minimalistic


1

(evil-set-register ?f (lambda nil "documentation" (call-interactively 'insert-foobar)))


1

Evil's vim-style search-replace does work, but you have to modify it slightly: :%s/; \(\w+\)/;\n\\textit{\\textbf{\1}}/g will perform the replacement you want (this won't affect word1, but you've already mentioned that). You have to use / to separate the s, match, replacement and the global g. \s* doesn't match the whitespace characters as expected.


1

After looking into VIM documentation, I found a way to do this which works in evil-mode too. See Visual select current search result. gn selects the highlighted text, after pressing this you can operate on the selection. Pressing n. repeats the operation on the next match. Note that you may use gn in place of w in many operations. cgn can be used to change ...


1

Having this is your init file will make s function as it does in Vim: (define-key evil-normal-state-map (kbd "s") 'evil-substitute) But this will replace the current functionality of s, so you will have to map its current value (C-h k s) to something else.


1

Ex-vimmer also. As Dan pointed out in the comment of OP, binding to C-c is too devastating in emacs. What I do is instead binding to C-c C-c so I can hit C-c like a crazy person to get back to normal. (Just like hitting C-s 10 times is the proper way to save MS Word documents, I do this a lot: C-c C-c C-c ... C-c C-g C-g ... C-g to make sure I'm in normal ...


1

The evil keybindings seem not to work for me in every major mode as either. What might help is to add the evil-collection package. But what I did to really make sure that my keybinding for switching windows is: (with-eval-after-load 'term (define-key term-raw-map (kbd "C-<left>") 'evil-window-left) (define-key term-raw-map (kbd "C-&...


1

I'm not sure why it is interrupted by evil mode. It's interrupted by evil mode to switch into the "emacs" state, a mode where evil falls back into your regular Emacs keybindings: (describe-key "\C-z") C-z runs the command evil-emacs-state (found in evil-motion-state-map), which is an interactive compiled Lisp function in ‘evil-states.el’...


1

I'm not sure but probably one of your minor modes overrides the TAB key. You can find the bound function via M-x describe-key and TAB. Default should be indent-for-tab-command. If it is not, you should find which minor mode overrides the TAB binding (you can probably understand using describe-key) and unbind it on the minor-mode keymap or rebind TAB to ...


1

In this kind of situation it's useful to use the function equivalent of whatever macro you're wrestling with, evil-define-key*. Note that this evaluates the keymap argument instead of deferring it to a later point, so I've adjusted your code to be run after the maps have been defined for c-mode and c++-mode: (with-eval-after-load 'cc-mode (dolist (this-...


1

You may want to try the package super-save, which auto saves files when idle or Emacs lose focus. My own auto save function saving when idle or lose focus, built from Emacs built-ins (github link in case I'm missing anything): (defvar jester-auto-save-idle 1 "Time in seconds before auto-saving all buffers.") (run-with-idle-timer jester-auto-save-...


1

Emacs has some built in functionality for this already, so there is no need to write your own function. In case you do want to use your function, I would suggest adding a check for 'prog-mode. Programming modes should all be derived from prog-mode, so: (when (derived-mode-p 'prog-mode) ;; Do stuff ) or, to include text-mode (org-mode, md, etc.): (when (...


1

I don't know if there is a regular command for that (maybe there is one in the emacs-lisp state) but of course you could define your own custom function. e.g. (defun custom-lisp-paste (&optional count) (interactive "*P") (forward-char) (insert " ") (evil-paste-after count)) And bind it to your prefered key. you could ...


1

The cleanest way is to not reuse Evil-specific commands or keystrokes unless absolutely necessary. Looking at the definition of :w, which happens to be the evil-write command, one can see that it parses the file name argument and calls shell-command-on-region if it starts with a bang. Here's the equivalent specialized command: (defun my-evil-run-python-...


1

Presuming this is about bulk changes in org-agenda. For me, the Org-Agenda buffers are in evil-mode's emacs-state, meaning that the default emacs key bindings work as expected. You can check what evil state in the mode line: <N> for normal state, <E> for emacs state. It might help to put the following into your .emacs: (evil-set-initial-state '...


1

It's a minor glitch/bug in the Emacs error interface, compilation-next-file only works (at least as of Emacs 25) if you are in the buffer showing the error messages, not in the source file with the error. Do something like other-window to get your cursor into error message buffer and compilation-next-file will work (and then you probably need to hit ...


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