Ask user editing style when creating .spacemacs file

This commit is contained in:
Tu Do 2015-03-29 21:20:29 +07:00 committed by syl20bnr
parent 9e2fec0fe8
commit c278b58a0b
3 changed files with 13 additions and 4 deletions

View File

@ -314,9 +314,13 @@ the documentation for more details.
## Editing Styles
Spacemacs can be used by Vim users or Emacs users by setting the
`dotspacemacs-editing-style` variable to `vim` or `emacs` in the dotfile
`dotspacemacs-editing-style` variable to `'vim` or `'emacs` in the dotfile
`~/.spacemacs`.
You can also set the variable automatically when generating `.spacemacs` file by
executing the command <kbd>M-x dotspacemacs/install</kbd>. Spacemacs then asks
you an editing style and create `.spacemacs` file with appropriate editing style.
## The leader key
`Spacemacs` key bindings use a leader key which is by default bound to

View File

@ -188,8 +188,13 @@ before installing the file if the destination already exists."
(format "%s already exists. Do you want to overwite it ? "
dotfile)) t)))
(when install
(copy-file (concat dotspacemacs-template-directory
".spacemacs.template") dotfile t)
(with-current-buffer (find-file-noselect (concat dotspacemacs-template-directory
".spacemacs.template"))
(re-search-forward "\$editing-style")
(replace-match (if (y-or-n-p "Do you want to use Vim style editing? (press \"n\" to choose Emacs)")
"'vim"
"'emacs"))
(write-file dotfile))
(message "%s has been installed." dotfile))))
(defun dotspacemacs/load-file ()

View File

@ -27,7 +27,7 @@ before layers configuration."
(setq-default
;; Either `vim' or `emacs'. Evil is always enabled but if the variable
;; is `emacs' then the `holy-mode' is enabled at startup.
dotspacemacs-editing-style 'vim
dotspacemacs-editing-style $editing-style
;; Specify the startup banner. Default value is `official', it displays
;; the official spacemacs logo. An integer value is the index of text
;; banner, `random' chooses a random text banner in `core/banners'