Skip to content

Instantly share code, notes, and snippets.

@ivanoats
Last active December 15, 2015 02:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivanoats/10586383 to your computer and use it in GitHub Desktop.
Save ivanoats/10586383 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Note: updated 2014-03-28 to handle patterns like foo/bar.txt
suffix=$(basename "$@")
pattern="${suffix}*"
if [ "$@" = "$suffix" ]; then
# If there's no folder then it should be a substring
pattern="*${suffix}*"
fi
mdfind -onlyin $HOME "kMDItemFSName = '$pattern'cd" \
| fgrep -i "$@" \
| grep -v "$HOME/Library/" \
| grep -v "$HOME/Pictures/" \
| grep -v "$HOME/Music/" \
| sed -e "s|^$HOME|~|"
(require 'helm-files)
(setq helm-idle-delay 0.1)
(setq helm-input-idle-delay 0.1)
(setq helm-locate-command "locate-with-mdfind %.0s %s")
(loop for ext in '("\\.swf$" "\\.elc$" "\\.pyc$")
do (add-to-list 'helm-boring-file-regexp-list ext))
(define-key global-map [(alt t)] 'helm-for-files))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment