diff options
| author | Ravi R Kiran <aine.marina@gmail.com> | 2015-10-23 18:57:59 (GMT) |
|---|---|---|
| committer | Ravi R Kiran <aine.marina@gmail.com> | 2015-10-23 18:57:59 (GMT) |
| commit | cd1924466152177ea06b17c843f256463c1b91b8 (patch) | |
| tree | af90afe028e5e392f242a3ea36302aafe1c1769d /lisp/ravi-init-ido.el | |
| parent | 5561df232cfa49822f322196d98170f95aa1139e (diff) | |
| parent | 74c319ef12dd3130f6afc17abc59404b59d601d1 (diff) | |
| download | dotemacs-cd1924466152177ea06b17c843f256463c1b91b8.zip dotemacs-cd1924466152177ea06b17c843f256463c1b91b8.tar.gz dotemacs-cd1924466152177ea06b17c843f256463c1b91b8.tar.bz2 | |
Merge branch 'master' into rtags-attempt
* master: (139 commits)
Add pdf-tools as a nicer replacement for doc-view
Add pdf-tools submodule
Fix maildir data with correct path
Add desktop notifications for email
Potential use for modes without repls
Attach files more easily in mu
Update to newest version of mu
Please remove tooltips after a while, please
ace-window gets confused when tooltips are present
Sometimes the dispatch list does come in handy
Pre-populate searches
Succumb to muscle memory of control keys
Remove ropemacs due to disuse
Do not let company-quickhelp steal a global key
Manage word navigation
Use proper helm function to replace completing-read
Electric operators on python mode
Use which-key in preference to guide-key
Navigate easier
Simplify config with magit 2.1.0
...
Diffstat (limited to 'lisp/ravi-init-ido.el')
| -rw-r--r-- | lisp/ravi-init-ido.el | 176 |
1 files changed, 176 insertions, 0 deletions
diff --git a/lisp/ravi-init-ido.el b/lisp/ravi-init-ido.el new file mode 100644 index 0000000..0997bd4 --- /dev/null +++ b/lisp/ravi-init-ido.el @@ -0,0 +1,176 @@ +;;; ravi-init-ido.el --- ido initialization + +;; Copyright (C) 2013 + +;; Author: <ravi@nero.lan> +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Ido initialization + +;;; Code: + +;; Almost all of the code below is stolen from jwiegley's .emacs.d. + +(use-package ibuffer + :bind ("C-x C-b" . ibuffer) + :config + (progn + + (use-package ibuffer-vc + :commands ibuffer-vc-set-filter-groups-by-vc-root + :ensure t) + + ;; Switching to ibuffer puts the cursor on the most recent past buffer + (defadvice ibuffer (around ibuffer-point-to-most-recent-but-one activate) () + "Open ibuffer with cursor pointed to most recent buffer name" + (let ((recent-buffer-name (buffer-name (other-buffer (current-buffer) t)))) + ad-do-it + (ibuffer-jump-to-buffer recent-buffer-name))) + + ;; Show version control status in ibuffer + (setq ibuffer-formats + '((mark modified read-only vc-status-mini " " + (name 18 18 :left :elide) + " " + (size 9 -1 :right) + " " + (mode 16 16 :left :elide) + " " + (vc-status 16 16 :left) + " " + filename-and-process))) + + (defun ravi/ibuffer-vc-sort-hook () + (ibuffer-vc-set-filter-groups-by-vc-root) + (unless (eq ibuffer-sorting-mode 'alphabetic) + (ibuffer-do-sort-by-alphabetic))) + (add-hook 'ibuffer-hook 'ravi/ibuffer-vc-sort-hook) + ) + ) + +(use-package ace-jump-buffer + :bind (("M-<f1>" . ace-jump-buffer) + ("C-<f1>" . ace-jump-buffer-other-window) + ("S-<f1>" . ace-jump-projectile-buffers)) + ;; :config + ;; (progn + ;; (bind-key "M-<f1>" 'ido-switch-buffer)) + :ensure t) + +;;;_ , ido + +(use-package ido + :defines (ido-cur-item + ido-require-match + ido-selected + ido-final-text + ido-show-confirm-message) + :if (not ravi/use-helm-instead-of-ido) + :init + (ido-mode 1) + + :config + (progn + (use-package ido-hacks + :config + (ido-hacks-mode 1) + :ensure t + ) + + (use-package flx-ido + :config + (progn + (use-package flx + :ensure t) + (flx-ido-mode 1) + ) + :ensure t + ) + (setq ido-use-filename-at-point 'guess) + (setq ido-use-virtual-buffers t) + (setq ido-create-new-buffer 'always) + + (use-package ido-ubiquitous + :config + (ido-ubiquitous-mode t) + :ensure t + ) + + (use-package ido-vertical-mode + :config + (ido-vertical-mode 1) + :ensure t + ) + + (defun ido-smart-select-text () + "Select the current completed item. Do NOT descend into directories." + (interactive) + (when (and (or (not ido-require-match) + (if (memq ido-require-match + '(confirm confirm-after-completion)) + (if (or (eq ido-cur-item 'dir) + (eq last-command this-command)) + t + (setq ido-show-confirm-message t) + nil)) + (ido-existing-item-p)) + (not ido-incomplete-regexp)) + (when ido-current-directory + (setq ido-exit 'takeprompt) + (unless (and ido-text (= 0 (length ido-text))) + (let ((match (ido-name (car ido-matches)))) + (throw 'ido + (setq ido-selected + (if match + (replace-regexp-in-string "/\\'" "" match) + ido-text) + ido-text ido-selected + ido-final-text ido-text))))) + (exit-minibuffer))) + + (add-hook 'ido-minibuffer-setup-hook + #'(lambda () + (bind-key "<return>" 'ido-smart-select-text + ido-file-completion-map))) + + (defun ido-switch-buffer-tiny-frame (buffer) + (interactive (list (ido-read-buffer "Buffer: " nil t))) + (with-selected-frame + (make-frame '((width . 80) + (height . 22) + (left-fringe . 0) + (right-fringe . 0) + (vertical-scroll-bars . nil) + (unsplittable . t) + (has-modeline-p . nil) + ;;(background-color . "grey80") + (minibuffer . nil))) + (switch-to-buffer buffer) + (set (make-local-variable 'mode-line-format) nil))) + + (bind-key "C-x 5 t" 'ido-switch-buffer-tiny-frame))) + +(use-package smex + :init + (global-set-key [remap execute-extended-command] 'smex) + :if (not ravi/use-helm-instead-of-ido) + :ensure t + ) + +(provide 'ravi-init-ido) +;;; ravi-init-ido.el ends here |
