my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

260 lines
5.4 KiB

3 years ago
  1. # wd
  2. [![Build Status](https://travis-ci.org/mfaerevaag/wd.png?branch=master)](https://travis-ci.org/mfaerevaag/wd)
  3. `wd` (*warp directory*) lets you jump to custom directories in zsh, without using `cd`.
  4. Why?
  5. Because `cd` seems inefficient when the folder is frequently visited or has a long path.
  6. ![tty.gif](https://raw.githubusercontent.com/mfaerevaag/wd/master/tty.gif)
  7. ## Setup
  8. ### [oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh)
  9. `wd` comes bundled with oh-my-zsh!
  10. Just add the plugin in your `.zshrc` file:
  11. ```zsh
  12. plugins=(... wd)
  13. ```
  14. ### [Antigen](https://github.com/zsh-users/antigen)
  15. In your `.zshrc`:
  16. ```zsh
  17. antigen bundle mfaerevaag/wd
  18. ```
  19. ### [Antibody](https://github.com/getantibody/antibody)
  20. In your `.zshrc`:
  21. ```zsh
  22. antibody bundle mfaerevaag/wd
  23. ```
  24. ### Arch ([AUR](https://aur.archlinux.org/packages/zsh-plugin-wd-git/))
  25. 1. Install from the AUR
  26. ```zsh
  27. yay -S zsh-plugin-wd-git
  28. # or use any other AUR helper
  29. ```
  30. 2. Then add to your `.zshrc`:
  31. ```zsh
  32. wd() {
  33. . /usr/share/wd/wd.sh
  34. }
  35. ```
  36. ### [zplug](https://github.com/zplug/zplug)
  37. ```zsh
  38. zplug "mfaerevaag/wd", as:command, use:"wd.sh", hook-load:"wd() { . $ZPLUG_REPOS/mfaerevaag/wd/wd.sh }"
  39. ```
  40. ### Automatic
  41. _Note: automatic install does not provide the manpage. It is also poor security practice to run remote code without first reviewing it, so you ought to look [here](https://github.com/mfaerevaag/wd/blob/master/install.sh)_
  42. Run either command in your terminal:
  43. ```zsh
  44. curl -L https://github.com/mfaerevaag/wd/raw/master/install.sh | sh
  45. ```
  46. or
  47. ```zsh
  48. wget --no-check-certificate https://github.com/mfaerevaag/wd/raw/master/install.sh -O - | sh
  49. ```
  50. ### Manual
  51. 1. Clone this repository on your local machine in a sensible location (if you know what you're doing of course all of this is up to you):
  52. ```zsh
  53. git clone [email protected]:mfaerevaag/wd.git ~/.local/wd --depth 1
  54. ```
  55. 2. Add `wd` function to `.zshrc` (or `.profile` etc.):
  56. ```zsh
  57. wd() {
  58. . ~/.local/wd/wd.sh
  59. }
  60. ```
  61. 3. Install manpage (optional):
  62. ```zsh
  63. sudo cp ~/.local/wd/wd.1 /usr/share/man/man1/wd.1
  64. sudo chmod 644 /usr/share/man/man1/wd.1
  65. ```
  66. **Note:** when pulling and updating `wd`, you'll need to repeat step 3 should the manpage change
  67. ## Completion
  68. If you're NOT using [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) and you want to utilize the zsh-completion feature, you will also need to add the path to your `wd` installation (`~/bin/wd` if you used the automatic installer) to your `fpath`.
  69. E.g. in your `~/.zshrc`:
  70. ```zsh
  71. fpath=(~/path/to/wd $fpath)
  72. ```
  73. Also, you may have to force a rebuild of `zcompdump` by running:
  74. ```zsh
  75. rm -f ~/.zcompdump; compinit
  76. ```
  77. ## Usage
  78. * Add warp point to current working directory:
  79. ```zsh
  80. wd add foo
  81. ```
  82. If a warp point with the same name exists, use `wd add foo --force` to overwrite it.
  83. **Note:** a warp point cannot contain colons, or consist of only spaces and dots.
  84. The first will conflict in how `wd` stores the warp points, and the second will conflict with other features, as below.
  85. You can omit point name to automatically use the current directory's name instead.
  86. * From any directory, warp to `foo` with:
  87. ```zsh
  88. wd foo
  89. ```
  90. * You can also warp to a directory within `foo`, with autocompletion:
  91. ```zsh
  92. wd foo some/inner/path
  93. ```
  94. * You can warp back to previous directory and higher, with this dot syntax:
  95. ```zsh
  96. wd ..
  97. wd ...
  98. ```
  99. This is a wrapper for the zsh's `dirs` function.
  100. _You might need to add `setopt AUTO_PUSHD` to your `.zshrc` if you are not using [oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh)._
  101. * Remove warp point:
  102. ```zsh
  103. wd rm foo
  104. ```
  105. You can omit point name to use the current directory's name instead.
  106. * List all warp points (stored in `~/.warprc` by default):
  107. ```zsh
  108. wd list
  109. ```
  110. * List files in given warp point:
  111. ```zsh
  112. wd ls foo
  113. ```
  114. * Show path of given warp point:
  115. ```zsh
  116. wd path foo
  117. ```
  118. * List warp points to current directory, or optionally, path to given warp point:
  119. ```zsh
  120. wd show
  121. ```
  122. * Remove warp points to non-existent directories.
  123. ```zsh
  124. wd clean
  125. ```
  126. Use `wd clean --force` to not be prompted with confirmation.
  127. * Print usage info:
  128. ```zsh
  129. wd help
  130. ```
  131. The usage will be printed also if you call `wd` with no command
  132. * Print the running version of `wd`:
  133. ```zsh
  134. wd --version
  135. ```
  136. * Specifically set the config file (default being `~/.warprc`), which is useful for testing:
  137. ```zsh
  138. wd --config ./file <command>
  139. ```
  140. * Force `exit` with return code after running. This is not default, as it will *exit your terminal*, though required for testing/debugging.
  141. ```zsh
  142. wd --debug <command>
  143. ```
  144. * Silence all output:
  145. ```zsh
  146. wd --quiet <command>
  147. ```
  148. ## Configuration
  149. You can configure `wd` with the following environment variables:
  150. ### `WD_CONFIG`
  151. Defines the path where warp points get stored. Defaults to `$HOME/.warprc`.
  152. ## Testing
  153. `wd` comes with a small test suite, run with [shunit2](https://github.com/kward/shunit2). This can be used to confirm that things are working as they should on your setup, or to demonstrate an issue.
  154. To run, simply `cd` into the `test` directory and run the `tests.sh`.
  155. ```zsh
  156. cd ./test
  157. ./tests.sh
  158. ```
  159. ## Maintainers
  160. Following @mfaerevaag stepping away from active maintainership of this repository, the following users now are also maintainers of the repo:
  161. * @alpha-tango-kilo
  162. * @MattLewin
  163. Anyone else contributing is greatly appreciated and will be mentioned in the release notes!
  164. ---
  165. Credit to [altschuler](https://github.com/altschuler) for an awesome idea.
  166. Hope you enjoy!