autojump icon indicating copy to clipboard operation
autojump copied to clipboard

Feature/issue 356 support git bash msysgit

Open azriel91 opened this issue 8 years ago • 14 comments

This should address issue #356. However I haven't tested it on other OSes to ensure no regressions

azriel91 avatar Jul 23 '16 02:07 azriel91

@wting: Any possibility of merging this? It would be great to be able to use autojump on my Windows and Linux machines!

mapitman avatar Mar 20 '18 17:03 mapitman

I just tried to install and use @azriel91's fork and I don't see the same results as were posted in #356. So maybe it is not quite ready to be merged 🤷‍♂️

mapitman avatar Mar 20 '18 17:03 mapitman

weird, it works on my machineTM, I'm using Windows 10 with git bash 2.16.1.windows.4

azriel91 avatar Mar 20 '18 18:03 azriel91

I'm on Windows 10 as well with Git-bash 2.15.1.2. I'll try updating and see what happens.

mapitman avatar Mar 20 '18 18:03 mapitman

Updated to git version 2.16.2.windows.1

Here's what I see when I install:

mpitman@SEADW2460 ~/src/github/azriel91/autojump [master] 
$ ./install.py
Installing autojump to C:\Users\mpitman\AppData\Local\autojump ...
creating directory: C:\Users\mpitman\AppData\Local\autojump\bin
creating directory: C:\Users\mpitman\AppData\Local\autojump\share\man\man1
creating directory: C:\Users\mpitman\AppData\Local\autojump\etc\profile.d
creating directory: C:\Users\mpitman\AppData\Local\autojump\share\autojump
copying file: ./bin/autojump -> C:\Users\mpitman\AppData\Local\autojump\bin
copying file: ./bin/autojump_argparse.py -> C:\Users\mpitman\AppData\Local\autojump\bin
copying file: ./bin/autojump_data.py -> C:\Users\mpitman\AppData\Local\autojump\bin
copying file: ./bin/autojump_match.py -> C:\Users\mpitman\AppData\Local\autojump\bin
copying file: ./bin/autojump_utils.py -> C:\Users\mpitman\AppData\Local\autojump\bin
copying file: ./bin/icon.png -> C:\Users\mpitman\AppData\Local\autojump\share\autojump
copying file: ./docs/autojump.1 -> C:\Users\mpitman\AppData\Local\autojump\share\man\man1
copying file: ./bin/autojump.lua -> C:\Users\mpitman\AppData\Local\clink
copying file: ./bin/autojump.bat -> C:\Users\mpitman\AppData\Local\autojump\bin
copying file: ./bin/j.bat -> C:\Users\mpitman\AppData\Local\autojump\bin
copying file: ./bin/jc.bat -> C:\Users\mpitman\AppData\Local\autojump\bin
copying file: ./bin/jo.bat -> C:\Users\mpitman\AppData\Local\autojump\bin
copying file: ./bin/jco.bat -> C:\Users\mpitman\AppData\Local\autojump\bin

Please manually add C:\Users\mpitman\AppData\Local\autojump\bin to your user path

Please restart terminal(s) before running autojump.

After adding it to my path and restarting, I get this:

$ autojump
Traceback (most recent call last):
  File "C:/Users/mpitman/AppData/Local/autojump/bin/autojump", line 320, in <module>
    sys.exit(main(parse_arguments()))
  File "C:/Users/mpitman/AppData/Local/autojump/bin/autojump", line 290, in main
    ['.'])))
  File "C:\Users\mpitman\AppData\Local\autojump\bin\autojump_utils.py", line 41, in first
    return it.__next__()
  File "C:\Users\mpitman\AppData\Local\autojump\bin\autojump_match.py", line 86, in <lambda>
    flags=regex_flags,
  File "C:\Users\mpitman\AppData\Local\Programs\Python\Python36\lib\re.py", line 182, in search
    return _compile(pattern, flags).search(string)
  File "C:\Users\mpitman\AppData\Local\Programs\Python\Python36\lib\re.py", line 301, in _compile
    p = sre_compile.compile(pattern, flags)
  File "C:\Users\mpitman\AppData\Local\Programs\Python\Python36\lib\sre_compile.py", line 562, in compile
    p = sre_parse.parse(p, flags)
  File "C:\Users\mpitman\AppData\Local\Programs\Python\Python36\lib\sre_parse.py", line 855, in parse
    p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
  File "C:\Users\mpitman\AppData\Local\Programs\Python\Python36\lib\sre_parse.py", line 416, in _parse_sub
    not nested and not items))
  File "C:\Users\mpitman\AppData\Local\Programs\Python\Python36\lib\sre_parse.py", line 523, in _parse
    source.tell() - here)
sre_constants.error: unterminated character set at position 0

At one point earlier I was at least able to run autojump and get a response, but it was not keeping track of my directory changes.

mapitman avatar Mar 20 '18 18:03 mapitman

Hm, my version of python is Python 2.7.11

Also, I remember I had to delete the autojump text database file when I swapped the implementation. ~~I can't seem to find where the file lives right now~~ Found it, in ~/AppData/Roaming/autojump/autojump.txt (or c:\users\<username> for the windows variant of ~)

azriel91 avatar Mar 20 '18 18:03 azriel91

OK, deleting the autojump.txt file stopped the traceback. It was located here: C:\Users\[USER]\AppData\Roaming\autojump\autojump.txt

Now when I try to use it, it doesn't really do anything.

mpitman@SEADW2460 ~
$ cd src/github
mpitman@SEADW2460 ~/src/github
$ cd ~
mpitman@SEADW2460 ~
$ autojump github
.

Also, as I change directories, the autojump.txt file does not get created.

