TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

PS1 generator

168 pointsby jerogarciaalmost 12 years ago
Not really mine but i liked it

16 comments

josh_blumalmost 12 years ago
Pretty awesome, just a couple of suggestions:<p>1. Items shouldn&#x27;t disappear from the selection (I can only add one (space) for some reason).<p>2. Allow grouping of items. For example, if you want to have [time] you should be able to drag the &quot;[&quot;, &quot;time&quot;, and &quot;]&quot; as a group instead of individually.
qrohlfalmost 12 years ago
Very cool!<p>Feature suggestion: It would be great to be able to change the colors of the individual components a la <a href="https://github.com/twolfson/sexy-bash-prompt" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;twolfson&#x2F;sexy-bash-prompt</a>
评论 #6202186 未加载
评论 #6202107 未加载
评论 #6203261 未加载
JoshTriplettalmost 12 years ago
Nice!<p>I&#x27;d love to see support for the terminal window title here, too. Add an additional container for the titlebar contents, and prefix \[\e]0;$titlebar_contents\a\] to the prompt when TERM is xterm<i>, rxvt</i>, or screen*.<p>Also, colors should be draggable into the prompt, since they can change between different parts of the prompt.<p>&quot;Last command error when not successful&quot; is nice as well; just add this to your prompt (includes color and whitespace):<p><pre><code> $(e=&quot;$?&quot;;[ &quot;$e&quot; -ne 0 ] &amp;&amp; echo -n &quot;\[\e[01;31m\]($e) &quot;) </code></pre> On my system, I also have some extra logic to only show the username and hostname if either $SSH_CONNECTION is set or the username is not my usual username (usually because it&#x27;s either root, some user I&#x27;ve sudoed to, or an unusual username because I&#x27;m on a system with mandated username conventions). Thus, on my personal system, my initial prompt is &quot;~$ &quot;, taking up very little room. Unfortunately &quot;not my usual username&quot; isn&#x27;t portable to different users (though you could check for the presence of SUDO_USER), but checking SSH_CONNECTION is.
评论 #6203908 未加载
ender7almost 12 years ago
Please add &quot;cursor: default;&quot; or &quot;cursor: move;&quot; to the draggable items. Draggable things should not use the text selection cursor. :)
评论 #6203769 未加载
egwynnalmost 12 years ago
It should probably emit the example PS1 with single quotes instead of double quotes.<p>This:<p><pre><code> export PS1=&quot;\h:\W\$(parse_git_branch) \u$ &quot; </code></pre> will execute parse_git_branch only once (at the time PS1 is set) but this:<p><pre><code> export PS1=&#x27;\h:\W\$(parse_git_branch) \u$ &#x27; </code></pre> will execute it every time the prompt every time.
评论 #6202336 未加载
hademalmost 12 years ago
You might also be interested in this PS1 generator. Seems to have a few more options.<p><a href="http://omar.io/ps1gen/" rel="nofollow">http:&#x2F;&#x2F;omar.io&#x2F;ps1gen&#x2F;</a>
pclarkalmost 12 years ago
I kept dragging the elements into the terminal window thinking that was how I construct it.
评论 #6202514 未加载
xxtjaxxalmost 12 years ago
1. Better know what you are doing when you fiddle with your shellprompt. Nothing is more agitating than having an unresponsive prompt because you entered a larger git repository. (<i>cough</i> linux kernel <i>cough</i>)<p>2. Here is a color map which escape will make your prompt look which way. <a href="https://github.com/andreas-marschke/misc-tools/blob/master/sh/color_shell/colorPrompt.sh" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;andreas-marschke&#x2F;misc-tools&#x2F;blob&#x2F;master&#x2F;s...</a><p>3. You can find my prompt setup here: <a href="https://github.com/andreas-marschke/dotfiles" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;andreas-marschke&#x2F;dotfiles</a><p>It&#x27;s split up across profile,bashrc,bash_alias,bash_export<p>4. As was requested in the comments here you can use $TERM variable to determine your terminal name. Since most popular terminal emulators try to be what they are supposed to be &quot;dumb vt100s&quot; you&#x27;ll get xterm or (if you use a multiplexer like tmux,screen) &quot;screen&quot; as $TERM. IMHO its not of much use therefore.<p>5.<a href="https://github.com/Lokaltog/powerline" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Lokaltog&#x2F;powerline</a> &lt;&lt; Mean to test this out. Its more for vim users.
D9ualmost 12 years ago
<a href="https://news.ycombinator.com/item?id=6155556" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=6155556</a><p><a href="http://blog.twistedcode.org/2008/03/customizing-your-bash-prompt.html" rel="nofollow">http:&#x2F;&#x2F;blog.twistedcode.org&#x2F;2008&#x2F;03&#x2F;customizing-your-bash-pr...</a><p><a href="http://www.bbs-software.com/blog/2013/08/03/%EF%A3%BF-in-your-system-prompt/" rel="nofollow">http:&#x2F;&#x2F;www.bbs-software.com&#x2F;blog&#x2F;2013&#x2F;08&#x2F;03&#x2F;%EF%A3%BF-in-you...</a>
sethammonsalmost 12 years ago
This is pretty neat. One issue: I put a lot of info in my ps1, so I need more than two space tokens. They should regenerate as you pull them up. Also, I want different colors on different tokens. I also like my git branch to be a different color between master, staging, integration (or other feature branches). I use the ps1_set from RVM, but take out the ruby version.
robinson-wallalmost 12 years ago
This just uses a literal dollar sign to mark the end of the prompt by default. That means if, like me, you don&#x27;t put the username in your PS1 - instead relying on $ changing to a # when you run `sudo -s&#x27; nothing will happen.<p>I would suggest adding a &quot;$&#x2F;#&quot; bubble which adds &quot;\$&quot; to the PS1 string.
prezjordanalmost 12 years ago
If you&#x27;re not opposed to using JS in your prompt (it runs fast, promise!) check out impromptu [0]. I&#x27;ve been using it for a few months now and it&#x27;s amazing.<p>[0]: <a href="https://github.com/impromptu/impromptu" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;impromptu&#x2F;impromptu</a>
评论 #6204168 未加载
keeperofdakeysalmost 12 years ago
If anyone wanted a full list of available options, you can look at the man page for your shell, under PROMPTING (you can type &#x2F;PROMPTING to search for it). Any other bash variable, or user defined variable will also work.
RandallBrownalmost 12 years ago
There&#x27;s a bug where if you drag everything out of your configuration, you can&#x27;t drag anything back in again.<p>Neat though.<p>I&#x27;m on Firefox v22.
评论 #6203266 未加载
petarbalmost 12 years ago
Wow this is great, props for making the first drag-n-drop $PS1 generator
评论 #6204613 未加载
snake_plisskenalmost 12 years ago
just confusing enough to thwart those pesky North Korean hackers:<p>export PS1=&quot;\[\e[30;0m\]\w^$ \v\h\u\W\u:\[\e[0m\]&quot;