How do I display only the current directory while using powerline in the terminal prompt.?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
Recently I installed the Powerline in the linux to enhance the look and feel of my terminal. It works great, however, it display 3 levels of directories in the prompt while traversing. Consider below example
unikx> ...>Dir1>Dir2>Dir3
where unikx is my username and Dir3 is my current working directory. The problem is, I have a habit of giving long names to directories. So due to above behaviour of Powerline showing 3 levels, I dont have enough space on that current line to write my commands and eventually my commands appear in the next line which I dont like.
So how do I customize powerline to show only 2 or current dir in the prompt like below:
unikx> ...>Dir3
or
unikx> ...>Dir2>Dir3
Thanks.
shell prompt
add a comment |Â
up vote
1
down vote
favorite
Recently I installed the Powerline in the linux to enhance the look and feel of my terminal. It works great, however, it display 3 levels of directories in the prompt while traversing. Consider below example
unikx> ...>Dir1>Dir2>Dir3
where unikx is my username and Dir3 is my current working directory. The problem is, I have a habit of giving long names to directories. So due to above behaviour of Powerline showing 3 levels, I dont have enough space on that current line to write my commands and eventually my commands appear in the next line which I dont like.
So how do I customize powerline to show only 2 or current dir in the prompt like below:
unikx> ...>Dir3
or
unikx> ...>Dir2>Dir3
Thanks.
shell prompt
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Recently I installed the Powerline in the linux to enhance the look and feel of my terminal. It works great, however, it display 3 levels of directories in the prompt while traversing. Consider below example
unikx> ...>Dir1>Dir2>Dir3
where unikx is my username and Dir3 is my current working directory. The problem is, I have a habit of giving long names to directories. So due to above behaviour of Powerline showing 3 levels, I dont have enough space on that current line to write my commands and eventually my commands appear in the next line which I dont like.
So how do I customize powerline to show only 2 or current dir in the prompt like below:
unikx> ...>Dir3
or
unikx> ...>Dir2>Dir3
Thanks.
shell prompt
Recently I installed the Powerline in the linux to enhance the look and feel of my terminal. It works great, however, it display 3 levels of directories in the prompt while traversing. Consider below example
unikx> ...>Dir1>Dir2>Dir3
where unikx is my username and Dir3 is my current working directory. The problem is, I have a habit of giving long names to directories. So due to above behaviour of Powerline showing 3 levels, I dont have enough space on that current line to write my commands and eventually my commands appear in the next line which I dont like.
So how do I customize powerline to show only 2 or current dir in the prompt like below:
unikx> ...>Dir3
or
unikx> ...>Dir2>Dir3
Thanks.
shell prompt
edited Oct 21 '17 at 13:43
Jeff Schaller
32.1k849109
32.1k849109
asked Oct 21 '17 at 13:07
uNIKx
61
61
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
I think the setting you're looking for is in something like
<powerline_install_dir>/config_files/themes/shell/__main__.json
on this line:
"dir_limit_depth": 3
(Note that your installation may be different from mine so you might have to search for the file.)
See Powerline quick setup guide. This reddit post might also help. (If you're in a hurry edit that file directly.)
FYI, a simple alternative is the powerline command's --width
flag which takes max width of the prompt in columns/characters. E.g. powerline --width 40 ...
. This will dynamically resize segments of the prompt as needed which usually means shrinking the path segment.
You probably won't know if you like it until you try it. That way you can see exactly how it behaves for different console widths, different paths, with whatever other segments you are displaying, etc.
I couldn't find a straightforward way to set this but looking at the code it seems that setting COLUMNS=X
(X is desired width) in your environment before invoking the powerline.sh
startup script will do the trick.
Thanks, I will try this. Before I try, I just want to know that after executing the powerline --width 40, what should i do to revert back incase i dont find it appropriate ?
â uNIKx
Oct 21 '17 at 14:07
I am using Bash, and the following lines are written in my .bashrc if [ -fwhich powerline-daemon
]; then powerline-daemon -q POWERLINE_BASH_CONTINUATION=1 POWERLINE_BASH_SELECT=1 . /usr/share/powerline/bash/powerline.sh fi I am newbie in linux and all this :-P
â uNIKx
Oct 21 '17 at 14:22
Hmm. For--width
try adding this immediately before thepowerline-daemon
call:export COLUMNS=99
(replace 99 with whatever you want).
â B Layer
Oct 21 '17 at 15:02
I am struggling with this path <python-dir>/site-packages/powerline/config_files/themes/shell/__main__.json. I am unable to find my <python-dir>.
â uNIKx
Oct 22 '17 at 14:01
:-( I ran the find command, no luck. The prompt doesnt show anything.
â uNIKx
Oct 22 '17 at 17:26
 |Â
show 3 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I think the setting you're looking for is in something like
<powerline_install_dir>/config_files/themes/shell/__main__.json
on this line:
"dir_limit_depth": 3
(Note that your installation may be different from mine so you might have to search for the file.)
See Powerline quick setup guide. This reddit post might also help. (If you're in a hurry edit that file directly.)
FYI, a simple alternative is the powerline command's --width
flag which takes max width of the prompt in columns/characters. E.g. powerline --width 40 ...
. This will dynamically resize segments of the prompt as needed which usually means shrinking the path segment.
You probably won't know if you like it until you try it. That way you can see exactly how it behaves for different console widths, different paths, with whatever other segments you are displaying, etc.
I couldn't find a straightforward way to set this but looking at the code it seems that setting COLUMNS=X
(X is desired width) in your environment before invoking the powerline.sh
startup script will do the trick.
Thanks, I will try this. Before I try, I just want to know that after executing the powerline --width 40, what should i do to revert back incase i dont find it appropriate ?
â uNIKx
Oct 21 '17 at 14:07
I am using Bash, and the following lines are written in my .bashrc if [ -fwhich powerline-daemon
]; then powerline-daemon -q POWERLINE_BASH_CONTINUATION=1 POWERLINE_BASH_SELECT=1 . /usr/share/powerline/bash/powerline.sh fi I am newbie in linux and all this :-P
â uNIKx
Oct 21 '17 at 14:22
Hmm. For--width
try adding this immediately before thepowerline-daemon
call:export COLUMNS=99
(replace 99 with whatever you want).
â B Layer
Oct 21 '17 at 15:02
I am struggling with this path <python-dir>/site-packages/powerline/config_files/themes/shell/__main__.json. I am unable to find my <python-dir>.
â uNIKx
Oct 22 '17 at 14:01
:-( I ran the find command, no luck. The prompt doesnt show anything.
â uNIKx
Oct 22 '17 at 17:26
 |Â
show 3 more comments
up vote
0
down vote
I think the setting you're looking for is in something like
<powerline_install_dir>/config_files/themes/shell/__main__.json
on this line:
"dir_limit_depth": 3
(Note that your installation may be different from mine so you might have to search for the file.)
See Powerline quick setup guide. This reddit post might also help. (If you're in a hurry edit that file directly.)
FYI, a simple alternative is the powerline command's --width
flag which takes max width of the prompt in columns/characters. E.g. powerline --width 40 ...
. This will dynamically resize segments of the prompt as needed which usually means shrinking the path segment.
You probably won't know if you like it until you try it. That way you can see exactly how it behaves for different console widths, different paths, with whatever other segments you are displaying, etc.
I couldn't find a straightforward way to set this but looking at the code it seems that setting COLUMNS=X
(X is desired width) in your environment before invoking the powerline.sh
startup script will do the trick.
Thanks, I will try this. Before I try, I just want to know that after executing the powerline --width 40, what should i do to revert back incase i dont find it appropriate ?
â uNIKx
Oct 21 '17 at 14:07
I am using Bash, and the following lines are written in my .bashrc if [ -fwhich powerline-daemon
]; then powerline-daemon -q POWERLINE_BASH_CONTINUATION=1 POWERLINE_BASH_SELECT=1 . /usr/share/powerline/bash/powerline.sh fi I am newbie in linux and all this :-P
â uNIKx
Oct 21 '17 at 14:22
Hmm. For--width
try adding this immediately before thepowerline-daemon
call:export COLUMNS=99
(replace 99 with whatever you want).
â B Layer
Oct 21 '17 at 15:02
I am struggling with this path <python-dir>/site-packages/powerline/config_files/themes/shell/__main__.json. I am unable to find my <python-dir>.
â uNIKx
Oct 22 '17 at 14:01
:-( I ran the find command, no luck. The prompt doesnt show anything.
â uNIKx
Oct 22 '17 at 17:26
 |Â
show 3 more comments
up vote
0
down vote
up vote
0
down vote
I think the setting you're looking for is in something like
<powerline_install_dir>/config_files/themes/shell/__main__.json
on this line:
"dir_limit_depth": 3
(Note that your installation may be different from mine so you might have to search for the file.)
See Powerline quick setup guide. This reddit post might also help. (If you're in a hurry edit that file directly.)
FYI, a simple alternative is the powerline command's --width
flag which takes max width of the prompt in columns/characters. E.g. powerline --width 40 ...
. This will dynamically resize segments of the prompt as needed which usually means shrinking the path segment.
You probably won't know if you like it until you try it. That way you can see exactly how it behaves for different console widths, different paths, with whatever other segments you are displaying, etc.
I couldn't find a straightforward way to set this but looking at the code it seems that setting COLUMNS=X
(X is desired width) in your environment before invoking the powerline.sh
startup script will do the trick.
I think the setting you're looking for is in something like
<powerline_install_dir>/config_files/themes/shell/__main__.json
on this line:
"dir_limit_depth": 3
(Note that your installation may be different from mine so you might have to search for the file.)
See Powerline quick setup guide. This reddit post might also help. (If you're in a hurry edit that file directly.)
FYI, a simple alternative is the powerline command's --width
flag which takes max width of the prompt in columns/characters. E.g. powerline --width 40 ...
. This will dynamically resize segments of the prompt as needed which usually means shrinking the path segment.
You probably won't know if you like it until you try it. That way you can see exactly how it behaves for different console widths, different paths, with whatever other segments you are displaying, etc.
I couldn't find a straightforward way to set this but looking at the code it seems that setting COLUMNS=X
(X is desired width) in your environment before invoking the powerline.sh
startup script will do the trick.
edited Oct 22 '17 at 14:13
answered Oct 21 '17 at 13:52
B Layer
3,9241525
3,9241525
Thanks, I will try this. Before I try, I just want to know that after executing the powerline --width 40, what should i do to revert back incase i dont find it appropriate ?
â uNIKx
Oct 21 '17 at 14:07
I am using Bash, and the following lines are written in my .bashrc if [ -fwhich powerline-daemon
]; then powerline-daemon -q POWERLINE_BASH_CONTINUATION=1 POWERLINE_BASH_SELECT=1 . /usr/share/powerline/bash/powerline.sh fi I am newbie in linux and all this :-P
â uNIKx
Oct 21 '17 at 14:22
Hmm. For--width
try adding this immediately before thepowerline-daemon
call:export COLUMNS=99
(replace 99 with whatever you want).
â B Layer
Oct 21 '17 at 15:02
I am struggling with this path <python-dir>/site-packages/powerline/config_files/themes/shell/__main__.json. I am unable to find my <python-dir>.
â uNIKx
Oct 22 '17 at 14:01
:-( I ran the find command, no luck. The prompt doesnt show anything.
â uNIKx
Oct 22 '17 at 17:26
 |Â
show 3 more comments
Thanks, I will try this. Before I try, I just want to know that after executing the powerline --width 40, what should i do to revert back incase i dont find it appropriate ?
â uNIKx
Oct 21 '17 at 14:07
I am using Bash, and the following lines are written in my .bashrc if [ -fwhich powerline-daemon
]; then powerline-daemon -q POWERLINE_BASH_CONTINUATION=1 POWERLINE_BASH_SELECT=1 . /usr/share/powerline/bash/powerline.sh fi I am newbie in linux and all this :-P
â uNIKx
Oct 21 '17 at 14:22
Hmm. For--width
try adding this immediately before thepowerline-daemon
call:export COLUMNS=99
(replace 99 with whatever you want).
â B Layer
Oct 21 '17 at 15:02
I am struggling with this path <python-dir>/site-packages/powerline/config_files/themes/shell/__main__.json. I am unable to find my <python-dir>.
â uNIKx
Oct 22 '17 at 14:01
:-( I ran the find command, no luck. The prompt doesnt show anything.
â uNIKx
Oct 22 '17 at 17:26
Thanks, I will try this. Before I try, I just want to know that after executing the powerline --width 40, what should i do to revert back incase i dont find it appropriate ?
â uNIKx
Oct 21 '17 at 14:07
Thanks, I will try this. Before I try, I just want to know that after executing the powerline --width 40, what should i do to revert back incase i dont find it appropriate ?
â uNIKx
Oct 21 '17 at 14:07
I am using Bash, and the following lines are written in my .bashrc if [ -f
which powerline-daemon
]; then powerline-daemon -q POWERLINE_BASH_CONTINUATION=1 POWERLINE_BASH_SELECT=1 . /usr/share/powerline/bash/powerline.sh fi I am newbie in linux and all this :-Pâ uNIKx
Oct 21 '17 at 14:22
I am using Bash, and the following lines are written in my .bashrc if [ -f
which powerline-daemon
]; then powerline-daemon -q POWERLINE_BASH_CONTINUATION=1 POWERLINE_BASH_SELECT=1 . /usr/share/powerline/bash/powerline.sh fi I am newbie in linux and all this :-Pâ uNIKx
Oct 21 '17 at 14:22
Hmm. For
--width
try adding this immediately before the powerline-daemon
call: export COLUMNS=99
(replace 99 with whatever you want).â B Layer
Oct 21 '17 at 15:02
Hmm. For
--width
try adding this immediately before the powerline-daemon
call: export COLUMNS=99
(replace 99 with whatever you want).â B Layer
Oct 21 '17 at 15:02
I am struggling with this path <python-dir>/site-packages/powerline/config_files/themes/shell/__main__.json. I am unable to find my <python-dir>.
â uNIKx
Oct 22 '17 at 14:01
I am struggling with this path <python-dir>/site-packages/powerline/config_files/themes/shell/__main__.json. I am unable to find my <python-dir>.
â uNIKx
Oct 22 '17 at 14:01
:-( I ran the find command, no luck. The prompt doesnt show anything.
â uNIKx
Oct 22 '17 at 17:26
:-( I ran the find command, no luck. The prompt doesnt show anything.
â uNIKx
Oct 22 '17 at 17:26
 |Â
show 3 more comments
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f399541%2fhow-do-i-display-only-the-current-directory-while-using-powerline-in-the-termina%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password