diff --git a/.gitmodules b/.gitmodules index 5e53a28e341e..d74ae3056cec 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,33 +1,33 @@ -[submodule "extensions/pylookup"] +[submodule "spacemacs/extensions/pylookup"] path = spacemacs/extensions/pylookup url = http://github.com/syl20bnr/pylookup -[submodule "extensions/projmake-mode"] +[submodule "spacemacs/extensions/projmake-mode"] path = extensions/projmake-mode url = http://github.com/ericbmerritt/projmake-mode -[submodule "extensions/revive"] +[submodule "spacemacs/extensions/revive"] path = spacemacs/extensions/revive url = http://github.com/vedang/revive-mode.git -[submodule "extensions/helm-c-moccur"] +[submodule "spacemacs/extensions/helm-c-moccur"] path = extensions/helm-c-moccur url = http://github.com/syl20bnr/helm-c-moccur -[submodule "extensions/solarized-theme"] +[submodule "spacemacs/extensions/solarized-theme"] path = spacemacs/extensions/solarized-theme url = http://github.com/syl20bnr/solarized-emacs ignore = dirty -[submodule "extensions/evil-plugins"] +[submodule "spacemacs/extensions/evil-plugins"] path = spacemacs/extensions/evil-plugins url = http://github.com/tarao/evil-plugins -[submodule "extensions/nose"] +[submodule "spacemacs/extensions/nose"] path = spacemacs/extensions/nose url = http://github.com/syl20bnr/nose.el -[submodule "snippets"] +[submodule "spacemacs/snippets"] path = spacemacs/snippets url = http://github.com/syl20bnr/yasnippet-snippets ignore = dirty -[submodule "extensions/use-package"] +[submodule "spacemacs/extensions/use-package"] path = spacemacs/extensions/use-package url = http://github.com/jwiegley/use-package -[submodule "extensions/emoji-cheat-sheet"] +[submodule "spacemacs/extensions/emoji-cheat-sheet"] path = spacemacs/extensions/emoji-cheat-sheet url = http://github.com/ShingoFukuyama/emacs-emoji-cheat-sheet [submodule "spacemacs/extensions/evil-org-mode"] diff --git a/README.md b/README.md index 0d506a2ae2ae..6b1e7acd06e0 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,10 @@ _Jump to [Install](#install) for more info and - [Install](#install) - [Troubleshoot](#troubleshoot) - [Loading fails](#loading-fails) - - [Version mismatch for ~/.spacemacs](#version-mismatch-for-spacemacs) + - [I have no file ~/.spacemacs](#i-have-no-file-spacemacs) + - [Help commands](#help-commands) + - [Key bindings](#key-bindings) + - [Other describe functions](#other-describe-functions) - [Configuration layers](#configuration-layers) - [Structure](#structure) - [Extensions and Packages declaration and initialization](#extensions-and-packages-declaration-and-initialization) @@ -61,7 +64,6 @@ _Jump to [Install](#install) for more info and - [Commands](#commands) - [Return to normal mode](#return-to-normal-mode) - [Executing Vim, Emacs and shell commands](#executing-vim-emacs-and-shell-commands) - - [Key bindings help](#key-bindings-help) - [Navigation](#navigation) - [Point/Cursor](#pointcursor) - [Vim motions with ace-jump mode](#vim-motions-with-ace-jump-mode) @@ -243,6 +245,9 @@ be provided in this read me. _Stay tuned._ mv .emacs.d .emacs.bak git clone --recursive http://github.com/syl20bnr/spacemacs .emacs.d +`master` is a stable branch, if you want the "bleeding edge" checkout the +`develop` branch. + 2) Launch Emacs, the first time a bunch of packages will be downloaded and installed. When the package installation is complete restart Emacs and `Spacemacs` should be ready to use. @@ -261,19 +266,37 @@ _('C-x b' means 'Ctrl + x then b' and 'RET' means 'return')_ Then you can copy/paste the error in a [Github issue][issues], thank you. -#### Version mismatch for ~/.spacemacs +#### I have no file ~/.spacemacs -If you get the error: -``` -Error: '~/.spacemacs' version mismatch. -``` +You have to manually copy the `~/.emacs.d/.spacemacs.template` file to +`~/.spacemacs` + +## Help commands + +### Key bindings + +`Spacemacs` defines hundreds of key bindings, you can easily discover them +inside Emacs by pressing: + + ? -Then you have to update your `~/.spacemacs` to the last version. Unfortunately -there is no automatic way to do it. You will have to refer to the template file -`.spacemacs.template` in your `~/.emacs.d` and to the commit messages. +To narrow the list to `Spacemacs` specific key bindings set the pattern to +something like the regular expression: + + `^SPC\ b` -If you need help to upgrade, open an issue or ask for help on the [Gitter -channel](https://gitter.im/syl20bnr/spacemacs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge). +The example above will list all the `buffer` related bindings. + +### Other describe functions + +Emacs `describe-xxx` function are accessible with the following bindings: + +Key Binding | Description +--------------|------------------------------------------------------------------ +` h d f` | describe-function +` h d k` | describe-key +` h d m` | describe-mode +` h d v` | describe-variable ## Configuration layers @@ -663,7 +686,6 @@ The minor mode area can be toggled on and off with: Ⓗ | [auto-highlight-symbol][auto-highlight] mode Ⓒ | [centered-cursor][centered-cursor] mode eⓅ | [e-project][e-project] mode -Ⓟ | [projectile][projectile] mode Ⓕ | flycheck mode Ⓕ2 | flymake mode Ⓢ | flyspell mode @@ -745,19 +767,6 @@ Vim | `:` Emacs | ` :` Shell | ` !` -### Key bindings help - -A list of all the key bindings can be accessed by pressing: - - ? - -To narrow the list to `Spacemacs` specific key bindings set the pattern to -something like the regular expression: - - `^SPC\ b` - -The example above will list all the `buffer` related bindings. - ### Navigation #### Point/Cursor @@ -1105,23 +1114,35 @@ Custom fringe bitmaps: ### Project management -Projects in `Spacemacs` are managed with [projectile][projectile]. -So projects are defined implicitly, for instance the root of a project -is found when a `.git` repository or `.projectile` file is encountered -in the file tree. +Projects in `Spacemacs` are managed with [projectile][projectile]. In +`projectile` projects are defined implicitly, for instance the root of a +project is found when a `.git` repository or `.projectile` file is +encountered in the file tree. + +The only bound key for `projectile` is `projectile-commander` which is: + + p -Projects management commands (start with `p`): +`projectile commander` commands: Key Binding | Description ------------------|------------------------------------------------------------ -` p C` | invalidate the cache of `projectile` -` p d` | open a `dired` buffer at the root of the project -` p f` | open a file of the project using `helm` -` p F` | find a file if the project using `ido` -` p k` | kill all the buffers of the project -` p g` | grep search in the project -` p r` | replace a string in the files of the project -` p s` | switch to a buffer of the project +`a` | run `ack` on project +`A` | run `ag` on project +`b` | switch to project buffer +`d` | find directory in project +`D` | open project root in `dired` +`f` | find file in project +`F` | find file in project using `helm` +`g` | run `grep` on project +`j` | find a tag in project +`k` | kill all project buffers +`o` | run `multi-occur` on project +`R` | regenerate the project's [e|g]tags +`r` | replace a string in the project +`s` | switch project +`T` | find test files in project +`v` | open project root in `vc-dir` or `magit` ### Working with Git diff --git a/spacemacs/keybindings.el b/spacemacs/keybindings.el index 42d3b43526c5..cc399b0c6a65 100644 --- a/spacemacs/keybindings.el +++ b/spacemacs/keybindings.el @@ -43,6 +43,12 @@ "bw" 'toggle-read-only) ;; Cycling settings ----------------------------------------------------------- (evil-leader/set-key "ct" 'spacemacs/cycle-spacemacs-theme) +;; describe functions --------------------------------------------------------- +(evil-leader/set-key + "hdf" 'describe-function + "hdk" 'describe-key + "hdm" 'describe-mode + "hdv" 'describe-variable) ;; errors --------------------------------------------------------------------- (evil-leader/set-key "en" 'next-error diff --git a/spacemacs/packages.el b/spacemacs/packages.el index ef577dd2a111..8058f5ecd71a 100644 --- a/spacemacs/packages.el +++ b/spacemacs/packages.el @@ -309,7 +309,10 @@ DELETE-FUNC when calling CALLBACK. (spacemacs/escape-state ',seq ',shadowed nil nil 'evil-exit-visual-state))) (define-key evil-motion-state-map key `(lambda () (interactive) - (spacemacs/escape-state ',seq ',shadowed nil nil 'evil-normal-state))) + (let ((exit-func (if (eq 'help-mode major-mode) + 'quit-window + 'evil-normal-state))) + (spacemacs/escape-state ',seq ',shadowed nil nil exit-func)))) (eval-after-load 'evil-lisp-state `(define-key evil-lisp-state-map ,key (lambda () (interactive) @@ -1269,16 +1272,17 @@ DELETE-FUNC when calling CALLBACK. (defun spacemacs/init-helm () (use-package helm - :idle (helm-mode 1) - :idle-priority 0 - :config - (progn - (evil-leader/set-key + :defer t + :init + (evil-leader/set-key ":" 'helm-M-x "bs" 'helm-mini "sl" 'helm-semantic-or-imenu "hb" 'helm-bookmarks - "kil" 'helm-how-kill-ring) + "kil" 'helm-show-kill-ring) + :config + (progn + (helm-mode +1) ;; alter helm-bookmark key bindings to be simpler (defun simpler-helm-bookmark-keybindings () (define-key helm-bookmark-map (kbd "C-d") 'helm-bookmark-run-delete) @@ -1352,21 +1356,23 @@ DELETE-FUNC when calling CALLBACK. :init (progn (ido-vertical-mode t) - (define-key ido-file-completion-map (kbd "C-d") 'ido-delete-file-at-head) - (define-key ido-file-completion-map (kbd "C-k") 'ido-prev-match) - (define-key ido-file-dir-completion-map (kbd "C-") 'ido-select-text) - (define-key ido-file-dir-completion-map (kbd "C-h") 'ido-delete-backward-updir) - (define-key ido-file-dir-completion-map (kbd "C-j") 'ido-next-match) - (define-key ido-file-dir-completion-map (kbd "C-l") 'ido-exit-minibuffer) - (define-key ido-file-dir-completion-map (kbd "C-S-j") 'ido-next-match-dir) - (define-key ido-file-dir-completion-map (kbd "C-S-k") 'ido-prev-match-dir) - ;; more natural navigation keys: up, down to change current item - ;; left to go up dir - ;; right to open the selected item - (define-key ido-file-dir-completion-map (kbd "") 'ido-prev-match) - (define-key ido-file-dir-completion-map (kbd "") 'ido-next-match) - (define-key ido-file-dir-completion-map (kbd "") 'ido-delete-backward-updir) - (define-key ido-file-dir-completion-map (kbd "") 'ido-exit-minibuffer)))) + (defadvice ido-vertical-define-keys (after spacemacs/ido-vertical-define-keys activate) + ;; overwrite the key bindings for ido vertical mode only + (define-key ido-completion-map (kbd "C-d") 'ido-delete-file-at-head) + (define-key ido-completion-map (kbd "C-k") 'ido-prev-match) + (define-key ido-completion-map (kbd "C-") 'ido-select-text) + (define-key ido-completion-map (kbd "C-h") 'ido-delete-backward-updir) + (define-key ido-completion-map (kbd "C-j") 'ido-next-match) + (define-key ido-completion-map (kbd "C-l") 'ido-exit-minibuffer) + (define-key ido-completion-map (kbd "C-S-j") 'ido-next-match-dir) + (define-key ido-completion-map (kbd "C-S-k") 'ido-prev-match-dir) + ;; more natural navigation keys: up, down to change current item + ;; left to go up dir + ;; right to open the selected item + (define-key ido-completion-map (kbd "") 'ido-prev-match) + (define-key ido-completion-map (kbd "") 'ido-next-match) + (define-key ido-completion-map (kbd "") 'ido-delete-backward-updir) + (define-key ido-completion-map (kbd "") 'ido-exit-minibuffer))))) (defun spacemacs/init-js2-mode () (use-package js2-mode @@ -1561,24 +1567,21 @@ DELETE-FUNC when calling CALLBACK. (defun spacemacs/init-projectile () (use-package projectile - :commands (projectile-switch-to-buffer - projectile-invalidate-cache - projectile-dired - projectile-find-file - projectile-kill-buffers - projectile-grep - projectile-replace) + :defer t :init - (evil-leader/set-key - "pC" 'projectile-invalidate-cache - "pd" 'projectile-dired - "pF" 'projectile-find-file - "pg" 'projectile-grep - "pk" 'projectile-kill-buffers - "pr" 'projectile-replace - "ps" 'projectile-switch-to-buffer) + (progn + (setq-default projectile-enable-caching t) + (evil-leader/set-key "p" 'projectile-commander)) :config - (spacemacs//diminish projectile-mode " Ⓟ"))) + (progn + (projectile-global-mode) + (def-projectile-commander-method ?F + "Find file in project using helm." + (helm-projectile)) + (def-projectile-commander-method ?r + "Replace a string in the project." + (projectile-replace)) + (spacemacs//hide-lighter projectile-mode)))) (defun spacemacs/init-python () (use-package python @@ -1792,9 +1795,9 @@ DELETE-FUNC when calling CALLBACK. (use-package tern-auto-complete :defer t :init - (progn - (tern-ac-setup) - (add-hook 'js2-mode-hook (lambda () (tern-mode t)))))) + (add-hook 'js2-mode-hook (lambda () (tern-mode t))) + :config + (tern-ac-setup))) (defun spacemacs/init-undo-tree () (use-package undo-tree