Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing dotspacemacs-command-key to ";" has no effect in dired #2494

Closed
stephenkraemer opened this issue Jul 31, 2015 · 2 comments
Closed

Comments

@stephenkraemer
Copy link

Problem

I set dotspacemacs-command-key to ";" in my .spacemacs file. This allows me to run evil-ex with ; in all modes, but it does not work in dired. If by muscle memory you always try to exit dired with ";bd", this can be really anyone, because it marks files for deletion instead.

Background

I had no luck solving this on my own. I asked in gitterchat and @TheBB pointed me in the direction of a minor mode shadowing the ";" key. What I have found out

  1. When you run C-h k in dired, you see that ";" is a prefix binding. E.g. "; s runs the command epa-dired-do-sign"
  2. When you run C-h m and look for ";", under the "Dired by date mode" it says
<normal-state> ;                Prefix Command
  1. When you grep for dired-mode-map you find this file:
 ~/.emacs.d/elpa/evil- 20150706.711/evil-integration.el 

where this section seems to be important (lines 110 - 120)

(eval-after-load 'dired
  '(progn
     ;; use the standard Dired bindings as a base
     (defvar dired-mode-map)
     (evil-make-overriding-map dired-mode-map 'normal)
     (evil-add-hjkl-bindings dired-mode-map 'normal
       "J" 'dired-goto-file                   ; "j"
       "K" 'dired-do-kill-lines               ; "k"
       "r" 'dired-do-redisplay                ; "l"
       ;; ":d", ":v", ":s", ":e"
       ";" (lookup-key dired-mode-map ":"))))

It seems like ":" is remapped to ";" to free ":" as evil-ex key. In my case, this shadows assigned evil-ex to ";"!

What I have tried so far

I tried to check the value of dotspacemacs-command-key in the evil-integration.el file and run the ";" reassignment only if dotspacemacs-command-key is ":". But it seems that when this file is loaded, dotspacemacs-command-key is always ":", no matter what I set it to in my .spacemacs file?

I could probably just set a dired-hook to re-assign ";" to evil-ex (I will try this next), but I think many people coming from vim are used to swapping ";" and ":", so this may be an issue worth fixing!

Thanks a lot!! I hope I can solve the next one on my own and contribute to this awesome project!

@stephenkraemer
Copy link
Author

I am becoming more and more enthusiastic about the possibilities of dired, but in the process, I find that also other key bindings don't work, e.g.

  • Use "," instead of SPC m
  • Use ", ," instead of C-c C-c

To give an example where correct keybindings would be very helpful

  1. I am using wdired mode. Because I use it often, I want to call it with ", w"
  2. To leave wdired mode, C-c C-C has to be pressed - ", , " would be better!

If anyone could integrate dired better into Evil/Spacemacs, I would be very grateful!!

@TheBB
Copy link
Collaborator

TheBB commented Aug 28, 2016

There's been no action here for over a year. The support for dotspacemacs-command-key has been removed in develop (doesn't do ex any more). Therefore I am closing this now as wontfix. Note I was able to get ; to work in dired quite simply with

(evil-define-key 'normal dired-mode-map ";" 'evil-ex)

so this should be simple to do in user config.

@TheBB TheBB closed this as completed Aug 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants