** Jumping
*** Avy
#+BEGIN_SRC emacs-lisp
-(use-package avy
- :ensure t
- :bind ("C-c C-SPC" . avy-goto-word-1)
- :config (progn
- (setq avy-background t)
- (key-chord-define-global "jj" #'avy-goto-word-1)))
+ (use-package avy
+ :ensure t
+ :bind (("C-c C-<SPC>" . avy-goto-word-or-subword-1)
+ ("C-c j j" . avy-goto-word-or-subword-1)
+ ("M-g g" . avy-goto-line))
+ :config (progn (setq avy-background t))
+ )
+#+END_SRC
+*** Ace-link (jumping to links)
+#+BEGIN_SRC emacs-lisp
+ (use-package ace-link
+ :ensure t
+ ; bind o in most modes
+ :config (ace-link-setup-default))
+#+END_SRC
+*** Jumping through edit points (goto-chg)
+#+BEGIN_SRC emacs-lisp
+ (use-package goto-chg
+ :ensure t
+ :bind (("C-c j ," . goto-last-change)
+ ("C-c j ." . goto-last-change-reverse))
+#+END_SRC
+*** Jumping to bookmarks (visible bookmarks, bm)
+#+BEGIN_SRC emacs-lisp
+ (use-package bm
+ :ensure t
+ :bind (("C-c j b ." . bm-next)
+ ("C-c j b ," . bm-previous)
+ ("C-c j b SPC" . bm-toggle)))
#+END_SRC
** Snippets
#+BEGIN_SRC emacs-lisp
(use-package ess
:ensure t
- :config (require 'ess_configuration))
+ :config
+ (defun ess-change-directory (path)
+ "Set the current working directory to PATH for both *R* and Emacs."
+ (interactive "DDirectory to change to: ")
+
+ (when (file-exists-p path)
+ (ess-command (concat "setwd(\"" path "\")\n"))
+ ;; use file-name-as-directory to ensure it has trailing /
+ (setq default-directory (file-name-as-directory path))))
+ (add-hook 'ess-mode-hook 'flyspell-prog-mode)
+ ;; outlining support for ess modes
+ (add-hook
+ 'ess-mode-hook
+ '(lambda ()
+ (outline-minor-mode)
+ (setq outline-regexp "\\(^#\\{4,5\\} \\)\\|\\(^[a-zA-Z0-9_\.]+ ?<- ?function\\)")
+ (defun outline-level ()
+ (cond ((looking-at "^##### ") 1)
+ ((looking-at "^#### ") 2)
+ ((looking-at "^[a-zA-Z0-9_\.]+ ?<- ?function(.*{") 3)
+ (t 1000)))
+ ))
+ (add-hook 'ess-mode-hook
+ '(lambda ()
+ (local-set-key (kbd "C-c C-R")
+ 'dla/ess-region-remote-eval)))
+
+ ;; Don't restore history or save workspace image
+ '(inferior-R-args "--no-restore-history --no-save")
+ )
#+END_SRC
** Rainbowmode
#+BEGIN_SRC emacs-lisp
(use-package atomic-chrome
:config (atomic-chrome-start-server)
+ (setq atomic-chrome-buffer-open-style 'full)
+ )
+#+END_SRC
+** Multiple Cursors
+ :PROPERTIES:
+ :ID: 6fcf218b-a762-4c37-9339-a8202ddeb544
+ :END:
+[[https://github.com/magnars/multiple-cursors.el][Multiple Cursors]]
+#+BEGIN_SRC emacs-lisp
+ (use-package multiple-cursors
+ :bind (("C-;" . mc/mark-all-dwim)
+ ("C-<" . mc/mark-previous-like-this)
+ ("C->" . mc/mark-next-like-this)
+ ("C-S-c C-S-c" . mc/edit-lines))
)
#+END_SRC
* Org Mode
(when (member (org-get-todo-state) org-todo-keywords-1)
(setq has-subtask t))))
(and is-a-task (not has-subtask)))))
+ (defun bh/is-project-p ()
+ "Any task with a todo keyword subtask"
+ (save-restriction
+ (widen)
+ (let ((has-subtask)
+ (subtree-end (save-excursion (org-end-of-subtree t)))
+ (is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1)))
+ (save-excursion
+ (forward-line 1)
+ (while (and (not has-subtask)
+ (< (point) subtree-end)
+ (re-search-forward "^\*+ " subtree-end t))
+ (when (member (org-get-todo-state) org-todo-keywords-1)
+ (setq has-subtask t))))
+ (and is-a-task has-subtask))))
(defun bh/is-subproject-p ()
"Any task which is a subtask of another project"
(defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
- ; use iedit everywhere
- (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
+ ; use mc everywhere
+ (define-key my-keys-minor-mode-map (kbd "C-;") 'mc/mark-all-dwim)
;; use outline mode keybindings everywhere
;; (define-key my-keys-minor-mode-map (kbd "C-;") 'my/mydra-outline/body)
(add-to-list 'minor-mode-map-alist mykeys))))
(ad-activate 'load)
#+END_SRC
-
+** Goto line
+#+BEGIN_SRC emacs-lisp
+ (global-unset-key "\M-g")
+ (global-set-key (kbd "M-g l") 'goto-line)
+#+END_SRC
* Misc (uncharacterized)
#+BEGIN_SRC emacs-lisp
(setq bibtex-user-optional-fields (quote (("annote" "Personal annotation (ignored)") ("abstract" "") ("pmid" "") ("doi" ""))))
(setq mail-yank-prefix "> ")
- (global-unset-key "\M-g")
- (global-set-key "\M-g" 'goto-line)
-
;; self-insert-command hack.
;; Without this, "if<SP>" expands to
;; if ( -!-) {
; don't use the multi-window configuration
(setq ediff-window-setup-function 'ediff-setup-windows-plain)
- ; use iedit
- (require 'iedit)
- (define-key global-map (kbd "C-;") 'iedit-mode)
- (global-set-key (kbd "C-;") 'iedit-mode)
-
; fix up css mode to not be silly
; from http://www.stokebloke.com/wordpress/2008/03/21/css-mode-indent-buffer-fix/
(setq cssm-indent-level 4)
(defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
; use iedit everywhere
- (define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
+ (define-key my-keys-minor-mode-map (kbd "C-;") 'mc/mark-all-dwim)
(define-minor-mode my-keys-minor-mode
"A minor mode so that my key settings override annoying major modes."