diff --git a/README.md b/README.md index c2c5b96..c10ebd6 100644 --- a/README.md +++ b/README.md @@ -217,8 +217,9 @@ for the `cwd` segment are set in `~/.powerline-shell.py` like: The options for the `cwd` segment are: - `mode`: If "plain" then simple text will be used to show the cwd. If - "dironly," only the current directory will be shown. Otherwise expands the - cwd into individual directories. + "dironly," only the current directory will be shown. If "compact", + simple text is used but is shortened according to "max_depth" and + "max_dir_size". Otherwise expands the cwd into individual directories. - `max_depth`: Maximum number of directories to show in path - `max_dir_size`: Maximum number of characters displayed for each directory in the path diff --git a/powerline_shell/segments/cwd.py b/powerline_shell/segments/cwd.py index f99eb13..781f112 100644 --- a/powerline_shell/segments/cwd.py +++ b/powerline_shell/segments/cwd.py @@ -83,6 +83,10 @@ def add_cwd_segment(powerline): # displayed, so chop everything else off names = names[-1:] + if powerline.segment_conf("cwd", "mode") == "compact": + # Like plain but uses max_depth. + names = [os.path.join(*names)] + for i, name in enumerate(names): is_last_dir = (i == len(names) - 1) fg, bg = get_fg_bg(powerline, name, is_last_dir)