4 ms·
Where is Msdos utility "ncd"? It was like "cd" but guessed from few character hint where you wanted to go. If the choice was not immediately obvious if offered
by timonoko 6y ago
Where is Msdos utility "ncd"? It was like "cd" but guessed from few character hint where you wanted to go. If the choice was not immediately obvious if offered a menu or a tree. I shortened it to "n". -- There was some linux utility but setting it up was annoyingly tedious, with lots of useless and cryptic options.
- andrewshadura 6y agocd cannot be an external command in Unix-like systems, it has to be a shell built-in.
- boring_twenties 6y agoIt could have been a script for adding to shell startup files.
- oweiler 6y agoBut cd can be invoked from a shell function (which doesn't create a subshell).
- Lio 6y agoI think that's the default behaviour in Zsh or Fish if you press tab.
- timonoko 6y agoProbably immediate subdir. What I am talking about is universal jump-to-anywhere. Like I have subdir "/media/tnoko/sdc1/capture/Roinaa/". "ncd Roi" should be totally sufficient and unique command to go there.
- RMPR 6y agoFor this I use autojump[0], what I really like is the integration with ranger FM[1]. I don't know exactly how ncd works, but with autojump you need to visit the directory at least one time to be able to fuzzy-jump. 0: https://github.com/wting/autojump https://github.com/wting/autojump 1: https://github.com/fdw/ranger-autojump https://github.com/fdw/ranger-autojump
- cmehdy 6y agoNotably for this there's autojump[0], z[1] and fasd[2]. More work than an efficient script for sure, but more fancy options around it all. Autojump works pretty well with zsh (and before that with fish) for me. [0] https://github.com/wting/autojump https://github.com/wting/autojump [1] https://github.com/rupa/z https://github.com/rupa/z [2] https://github.com/clvv/fasd https://github.com/clvv/fasd
- dexen 6y agoDidn't know about "ncd", ended up re-inventing it. The following script, named 'F', takes regexp(3) pattern in $1 and works reasonably well in the 'all text is hypertex' environment of (p9p) Acme. If it finds one match, it opens it via plumb(1). Otherwise lists results; one right-click opens the clicked result again via plumb(1). Yes, the find -type f focuses on files; nonetheless it's easy enough to right-click-select the relevant directory to open it rather than the file. #!/usr/bin/env rc if (~ `{find -type f | 9 grep $1 | wc -l} 1) plumb `{find -type f | 9 grep $1} if not find -type f | 9 grep $1
- timonoko 6y agoQue? What is rc? "rc - implementation of the AT&T Plan 9 shell". Do I have to install that?
- timonoko 6y agoNevermind now that I think about it, this is basically most of ncd: #! /bin/bash d=$(find / -name "$1" 2>/dev/null | head -1) echo Jumping to $d, Control-D to return cd $d bash Actually it is now perfect. If the guess is wrong, you can return and add letters to you search string.
- timonoko 6y agoAch. It was "Norton Change Directory" http://www.softpanorama.org/OFM/norton_change_directory_clones.shtml http://www.softpanorama.org/OFM/norton_change_directory_clon... But I already made my own. It is quite perfect: #! /bin/bash d=$(find / -name "$1" 2>/dev/null | head -1) echo Jumping to $d, Control-D to return sleep 1 cd $d bash
- krick 6y agoUse z[1]. Also use fzf. [1] - https://github.com/skywind3000/z.lua https://github.com/skywind3000/z.lua
- FeepingCreature 6y agoConsider fzf: https://github.com/junegunn/fzf https://github.com/junegunn/fzf I have it bound to ctrl-e for edit: https://gist.github.com/FeepingCreature/5f575b6fcda041a48f58a778ef0e9df3 https://gist.github.com/FeepingCreature/5f575b6fcda041a48f58... It's like adding the vscode file finder to bash :) The additional code is to make bash "act as if you typed in the command manually". So you can arrow-up to find it in the history buffer with the filename expanded.