Skip to content

Instantly share code, notes, and snippets.

@sanchitgangwar
Created January 29, 2013 13:46
Show Gist options
  • Save sanchitgangwar/4664351 to your computer and use it in GitHub Desktop.
Save sanchitgangwar/4664351 to your computer and use it in GitHub Desktop.
Inline file search - bash completion
_is()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
if [[ ${cur} == * ]]; then
COMPREPLY=( $(find ./ -maxdepth 1 -iname "*${cur}*" | cut -d '/' -f 2) )
return 0
fi
}
complete -F _is is
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment