Skip to content

Commit

Permalink
Merge remote-tracking branch 'magnars/master'
Browse files Browse the repository at this point in the history
Conflicts:
	.mc-lists.el
	init.el
	setup-ido.el
	site-lisp/flx
  • Loading branch information
Christian Johansen committed Nov 7, 2013
2 parents bb8ed44 + 7e847c9 commit 4da3bbe
Show file tree
Hide file tree
Showing 37 changed files with 282 additions and 170 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -10,4 +10,5 @@ emms
site-lisp/adventur-mode
*.elc
.DS_Store
.yas-compiled-snippets.el
.yas-compiled-snippets.el
.cask
8 changes: 1 addition & 7 deletions .gitmodules
Expand Up @@ -13,9 +13,6 @@
[submodule "site-lisp/buster-snippets"]
path = site-lisp/buster-snippets
url = https://github.com/magnars/buster-snippets.el.git
[submodule "site-lisp/yasnippet"]
path = site-lisp/yasnippet
url = https://github.com/capitaomorte/yasnippet.git
[submodule "site-lisp/expand-region"]
path = site-lisp/expand-region
url = https://github.com/magnars/expand-region.el.git
Expand Down Expand Up @@ -81,7 +78,7 @@
url = https://github.com/magnars/change-inner.el.git
[submodule "site-lisp/crappy-jsp-mode"]
path = site-lisp/crappy-jsp-mode
url = git://github.com/magnars/crappy-jsp-mode.git
url = https://github.com/magnars/crappy-jsp-mode.git
[submodule "site-lisp/s"]
path = site-lisp/s
url = https://github.com/magnars/s.el.git
Expand Down Expand Up @@ -112,9 +109,6 @@
[submodule "site-lisp/angular-snippets"]
path = site-lisp/angular-snippets
url = https://github.com/magnars/angular-snippets.el.git
[submodule "site-lisp/flx"]
path = site-lisp/flx
url = https://github.com/lewang/flx.git
[submodule "site-lisp/flycheck"]
path = site-lisp/flycheck
url = https://github.com/lunaryorn/flycheck.git
Expand Down
14 changes: 13 additions & 1 deletion .mc-lists.el
Expand Up @@ -15,6 +15,7 @@
c-electric-backspace
c-electric-delete-forward
c-electric-paren
c-electric-pound
c-electric-semi&comma
c-electric-slash
c-electric-star
Expand All @@ -24,6 +25,7 @@
cua-replace-region
cua-set-mark
delete-blank-lines
delete-indentation
dired-back-to-start-of-files
duplicate-current-line-or-region
end-of-buffer
Expand All @@ -33,9 +35,11 @@
forward-paragraph
forward-sentence
forward-sexp
god-mode-repeat
hippie-expand-no-case-fold
html-wrap-in-tag
isearch-forward-use-region
insert-postfix-whitespace
js2-beginning-of-line
js2-end-of-line
js2-insert-and-indent
Expand Down Expand Up @@ -69,12 +73,15 @@
orgtbl-self-insert-command
paredit-backslash
paredit-backward
paredit-backward-barf-sexp
paredit-backward-slurp-sexp
paredit-backward-up
paredit-close-round
paredit-close-square
paredit-comment-dwim
paredit-doublequote
paredit-forward
paredit-forward-barf-sexp
paredit-forward-delete
paredit-forward-down
paredit-forward-kill-word
Expand All @@ -91,6 +98,7 @@
paredit-reindent-defun
paredit-semicolon
paredit-splice-sexp
paredit-splice-sexp-killing-backward
paredit-split-sexp
paredit-wrap-round
paredit-wrap-round-from-behind
Expand Down Expand Up @@ -127,7 +135,7 @@
transpose-sexps
wrap-region-trigger
yank-indented
yas/expand
yas-expand
zap-up-to-char
))

