reddit / emacs

Emacs equivalent of: v, "z for vim"

LowCom · 2022-06-20 06:44
v, z for vim is a shell program(or terminal program) that finds any of the recently opened text files and opens them with vim. For eg, if you type "v table" in shell, it will open the file tableData in vim if you have edited such a file recetnly in vim. Thus you can quickly type a few first letters of a file name with v and you can open that in vim quickly. What is the emacs equivalent? Counsel-fzf seems to do that from M-x, but what is the eshell equivalent? or a Shell equivalent? This is the package I am talking about. https://github.com/rupa/v
hajovonta · 2022-06-20 07:12
If counsel-fzf does what you want, what's the problem? Just type counsel-fzf in eshell and that's it. You can create an alias or shortcut for that if you want.
publicvoit · 2022-06-20 07:20
For opening directories in dired, I'm using [my-dired-recent-dirs()](https://github.com/novoid/dot-emacs/blob/master/config.org#dired-recent--c-z). For opening files, I'm using [recentf](https://github.com/novoid/dot-emacs/blob/master/config.org#recent-files).
SlowValue · 2022-06-20 08:21
> but what is the eshell equivalent? Whats the point in leaving Emacs and drop to shell? (rhetorical question) In case no one recommends something, that's a hint that, until now, no one found that feature important enough to develop/publish such a solution. You could write an shell alias which runs some lisp code (`--eval`), which utilizes `recentf`.
bugamn · 2022-06-20 08:50
This isn't exactly "z for emacs", but when I want to access files that I've edited recently in Emacs I use [recentf](https://www.emacswiki.org/emacs/RecentFiles). You could probably get a similar behavior to v inside emacs by combining it with Ido or Helm or something like that. Also, if counsel-fzf does what you want from M-x, you can just call it directly from eshell, or you can also bind a key to it if you don't want to use M-x. If you want to use it from the shell, maybe you could create a shell script that opens emacs and calls counsel-fzf.
00-11 · 2022-06-20 16:07
Dunno if there's an exact replacement. Here's what I think Emacs offers that sounds like it would provide similar functionality: Turn on `recentf-mode`. Then use its commands to access recently accessed files by matching their file names. ---- There are 3rd-party libraries that add to what `recentf.el` offers, giving you more control over selecting recent files. [Icicles](https://www.emacswiki.org/emacs/Icicles) is one -- see command [`icicle-recent-file`](https://www.emacswiki.org/emacs/Icicles_-_File-Name_Input#VisitRecentFiles).
[deleted] · 2022-06-20 16:14
[deleted]
00-11 · 2022-06-20 16:16
With [Dired+](https://www.emacswiki.org/emacs/DiredPlus) ([code](https://www.emacswiki.org/emacs/download/dired%2b.el)) you can visit your recent files or directories in Dired mode, using `C-x D R` or `C-x D r`, respectively. > `diredp-dired-recent-files` is an interactive compiled Lisp function in [`dired+.el`](https://www.emacswiki.org/emacs/download/dired%2b.el). > > It is bound to `C-x D R`. > > `(diredp-dired-recent-files BUFFER &optional ARG FILES)` > > Open Dired in `BUFFER`, showing recently visited files and directories. > > You are prompted for `BUFFER` (default: `Recently Visited Files`). > > With a **numeric** prefix arg you can enter names of recent files to **include** or **exclude**. > > No prefix arg or a plain prefix arg (`C-u`, `C-u C-u`, etc.) means list **all** of the recently used files. > > With a prefix arg: > > * If 0, `-`, or plain (`C-u`) then you are prompted for the `ls` switches to use. > * If not plain (`C-u`) then: > * If >= 0 then the files to **include** are read, one by one. > * If < 0 then the files to **exclude** are read, one by one. > > When entering files to include or exclude, use `C-g` to end. > > The file listing is sorted by option `diredp-default-sort-arbitrary-function`, if non-nil. If nil (the default) then the listing is in reverse chronological order of opening or writing files you access.
redguardtoo · 2022-06-21 13:03
I use both emacs `recentf` and z in shell. Emacs knows the z's history data. See https://github.com/redguardtoo/shellcop/blob/4e71f5b9199a0ad10017104a6b2bf5ef5f207dfc/shellcop.el#L400
Bediavad · 2022-06-22 07:37
Look into these The tool behind z is called fasd https://github.com/emacsmirror/fasd https://develop.spacemacs.org/layers/+tools/fasd/README.html https://melpa.org/#/fasd