You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know others have raised the usability issues caused by having the full path of the current working directory as the rshell prompt. I have my terminal windows 80 columns wide, giving just enough room for two terminal windows side-by-side on my laptop. My working directories can be longer than 80 characters and the overlap this caused in rshell, along with the line munging reported in #152 (and noted in /main.py#L73-L75) was irritating me.
So, I wrote a quick loop which replaces the home directory part with ~ and then automatically trims the prompt if the directory part is still longer than [arbitrarily] 30 characters. The following change to line 1863 in the current HEAD revision on master should be made to enjoy a prompt that shows at the minimum the current directory name, even if its length is greater than 30 characters, and in all other cases displays a directory part of the prompt which is strictly 30 characters or less in length. It gives a prompt that looks like either ~/Hacks/rshell> or software/hacks/rshell>, which has been working well for me.
def set_prompt(self):
if self.stdin == sys.stdin:
- prompt = PROMPT_COLOR + cur_dir + END_COLOR + '> '+ prompt = cur_dir.replace(os.path.expanduser("~"), "~")+ if len(prompt) > 30:+ # Make the directory part of the prompt shorter!+ head, prompt = os.path.split(prompt)+ head, tail = os.path.split(head)+ while len(os.path.join(tail, prompt)) <= 30:+ prompt = os.path.join(tail, prompt)+ head, tail = os.path.split(head)+ prompt = PROMPT_COLOR + prompt + END_COLOR + '> '
I'd be happy to submit a pull request for this if it would be accepted.
The text was updated successfully, but these errors were encountered:
I know others have raised the usability issues caused by having the full path of the current working directory as the rshell prompt. I have my terminal windows 80 columns wide, giving just enough room for two terminal windows side-by-side on my laptop. My working directories can be longer than 80 characters and the overlap this caused in rshell, along with the line munging reported in #152 (and noted in /main.py#L73-L75) was irritating me.
So, I wrote a quick loop which replaces the home directory part with
~
and then automatically trims the prompt if the directory part is still longer than [arbitrarily] 30 characters. The following change to line 1863 in the current HEAD revision on master should be made to enjoy a prompt that shows at the minimum the current directory name, even if its length is greater than 30 characters, and in all other cases displays a directory part of the prompt which is strictly 30 characters or less in length. It gives a prompt that looks like either~/Hacks/rshell>
orsoftware/hacks/rshell>
, which has been working well for me.I'd be happy to submit a pull request for this if it would be accepted.
The text was updated successfully, but these errors were encountered: