skywind3000 / z.lua

:zap: A new cd command that helps you navigate faster by learning your habits.
MIT License
3k stars 141 forks source link

is it possible to support tcsh #110

Closed zhuzhzh closed 4 years ago

zhuzhzh commented 4 years ago

I know cshell is not used widely. unfornately, hw engineer has to use it, because it's recommended by all eda tools. I want to check if it's possable to support cshell with a little effort. if it needs lots of effort, just ignore this question

skywind3000 commented 4 years ago

If I remember correctly, cshell doesn't get a $PROMPT_COMMAND or can't evaluate script in the $PS1, z.lua or autojump require to be executed everytime you press enter (display the prompt).

skywind3000 commented 4 years ago

If you can figure out a way for it, cshell is possible to run z.lua.

zhuzhzh commented 4 years ago

check the below website: https://tldp.org/HOWTO/Xterm-Title-4.html

tcsh has some functions and expansions similar to those of zsh:

precmd ()   a function which is executed just before each prompt
cwdcmd ()   a function which is executed whenever the directory is changed
%n          expands to username
%m          expands to hostname
%~          expands to directory, replacing $HOME with '~'
%#          expands to '>' for normal users, '#' for root users
%{...%}     includes a string as a literal escape sequence
skywind3000 commented 4 years ago

fantastic ! can you create a PR for this ?

porting z.lua to csh requires a _zlua() function (which can be found here ). and a shell hook.

I am not skilled in csh scripting.

It can be implemented in a separated csh script file which will setup the _zlua() function and the hook by invoking z.lua

zhuzhzh commented 4 years ago

I tried to write the wrapper for tcsh. but tcsh doesn't have funciton supporting. ans alias has many limitation (like doesn't support newline). after some effort, it still doens't work as expected. so I decided to give up. Thanks all the time! I actually know how to make it work.

skywind3000 commented 4 years ago

There is a tool, bass, can allow fish shell users call bash script. It can record working dir and environment variable changes in the bash script, and apply them in fish shell.

And another _zlua.tcsh script to simulate _zlua function ?

Is it possible to do similar things in tcsh ??

zhuzhzh commented 4 years ago

yes, because tcsh doesn't support function, need use script file to simulate the function call. I think it would break current style (all in one), so didn't do this.