sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

index.md (1300B)


      1 XDG-Open Selected
      2 =================
      3 This patch adds a function that can be bound to a key or button which attempts
      4 to open the selected text using `xdg-open`.
      5 
      6 Description
      7 -----------
      8 This functionality is most useful for opening URL's in a web-browser, but also
      9 allows you to open any type of file in the default application for its mimetype
     10 by having its path selected.
     11 
     12 By default, `CTRL + Mouse2` will open the selected text.
     13 
     14 OSC 7
     15 -----
     16 This patch also adds support for the `OSC 7` escape sequence, which allows for
     17 automatically changing the current working directory of st from a shell.
     18 
     19 This is useful because `xdg-open` is spawned as a child process of st, and so
     20 by default you won't be able to open a file using its relative path (unless
     21 that relative path happens to correspond with the CWD of st).
     22 
     23 To allow opening files using the relative path of the shell instead, you just
     24 need to add the following to your shell's rc:
     25 
     26 * zshrc: `function precmd () { builtin print -Pn "\e]7;file://${PWD}\a" }`
     27 * bashrc: `export PROMPT_COMMAND='echo -ne "\e]7;file://${PWD}\a"'`
     28 
     29 Setting this up will ensure that st's CWD is always synced with the CWD of your
     30 shell.
     31 
     32 Download
     33 --------
     34 * [st-open-selected-0.9.2.diff](st-open-selected-0.9.2.diff)
     35 
     36 Authors
     37 -------
     38 * Tim Keller - <tjk@tjkeller.xyz>