All Projects → peterwvj → eshell-up

peterwvj / eshell-up

Licence: GPL-3.0 license
Quickly go to a specific parent directory in eshell

Programming Languages

emacs lisp
2029 projects

Projects that are alternatives of or similar to eshell-up

Emacs Datetime
Stars: ✭ 8 (-71.43%)
Mutual labels:  melpa
Auto Complete
Emacs auto-complete package
Stars: ✭ 1,622 (+5692.86%)
Mutual labels:  melpa
Evil Multiedit
Multiple cursors for evil-mode, based on iedit
Stars: ✭ 200 (+614.29%)
Mutual labels:  melpa
Exwm Edit
Edit mode for EXWM
Stars: ✭ 92 (+228.57%)
Mutual labels:  melpa
Graphql Mode
An Emacs mode for GraphQL
Stars: ✭ 120 (+328.57%)
Mutual labels:  melpa
Linum Relative
display relative line number in the left margin in emacs
Stars: ✭ 152 (+442.86%)
Mutual labels:  melpa
Meghanada Emacs
A Better Java Development Environment for Emacs
Stars: ✭ 582 (+1978.57%)
Mutual labels:  melpa
elcord
Discord Rich Presence / Gamebridge support for Emacs!
Stars: ✭ 149 (+432.14%)
Mutual labels:  melpa
Selectric Mode
⌨ Make your Emacs sound like a proper typewriter.
Stars: ✭ 121 (+332.14%)
Mutual labels:  melpa
Modern Cpp Font Lock
C++ font-lock for Emacs
Stars: ✭ 159 (+467.86%)
Mutual labels:  melpa
Lsp Dart
lsp-mode ❤️ dart
Stars: ✭ 94 (+235.71%)
Mutual labels:  melpa
Web Mode
web template editing mode for emacs
Stars: ✭ 1,470 (+5150%)
Mutual labels:  melpa
Explain Pause Mode
top, but for Emacs.
Stars: ✭ 158 (+464.29%)
Mutual labels:  melpa
Dumb Jump
an Emacs "jump to definition" package for 50+ languages
Stars: ✭ 1,256 (+4385.71%)
Mutual labels:  melpa
Bm
bm.el -- Visual Bookmarks for GNU Emacs
Stars: ✭ 204 (+628.57%)
Mutual labels:  melpa
Cmake Ide
Use Emacs as a C/C++ IDE
Stars: ✭ 661 (+2260.71%)
Mutual labels:  melpa
Emacs Solaire Mode
If only certain buffers could be so grossly incandescent.
Stars: ✭ 129 (+360.71%)
Mutual labels:  melpa
shell-switcher
An emacs minor mode to easily switch between shell buffers (like with alt+tab)
Stars: ✭ 40 (+42.86%)
Mutual labels:  eshell
Emacs Easy Hugo
Emacs major mode for managing hugo
Stars: ✭ 235 (+739.29%)
Mutual labels:  melpa
Lsp Haskell
lsp-mode ❤️ haskell
Stars: ✭ 158 (+464.29%)
Mutual labels:  melpa

eshell-up.el

https://melpa.org/packages/eshell-up-badge.svg https://stable.melpa.org/packages/eshell-up-badge.svg https://travis-ci.org/peterwvj/eshell-up.svg?branch=master http://img.shields.io/:license-gpl3-blue.svg?style=flat-square

Emacs package for quickly navigating to a specific parent directory in eshell without having to repeatedly typing cd ...

Usage

Navigating to a specific parent directory is achieved using the eshell-up function, which can be bound to an eshell alias such as up.

Examples

To demonstrate how to use eshell-up let’s assume that the current working directory of eshell is:

/home/user/first/second/third/fourth/fifth $

Now, in order to quicky go to (say) the directory named first one simply executes:

/home/user/first/second/third/fourth/fifth $ up fi
/home/user/first $

This command searches the current path from right to left (while skipping the current directory, fifth) for a directory that matches the user’s input (fi in this case). If a match is found then eshell changes to that directory, otherwise it does nothing. If, on the other hand, no argument is passed to eshell-up, this command simply changes to the nearest parent directory (like cd .. does).

It is also possible to compute the matching parent directory without changing to it. This is achieved using the eshell-up-peek function, which can be bound to an alias such as pk. When this function is used in combination with subshells the matching parent directory can be passed as an argument to other functions. Returning to the previous example one can (for example) list the contents of first by executing:

/home/user/first/second/third/fourth/fifth $ ls {pk fi}
<directory contents>
...

Installation

eshell-up is available via MELPA. To add it to Emacs execute the following:

package-install RET eshell-up RET

Now, put the following in your .emacs file:

(require 'eshell-up)

It is recommended to invoke eshell-up and eshell-up-peek using aliases as done in the examples above. To do that, add the following to your .eshell.aliases file:

alias up eshell-up $1
alias pk eshell-up-peek $1

Configuration (optional)

To make eshell-up searches case sensitive:

(setq eshell-up-ignore-case nil)

To print the matching parent directory before changing to it:

(setq eshell-up-print-parent-dir t)

Testing

The test are written using ERT, and can be executed as follows:

load-file eshell-up-tests.el
ert t

Alternatively, the tests can be run in batch mode:

emacs -Q --batch -L . -l ert -l eshell-up-tests.el -f ert-run-tests-batch-and-exit

Credits

This package is inspired by bd, which uses bash to implement similar functionality.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].