diff --git a/.gitmodules b/.gitmodules index 04e895219e08..d74ae3056cec 100644 --- a/.gitmodules +++ b/.gitmodules @@ -42,6 +42,3 @@ [submodule "contrib/syl20bnr/extensions/o-blog"] path = contrib/syl20bnr/extensions/o-blog url = https://github.com/renard/o-blog.git -[submodule "spacemacs/extensions/evil-nerd-commenter"] - path = spacemacs/extensions/evil-nerd-commenter - url = https://github.com/redguardtoo/evil-nerd-commenter diff --git a/README.md b/README.md index 2e04e8f306a5..1afc258ca681 100644 --- a/README.md +++ b/README.md @@ -34,15 +34,18 @@ _Jump to [Install](#install) for more info and - [Structure](#structure) - [Extensions and Packages declaration and initialization](#extensions-and-packages-declaration-and-initialization) - [Packages synchronization (Vundle like feature)](#packages-synchronization-vundle-like-feature) - - [Configuration](#configuration) - - [Contribution layers](#contribution-layers) + - [Contribution layers](#contribution-layers) + - [-](#-) + - [Submitting a contribution layer upstream](#submitting-a-contribution-layer-upstream) + - [Themes Megapack example](#themes-megapack-example) + - [Pull Request Guidelines](#pull-request-guidelines) + - [Dotfile Configuration](#dotfile-configuration) + - [Installation](#installation) + - [Content](#content) - [Using contributions layers](#using-contributions-layers) - - [Adding a contribution layer](#adding-a-contribution-layer) - - [Submitting a contribution layer upstream](#submitting-a-contribution-layer-upstream) - - [Themes Megapack example](#themes-megapack-example) - - [Excluding packages](#excluding-packages) - - [Hooks](#hooks) - - [Custom variables](#custom-variables) + - [Excluding packages](#excluding-packages) + - [Hooks](#hooks) + - [Custom variables](#custom-variables) - [Main principles](#main-principles) - [Evil](#evil) - [States](#states) @@ -278,8 +281,7 @@ You have to manually copy the `~/.emacs.d/.spacemacs.template` file to 1) By default, [guide-key][] and [guide-key-tip][] are enabled. Whenever you press a prefix command (like ``) and wait for one second, -a tool tip (GUI) or buffer (terminal) appear listing the possible keys -following this prefix. +a buffer appear listing the possible keys following this prefix. 2) You can also easily get a full list of all the key bindings by pressing: @@ -367,45 +369,17 @@ _and_ auto-delete orphan packages in your `elpa` directory. It effectively makes `Spacemacs` to behave like [Vundle][vundle]. -## Configuration - -Some user configuration can be performed in your `~/.spacemacs` file. - -### Contribution layers +## Contribution layers `Spacemacs` leverages the configuration layers in order to make it possible for you to share your own layer with other `Spacemacs` users. This kind of layer is called `contribution layer`. -#### Using contributions layers - -To use a contribution layer, add it to the `dotspacemacs-configuration-layers` -variable of your `~/.spacemacs`. - -For instance to add the configuration layer of [RMS](#thank-you): -```elisp -(setq-default dotspacemacs-configuration-layers '(rms)) -``` -If this layer does not exist you can still try another one in -[the `contrib` directory](https://github.com/syl20bnr/spacemacs/tree/master/contrib). - -By default contribution layers are expected to be stored in `~/.emacs.d/contrib` -and we encourage you to submit your layers upstream in order to share them, -grow the package coverage of `Spacemacs` and dispatch responsibilities for their -maintenance. But of course you are free to keep them somewhere else, if this is -your case you can declare additional paths where `Spacemacs` can look for -contribution layers. This is done by setting the list -`dotspacemacs-configuration-layer-path` in your `~/.spacemacs`: - -```elisp -(setq-default dotspacemacs-configuration-layer-path '("~/.mycontribs/")) -``` - #### Adding a contribution layer Just create a configuration layer in `~/.emacs.d/contrib` or in a path that is registered in `dotspacemacs-configuration-layer-path` variable of your -`~/.spacemacs` directory. +`~/.spacemacs` dotile (see the [dotfile section]() for more info on this file). The base files of a configuration layer (see [structure](#structure)) are optional so you just have to create only the files you need in your layer. @@ -415,14 +389,13 @@ layer). #### Submitting a contribution layer upstream -`Spacemacs` uses the `git-flow` model, so you'll have to submit your -contributions and fixes as features or hotfixes within a pull-request to apply -against the `develop` branch. - It is recommended to join a `README.md` file with your layer, ideally this file should document the packages of your layer as well as the key bindings associated with them. +To submit your contribution layer follow the [guidelines]() +for pull requests. + _Note: by submitting a configuration layer you become the maintainer of it._ #### Themes Megapack example @@ -433,11 +406,84 @@ This is a simple contribution layer listing a bunch of themes, you can find it To install it, just add `themes-megapack` to your `~/.spacemacs`. You have now installed around 100 themes you are free to try with ` h t` (helm-themes). -### Excluding packages +## Pull Request Guidelines + +`Spacemacs` uses the `git-flow` model, so you'll have to submit your +contributions and fixes within a pull-request to apply against the `develop` +branch. + +_Guidelines:_ +- always create a branch for your pull request. +- always branch from the `master` branch (this way `develop` remains in a +read-only state from a contributor point of view, it allows the maintainers +to freely perform altering tasks such as rewriting the history). +- commit often in your pull request branch with a concise and clear commit +message. The first line of a commit message should be short, you can explain +in details what you did in a paragraph by skipping a line after the first line. +`often` is subtle, see `Notes` below. +- if your pull request branch forked an old commit (i.e. not the current last +commit in upstream master) then fetch upstream master and rebase your pull +request branch on top of it and resolve any conflict locally in your pull +request branch. +- you are ready to open a pull request. + +If you have any question on this process, join the [gitter chatroom][gitter] +and ask your questions there. Do not hesitate to ask your questions even the +simplest one, it will be a pleasure to help you in your desire to contribute! + +_Notes:_ +I encourage you to not squash too much your commits. Good candidates for squash +are commits which contain reverted modifications. For instance when you was +experimenting on a feature and performed a lot of refactoring in the process, +you can squash the intermediary refactoring commits. Typo commits are also good +candidates for squashing. Anyway, just try to find a good balance between one +huge commit and lot of small commits. + +## Dotfile Configuration + +User configuration can be stored in your `~/.spacemacs` file. + +### Installation + +`~/.spacemacs` is an optional file. If you want to use it you have to copy it +manually from the template file `~/.emacs.d/.spacemacs.template` + +```sh +$ cp ~/.emacs.d/.spacemacs.template ~/.spacemacs +``` + +### Content + +#### Using contributions layers + +To use a contribution layer, add it to the `dotspacemacs-configuration-layers` +variable of your `~/.spacemacs`. + +For instance to add the configuration layer of [RMS](#thank-you): +```elisp +(setq-default dotspacemacs-configuration-layers '(rms)) +``` +If this layer does not exist you can still try another one in +[the `contrib` directory](https://github.com/syl20bnr/spacemacs/tree/master/contrib). + +By default contribution layers are expected to be stored in `~/.emacs.d/contrib` +and we encourage you to submit your layers upstream in order to share them, +grow the package coverage of `Spacemacs` and dispatch responsibilities for their +maintenance. But of course you are free to keep them somewhere else, if this is +your case you can declare additional paths where `Spacemacs` can look for +contribution layers. This is done by setting the list +`dotspacemacs-configuration-layer-path` in your `~/.spacemacs`: + +```elisp +(setq-default dotspacemacs-configuration-layer-path '("~/.mycontribs/")) +``` + +#### Excluding packages -You can also exclude packages you don't want to install with the variable +You can exclude packages you don't want to install with the variable `dotspacemacs-excluded-packages`, this variable can exclude both packages and -extensions. +extensions (see [Configuration layers](#configuration-layers) for more info +on packages and extensions). For instance to disable the `rainbow-delimiters` package: ```elisp @@ -448,7 +494,7 @@ Note that for now, excluded packages that have been installed are not uninstalled. You'll have to delete them manually from your `~/.emacs.d/elpa` directory. -### Hooks +#### Hooks Two special functions of the `~/.spacemacs` file can be used to perform configuration at the beginning and end of `Spacemacs` loading process. @@ -457,7 +503,7 @@ configuration at the beginning and end of `Spacemacs` loading process. loading. - `dotspacemacs/config` is triggered at the very end of `Spacemacs` loading. -### Custom variables +#### Custom variables Custom variables configuration from `M-x customize-group` which are automatically saved by Emacs are stored at the end of your `~/.spacemacs` @@ -1665,3 +1711,4 @@ Thank you to the whole Emacs community from core developers to elisp hackers! [themes-megapack]: https://github.com/syl20bnr/spacemacs/tree/master/contrib/themes-megapack [guide-key]: https://github.com/kai2nenobu/guide-key [guide-key-tip]: https://github.com/aki2o/guide-key-tip +[gitter]: https://gitter.im/syl20bnr/spacemacs diff --git a/contrib/ranger-control/Readme.md b/contrib/ranger-control/Readme.md new file mode 100644 index 000000000000..051d8fcdf123 --- /dev/null +++ b/contrib/ranger-control/Readme.md @@ -0,0 +1,7 @@ +# Ranger Control + +This module hooks into the command server in MacRanger to add the command ` p d` +which adds a special `e` tab in ranger that is in the current projectile directory. + +Currently this functionality only works with MacRanger but I plan on making it a plugin +that anyone can install into their ranger. diff --git a/contrib/ranger-control/config.el b/contrib/ranger-control/config.el new file mode 100644 index 000000000000..07291d281cd3 --- /dev/null +++ b/contrib/ranger-control/config.el @@ -0,0 +1,2 @@ +(evil-leader/set-key + "pc" 'ranger-control/projectile-cd) diff --git a/contrib/ranger-control/funcs.el b/contrib/ranger-control/funcs.el new file mode 100644 index 000000000000..0e618cfcbdc2 --- /dev/null +++ b/contrib/ranger-control/funcs.el @@ -0,0 +1,12 @@ +(defun ranger-control/cd-tab (path) + (start-process "ranger-control-curl" nil "curl" "-X" "POST" "--data" path + "--connect-timeout" "0.1" "http://localhost:5964/cdtab-e")) + +(defun ranger-control/kill-result-buffer (status) + "Kill the buffer returned by `url-retrieve'." + (kill-buffer (current-buffer))) + +(defun ranger-control/projectile-cd () + (interactive) + (use-package projectile :init + (ranger-control/cd-tab (projectile-project-root)))) diff --git a/contrib/trishume/Readme.md b/contrib/trishume/Readme.md new file mode 100644 index 000000000000..0c1382cc34be --- /dev/null +++ b/contrib/trishume/Readme.md @@ -0,0 +1,6 @@ +# Tristan Hume's Contrib Layer + +Mostly consists of support for additional languages including: +LaTeX, Idris, OpenSCAD, Julia, Arduino, QML, Lua + +Also adds smooth scrolling and Helm Ag support. diff --git a/contrib/trishume/packages.el b/contrib/trishume/packages.el index c1522a8d6ab8..a58697f96c01 100644 --- a/contrib/trishume/packages.el +++ b/contrib/trishume/packages.el @@ -1,20 +1,54 @@ (defvar trishume-packages '( auctex - cdlatex smooth-scrolling + idris-mode + arduino-mode + scad-mode + qml-mode + julia-mode helm-ag + lua-mode )) (defun trishume/init-auctex () - (use-package tex - :defer t - :config - (progn - (setq-default TeX-auto-save t) - (setq-default TeX-parse-self t) - (setq-default TeX-master nil) - (setq-default TeX-PDF-mode t)))) + (defun load-auctex-on-demand () + (interactive) + (use-package tex + :config + (progn + (use-package smartparens + :config (require 'smartparens-latex)) + + (defun build-view () + (interactive) + (if (buffer-modified-p) + (progn + (let ((TeX-save-query nil)) + (TeX-save-document (TeX-master-file))) + (setq build-proc (TeX-command "LaTeX" 'TeX-master-file -1)) + (set-process-sentinel build-proc 'build-sentinel)) + (TeX-view))) + + (defun build-sentinel (process event) + (if (string= event "finished\n") + (TeX-view) + (message "Errors! Check with C-`"))) + + (add-hook 'LaTeX-mode-hook '(lambda () (local-set-key (kbd "H-r") 'build-view))) + (add-hook 'LaTeX-mode-hook 'flyspell-mode) + (add-hook 'LaTeX-mode-hook 'LaTeX-math-mode) + + (evil-leader/set-key + "oe" 'LaTeX-environment + "oc" 'LaTeX-close-environment) + + (setq-default TeX-auto-save t) + (setq-default TeX-parse-self t) + (setq-default TeX-master nil) + (setq-default TeX-PDF-mode t)))) + (evil-leader/set-key + "el" 'load-auctex-on-demand)) (defun trishume/init-smooth-scrolling () (use-package smooth-scrolling @@ -23,6 +57,21 @@ scroll-conservatively 9999 scroll-step 1))) +(defun trishume/init-arduino-mode () + (use-package arduino-mode :defer t)) + +(defun trishume/init-idris-mode () + (use-package idris-mode :defer t)) + +(defun trishume/init-scad-mode () + (use-package scad-mode :defer t)) + +(defun trishume/init-qml-mode () + (use-package qml-mode :defer t)) + +(defun trishume/init-julia-mode () + (use-package julia-mode :defer t)) + (defun trishume/init-helm-ag () (use-package helm-ag :init @@ -32,3 +81,7 @@ (helm-ag (projectile-project-root))) (evil-leader/set-key "pa" 'trishume-helm-ag)))) + +(defun trishume/init-lua-mode () + (use-package lua-mode + :defer t)) diff --git a/spacemacs/extensions.el b/spacemacs/extensions.el index a05ab4f18c81..4a2529e052bc 100644 --- a/spacemacs/extensions.el +++ b/spacemacs/extensions.el @@ -13,7 +13,6 @@ centered-cursor dos emoji-cheat-sheet - evil-nerd-commenter evil-org-mode evil-plugins helm-rcirc @@ -52,19 +51,6 @@ (use-package emoji-cheat-sheet :commands emoji-cheat-sheet)) -(defun spacemacs/init-evil-nerd-commenter () - (use-package evil-nerd-commenter - :init - (progn - (evil-leader/set-key - "ncl" 'evilnc-comment-or-uncomment-lines - "nct" 'evilnc-quick-comment-or-uncomment-to-the-line - "ncy" 'evilnc-copy-and-comment-lines - "ncp" 'evilnc-comment-or-uncomment-paragraphs - "ncr" 'comment-or-uncomment-region - "nci" 'evilnc-toggle-invert-comment-line-by-line - "ncc" 'evilnc-comment-operator)))) - (defun spacemacs/init-evil-org-mode () (use-package evil-org :commands evil-org-mode diff --git a/spacemacs/extensions/evil-nerd-commenter b/spacemacs/extensions/evil-nerd-commenter deleted file mode 160000 index c54cee2648f6..000000000000 --- a/spacemacs/extensions/evil-nerd-commenter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c54cee2648f6b2b2bbcf5856acebde3b4a20eddb diff --git a/spacemacs/packages.el b/spacemacs/packages.el index a759aa4bd526..9ba40ec2f206 100644 --- a/spacemacs/packages.el +++ b/spacemacs/packages.el @@ -31,6 +31,7 @@ evil-exchange evil-leader evil-lisp-state + evil-nerd-commenter evil-surround evil-terminal-cursor-changer evil-visualstar @@ -903,6 +904,19 @@ DELETE-FUNC when calling CALLBACK. (define-key inferior-ess-mode-map (kbd "C-j") 'comint-next-input) (define-key inferior-ess-mode-map (kbd "C-k") 'comint-previous-input)))) +(defun spacemacs/init-evil-nerd-commenter () + (use-package evil-nerd-commenter + :init + (progn + (evil-leader/set-key + "ncl" 'evilnc-comment-or-uncomment-lines + "nct" 'evilnc-quick-comment-or-uncomment-to-the-line + "ncy" 'evilnc-copy-and-comment-lines + "ncp" 'evilnc-comment-or-uncomment-paragraphs + "ncr" 'comment-or-uncomment-region + "nci" 'evilnc-toggle-invert-comment-line-by-line + "ncc" 'evilnc-comment-operator)))) + (defun spacemacs/init-exec-path-from-shell () (use-package exec-path-from-shell :init (when (memq window-system '(mac ns)) @@ -1206,7 +1220,10 @@ DELETE-FUNC when calling CALLBACK. guide-key/popup-window-position 'right guide-key/idle-delay 1 guide-key/text-scale-amount 0 - guide-key-tip/enabled (if window-system t)) + ;; use this in your ~/.spacemacs file to enable tool tip in a + ;; graphical envrionment + ;; guide-key-tip/enabled (if window-system t) + guide-key-tip/enabled nil) (guide-key-mode 1) (spacemacs//diminish guide-key-mode " Ⓖ")))) @@ -1511,8 +1528,22 @@ DELETE-FUNC when calling CALLBACK. (setq neo-create-file-auto-open t neo-dont-be-alone t neo-banner-message "File Tree browser" - neo-smart-open t)) - (evil-leader/set-key "ft" 'neotree-toggle))) + neo-smart-open t) + (evil-leader/set-key "ft" 'neotree-toggle)) + :config + (add-hook 'neotree-mode-hook + (lambda () + (define-key evil-normal-state-local-map (kbd "TAB") 'neotree-enter) + (define-key evil-normal-state-local-map (kbd "RET") 'neotree-enter) + (define-key evil-normal-state-local-map (kbd "D") 'neotree-delete-node) + (define-key evil-normal-state-local-map (kbd "H") 'neotree-hidden-file-toggle) + (define-key evil-normal-state-local-map (kbd "a") 'neotree-stretch-toggle) + (define-key evil-normal-state-local-map (kbd "A") 'neotree-stretch-toggle) + (define-key evil-normal-state-local-map (kbd "g") 'neotree-refresh) + (define-key evil-normal-state-local-map (kbd "q") 'neotree-hide) + (define-key evil-normal-state-local-map (kbd "?") 'evil-search-backward) + (define-key evil-normal-state-local-map (kbd "Q") 'kill-this-buffer))) + )) (defun spacemacs/init-org () (use-package org