;;; ravi-init-navigation.el --- navigation utilities ;; Copyright (C) 2013 ;; Author: ;; Keywords: ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;; Buffer navigation utilities ;;; Code: (use-package region-bindings-mode :init (region-bindings-mode-enable) :config (progn (region-bindings-mode-enable) ;; The macro 'bind-key does not seem to work for region-bindings-mode-map (define-key region-bindings-mode-map "f" 'forward-word) (define-key region-bindings-mode-map "b" 'backward-word) ;; HJKL cluster to replace arrow keys (define-key region-bindings-mode-map "h" 'backward-char) (define-key region-bindings-mode-map "l" 'forward-char) (define-key region-bindings-mode-map "j" 'previous-line) (define-key region-bindings-mode-map "k" 'next-line) ;; Most of the time, we mark regions to copy (define-key region-bindings-mode-map "w" 'kill-ring-save) ) :ensure t ) (use-package ace-jump-mode :bind ("M-h" . ace-jump-mode) :ensure t ) (use-package imenu-anywhere :bind ("s-." . imenu-anywhere) :ensure t ) (use-package expand-region :bind ("C-=" . er/expand-region) :ensure t ) (use-package multiple-cursors :bind (("C-S-c C-S-c" . mc/edit-lines) ("C->" . mc/mark-next-like-this) ("C-<" . mc/mark-previous-like-this) ("C-c C-<" . mc/mark-all-like-this)) :init (setq mc/list-file (ravi/emacs-file "past/mc-lists.el")) :config (progn (define-key region-bindings-mode-map "a" 'mc/mark-all-like-this) (define-key region-bindings-mode-map "p" 'mc/mark-previous-like-this) (define-key region-bindings-mode-map "n" 'mc/mark-next-like-this) (define-key region-bindings-mode-map "m" 'mc/mark-more-like-this-extended) ) :ensure t ) (use-package god-mode :bind (("" . god-local-mode)) :ensure t ) (bind-key "" 'ff-find-other-file) (setq compilation-scroll-output 'first-error) (use-package smartparens :commands (smartparens-mode show-smartparens-mode) :init (show-smartparens-global-mode 1) :config (require 'smartparens-config) :ensure t ) ;; Marking and moving lines (bind-key "M-j" (lambda () (interactive) (join-line -1)) ) (use-package move-lines :bind (("" . move-lines-down) ("" . move-lines-up) ) ) ;; grep and friends (use-package wgrep :ensure t ) (let ((ad-redefinition-action 'accept)) (use-package color-moccur :commands (isearch-moccur isearch-all) :bind ("M-s O" . moccur) :init (progn (bind-key "M-o" 'isearch-moccur isearch-mode-map) (bind-key "M-O" 'isearch-moccur-all isearch-mode-map)) :config (use-package moccur-edit) :ensure t ) ) ;; Search the web (use-package webjump :bind ("C-x g" . webjump) :config (progn ;; Suggest word at point if possible (defun webjump-read-string (prompt) (let* ((prompt (concat prompt (if (word-at-point) (concat " (default: " (word-at-point) ")")) ": ")) (input (read-string prompt))) (if (webjump-null-or-blank-string-p input) (word-at-point) input))) ;; C++ reference (add-to-list 'webjump-sites '("cpp" . [simple-query "en.cppreference.com" "http://en.cppreference.com/mwiki/index.php?title=Special:Search&search=" ""])) ) ) ;; to do: add zeal-at-point (provide 'ravi-init-navigation) ;;; ravi-init-navigation.el ends here