The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

  jump  

DESCRIPTION

A utility to navigate your filesystem. It can ither be used directly on the command line or integrated with Bash.

SYNOPSIS

  $> j --add path [weight]

  $> j --remove path

  $> j --search path_part [path_part] ...

  $> j --show_database

OPTIONS

  --search              search for the best match in the database
  --file=glob           match only directories that contain a file matching the shell regexp

  -a|add                add path to database, weight is adjusted if the path exists
                        curent path if none is given

  -r|remove             remove path from database,  current path if none is given
  -remove_all           remove all paths from database

  -s|show_database      show database entries
  -show_config_files    show configuration files

  --complete            return completion path, used by bash complete

  -v|version            show version information and exit
  -h|help               show this help

  -ignore_path          paths matching will not be be included
  -q|quote              double quote results
  -ignore_case          do a case insensitive search
  -no_direct_path       ignore directories directly under cwd
  -no_sub_cwd           ignore directories and sub directories under cwd
  -no_sub_db            ignore directories under the database entries

FILES

  ~/.jump_database      default database
  ~/.jump_config        optional configuration file, a Perl hash format

CONFIGURATION FILE FORMAT

        {
        ignore_path => [string, qr], # paths listed will not match
        black_listed_directories => [string, qr], # paths matching are not added to db

        quote => 0              # doubl quote results
        ignore_case => 0,       # case insensitive search and completion

        no_direct_path => 0,    # ignore directories directly under cwd
        no_sub_cwd => 0,        # ignore directories and sub directories under cwd
        no_sub_db => 0,         # ignore directories under the database entries
        } ;

ENVIRONMENT

  APP_TERM_JUMP_DB      name of the database file
  APP_TERM_JUMP_CONFIG  name of the configuration file

COMMANDS

Adding directories

  $> j --add path [weight]

path is added to the directory with optional weight. If no weight is given, a default weight is assigned. If the entry already exist, the weight is added to the existing entry.

Only directories can be added to the database.

Paths matching entries in config black_listed_directories are silently ignored

Removing entries

  $> j --remove_all

The database is emptied

  $> j --remove  path

The the pat is removed from the database

Increasing and reseting weight

Increasing weight

  $> j --add path weight

Resetting weight

  $> j --remove --add path weight

Show the database contents

  $> j --show_database

Displa the database file name and the configuration file name

  $> j --show_configuration_files

MATCHING

  $> j --search  path_part [path_part] ...

path_part is matched in a case sensitie fashion; set $config->{ignore_case} in the configuration file for matching in a case insensitive fashion.

Given this directory structure, the database entries and cwd being /

  /
   A

   path_part
     path_part2
       A (w:10)
       B_directory (w:10)
       C (w:10)
         F

   path_part3
     B (w:1)
     B_directory (w:20)
     C (w:10)
       E
       F

   subdir
     E

Paths are matched in this order:

  • existing full path

    Setting configuration no_direct_path disables this matching

  • match directory under the current working directory

    this allow Jump to mimic cd's behavior and jump to directories within the current "project".

      $> jump --search A

    will return /A even though /path_part/path_part2/A is a database entry with weight:10

    Setting configuration no_direct_path disables this matching

  • full match last directory of database entry

      $> jump --search B 

    will return /path_part/path_part3/B, which has weigh:1 even though /path_part/path_part3/B_directory is a database entry with weight:10

  • partial match last directory of database entry

      $> jump --search B_dir

    will return /path_part/path_part3/B_directory which is heavier than /path_part/path_part2/B_directory

  • equivalent matches return the first entry in alphabetical order

      $> jump --search C

    will return /path_part/path_part2/C which sorts before /path_part/path_part3/C

  • match part of a db entry

      $> jump --search path 

    will return /path_part/path_part3/C which is the entry containing path and has the heaviest weight

  • match sub directory of cwd

      $> jump --search E

    will return /subdir/E

    Seting configuration no_sub_cwd disables this matching

  • match sub directory of a db entry

      $> jump --search F

    will return /path_part/path_part3/C/F. /path_part/path_part2/F is not under a database entry

    Setting configuration no_sub_db disables this matching

Matching with multiple path parts

  $> jump --search C

Matches 2 entries but will return /path_part/path_part2/C which sorts before /path_part/path_part3/C, you can give multiple matches on the command line

  $> jump --search 3 C
 

will return /path_part/path_part3/C

Not matching everything

When Jump searches under the current working directory or in directories under database entries, thousands of matches can be returned. Option --ignore_path disables the scanning of the given paths.

Bash INTEGRATION and --complete

  $> j --complete path_part [path_part] ...

will return a list of matches that an be used to integrate with the cd command. Read jump_bash_integration.sh in the distribution

Matching files

the --file option let you specify a file regex which will be use by Jump to further refine your search. Once all the matching possible matching directories are found, each directory is checked for files matching the regexp.

EXIT CODE

  0 in case of success, which may or may not return any match

  not 0 in case of error

BUGS AND LIMITATIONS

None so far.

Please report bugs on Github or CPAN

AUTHOR

        Nadim ibn hamouda el Khemir
        CPAN ID: NKH
        mailto: nadim@cpan.org

COPYRIGHT AND LICENSE

Copyright Nadim Khemir 2015.

This program is free software; you can redistribute it and/or modify it under the terms of either:

  • the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or

  • the Artistic License version 2.0.

SEE ALSO

  autojump