Expand All @@ -139,16 +147,20 @@
dired-toggle-read-only
edebug-next-mode
eval-expression
find-tag
god-local-mode
goto-line-with-feedback
handle-switch-frame
ido-switch-buffer
js2r-extract-var
js2r-rename-var
jump-between-source-and-test-files
kmacro-end-or-call-macro
magit-status
mc/add-cursor-on-click
mc/add-cursors-to-all-matches
multiple-cursors-mode
ns-prev-frame
persp-switch
shell
smex
Expand Down
31 changes: 8 additions & 23 deletions README.md
Expand Up @@ -15,15 +15,20 @@ that are best handled by the package manager.

## Install emacs on mac

I use [Emacs For Mac OS X](http://emacsformacosx.com).
I use Cocoa Emacs, installed like this:

brew install emacs --cocoa

To open it with Alfred or Quicksilver, you have to copy `Emacs.app` into
`/Applications` instead of the symlink that brew places there.

## Tips for using these emacs settings

If you want to use my settings straight out of the box, here are some things to note:

* I recommend starting with a blank emacs +
[Technomancy's better-defaults package](https://github.com/technomancy/better-defaults),
and then dig through this repo for useful nuggets.
and then dig through this repo for useful nuggets, instead of forking it directly.

* The key bindings are optimized for a norwegian keyboard layout.

Expand Down Expand Up @@ -53,26 +58,6 @@ If you want to use my settings straight out of the box, here are some things to

* Watch [emacsrocks.com](http://emacsrocks.com)

### Additional setup

#### tern.js

If you want [tern](http://ternjs.net/) in your javascript, you need to
install [node](http://nodejs.org) and run `npm install` in the
`.emacs/site-lisp/tern` directory.

#### nrepl-inspect

If you want [nrepl-inspect](https://github.com/vitalreactor/nrepl-inspect)
to work, you need to:

- Go to `.emacs.d/site-lisp/nrepl-inspect` and do `lein install`
- Configure your `~/.lein/profiles.clj`:

{:user {:dependencies [[nrepl-inspect "0.3.0"]]
:repl-options {:nrepl-middleware
[inspector.middleware/wrap-inspect]}}}

## Survival guide for the first week of emacs

When you start using emacs for the first time, your habits fight you every inch
Expand Down Expand Up @@ -118,7 +103,7 @@ overview of the most commonly used shortcuts to get you through this pain:
### Navigation

* `C-arrow` Move past words/paragraphs
* `C-a ` Go to indentation, then start of line
* `C-a ` Go to start of line
* `C-e ` Go to end of line
* `M-g M-g` Go to line number
* `C-x C-i` Go to symbol
Expand Down
3 changes: 2 additions & 1 deletion appearance.el
Expand Up @@ -72,7 +72,7 @@

;; Unclutter the modeline
(require 'diminish)
(eval-after-load "yasnippet" '(diminish 'yas/minor-mode))
(eval-after-load "yasnippet" '(diminish 'yas-minor-mode))
(eval-after-load "eldoc" '(diminish 'eldoc-mode))
(eval-after-load "paredit" '(diminish 'paredit-mode))
(eval-after-load "tagedit" '(diminish 'tagedit-mode))
Expand All @@ -81,6 +81,7 @@
(eval-after-load "skewer-css" '(diminish 'skewer-css-mode))
(eval-after-load "skewer-html" '(diminish 'skewer-html-mode))
(eval-after-load "smartparens" '(diminish 'smartparens-mode))
(eval-after-load "guide-key" '(diminish 'guide-key-mode))

