Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

short dir listing for cwd #303

Closed
jceaser opened this issue Oct 12, 2017 · 10 comments
Closed

short dir listing for cwd #303

jceaser opened this issue Oct 12, 2017 · 10 comments

Comments

@jceaser
Copy link
Contributor

jceaser commented Oct 12, 2017

The documentation is completely confusing to me with regards to how I would use ~/.powerline-shell.py to set up short dir listings for the current working directory. What I would like to do is have only the first letter of each directory displayed except for the current directory which should be the full name. Documentation indicates this is possible using something like the bottom, but I'm totally confused as to how this is done. The documentation completely fails to describe how I actually do this.

#powerline.segments.common.env.cwd(dir_shorten_len=1)

@b-ryan
Copy link
Owner

b-ryan commented Oct 12, 2017

@jceaser you have the wrong project. You want: https://github.com/powerline/powerline

Although we would certainly be happy to have you as a powerline-shell user :)

@b-ryan b-ryan closed this as completed Oct 12, 2017
@jceaser
Copy link
Contributor Author

jceaser commented Oct 13, 2017

well, I think I tried yours first then, why don't I try a little harder.

@jceaser
Copy link
Contributor Author

jceaser commented Oct 13, 2017

Well wait, I have configured fish to use:

function fish_prompt
    powerline-shell --shell bare $status
end

@b-ryan
Copy link
Owner

b-ryan commented Oct 13, 2017

Ah ok - it may have just been the documentation getting mixed up then.

This project doesn't have the exact configuration options you want though, I think. The customization available for the current directory can be seen here: https://github.com/banga/powerline-shell#segment-configuration Specifically the max_dir_size - This option shortens all directory names though, including the current directory.

@b-ryan b-ryan reopened this Oct 13, 2017
@jceaser
Copy link
Contributor Author

jceaser commented Oct 14, 2017

well, here is a question then, can I make it do what I want to do. Presumable I have all the code.

powerline-shell/powerline_shell/segments/cwd.py looks like my answer, I may fork the project and add a new parameter in the add_cwd_segment(). I just need to figure out how to "compile" and deploy on my box as a developer instead of a consumer.

@jceaser
Copy link
Contributor Author

jceaser commented Oct 17, 2017

Changed the code, so what is the process here, you want me to fork the project and then make a pull request? I assume direct changes are not allowed?

@jceaser
Copy link
Contributor Author

jceaser commented Oct 18, 2017

Here are some changes I have made to support the feature I'm requesting. I want to do a pull request, but I think people may not like how I configure my feature.

jceaser@3bc516f

The issue I want to ask about is my use of "-1" to indicate that the "max size" of the current directory should be all chars. "0" will effectively strip hide the current directory, where any positive number will result in that many chars being displayed.

I could have just required users to put in 255 or some very large number to mean "full name". What does anyone here thing?

@b-ryan
Copy link
Owner

b-ryan commented Oct 18, 2017

Between using -1 and 255 - I prefer your choice of -1. It's clearer that it is a special flag. You could also allow the option to be a string in that case, like it could be "last_max_dir_size": "full" or something.

I lean more toward keeping things simple and just introducing an option that is shorten_last_dir that indicates whether max_dir_size should apply to the last dir or not. Had you considered that and if so, what were you thoughts on it?

@jceaser
Copy link
Contributor Author

jceaser commented Oct 18, 2017

got it, will rework

@jceaser
Copy link
Contributor Author

jceaser commented Oct 19, 2017

ok, updated to : jceaser@c599e7c

In this change, you can provide the following:

  • 'all','full' for displaying the entire current working directory
  • 'none','empty' for no current working directory (only path)
  • 'one' for only the first letter of the current working directory
  • a number for the length of the current working directory
  • if no value is provided then the max_dir_size is used as before

if no comments I'll create a pull request.

(how does unit testing work on this project)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants