Emacs configuration for Clojure on MacOS
This commit is contained in:
13
.emacs.d.clojure/.gitignore
vendored
Normal file
13
.emacs.d.clojure/.gitignore
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
.smex-items
|
||||||
|
*~$
|
||||||
|
places
|
||||||
|
.recentf
|
||||||
|
ido.last
|
||||||
|
cider-history
|
||||||
|
projectile-bookmarks.eld
|
||||||
|
projectile.cache
|
||||||
|
auto-save-list
|
||||||
|
backups
|
||||||
|
melpa-stable
|
||||||
|
archive-contents
|
||||||
|
*.elc
|
||||||
71
.emacs.d.clojure/README.md
Normal file
71
.emacs.d.clojure/README.md
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
# this is a Clojure-friendly emacs config
|
||||||
|
|
||||||
|
If you're new to emacs, check out
|
||||||
|
[this introductory tutorial](http://www.braveclojure.com/basic-emacs/)!
|
||||||
|
|
||||||
|
## Installing
|
||||||
|
|
||||||
|
1. Close Emacs.
|
||||||
|
2. Delete `~/.emacs` or `~/.emacs.d` if they exist. (Windows users, your
|
||||||
|
emacs files will probably live in
|
||||||
|
`C:\Users\your_user_name\AppData\Roaming\`. So, for example, you
|
||||||
|
would delete `C:\Users\jason\AppData\Roaming\.emacs.d`.) This is
|
||||||
|
where Emacs looks for configuration files, and deleting these files
|
||||||
|
and directories will ensure that you start with a clean slate.
|
||||||
|
3. Download the Emacs
|
||||||
|
[configuration zip file](https://github.com/flyingmachine/emacs-for-clojure/archive/book1.zip)
|
||||||
|
and unzip it. Its contents should be a folder,
|
||||||
|
`emacs-for-clojure-book1`. Run `mv path/to/emacs-for-clojure-book1
|
||||||
|
~/.emacs.d`.
|
||||||
|
|
||||||
|
Then open Emacs.
|
||||||
|
|
||||||
|
## Upgrading
|
||||||
|
|
||||||
|
Before upgrading, ensure that your `.emacs.d` directory is under
|
||||||
|
version control so that you can always revert to a known good state.
|
||||||
|
|
||||||
|
To upgrade:
|
||||||
|
|
||||||
|
1. Edit `.emacs.d/init.el`, adding these lines after line 12:
|
||||||
|
|
||||||
|
```elisp
|
||||||
|
(add-to-list 'package-archives
|
||||||
|
'("melpa-stable" . "http://stable.melpa.org/packages/") t)
|
||||||
|
|
||||||
|
(add-to-list 'package-pinned-packages '(cider . "melpa-stable") t)
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Close Emacs.
|
||||||
|
3. Run `rm -Rf .emacs.d/elpa/cider-*`
|
||||||
|
4. Open Emacs. You'll probably see some errors and your theme won't
|
||||||
|
load. That's ok.
|
||||||
|
5. In Emacs, run `M-x package-refresh contents`.
|
||||||
|
6. In Emacs, run `M-x package-install cider`.
|
||||||
|
7. Close and re-open Emacs.
|
||||||
|
|
||||||
|
That should install the latest version. Enjoy!
|
||||||
|
|
||||||
|
## Organization
|
||||||
|
|
||||||
|
I've tried to separate everything logically and document the purpose
|
||||||
|
of every line. [`init.el`](./init.el) acts as a kind of table of
|
||||||
|
contents. It's a good idea to eventually go through `init.el` and the
|
||||||
|
files under the `customizations` directory so that you know exactly
|
||||||
|
what's going on.
|
||||||
|
|
||||||
|
## Supporting CSS, HTML, JS, etc.
|
||||||
|
|
||||||
|
Emacs has decent support for CSS, HTML, JS, and many other file types out of the box, but if you want better support, then have a look at [my personal emacs config's init.el](https://github.com/flyingmachine/emacs.d/blob/master/init.el). It's meant to read as a table of contents. The emacs.d as a whole adds the following:
|
||||||
|
|
||||||
|
* [Customizes js-mode and html editing](https://github.com/flyingmachine/emacs.d/blob/master/customizations/setup-js.el)
|
||||||
|
* Sets indentation level to 2 spaces for JS
|
||||||
|
* enables subword-mode so that M-f and M-b break on capitalization changes
|
||||||
|
* Uses `tagedit` to give you paredit-like functionality when editing html
|
||||||
|
* adds support for coffee mode
|
||||||
|
* [Uses enh-ruby-mode for ruby editing](https://github.com/flyingmachine/emacs.d/blob/master/customizations/setup-ruby.el). enh-ruby-mode is a little nicer than the built-in ruby-mode, in my opinion.
|
||||||
|
* Associates many filenames and extensions with enh-ruby-mode (.rb, .rake, Rakefile, etc)
|
||||||
|
* Adds keybindings for running specs
|
||||||
|
* Adds support for YAML and SCSS using the yaml-mode and scss-mode packages
|
||||||
|
|
||||||
|
In general, if you want to add support for a language then you should be able to find good instructions for it through Google. Most of the time, you'll just need to install the "x-lang-mode" package for it.
|
||||||
69
.emacs.d.clojure/customizations/editing.el
Normal file
69
.emacs.d.clojure/customizations/editing.el
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
;; Customizations relating to editing a buffer.
|
||||||
|
|
||||||
|
;; Key binding to use "hippie expand" for text autocompletion
|
||||||
|
;; http://www.emacswiki.org/emacs/HippieExpand
|
||||||
|
(global-set-key (kbd "M-/") 'hippie-expand)
|
||||||
|
|
||||||
|
;; Lisp-friendly hippie expand
|
||||||
|
(setq hippie-expand-try-functions-list
|
||||||
|
'(try-expand-dabbrev
|
||||||
|
try-expand-dabbrev-all-buffers
|
||||||
|
try-expand-dabbrev-from-kill
|
||||||
|
try-complete-lisp-symbol-partially
|
||||||
|
try-complete-lisp-symbol))
|
||||||
|
|
||||||
|
;; Highlights matching parenthesis
|
||||||
|
(show-paren-mode 1)
|
||||||
|
|
||||||
|
;; Highlight current line
|
||||||
|
(global-hl-line-mode 1)
|
||||||
|
|
||||||
|
;; Interactive search key bindings. By default, C-s runs
|
||||||
|
;; isearch-forward, so this swaps the bindings.
|
||||||
|
(global-set-key (kbd "C-s") 'isearch-forward-regexp)
|
||||||
|
(global-set-key (kbd "C-r") 'isearch-backward-regexp)
|
||||||
|
(global-set-key (kbd "C-M-s") 'isearch-forward)
|
||||||
|
(global-set-key (kbd "C-M-r") 'isearch-backward)
|
||||||
|
|
||||||
|
;; Don't use hard tabs
|
||||||
|
(setq-default indent-tabs-mode nil)
|
||||||
|
|
||||||
|
;; When you visit a file, point goes to the last place where it
|
||||||
|
;; was when you previously visited the same file.
|
||||||
|
;; http://www.emacswiki.org/emacs/SavePlace
|
||||||
|
(require 'saveplace)
|
||||||
|
(setq-default save-place t)
|
||||||
|
;; keep track of saved places in ~/.emacs.d/places
|
||||||
|
(setq save-place-file (concat user-emacs-directory "places"))
|
||||||
|
|
||||||
|
;; Emacs can automatically create backup files. This tells Emacs to
|
||||||
|
;; put all backups in ~/.emacs.d/backups. More info:
|
||||||
|
;; http://www.gnu.org/software/emacs/manual/html_node/elisp/Backup-Files.html
|
||||||
|
(setq backup-directory-alist `(("." . ,(concat user-emacs-directory
|
||||||
|
"backups"))))
|
||||||
|
(setq auto-save-default nil)
|
||||||
|
|
||||||
|
|
||||||
|
;; comments
|
||||||
|
(defun toggle-comment-on-line ()
|
||||||
|
"comment or uncomment current line"
|
||||||
|
(interactive)
|
||||||
|
(comment-or-uncomment-region (line-beginning-position) (line-end-position)))
|
||||||
|
(global-set-key (kbd "C-;") 'toggle-comment-on-line)
|
||||||
|
|
||||||
|
;; use 2 spaces for tabs
|
||||||
|
(defun die-tabs ()
|
||||||
|
(interactive)
|
||||||
|
(set-variable 'tab-width 2)
|
||||||
|
(mark-whole-buffer)
|
||||||
|
(untabify (region-beginning) (region-end))
|
||||||
|
(keyboard-quit))
|
||||||
|
|
||||||
|
;; fix weird os x kill error
|
||||||
|
(defun ns-get-pasteboard ()
|
||||||
|
"Returns the value of the pasteboard, or nil for unsupported formats."
|
||||||
|
(condition-case nil
|
||||||
|
(ns-get-selection-internal 'CLIPBOARD)
|
||||||
|
(quit nil)))
|
||||||
|
|
||||||
|
(setq electric-indent-mode nil)
|
||||||
15
.emacs.d.clojure/customizations/elisp-editing.el
Normal file
15
.emacs.d.clojure/customizations/elisp-editing.el
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
;; Automatically load paredit when editing a lisp file
|
||||||
|
;; More at http://www.emacswiki.org/emacs/ParEdit
|
||||||
|
(autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t)
|
||||||
|
(add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode)
|
||||||
|
(add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode)
|
||||||
|
(add-hook 'ielm-mode-hook #'enable-paredit-mode)
|
||||||
|
(add-hook 'lisp-mode-hook #'enable-paredit-mode)
|
||||||
|
(add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode)
|
||||||
|
(add-hook 'scheme-mode-hook #'enable-paredit-mode)
|
||||||
|
|
||||||
|
;; eldoc-mode shows documentation in the minibuffer when writing code
|
||||||
|
;; http://www.emacswiki.org/emacs/ElDoc
|
||||||
|
(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
|
||||||
|
(add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)
|
||||||
|
(add-hook 'ielm-mode-hook 'turn-on-eldoc-mode)
|
||||||
12
.emacs.d.clojure/customizations/misc.el
Normal file
12
.emacs.d.clojure/customizations/misc.el
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
;; Changes all yes/no questions to y/n type
|
||||||
|
(fset 'yes-or-no-p 'y-or-n-p)
|
||||||
|
|
||||||
|
;; shell scripts
|
||||||
|
(setq-default sh-basic-offset 2)
|
||||||
|
(setq-default sh-indentation 2)
|
||||||
|
|
||||||
|
;; No need for ~ files when editing
|
||||||
|
(setq create-lockfiles nil)
|
||||||
|
|
||||||
|
;; Go straight to scratch buffer on startup
|
||||||
|
(setq inhibit-startup-message t)
|
||||||
62
.emacs.d.clojure/customizations/navigation.el
Normal file
62
.emacs.d.clojure/customizations/navigation.el
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
;; These customizations make it easier for you to navigate files,
|
||||||
|
;; switch buffers, and choose options from the minibuffer.
|
||||||
|
|
||||||
|
|
||||||
|
;; "When several buffers visit identically-named files,
|
||||||
|
;; Emacs must give the buffers distinct names. The usual method
|
||||||
|
;; for making buffer names unique adds ‘<2>’, ‘<3>’, etc. to the end
|
||||||
|
;; of the buffer names (all but one of them).
|
||||||
|
;; The forward naming method includes part of the file's directory
|
||||||
|
;; name at the beginning of the buffer name
|
||||||
|
;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Uniquify.html
|
||||||
|
(require 'uniquify)
|
||||||
|
(setq uniquify-buffer-name-style 'forward)
|
||||||
|
|
||||||
|
;; Turn on recent file mode so that you can more easily switch to
|
||||||
|
;; recently edited files when you first start emacs
|
||||||
|
(setq recentf-save-file (concat user-emacs-directory ".recentf"))
|
||||||
|
(require 'recentf)
|
||||||
|
(recentf-mode 1)
|
||||||
|
(setq recentf-max-menu-items 40)
|
||||||
|
|
||||||
|
|
||||||
|
;; ido-mode allows you to more easily navigate choices. For example,
|
||||||
|
;; when you want to switch buffers, ido presents you with a list
|
||||||
|
;; of buffers in the the mini-buffer. As you start to type a buffer's
|
||||||
|
;; name, ido will narrow down the list of buffers to match the text
|
||||||
|
;; you've typed in
|
||||||
|
;; http://www.emacswiki.org/emacs/InteractivelyDoThings
|
||||||
|
(ido-mode t)
|
||||||
|
|
||||||
|
;; This allows partial matches, e.g. "tl" will match "Tyrion Lannister"
|
||||||
|
(setq ido-enable-flex-matching t)
|
||||||
|
|
||||||
|
;; Turn this behavior off because it's annoying
|
||||||
|
(setq ido-use-filename-at-point nil)
|
||||||
|
|
||||||
|
;; Don't try to match file across all "work" directories; only match files
|
||||||
|
;; in the current directory displayed in the minibuffer
|
||||||
|
(setq ido-auto-merge-work-directories-length -1)
|
||||||
|
|
||||||
|
;; Includes buffer names of recently open files, even if they're not
|
||||||
|
;; open now
|
||||||
|
(setq ido-use-virtual-buffers t)
|
||||||
|
|
||||||
|
;; This enables ido in all contexts where it could be useful, not just
|
||||||
|
;; for selecting buffer and file names
|
||||||
|
(ido-ubiquitous-mode t)
|
||||||
|
(ido-everywhere t)
|
||||||
|
|
||||||
|
;; Shows a list of buffers
|
||||||
|
(global-set-key (kbd "C-x C-b") 'ibuffer)
|
||||||
|
|
||||||
|
|
||||||
|
;; Enhances M-x to allow easier execution of commands. Provides
|
||||||
|
;; a filterable list of possible commands in the minibuffer
|
||||||
|
;; http://www.emacswiki.org/emacs/Smex
|
||||||
|
(setq smex-save-file (concat user-emacs-directory ".smex-items"))
|
||||||
|
(smex-initialize)
|
||||||
|
(global-set-key (kbd "M-x") 'smex)
|
||||||
|
|
||||||
|
;; projectile everywhere!
|
||||||
|
(projectile-global-mode)
|
||||||
83
.emacs.d.clojure/customizations/setup-clojure.el
Normal file
83
.emacs.d.clojure/customizations/setup-clojure.el
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
;;;;
|
||||||
|
;; Clojure
|
||||||
|
;;;;
|
||||||
|
|
||||||
|
;; Enable paredit for Clojure
|
||||||
|
(add-hook 'clojure-mode-hook 'enable-paredit-mode)
|
||||||
|
|
||||||
|
;; This is useful for working with camel-case tokens, like names of
|
||||||
|
;; Java classes (e.g. JavaClassName)
|
||||||
|
(add-hook 'clojure-mode-hook 'subword-mode)
|
||||||
|
|
||||||
|
;; A little more syntax highlighting
|
||||||
|
(require 'clojure-mode-extra-font-locking)
|
||||||
|
|
||||||
|
;; syntax hilighting for midje
|
||||||
|
(add-hook 'clojure-mode-hook
|
||||||
|
(lambda ()
|
||||||
|
(setq inferior-lisp-program "lein repl")
|
||||||
|
(font-lock-add-keywords
|
||||||
|
nil
|
||||||
|
'(("(\\(facts?\\)"
|
||||||
|
(1 font-lock-keyword-face))
|
||||||
|
("(\\(background?\\)"
|
||||||
|
(1 font-lock-keyword-face))))
|
||||||
|
(define-clojure-indent (fact 1))
|
||||||
|
(define-clojure-indent (facts 1))
|
||||||
|
(rainbow-delimiters-mode)))
|
||||||
|
|
||||||
|
;;;;
|
||||||
|
;; Cider
|
||||||
|
;;;;
|
||||||
|
|
||||||
|
;; provides minibuffer documentation for the code you're typing into the repl
|
||||||
|
(add-hook 'cider-mode-hook 'eldoc-mode)
|
||||||
|
|
||||||
|
;; go right to the REPL buffer when it's finished connecting
|
||||||
|
(setq cider-repl-pop-to-buffer-on-connect t)
|
||||||
|
|
||||||
|
;; When there's a cider error, show its buffer and switch to it
|
||||||
|
(setq cider-show-error-buffer t)
|
||||||
|
(setq cider-auto-select-error-buffer t)
|
||||||
|
|
||||||
|
;; Where to store the cider history.
|
||||||
|
(setq cider-repl-history-file "~/.emacs.d/cider-history")
|
||||||
|
|
||||||
|
;; Wrap when navigating history.
|
||||||
|
(setq cider-repl-wrap-history t)
|
||||||
|
|
||||||
|
;; enable paredit in your REPL
|
||||||
|
(add-hook 'cider-repl-mode-hook 'paredit-mode)
|
||||||
|
|
||||||
|
;; Use clojure mode for other extensions
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.edn$" . clojure-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.boot$" . clojure-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.cljs.*$" . clojure-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("lein-env" . enh-ruby-mode))
|
||||||
|
|
||||||
|
|
||||||
|
;; key bindings
|
||||||
|
;; these help me out with the way I usually develop web apps
|
||||||
|
(defun cider-start-http-server ()
|
||||||
|
(interactive)
|
||||||
|
(cider-load-current-buffer)
|
||||||
|
(let ((ns (cider-current-ns)))
|
||||||
|
(cider-repl-set-ns ns)
|
||||||
|
(cider-interactive-eval (format "(println '(def server (%s/start))) (println 'server)" ns))
|
||||||
|
(cider-interactive-eval (format "(def server (%s/start)) (println server)" ns))))
|
||||||
|
|
||||||
|
|
||||||
|
(defun cider-refresh ()
|
||||||
|
(interactive)
|
||||||
|
(cider-interactive-eval (format "(user/reset)")))
|
||||||
|
|
||||||
|
(defun cider-user-ns ()
|
||||||
|
(interactive)
|
||||||
|
(cider-repl-set-ns "user"))
|
||||||
|
|
||||||
|
(eval-after-load 'cider
|
||||||
|
'(progn
|
||||||
|
(define-key clojure-mode-map (kbd "C-c C-v") 'cider-start-http-server)
|
||||||
|
(define-key clojure-mode-map (kbd "C-M-r") 'cider-refresh)
|
||||||
|
(define-key clojure-mode-map (kbd "C-c u") 'cider-user-ns)
|
||||||
|
(define-key cider-mode-map (kbd "C-c u") 'cider-user-ns)))
|
||||||
22
.emacs.d.clojure/customizations/setup-js.el
Normal file
22
.emacs.d.clojure/customizations/setup-js.el
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
;; javascript / html
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.js$" . js-mode))
|
||||||
|
(add-hook 'js-mode-hook 'subword-mode)
|
||||||
|
(add-hook 'html-mode-hook 'subword-mode)
|
||||||
|
(setq js-indent-level 2)
|
||||||
|
(eval-after-load "sgml-mode"
|
||||||
|
'(progn
|
||||||
|
(require 'tagedit)
|
||||||
|
(tagedit-add-paredit-like-keybindings)
|
||||||
|
(add-hook 'html-mode-hook (lambda () (tagedit-mode 1)))))
|
||||||
|
|
||||||
|
|
||||||
|
;; coffeescript
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.coffee.erb$" . coffee-mode))
|
||||||
|
(add-hook 'coffee-mode-hook 'subword-mode)
|
||||||
|
(add-hook 'coffee-mode-hook 'highlight-indentation-current-column-mode)
|
||||||
|
(add-hook 'coffee-mode-hook
|
||||||
|
(defun coffee-mode-newline-and-indent ()
|
||||||
|
(define-key coffee-mode-map "\C-j" 'coffee-newline-and-indent)
|
||||||
|
(setq coffee-cleanup-whitespace nil)))
|
||||||
|
(custom-set-variables
|
||||||
|
'(coffee-tab-width 2))
|
||||||
10
.emacs.d.clojure/customizations/shell-integration.el
Normal file
10
.emacs.d.clojure/customizations/shell-integration.el
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
;; Sets up exec-path-from shell
|
||||||
|
;; https://github.com/purcell/exec-path-from-shell
|
||||||
|
(add-to-list 'my-packages 'exec-path-from-shell)
|
||||||
|
(when (memq window-system '(mac ns))
|
||||||
|
;; Active debug mode
|
||||||
|
;;(setq exec-path-from-shell-debug t)
|
||||||
|
(exec-path-from-shell-initialize)
|
||||||
|
(exec-path-from-shell-copy-envs
|
||||||
|
'("PATH")))
|
||||||
|
|
||||||
104
.emacs.d.clojure/customizations/ui.el
Normal file
104
.emacs.d.clojure/customizations/ui.el
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
;; These customizations change the way emacs looks and disable/enable
|
||||||
|
;; some user interface elements. Some useful customizations are
|
||||||
|
;; commented out, and begin with the line "CUSTOMIZE". These are more
|
||||||
|
;; a matter of preference and may require some fiddling to match your
|
||||||
|
;; preferences
|
||||||
|
|
||||||
|
;; Turn off the menu bar at the top of each frame because it's distracting
|
||||||
|
(menu-bar-mode -1)
|
||||||
|
|
||||||
|
;; Show line numbers
|
||||||
|
(global-linum-mode)
|
||||||
|
|
||||||
|
;; Change cursor type to underline
|
||||||
|
(set-default 'cursor-type 'hbar)
|
||||||
|
|
||||||
|
;; You can uncomment this to remove the graphical toolbar at the top. After
|
||||||
|
;; awhile, you won't need the toolbar.
|
||||||
|
(when (fboundp 'tool-bar-mode)
|
||||||
|
(tool-bar-mode -1))
|
||||||
|
|
||||||
|
;; Don't show native OS scroll bars for buffers because they're redundant
|
||||||
|
(when (fboundp 'scroll-bar-mode)
|
||||||
|
(scroll-bar-mode -1))
|
||||||
|
|
||||||
|
;; Color Themes
|
||||||
|
;; Read http://batsov.com/articles/2012/02/19/color-theming-in-emacs-reloaded/
|
||||||
|
;; for a great explanation of emacs color themes.
|
||||||
|
;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Custom-Themes.html
|
||||||
|
;; for a more technical explanation.
|
||||||
|
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
|
||||||
|
(add-to-list 'load-path "~/.emacs.d/themes")
|
||||||
|
|
||||||
|
;; set theme
|
||||||
|
(load-theme 'darcula t)
|
||||||
|
|
||||||
|
;; increase font size for better readability
|
||||||
|
;;(set-face-attribute 'default nil :height 140)
|
||||||
|
|
||||||
|
;; Set font family and size
|
||||||
|
(set-frame-font "Monaco 16" nil t)
|
||||||
|
|
||||||
|
;; Maximize Emacs window on startup
|
||||||
|
(add-to-list 'default-frame-alist '(fullscreen . maximized))
|
||||||
|
|
||||||
|
;;(windmove-default-keybindings)
|
||||||
|
|
||||||
|
;; Change META button for MacOS from Option to Cmd
|
||||||
|
(setq mac-option-modifier nil
|
||||||
|
mac-command-modifier 'meta
|
||||||
|
x-select-enable-clipboart t)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;; Uncomment the lines below by removing semicolons and play with the
|
||||||
|
;; values in order to set the width (in characters wide) and height
|
||||||
|
;; (in lines high) Emacs will have whenever you start it
|
||||||
|
;; (setq initial-frame-alist '((top . 0) (left . 0) (width . 177) (height . 53)))
|
||||||
|
|
||||||
|
;; These settings relate to how emacs interacts with your operating system
|
||||||
|
(setq ;; makes killing/yanking interact with the clipboard
|
||||||
|
x-select-enable-clipboard t
|
||||||
|
|
||||||
|
;; I'm actually not sure what this does but it's recommended?
|
||||||
|
x-select-enable-primary t
|
||||||
|
|
||||||
|
;; Save clipboard strings into kill ring before replacing them.
|
||||||
|
;; When one selects something in another program to paste it into Emacs,
|
||||||
|
;; but kills something in Emacs before actually pasting it,
|
||||||
|
;; this selection is gone unless this variable is non-nil
|
||||||
|
save-interprogram-paste-before-kill t
|
||||||
|
|
||||||
|
;; Shows all options when running apropos. For more info,
|
||||||
|
;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Apropos.html
|
||||||
|
apropos-do-all t
|
||||||
|
|
||||||
|
;; Mouse yank commands yank at point instead of at click.
|
||||||
|
mouse-yank-at-point t)
|
||||||
|
|
||||||
|
;; No cursor blinking, it's distracting
|
||||||
|
(blink-cursor-mode 1)
|
||||||
|
|
||||||
|
;; full path in title bar
|
||||||
|
(setq-default frame-title-format "%b (%f)")
|
||||||
|
|
||||||
|
;; don't pop up font menu
|
||||||
|
(global-set-key (kbd "s-t") '(lambda () (interactive)))
|
||||||
|
|
||||||
|
;; no bell
|
||||||
|
(setq ring-bell-function 'ignore)
|
||||||
|
|
||||||
|
|
||||||
|
(global-hl-line-mode)
|
||||||
|
|
||||||
|
(setq confirm-kill-emacs 'y-or-n-p)
|
||||||
|
|
||||||
|
;; Changes all yes/no questions to y/n type
|
||||||
|
(fset 'yes-or-no-p 'y-or-n-p)
|
||||||
|
|
||||||
|
(add-hook 'emacs-startup-hook
|
||||||
|
(lambda ()
|
||||||
|
(message "Emacs ready in %s with %d garbage collections."
|
||||||
|
(format "%.2f seconds"
|
||||||
|
(float-time (time-subtract after-init-time before-init-time)))
|
||||||
|
gcs-done)))
|
||||||
153
.emacs.d.clojure/init.el
Normal file
153
.emacs.d.clojure/init.el
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
;;;;
|
||||||
|
;; Packages
|
||||||
|
;;;;
|
||||||
|
|
||||||
|
;; Define package repositories
|
||||||
|
(require 'package)
|
||||||
|
(add-to-list 'package-archives
|
||||||
|
'("tromey" . "http://tromey.com/elpa/") t)
|
||||||
|
(add-to-list 'package-archives
|
||||||
|
'("melpa" . "http://melpa.milkbox.net/packages/") t)
|
||||||
|
(add-to-list 'package-archives
|
||||||
|
'("melpa-stable" . "http://stable.melpa.org/packages/") t)
|
||||||
|
|
||||||
|
(add-to-list 'package-pinned-packages '(cider . "melpa-stable") t)
|
||||||
|
(add-to-list 'package-pinned-packages '(magit . "melpa-stable") t)
|
||||||
|
|
||||||
|
|
||||||
|
;; Load and activate emacs packages. Do this first so that the
|
||||||
|
;; packages are loaded before you start trying to modify them.
|
||||||
|
;; This also sets the load path.
|
||||||
|
(package-initialize)
|
||||||
|
|
||||||
|
;; Download the ELPA archive description if needed.
|
||||||
|
;; This informs Emacs about the latest versions of all packages, and
|
||||||
|
;; makes them available for download.
|
||||||
|
(when (not package-archive-contents)
|
||||||
|
(package-refresh-contents))
|
||||||
|
|
||||||
|
;; Define he following variables to remove the compile-log warnings
|
||||||
|
;; when defining ido-ubiquitous
|
||||||
|
;; (defvar ido-cur-item nil)
|
||||||
|
;; (defvar ido-default-item nil)
|
||||||
|
;; (defvar ido-cur-list nil)
|
||||||
|
;; (defvar predicate nil)
|
||||||
|
;; (defvar inherit-input-method nil)
|
||||||
|
|
||||||
|
;; The packages you want installed. You can also install these
|
||||||
|
;; manually with M-x package-install
|
||||||
|
;; Add in your own as you wish:
|
||||||
|
(defvar my-packages
|
||||||
|
'(;; makes handling lisp expressions much, much easier
|
||||||
|
;; Cheatsheet: http://www.emacswiki.org/emacs/PareditCheatsheet
|
||||||
|
paredit
|
||||||
|
|
||||||
|
;; key bindings and code colorization for Clojure
|
||||||
|
;; https://github.com/clojure-emacs/clojure-mode
|
||||||
|
clojure-mode
|
||||||
|
|
||||||
|
;; extra syntax highlighting for clojure
|
||||||
|
clojure-mode-extra-font-locking
|
||||||
|
|
||||||
|
;; integration with a Clojure REPL
|
||||||
|
;; https://github.com/clojure-emacs/cider
|
||||||
|
cider
|
||||||
|
|
||||||
|
;; allow ido usage in as many contexts as possible. see
|
||||||
|
;; customizations/navigation.el line 23 for a description
|
||||||
|
;; of ido
|
||||||
|
ido-completing-read+
|
||||||
|
|
||||||
|
;; Enhances M-x to allow easier execution of commands. Provides
|
||||||
|
;; a filterable list of possible commands in the minibuffer
|
||||||
|
;; http://www.emacswiki.org/emacs/Smex
|
||||||
|
smex
|
||||||
|
|
||||||
|
;; project navigation
|
||||||
|
projectile
|
||||||
|
|
||||||
|
;; colorful parenthesis matching
|
||||||
|
rainbow-delimiters
|
||||||
|
|
||||||
|
;; edit html tags like sexps
|
||||||
|
tagedit
|
||||||
|
|
||||||
|
;; git integration
|
||||||
|
magit))
|
||||||
|
|
||||||
|
;; On OS X, an Emacs instance started from the graphical user
|
||||||
|
;; interface will have a different environment than a shell in a
|
||||||
|
;; terminal window, because OS X does not run a shell during the
|
||||||
|
;; login. Obviously this will lead to unexpected results when
|
||||||
|
;; calling external utilities like make from Emacs.
|
||||||
|
;; This library works around this problem by copying important
|
||||||
|
;; environment variables from the user's shell.
|
||||||
|
;; https://github.com/purcell/exec-path-from-shell
|
||||||
|
(if (eq system-type 'darwin)
|
||||||
|
(add-to-list 'my-packages 'exec-path-from-shell))
|
||||||
|
|
||||||
|
(dolist (p my-packages)
|
||||||
|
(when (not (package-installed-p p))
|
||||||
|
(package-install p)))
|
||||||
|
|
||||||
|
|
||||||
|
;; Place downloaded elisp files in ~/.emacs.d/vendor. You'll then be able
|
||||||
|
;; to load them.
|
||||||
|
;;
|
||||||
|
;; For example, if you download yaml-mode.el to ~/.emacs.d/vendor,
|
||||||
|
;; then you can add the following code to this file:
|
||||||
|
;;
|
||||||
|
;; (require 'yaml-mode)
|
||||||
|
;; (add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
|
||||||
|
;;
|
||||||
|
;; Adding this code will make Emacs enter yaml mode whenever you open
|
||||||
|
;; a .yml file
|
||||||
|
(add-to-list 'load-path "~/.emacs.d/vendor")
|
||||||
|
|
||||||
|
|
||||||
|
;;;;
|
||||||
|
;; Customization
|
||||||
|
;;;;
|
||||||
|
|
||||||
|
;; Add a directory to our load path so that when you `load` things
|
||||||
|
;; below, Emacs knows where to look for the corresponding file.
|
||||||
|
(add-to-list 'load-path "~/.emacs.d/customizations")
|
||||||
|
|
||||||
|
;; Sets up exec-path-from-shell so that Emacs will use the correct
|
||||||
|
;; environment variables
|
||||||
|
(load "shell-integration.el")
|
||||||
|
|
||||||
|
;; These customizations make it easier for you to navigate files,
|
||||||
|
;; switch buffers, and choose options from the minibuffer.
|
||||||
|
(load "navigation.el")
|
||||||
|
|
||||||
|
;; These customizations change the way emacs looks and disable/enable
|
||||||
|
;; some user interface elements
|
||||||
|
(load "ui.el")
|
||||||
|
|
||||||
|
;; These customizations make editing a bit nicer.
|
||||||
|
(load "editing.el")
|
||||||
|
|
||||||
|
;; Hard-to-categorize customizations
|
||||||
|
(load "misc.el")
|
||||||
|
|
||||||
|
;; For editing lisps
|
||||||
|
(load "elisp-editing.el")
|
||||||
|
|
||||||
|
;; Langauage-specific
|
||||||
|
(load "setup-clojure.el")
|
||||||
|
(load "setup-js.el")
|
||||||
|
(custom-set-variables
|
||||||
|
;; custom-set-variables was added by Custom.
|
||||||
|
;; If you edit it by hand, you could mess it up, so be careful.
|
||||||
|
;; Your init file should contain only one such instance.
|
||||||
|
;; If there is more than one, they won't work right.
|
||||||
|
'(coffee-tab-width 2)
|
||||||
|
'(package-selected-packages
|
||||||
|
'(darcula-theme atom-one-dark-theme magit tagedit rainbow-delimiters projectile smex ido-completing-read+ cider clojure-mode-extra-font-locking clojure-mode paredit exec-path-from-shell)))
|
||||||
|
(custom-set-faces
|
||||||
|
;; custom-set-faces was added by Custom.
|
||||||
|
;; If you edit it by hand, you could mess it up, so be careful.
|
||||||
|
;; Your init file should contain only one such instance.
|
||||||
|
;; If there is more than one, they won't work right.
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user