How do I display only the current directory while using powerline in the terminal prompt.?

The name of the pictureThe name of the pictureThe name of the pictureClash 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.







share|improve this question


























    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.







    share|improve this question
























      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.







      share|improve this question














      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.









      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 21 '17 at 13:43









      Jeff Schaller

      32.1k849109




      32.1k849109










      asked Oct 21 '17 at 13:07









      uNIKx

      61




      61




















          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.






          share|improve this answer






















          • 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











          • 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 ran the find command, no luck. The prompt doesnt show anything.
            – uNIKx
            Oct 22 '17 at 17:26











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          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






























          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.






          share|improve this answer






















          • 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











          • 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 ran the find command, no luck. The prompt doesnt show anything.
            – uNIKx
            Oct 22 '17 at 17:26















          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.






          share|improve this answer






















          • 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











          • 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 ran the find command, no luck. The prompt doesnt show anything.
            – uNIKx
            Oct 22 '17 at 17:26













          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.






          share|improve this answer














          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.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          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 [ -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










          • 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










          • 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










          • 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


















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          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













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?