codesofrishi / smartcd Goto Github PK
View Code? Open in Web Editor NEWExpedite your navigation of Linux filesystem.
License: MIT License
Expedite your navigation of Linux filesystem.
License: MIT License
In generate_recent_dir_log (), please change:
printf '%s\n' "${PWD}" > ${tmp_log}
to
printf '%s\n' "${PWD}" >> ${tmp_log}
Necessary to work with bash's noclobber
Could you consider adding this to the "brew" package manager? I don't know what work that would entail for you, but it could be appreciated if possible.
I use Brew on the Mac and on a couple of Linux servers.
Thanks
Without the plugin, if I type cd
and press TAB I get a list of only directories.
With the plugin, both files and directories are listed.
.zshrc
config required:
autoload -Uz compinit && compinit
Are you using the latest version?
4.0.0
The issue is with the following feature(s):
Issue observed in the following shell(s):
Describe the bug
I get unwanted and unneeded extra variables after sourcing this.
Eg _feats
. (which may be better named singular anyway).
To Reproduce
Steps to reproduce the behaviour:
( set -o posix ; set ) > before
( set -o posix ; set ) > after
diff before after
Expected behaviour
Minimum set of required variables are added, and only exported if needed
Are you using the latest version?
...
The issue is with the following feature(s):
Issue observed in the following shell(s):
Describe the bug
find
command throws 'Permission denied' error message(s) whenever it searches and finds any directory with insufficient permissions.
To Reproduce
NA
Expected behaviour
Remove/skip/exclude 'Permission denied' error messages coming from find
command.
Screenshots
NA
Additional context
NA
Often in a deep directory, I want to be able to cd and search to anywhere below $HOME
.
I'd like to be able to do:
alias hcd='f() { SMARTCD_ROOT=$HOME; cd "$@"; unset SMARTCD_HOME; };f'
Would you consider a SMARTCD_ROOT
variable from which the listing is generated? I'd suggest a subshell for the generation to allow for user ^C
or permission denied on the target directory.
Issue observed in the following shell(s):
Describe the bug
Upon shell startup:
whereis: illegal option -- b
usage: whereis program [...]
Can't use SmartCd: fzf not found !
I suggest you do:
is_cmd () {
command -v "$1" >&/dev/null
}
and then:
if is_cmd fdfind; then
Expected behaviour
No error
zinit ice wait # For faster prompt loading
zinit snippet 'https://raw.githubusercontent.com/CodesOfRishi/smartcd/main/smartcd.sh'
For copy paste:
### [Zinit](https://github.com/zdharma-continuum/zinit)
Please run shellcheck against this -- there are many warnings and an error:
validate_parameters $@ ${piped_value}
Should be: "$@"
.
Are you using the latest version?
v4.0.0
The issue is with the following feature(s):
Issue observed in the following shell(s):
Describe the bug
SmartCd is using hash
command to validate whether an executable exist or not.
hash
command hashes the searched path for faster lookup next time when it's used again. Hashing is really not necessary here.
Additional context
Possible alternatives:
whence
command in zsh
. (run man zshbuiltins
& search whence
)type
command in bash
. (run help type
)Possible solution:
path_search() {
local _executable=$1
if ps -p $$ | grep -i --quiet 'zsh$'; then
whence -p "${_executable}" &> /dev/null
elif ps -p $$ | grep -i --quiet 'bash$'; then
type -P "${_executable}" &> /dev/null
else
printf '%s\n' "Shell doesn't seems to be either Base or Zsh" 1>&2
return 1
fi
}
% mkdir -m000 noperms
Standard behaviour:
% builtin cd noperms
cd: permission denied: noperms
%
With SmartCd, I get a directory search.
% cd noperms
No directory found or selected!
If the specified diretory exists, can it fail just like the builtin cd
?
Do you have plans to package it for the AUR?
I can offer 2 options:
Let me know if you want either or none.
Cheers
There is already a project using the name smartcd to patch the shell cd command. It exists at https://github.com/cxreg/smartcd.
I don't really want to start a fight over naming or anything like that. I suggest that both projects provide a short statement saying something like "if you're looking for OTHER SMARTCD that does THE OTHER THING you can find it at THE OTHER SMARTCD PROJECT URL".
I have a commit bit on the other smartcd, and can update the readme accordingly.
whereis: illegal option -- b
usage: whereis program [...]
whereis: illegal option -- b
usage: whereis program [...]
Can't use SmartCd: fzf not found !
whereis: illegal option -- b
usage: whereis program [...]
Can't use SmartCd: fd not found !
Is your feature request related to a problem? Please describe.
Remove unnecessary calls to awk
Describe the solution you'd like
% col_n () {
[[ -n $ZSH_VERSION ]] && setopt local_options sh_word_split
local col=$1
local IFS=$' \t'
while read -r line; do
set $line # Spilt by IFS and set into $1, $2, ...
printf "%s\n" "${@:$col:1}"
done;
}
% echo "one two three" | col_n 2
two
Are you using the latest version?
Yes. v3.3.0
The issue is with the following feature(s):
Issue observed in the following shell(s):
Describe the bug
In bash, cd
with multiple string arguments is throwing too many arguments
error.
To Reproduce
cd ~
(traverse to home directory)cd \!git fzf
Expected behaviour
Should bring fzf
list of sub-directories with provided string arguments as query for the fzf
.
Screenshots
NA
Additional context
High probability that bug occurred from 9698c36.
I find it much easier to type ''
than --
.
Also, --
has a valid meaning eg, cd -P -e -- -P
.
In this example, P
and e
are arguments to cd
(please pass these through!) whereas the --
says that what follows, ie -P
is not an argument to cd
itself, but rather the directory to change to. (Useful if you have directory names starting with a -
)
Piping an empty string or an empty file to cd
having --clean
option, cleans the log file without the user's consent.
For example,
echo | cd --clean
# OR
touch file1 # creating an empty file
cat file1 | cd --clean
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.