Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
;;; jg-quicknav.el --- Quickly navigate the file system to find a file. ;; Copyright (C) 2013-2015 Jeff Gran ;; Author: Jeff Gran <email@example.com> ;; URL: https://github.com/jeffgran/jg-quicknav ;; Created: 3 Mar 2013 ;; Keywords: navigation ;; Version: 1.4.0 ;; Package-Requires: ((s "1.9.0") (cl-lib "0.5")) ;; This file is not part of GNU Emacs. ;;; Commentary: ;; A quick file-finder for emacs. Navigate up and down directories to find a file. ;; ;; Like ido-find-file, lusty-explorer, helm/anything, etc. But none of them ;; did quite what I wanted so I created this. The goal is to navigate the file ;; system as fast as possible. Like a much faster way of doing the... ;; ;; 1. cd <foo> ;; 2. ls ;; 3. goto 1 ;; 4. <open file> ;; ;; ...loop in the shell. ;; ;; Usage: - assign `jg-quicknav' to a key, and use it. ;; - buffer will show you the directory listing for the current default directory ;; (reminder: if you're in a file buffer, that will be the directory ;; that file is in. If you're in shell-mode, eshell, ansi-term, dired, etc, ;; that will be the correct current directory). ;; - type some letters to filter down the results. C-n and C-p to change selection ;; - RET on a file to open the file, or RET on a directory to `jg-quicknav' that dir. ;; - C-, to go "up a directory", after which you can go "forward" with C-. ;; - Drop into dired with C-/ ;; - I tried to make it easy to rebind the bindings. I rebind everything all the time ;; so I was sure others would not like my key choices. see below. ;; ;; ;; ;; You'll likely want to change some of the key bindings. Just redefine the keys ;; on jg-quicknav-mode-map. For example, if you use C-n for something else and want ;; to move up and down lines while navigating with M-n instead, use this: ;; ;; (define-key jg-quicknav-mode-map (kbd "C-n") nil) ;; (define-key jg-quicknav-mode-map (kbd "M-n") 'jg-quicknav-next) ;; ;; ;; TODO/IDEAS: ;; - better support for dirs with many files in them ;; - ensure-cursor-visible or something in case selection is off the screen ;; - also page-down and page-up support for long lists ;; - maybe add an option to toggle showing only files/only dirs? ;; - shell-mode plugin to "cd" to a directory chosen via jgqn? ;; - secondary-highlight for previous dir after going 'updir' ;; - different face/color for executables? or just the "*"? ;; - and different face for file extensions? (just like dired+) ;; - add a jg-quick-buffer-switcher too? ;;; History: ;; 2013-03-03 Initial release v 1.0.0 ;; 2013-03-03 v 1.0.1 ;; - use overriding-local-map in minibuffer to make sure ;; the jgqn keys override other minor modes during navigation ;; - bugfix: clear out "history" in between sessions ;; 2013-03-05 v 1.1.0 ;; - fixed weirdness when going "back" when already at the root directory ;; - added `jg-quicknav-find-file' -- key command to open a buffer for a new file ;; with the contents of the minibuffer as the filename, in the same directory ;; currently being shown ;; - added `jg-quicknav-dired' -- key command to drop into dired in the same directory ;; currently being shown ;; 2013-03-09 v 1.1.1 ;; - fixed bug: opening multiple files of the same name doesn't work ;; - fixed bug: doesn't show / when / is the jg-quicknav-default-dir ;; - fixed bug: use save-window-excursion instead of delete-window when session ;; ends. this ensures your window configuration will look the same before and ;; after the jgqn session ;; - fixed bug: when updating results, clamp the selection index to the number ;; of results so it doesn't disappear off the end ;; 2013-03-23 v 1.2.0 ;; - added jg-quicknav-dired. use it to fuzzy-filter a dired buffer ;; - added (and made default) different behavior for C-g. Now it will clear the ;; minibuffer input (if any) the first time you press it, and then quit the ;; quicknav session the second time. To go back to previous behavior (C-g ;; always quits), set "C-g" to 'jg-quicknav-minibuffer-exit instead of ;; 'jg-quicknav-minibuffer-clear-then-exit in the jg-quicknav-mode-map ;; 2013-03-29 v 1.2.1 ;; - fixed small annoyance: if you narrow to zero results then delete, ;; clamp selection index to 1 otherwise it disappears until you move it again. ;; 2013-04-14 v 1.3.0 ;; - Now works remotely! You must be using tramp. This means that if you are ;; visiting a remote file, or if you are in an ssh shell backed by tramp, ;; you can use jg-quicknav and it will show the listing of the corresponding ;; remote directory. ;; - fixed annoying blinking selection line when list is empty ;; 2013-04-28 v 1.3.1 ;; - fixed bug: dir with space in name results in error. wrap `cd` command in quotes. ;; 2014-09-12 v 1.3.2 ;; - fixed bug: use expand-file-name so we always start with a full absolute path ;; - fixed bug: concat pwd when visiting file so two files in different directories ;; with the same name don't get confused. ;; 2015-02-11 v 1.4.0 ;; - no new code, just renamed a bunch of functions for melpa compliance. ;; - everything now prefixed with jg-quicknav- (previously some were jgqn-) ;; - prefixed stolen functions too, to prevent conflicts. ;; - internal-only functions prefixed with jg-quicknav-- ;; 2015-02-16 v 1.4.1 ;; - add (require 'tramp) to make sure tramp is loaded. doesn't work without it.