1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +00:00

Merge pull request #381 from ElArtista/master

Handling of directories with spaces in Windows and portability fixes.
This commit is contained in:
William Ting 2016-06-19 11:22:03 -07:00 committed by GitHub
commit 0bce510c7e
6 changed files with 14 additions and 12 deletions

View File

@ -1,2 +1,2 @@
@echo off
python %~dp0\autojump %*
python "%~dp0\autojump" %*

View File

@ -1,13 +1,15 @@
local AUTOJUMP_DIR = debug.getinfo(1, "S").source:match[[^@?(.*[\/])[^\/]-$]] .. "..\\AutoJump"
local AUTOJUMP_BIN_DIR = AUTOJUMP_DIR .. "\\bin"
local AUTOJUMP_BIN = (AUTOJUMP_BIN_DIR or clink.get_env("LOCALAPPDATA") .. "\\autojump\\bin") .. "\\autojump"
function autojump_add_to_database()
os.execute("python " .. AUTOJUMP_BIN .. " --add " .. clink.get_cwd() .. " 2> " .. clink.get_env("TEMP") .. "\\autojump_error.txt")
os.execute("python " .. "\"" .. AUTOJUMP_BIN .. "\"" .. " --add " .. "\"" .. clink.get_cwd() .. "\"" .. " 2> " .. clink.get_env("TEMP") .. "\\autojump_error.txt")
end
clink.prompt.register_filter(autojump_add_to_database, 99)
function autojump_completion(word)
for line in io.popen("python " .. AUTOJUMP_BIN .. " --complete " .. word):lines() do
for line in io.popen("python " .. "\"" .. AUTOJUMP_BIN .. "\"" .. " --complete " .. word):lines() do
clink.add_match(line)
end
return {}

View File

@ -3,7 +3,7 @@ setlocal EnableDelayedExpansion
echo %*|>nul findstr /rx \-.*
if ERRORLEVEL 1 (
for /f %%i in ('python %~dp0\autojump %*') do set new_path=%%i
for /f %%i in ('python "%~dp0\autojump" %*') do set new_path=%%i
if exist !new_path!\nul (
echo !new_path!
pushd !new_path!
@ -17,5 +17,5 @@ if ERRORLEVEL 1 (
echo try `autojump --help` for more information
)
) else (
python %~dp0\autojump %*
python "%~dp0\autojump" %*
)

View File

@ -2,7 +2,7 @@
echo %*|>nul findstr /rx \-.*
if ERRORLEVEL 1 (
%~dp0\j.bat %cd% %*
"%~dp0\j.bat" "%cd%" %*
) else (
python %~dp0\autojump %*
python "%~dp0\autojump" %*
)

View File

@ -2,7 +2,7 @@
echo %*|>nul findstr /rx \-.*
if ERRORLEVEL 1 (
%~dp0\jc.bat %cd% %*
"%~dp0\jc.bat" "%cd%" %*
) else (
python %~dp0\autojump %*
python "%~dp0\autojump" %*
)

View File

@ -3,7 +3,7 @@ setlocal EnableDelayedExpansion
echo %*|>nul findstr /rx \-.*
if ERRORLEVEL 1 (
for /f %%i in ('python %~dp0\autojump %*') do set new_path=%%i
for /f %%i in ('python "%~dp0\autojump" %*') do set new_path=%%i
if exist !new_path!\nul (
start !new_path!
) else (
@ -11,5 +11,5 @@ if ERRORLEVEL 1 (
echo try `autojump --help` for more information
)
) else (
python %~dp0\autojump %*
python "%~dp0\autojump" %*
)