(defmacro rename-modeline (package-name mode new-name)
`(eval-after-load ,package-name
Expand Down
6 changes: 3 additions & 3 deletions custom.el
Expand Up @@ -3,7 +3,7 @@
;; 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.
'(custom-safe-themes (quote ("c03d60937e814932cd707a487676875457e0b564a615c1edfd453f23b06fe879" "f3ec2da81c2b1f66f911fe47843a09055754b40fafaddcce79bbd4d781161329" "30c6aef3025cd6f05ccb611ec8838a448a14a6784987ed98b24f78916d63b388" "84ff07913c6109d12bfda40644daeaaa8f4665afb5f04e13e422bd98b02ee88b" "cf33119622dd833e4d8f904f34c5e3ff95d1d3d45bada72dd44648b3470bdebe" "f5776f3da6117901f29405fe52edb2bcba6a687629b4cbd5923d1a642484f2f9" "d56e289b10204629ac5c35b9621a650a534ef3baf183a1c601b4936482321df1" "50ceca952b37826e860867d939f879921fac3f2032d8767d646dd4139564c68a" "ff73e1b0216feca9e041dcb3196938442cc6aa8319f97eedbc2a3e38c8ca9825" "a18dd0a954ac63a80e62c8cb1b550ffcf5d8461189c7c672555faadf2facfcf3" "cb36f8e44d41595010baa23737984c4ecb2d8cc2e363ec15fbfa0408c2f8ea9f" "ea0c5df0f067d2e3c0f048c1f8795af7b873f5014837feb0a7c8317f34417b04" "9f42bccce1e13fa5017eb8718574db099e85358b9f424db78e7318f86d1be08f" default)))
'(custom-safe-themes (quote ("9527feeeec43970b1d725bdc04e97eb2b03b15be982ac50089ad223d3c6f2920" "c03d60937e814932cd707a487676875457e0b564a615c1edfd453f23b06fe879" "f3ec2da81c2b1f66f911fe47843a09055754b40fafaddcce79bbd4d781161329" "30c6aef3025cd6f05ccb611ec8838a448a14a6784987ed98b24f78916d63b388" "84ff07913c6109d12bfda40644daeaaa8f4665afb5f04e13e422bd98b02ee88b" "cf33119622dd833e4d8f904f34c5e3ff95d1d3d45bada72dd44648b3470bdebe" "f5776f3da6117901f29405fe52edb2bcba6a687629b4cbd5923d1a642484f2f9" "d56e289b10204629ac5c35b9621a650a534ef3baf183a1c601b4936482321df1" "50ceca952b37826e860867d939f879921fac3f2032d8767d646dd4139564c68a" "ff73e1b0216feca9e041dcb3196938442cc6aa8319f97eedbc2a3e38c8ca9825" "a18dd0a954ac63a80e62c8cb1b550ffcf5d8461189c7c672555faadf2facfcf3" "cb36f8e44d41595010baa23737984c4ecb2d8cc2e363ec15fbfa0408c2f8ea9f" "ea0c5df0f067d2e3c0f048c1f8795af7b873f5014837feb0a7c8317f34417b04" "9f42bccce1e13fa5017eb8718574db099e85358b9f424db78e7318f86d1be08f" default)))
'(ido-use-filename-at-point nil)
'(fill-column 80)
'(safe-local-variable-values (quote ((eval font-lock-add-keywords nil (quote (("defexamples\\|def-example-group\\| => " (0 (quote font-lock-keyword-face)))))) (eval when (and (buffer-file-name) (file-regular-p (buffer-file-name)) (string-match-p "^[^.]" (buffer-file-name))) (emacs-lisp-mode)) (eval font-lock-add-keywords nil (quote (("defexamples\\| => " (0 (quote font-lock-keyword-face)))))) (encoding . utf-8)))))
Expand All @@ -13,5 +13,5 @@
;; 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.
'(js2-error-face ((t nil)))
'(js2-warning-face ((t nil))))
'(js2-error-face ((t nil)) t)
'(js2-warning-face ((t nil)) t))
6 changes: 6 additions & 0 deletions defuns/misc-defuns.el
Expand Up @@ -26,6 +26,12 @@
(call-interactively 'goto-line))
(linum-mode -1)))

(defun open-line-and-indent ()
(interactive)
(newline-and-indent)
(end-of-line 0)
(indent-for-tab-command))

;; start a httpd-server in current directory
(defun httpd-start-here (directory port)
(interactive (list (read-directory-name "Root directory: " default-directory nil t)
Expand Down
2 changes: 1 addition & 1 deletion defuns/snippet-helpers.el
Expand Up @@ -12,7 +12,7 @@

(defun snippet--function-punctuation ()
(if (js-method-p)
(when (not (looking-at "[ \n\t\r]*}"))
(when (not (looking-at "[ \n\t\r]*[},]"))
(insert ","))
(unless (js-function-declaration-p)
(if (looking-at "$") (insert ";")))))
Expand Down
25 changes: 20 additions & 5 deletions init.el
Expand Up @@ -56,22 +56,31 @@
'(magit
paredit
move-text
god-mode
gist
htmlize
visual-regexp
flycheck
flx
flx-ido
css-eldoc
yasnippet
smartparens
ido-vertical-mode
ido-at-point
simple-httpd
guide-key
nodejs-repl
restclient
highlight-escape-sequences
whitespace-cleanup-mode
elisp-slime-nav
git-commit-mode
gitconfig-mode
gitignore-mode
clojure-mode)))
clojure-mode
cider
cider-tracing)))

(condition-case nil
(init--install-packages)
Expand All @@ -89,12 +98,15 @@

;; guide-key
(require 'guide-key)
(setq guide-key/guide-key-sequence '("C-x r" "C-x 4" "C-x v" "C-x 8"))
(setq guide-key/guide-key-sequence '("C-x r" "C-x 4" "C-x v" "C-x 8" "C-x +"))
(guide-key-mode 1)
(setq guide-key/highlight-command-regexp "bookmark")
(setq guide-key/recursive-key-sequence-flag t)
(setq guide-key/popup-window-position 'bottom)

;; god-mode
(require 'god-mode)
(global-set-key (kbd "<escape>") 'god-local-mode)

;; Setup extensions
(eval-after-load 'ido '(require 'setup-ido))
(eval-after-load 'org '(require 'setup-org))
Expand All @@ -109,14 +121,17 @@
(require 'setup-html-mode)
(require 'setup-paredit)

;; Font lock dash.el
(eval-after-load "dash" '(dash-enable-font-lock))

;; Default setup of smartparens
(require 'smartparens-config)
(setq sp-autoescape-string-quote nil)
(--each '(css-mode-hook
restclient-mode-hook
js-mode-hook
markdown-mode
ruby-mode-hook)
ruby-mode
markdown-mode)
(add-hook it 'turn-on-smartparens-mode))

;; Language specific setup files
Expand Down
21 changes: 18 additions & 3 deletions key-bindings.el
Expand Up @@ -28,7 +28,7 @@
(global-set-key (kbd "C-S-c C-a") 'mc/edit-beginnings-of-lines)

;; Mark additional regions matching current region
(global-set-key (kbd "M-æ") 'mc/mark-all-like-this-dwim)
(global-set-key (kbd "M-æ") 'mc/mark-all-dwim)
(global-set-key (kbd "C-å") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-æ") 'mc/mark-next-like-this)
(global-set-key (kbd "C-Æ") 'mc/mark-more-like-this-extended)
Expand Down Expand Up @@ -60,6 +60,7 @@

;; Perform general cleanup.
(global-set-key (kbd "C-c n") 'cleanup-buffer)
(global-set-key (kbd "C-c C-n") 'cleanup-buffer)
(global-set-key (kbd "C-c C-<return>") 'delete-blank-lines)

;; M-i for back-to-indentation
Expand All @@ -71,6 +72,7 @@
;; Use shell-like backspace C-h, rebind help to F1
(define-key key-translation-map [?\C-h] [?\C-?])
(global-set-key (kbd "<f1>") 'help-command)
(define-key god-local-mode-map (kbd "h") 'backward-delete-char)

(global-set-key (kbd "M-h") 'kill-region-or-backward-word)

Expand All @@ -88,14 +90,22 @@
(global-set-key (kbd "C-c C--") 'replace-next-underscore-with-camel)
(global-set-key (kbd "M-s M--") 'snakeify-current-word)

;; Change word separators
(global-unset-key (kbd "C-x +")) ;; used to be balance-windows
(global-set-key (kbd "C-x + -") (λ (replace-region-by 's-dashed-words)))
(global-set-key (kbd "C-x + _") (λ (replace-region-by 's-snake-case)))
(global-set-key (kbd "C-x + c") (λ (replace-region-by 's-lower-camel-case)))
(global-set-key (kbd "C-x + C") (λ (replace-region-by 's-upper-camel-case)))

;; Killing text
(global-set-key (kbd "C-S-k") 'kill-and-retry-line)
(global-set-key (kbd "C-w") 'kill-region-or-backward-word)
(global-set-key (kbd "C-c C-w") 'kill-to-beginning-of-line)

;; Use M-w for copy-line if no active region
(global-set-key (kbd "M-w") 'save-region-or-current-line)
(global-set-key (kbd "M-W") '(λ (save-region-or-current-line 1)))
(global-set-key (kbd "s-w") 'save-region-or-current-line)
(global-set-key (kbd "M-W") (λ (save-region-or-current-line 1)))

;; Make shell more convenient, and suspend-frame less
(global-set-key (kbd "C-z") 'shell)
Expand All @@ -105,7 +115,7 @@
(global-set-key (kbd "M-z") 'zap-up-to-char)
(global-set-key (kbd "s-z") (lambda (char) (interactive "cZap up to char backwards: ") (zap-up-to-char -1 char)))

(global-set-key (kbd "M-Z") 'zap-to-char)
(global-set-key (kbd "M-Z") (lambda (char) (interactive "cZap to char: ") (zap-to-char 1 char)))
(global-set-key (kbd "s-Z") (lambda (char) (interactive "cZap to char backwards: ") (zap-to-char -1 char)))

;; iy-go-to-char - like f in Vim
Expand Down Expand Up @@ -252,6 +262,7 @@
(global-set-key (kbd "C-x M") 'mu4e-up-to-date-status)

;; Clever newlines
(global-set-key (kbd "C-o") 'open-line-and-indent)
(global-set-key (kbd "<C-return>") 'open-line-below)
(global-set-key (kbd "<C-S-return>") 'open-line-above)
(global-set-key (kbd "<M-return>") 'new-line-dwim)
Expand Down Expand Up @@ -318,6 +329,7 @@
(global-set-key (kbd "C-x C-o ht") (ffip-create-pattern-file-finder "*.html"))
(global-set-key (kbd "C-x C-o jp") (ffip-create-pattern-file-finder "*.jsp"))
(global-set-key (kbd "C-x C-o cs") (ffip-create-pattern-file-finder "*.css"))
(global-set-key (kbd "C-x C-o ft") (ffip-create-pattern-file-finder "*.feature"))
(global-set-key (kbd "C-x C-o cl") (ffip-create-pattern-file-finder "*.clj"))
(global-set-key (kbd "C-x C-o el") (ffip-create-pattern-file-finder "*.el"))
(global-set-key (kbd "C-x C-o md") (ffip-create-pattern-file-finder "*.md"))
Expand All @@ -327,9 +339,12 @@
(global-set-key (kbd "C-x C-o tx") (ffip-create-pattern-file-finder "*.txt"))
(global-set-key (kbd "C-x C-o vm") (ffip-create-pattern-file-finder "*.vm"))
(global-set-key (kbd "C-x C-o xm") (ffip-create-pattern-file-finder "*.xml"))
(global-set-key (kbd "C-x C-o in") (ffip-create-pattern-file-finder "*.ini"))
(global-set-key (kbd "C-x C-o pr") (ffip-create-pattern-file-finder "*.properties"))
(global-set-key (kbd "C-x C-o in") (ffip-create-pattern-file-finder "*.ini"))
(global-set-key (kbd "C-x C-o gr") (ffip-create-pattern-file-finder "*.groovy"))
(global-set-key (kbd "C-x C-o ga") (ffip-create-pattern-file-finder "*.gradle"))
(global-set-key (kbd "C-x C-o !") (ffip-create-pattern-file-finder "*"))

;; View occurrence in occur mode
(define-key occur-mode-map (kbd "v") 'occur-mode-display-occurrence)
Expand Down

0 comments on commit 4da3bbe

Please sign in to comment.