• W9_777888
    了解作者
  • 7KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-14 02:45
    上传日期
gx gx是受和启发的。 建筑 gx取决于plan9的的unix版本。除此之外: make && sudo make install 港口 port是一个脚本,用于将接口与实现分离。这使您可以为给定的接口注册多个实现,并使其更易于在多用户环境中使用。 #!/bin/sh op="$1" shift 1 case "$op" in web) firefox "$@" & ;; edit) st vim $@ & ;; esac 这会将Web操作路由到firefox,并编辑为在st中运行的vim。 配置文件 gx使用简化了开发过程,因此,除最后一行外的每一行都必须以\作为最后一个字符。 X行定义必须与stdin上的输入匹配的正则表达式,然后以下Y行指定要运行的命令。请注意,X行必须完全匹配输入,否则将不被视为匹配项。另外,如果需要使用反斜杠来转义字符,则必须将其加倍,
gx-master.zip
  • gx-master
  • .gitignore
    447B
  • std_inc
    324B
  • Makefile
    649B
  • port.def
    180B
  • LICENSE
    1KB
  • gx.c
    2.2KB
  • dwmgx
    24B
  • config.mk
    21B
  • README.md
    2.5KB
  • simple_plumb.diff
    3.2KB
  • config.def.h
    593B
内容介绍
# gx gx is a utility inspired by the [plan9 plumber](http://doc.cat-v.org/plan_9/4th_edition/papers/plumb) and [suckless utilities](https://suckless.org). ## Building gx depends on the unix version of plan9's [regex library](https://9fans.github.io/plan9port/unix/). Other than that: ``` make && sudo make install ``` ## port port is a script that dissassociates interfaces from implementations. This allows you to register multiple implementations for a given interface, and makes it easier to use in a multi-user environment. ``` #!/bin/sh op="$1" shift 1 case "$op" in web) firefox "$@" & ;; edit) st vim $@ & ;; esac ``` This routes web actions to firefox, and edits to vim running in st. ## config.h gx uses [X macros](https://en.wikipedia.org/wiki/X_Macro) to simplify the development, so each line but the last must have a `\` as the last character. X lines define regular expressions that must match the input on stdin, then the following Y line specifies the command to run. Note that the X lines must match the input in it's entirety, or it doesn't count as a match. Also, if a backslash is needed to escape a character, it must be doubled so as to escape the c string parsing. The Y line can use `\\n` where `n` is a digit to specify a sub match to be interpolated. `\\0` matches the entire regex (so the entire input), while `\\1` matches from the leftmost parenthese to it's closing pair. Example: ``` #define TABLE \ X("https?://.+") \ Y("port web \\0") \ X("#include \"([a-zA-Z0-9]+\\.h)\"") \ Y("port edit \\1") ``` When presented with a http or https url, it runs the web port to open it, and when presented with an include directive, it will open the edit port on the file. This is meant to be run, among other ways, inside vim or [vis](https://github.com/martanne/vis) to better utilize linux and [dwm](https://dwm.suckless.org) as an ide. ## Features Note that if the last character in the input is a newline, it doesn't have to be matched. There are limits to the number of matches (8) and the length of the input (1023 bytes) and the regex-interpolated command to run (4095 bytes). If you don't like them, you can edit them in the source. ## dwm To aid in incorporating this with dwm, there is a script, `dwmgx` that pipes the primary selection to gx. It can be added to your dwm config.h ## st To incorporate this into st, a patch is provided called [simple_plumb.diff](/simple_plumb.diff). This sends the currently selected text in st is sent to the plumber as a parameter on right click.
评论
    相关推荐