When I run the install, it doesn't copy all the files shown in the output you had. Maybe if I manually copy the files it will start working. I'll mess around with it some more and see what happens. I have some ideas about changes to the install.py file that may help it behave more like it does on *nix.

mapitman avatar Mar 20 '18 20:03 mapitman

I can confirm this PR works in Git Bash while the master branch doesn't. Any chance of getting it merged?

lins05 avatar Jul 27 '18 04:07 lins05

I tried this again today (setting up a new Windows 10 install) and it works for me now too.

Install:

Cloning into 'C:/Users/mark/.local/tmp/autojump'...
remote: Enumerating objects: 8, done.
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 3333 (delta 1), reused 2 (delta 0), pack-reused 3325
Receiving objects: 100% (3333/3333), 814.81 KiB | 11.81 MiB/s, done.
Resolving deltas: 100% (2015/2015), done.
Switched to a new branch 'feature/issue-356-support-git-bash-msysgit'
Branch 'feature/issue-356-support-git-bash-msysgit' set up to track remote branch 'feature/issue-356-support-git-bash-msysgit' from 'origin'.
Installing autojump to C:\Users\mark\AppData\Local\autojump ...
creating directory: C:\Users\mark\AppData\Local\autojump\bin
creating directory: C:\Users\mark\AppData\Local\autojump\share\man\man1
creating directory: C:\Users\mark\AppData\Local\autojump\etc\profile.d
creating directory: C:\Users\mark\AppData\Local\autojump\share\autojump
copying file: ./bin/autojump -> C:\Users\mark\AppData\Local\autojump\bin
copying file: ./bin/autojump_argparse.py -> C:\Users\mark\AppData\Local\autojump\bin
copying file: ./bin/autojump_data.py -> C:\Users\mark\AppData\Local\autojump\bin
copying file: ./bin/autojump_match.py -> C:\Users\mark\AppData\Local\autojump\bin
copying file: ./bin/autojump_utils.py -> C:\Users\mark\AppData\Local\autojump\bin
copying file: ./bin/icon.png -> C:\Users\mark\AppData\Local\autojump\share\autojump
copying file: ./docs/autojump.1 -> C:\Users\mark\AppData\Local\autojump\share\man\man1
creating directory: C:\Users\mark\AppData\Local\autojump\etc\profile.d
creating directory: C:\Users\mark\AppData\Local\autojump\share\autojump
creating directory: C:\Users\mark\AppData\Local\autojump\functions
copying file: ./bin/autojump.sh -> C:\Users\mark\AppData\Local\autojump\etc\profile.d
copying file: ./bin/autojump.bash -> C:\Users\mark\AppData\Local\autojump\share\autojump
copying file: ./bin/autojump.fish -> C:\Users\mark\AppData\Local\autojump\share\autojump
copying file: ./bin/autojump.zsh -> C:\Users\mark\AppData\Local\autojump\share\autojump
copying file: ./bin/_j -> C:\Users\mark\AppData\Local\autojump\functions

Please manually add the following line(s) to ~/.bash.exerc:

        [[ -s /c/Users/mark/AppData/Local/autojump/etc/profile.d/autojump.sh ]] && source /c/Users/mark/AppData/Local/autojump/etc/profile.d/autojump.sh

After adding the lines to my .bashrc:

mark@colossus ~
$ cd src/github
mark@colossus ~/src/github
$ cd -
/c/Users/mark
mark@colossus ~
$ j github
C:/Users/mark/src/github
mark@colossus ~/src/github

It would be great to get it merged!

mapitman avatar Mar 26 '20 15:03 mapitman

I have also tried @azriel91's pull request with git bash, works just fine.

khongi avatar May 21 '21 09:05 khongi

I have also tried @azriel91's pull request with git bash, works just fine.

Not work for me.help.

➜  autojump-master /c/Users/wgfabc/AppData/Local/autojump/bin/autojump
Traceback (most recent call last):
  File "C:\Users\wgfabc\AppData\Local\autojump\bin\autojump", line 320, in <module>
    sys.exit(main(parse_arguments()))
  File "C:\Users\wgfabc\AppData\Local\autojump\bin\autojump", line 287, in main
    print_local(first(chain(
  File "C:\Users\wgfabc\AppData\Local\autojump\bin\autojump_utils.py", line 41, in first
    return it.__next__()
  File "C:\Users\wgfabc\AppData\Local\autojump\bin\autojump_match.py", line 83, in <lambda>
    found = lambda entry: re.search(
  File "C:\Users\wgfabc\.pyenv\pyenv-win\versions\3.10.1\lib\re.py", line 200, in search
    return _compile(pattern, flags).search(string)
  File "C:\Users\wgfabc\.pyenv\pyenv-win\versions\3.10.1\lib\re.py", line 303, in _compile
    p = sre_compile.compile(pattern, flags)
  File "C:\Users\wgfabc\.pyenv\pyenv-win\versions\3.10.1\lib\sre_compile.py", line 764, in compile
    p = sre_parse.parse(p, flags)
  File "C:\Users\wgfabc\.pyenv\pyenv-win\versions\3.10.1\lib\sre_parse.py", line 948, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
  File "C:\Users\wgfabc\.pyenv\pyenv-win\versions\3.10.1\lib\sre_parse.py", line 443, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
  File "C:\Users\wgfabc\.pyenv\pyenv-win\versions\3.10.1\lib\sre_parse.py", line 549, in _parse
    raise source.error("unterminated character set",
re.error: unterminated character set at position 0

wgf4242 avatar Mar 20 '22 00:03 wgf4242

@azriel91 so cool !

Z-HNAN avatar Apr 10 '22 02:04 Z-HNAN