Giter Club home page Giter Club logo

iterm2-dwim's People

Contributors

dandavison avatar danielkrausz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

iterm2-dwim's Issues

Try relative path relative to root of git repository

Currently a parse rule exists that tries to interpret a relative path as relative to the current directory CWD.

However, it's fairly common to be in an internal directory of the git repo, and yet be looking at a path in some output that is relative to the root of the git repo. In that situation, no parse rule will cerrently match.

We could add a parse rule that works as follows: ask git whether CWD is in a git repo and if so what the root is (git rev-parse --show-toplevel), and try the path relative to that root.

Support line numbers when path is relative

With the current configuration instructions in the README, absolute paths are handled by iTerm2's "Semantic History"
image

whereas relative paths are handled by the "Paths" regex in "Smart Selection"

image

image

However, the default "Paths" regex that comes with iTerm2 does not capture the trailing text, which is where the line number is to be found, if present. E.g. this python traceback will open on line 1, not line 4 as it should:

$ /tmp mkdir z
/tmp cat > z/z.py
a = 1
b = 2
c = 0
a/c
/tmp python z/z.py
Traceback (most recent call last):
  File "z/z.py", line 4, in <module>
    a/c
ZeroDivisionError: integer division or modulo by zero

I think the solution will involve

  • Design a suitable regex to use as a "Smart Selection" rule in iTerm2 that passes the appropriate trailing text to iterm2-dwim
  • Document how to configure iterm2-dwim in the README.

The default Paths regex that comes with iTerm2 is

\~?/?([[:letter:][:number:]._-]+/+)+[[:letter:][:number:]._-]+/?

So far I've experimented with one variation on this:

Regex:     (\~?/?([[:letter:][:number:]._-]+/+)+[[:letter:][:number:]._-]+/?)([^ ]*)
Parameter: /usr/local/bin/iterm2-dwim \1 \3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.