-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9c896a9
commit 09f9025
Showing
7 changed files
with
165 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,100 @@ | ||
# jump | ||
Jump for Windows | ||
# Jump for Windows | ||
Easily jump around the file system by manually adding marks. | ||
|
||
It's like the [Oh My Zsh jump plugin](https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/jump/jump.plugin.zsh), but for Windows. | ||
|
||
## Installation | ||
Copy all the .bat files in any directory listed in your [`%PATH%`](https://en.wikipedia.org/wiki/PATH_(variable)#DOS.2C_OS.2F2.2C_and_Windows). | ||
|
||
## Usage | ||
|
||
### Mark the current path for recurrent use | ||
``` | ||
mark foo | ||
``` | ||
Example : | ||
``` | ||
C:\Program Files>mark prog | ||
C:\Program Files>_ | ||
``` | ||
|
||
### Jump to a marked path | ||
``` | ||
jump foo | ||
``` | ||
Example : | ||
``` | ||
C:\Program Files>cd .. | ||
C:\>jump prog | ||
C:\Program Files>_ | ||
``` | ||
|
||
### List all created marks | ||
``` | ||
marks | ||
``` | ||
Example : | ||
``` | ||
C:\Program Files>marks | ||
prog -> C:\Program Files | ||
C:\Program Files>_ | ||
``` | ||
|
||
### Remove a mark | ||
``` | ||
unmark foo | ||
``` | ||
Example : | ||
``` | ||
C:\Program Files>unmark prog | ||
C:\Program Files>_ | ||
``` | ||
|
||
### Keep a path for later user | ||
``` | ||
keep | ||
``` | ||
Example : | ||
``` | ||
C:\Users\Username>keep | ||
``` | ||
|
||
### Jump back to the keeped path | ||
``` | ||
back | ||
``` | ||
Example : | ||
``` | ||
C:\Users\Username>cd \ | ||
C:\>back | ||
C:\Users\Username>_ | ||
``` | ||
|
||
## Notes | ||
If you `mark` a path without giving a name, the mark name with be the folder name : | ||
``` | ||
C:\bar>mark | ||
C:\bar>cd .. | ||
C:\>jump bar | ||
C:\bar>_ | ||
``` | ||
When a path is no more available, `marks` will tell you : | ||
``` | ||
C:\bar>mark foo | ||
C:\bar>cd .. | ||
C:\>rmdir C:\bar | ||
C:\>marks | ||
bar -> ? | ||
C:\>_ | ||
``` | ||
`mark` will ask for a confirmation if you're trying to override any existing mark name : | ||
``` | ||
C:\>marks | ||
home -> C:\Users\Username | ||
C:\>mark home | ||
Mark C:\ as home? (y/n) _ | ||
``` | ||
Marks are stored in the directory `%MARKPATH%`, which defaults to `%HOME%\.marks`. If `%HOME%` is not [set](http://www.computerhope.com/issues/ch000549.htm), it defaults to [`%USERPROFILE%\.marks`](https://en.wikipedia.org/wiki/Home_directory#Default_home_directory_per_operating_system). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@jump _back |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@echo off | ||
if .%1==. exit /b 1 | ||
if not defined HOME set HOME=%USERPROFILE% | ||
if not defined MARKPATH set MARKPATH=%HOME%\.marks | ||
if not exist "%MARKPATH%\%~1" echo No such mark: %~1 | ||
if not exist "%MARKPATH%\%~1" exit /b 1 | ||
for /f "delims=" %%a in ('type "%MARKPATH%\%~1"') do call :cd "%~1" "%%~a" | ||
exit /b %errorlevel% | ||
:cd | ||
if not exist "%~2" echo %~1 -^> ^? | ||
if not exist "%~2" exit /b 1 | ||
cd /D "%~2" | ||
exit /b 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@mark _back |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@echo off | ||
if not defined HOME set HOME=%USERPROFILE% | ||
if not defined MARKPATH set MARKPATH=%HOME%\.marks | ||
if .%1==. call :mark_with_folder_name "%cd%" | ||
if .%1==.. call :mark_with_folder_name "%cd%" | ||
if not .%1==. if not .%1==.. call :mark "%~1" "%cd%" | ||
exit /b | ||
:mark | ||
if not exist "%MARKPATH%" mkdir "%MARKPATH%">nul 2>&1 | ||
set _answer=n | ||
if exist "%MARKPATH%\%~1" call :ask "%~1" "%~2" | ||
if not defined _answer exit /b | ||
set _answer= | ||
>"%MARKPATH%\%~1" echo %~2 | ||
exit /b | ||
:mark_with_folder_name | ||
if .%~n1==. call :mark_with_drive_name "%~d1" "%~1" | ||
if not .%~n1==. call :mark "%~n1" "%~1" | ||
exit /b | ||
:mark_with_drive_name | ||
set _drive_name=%~1 | ||
set _drive_name=%_drive_name:~0,-1% | ||
call :mark "%_drive_name%" "%~2" | ||
set _drive_name= | ||
exit /b | ||
:ask | ||
set /p _answer="Mark %~2 as %~1? (y/n) " | ||
if /i not .%_answer%==.y set _answer= | ||
exit /b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@echo off | ||
if not defined HOME set HOME=%USERPROFILE% | ||
if not defined MARKPATH set MARKPATH=%HOME%\.marks | ||
for /f "delims=" %%a in ('dir /A-D /B "%MARKPATH%" 2^>nul') do call :marks "%%a" | ||
exit /b | ||
:marks | ||
for /f "delims=" %%a in ('type "%MARKPATH%\%~1"') do call :echo "%~1" "%%~a" | ||
exit /b | ||
:echo | ||
if "%~1"=="_back" exit /b | ||
if not exist "%~2" echo %~1 -^> ? | ||
if exist "%~2" echo %~1 -^> %~2 | ||
exit /b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@echo off | ||
if .%1==. exit /b 1 | ||
if not defined HOME set HOME=%USERPROFILE% | ||
if not defined MARKPATH set MARKPATH=%HOME%\.marks | ||
if not exist "%MARKPATH%\%~1" echo No such mark: %~1 | ||
if not exist "%MARKPATH%\%~1" exit /b 1 | ||
del /F "%MARKPATH%\%~1">nul 2>&1 | ||
exit /b 0 |