https://github.com/knu/zsh-shell-word-at-point
zle function to get a shell word at point
https://github.com/knu/zsh-shell-word-at-point
Last synced: about 1 year ago
JSON representation
zle function to get a shell word at point
- Host: GitHub
- URL: https://github.com/knu/zsh-shell-word-at-point
- Owner: knu
- License: bsd-2-clause
- Created: 2015-07-08T04:46:26.000Z (almost 11 years ago)
- Default Branch: main
- Last Pushed: 2024-09-11T09:26:35.000Z (almost 2 years ago)
- Last Synced: 2025-03-25T14:51:17.022Z (about 1 year ago)
- Language: Shell
- Size: 9.77 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
shell-word-at-point for zsh
===========================
Synopsis
--------
* shell-word-at-point - zle function to get a shell word at point
Description
-----------
Unless I am missing something, zsh does not provide the "ffap"
(find-file-at-point) functionality out of the box. This library
provides the following functions to fill the needs.
- `shell-word-at-point` sets the global variable `shell_word` to the
raw shell word at point and `shell_word_position` to the zero-based
index of where it starts.
- `copy-whole-shell-word` copies the shell word at point as kill.
- `kill-whole-shell-word` kills the shell word at point.
- `edit-file-at-point` invokes `EDITOR` (default: `vi`) passing a file
name at point.
- `view-file-at-point` invokes `PAGER` (default: `more`) passing a
file name at point.
- `run-shell-word-at-point` opens a new command line with only the
current shell word set, pushing the whole command line with
`push-line`.
After closing `EDITOR` or `PAGER`, you will be back on the command
line exactly with the previous status.
How to set up
-------------
Put the file `shell-word-at-point` somewhere in your `$fpath` and add
these lines to your `.zshrc`:
autoload -Uz shell-word-at-point
shell-word-at-point
Here's example bindings for Emacs users:
bindkey '^[^W' copy-whole-shell-word
bindkey '^[^K' kill-whole-shell-word
bindkey '^X^F' edit-file-at-point
bindkey '^X^R' view-file-at-point
bindkey '^[!' run-shell-word-at-point
License
-------
Copyright (c) 2015-2024 Akinori MUSHA
Licensed under the 2-clause BSD license.
See `LICENSE` for details.