├── README.md └── pcd.bat /README.md: -------------------------------------------------------------------------------- 1 | # pcd 2 | 3 | peco + cd = awesome! 4 | 5 | ## Requirements 6 | 7 | * [peco](https://github.com/peco/peco) 8 | * Windows 9 | 10 | ## Installation 11 | 12 | Copy `pcd.bat` into your favorite directory which is contained in `%PATH%`. 13 | 14 | ## Usage 15 | 16 | ``` 17 | C:\>pcd help 18 | pcd [add PATH | edit] 19 | 20 | ``` 21 | 22 | Add your favorite directory 23 | ``` 24 | C:\>cd C:\Users\mattn 25 | 26 | C:\Users\mattn>pcd add . 27 | 28 | C:\Users\mattn>pcd add %TEMP% 29 | 30 | C:\Users\mattn>pcd 31 | ``` 32 | 33 | ![](http://go-gyazo.appspot.com/6431b8f056c22049.png) 34 | 35 | Just type `temp` and `ENTER`. 36 | 37 | ``` 38 | C:\Users\mattn\AppData\Local\Temp> 39 | ``` 40 | 41 | If you want to edit configuration, type `pcd edit`. 42 | 43 | ## License 44 | 45 | MIT 46 | 47 | ## Author 48 | 49 | Yasuhiro Matsumoto (a.k.a mattn) 50 | -------------------------------------------------------------------------------- /pcd.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set PCD_CONFIG=%USERPROFILE%\.pcd 4 | 5 | if "%1" equ "add" ( 6 | if "%2" neq "" ( 7 | echo %~dpf2>> "%PCD_CONFIG%" 8 | goto end 9 | ) 10 | goto usage 11 | ) 12 | if "%1" equ "edit" ( 13 | goto edit 14 | ) 15 | if "%1" neq "" ( 16 | goto usage 17 | ) 18 | goto query 19 | 20 | :usage 21 | echo %0 [add PATH ^| edit] 22 | goto end 23 | 24 | :edit 25 | if "%EDITOR%" neq "" ( 26 | "%EDITOR%" "%PCD_CONFIG%" 27 | goto end 28 | ) 29 | notepad "%PCD_CONFIG%" 30 | goto end 31 | 32 | :query 33 | rem NOTE: 34 | rem 35 | rem If you have a problem caused by character-set, modify below part like: 36 | rem 'type ^"%USERPROFILE%\.pcd^" ^| iconv -f char -t utf-8 ^| peco --null' 37 | rem 38 | for /f "delims=" %%i in ('type ^"%PCD_CONFIG%^" ^| peco') do ( 39 | cd /D %%i 40 | break 41 | ) 42 | 43 | :end 44 | --------------------------------------------------------------------------------