<!doctype html><html><head><title>Getting Started — Hilbish</title><metacharset=utf-8><metaname=viewportcontent="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><metaname=theme-colorcontent="#ff89dd"><metacontent="/Hilbish/hilbish-flower.png"property="og:image"><metaproperty="og:site_name"content="Hilbish"><metacontent="Getting Started — Hilbish"property="og:title"><metacontent="TostartHilbish,openaterminal.IfHilbishhasbeeninstalledandisnotthedefaultshell,youcansimplyrunhilbishtostartit.Thiswilllaunchanormalinteractivesession.Toexit,youcaneitherruntheexitcommandorhitCtrl+D.
Setting as Default Login shell There are a few ways to make Hilbish your default shell. A simple way is to make it your user/login shell." property="og:description"><metacontent="TostartHilbish,openaterminal.IfHilbishhasbeeninstalledandisnotthedefaultshell,youcansimplyrunhilbishtostartit.Thiswilllaunchanormalinteractivesession.Toexit,youcaneitherruntheexitcommandorhitCtrl+D.
Setting as Default Login shell There are a few ways to make Hilbish your default shell. A simple way is to make it your user/login shell." name=description><metaname=revisit-aftercontent="2 days"><metaname=keywordscontent="Lua,Hilbish,Linux,Shell"><metaproperty="og:locale"content="en_GB"><linkrel=canonicalhref=https://rosettea.github.io/Hilbish/><metaproperty="og:url"content="https://rosettea.github.io/Hilbish/"><linkhref=https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.cssrel=stylesheetintegrity=sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVorcrossorigin=anonymous><scriptsrc=https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/js/bootstrap.bundle.min.jsintegrity=sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2crossorigin=anonymous></script>
<ahref=#login-shellclass=heading-link><iclass="fas fa-paperclip"></i></a></h3><p>There are a few ways to make Hilbish your default shell. A simple way is
to make it your user/login shell.</p><divclass="alert alert-warning d-flex align-items-center"role=alert><svgclass="bi flex-shrink-0 me-2"width="24"height="24"role="img"aria-label="Warning:"><usexlink:href="#exclamation-triangle-fill"/></svg><div>It is not recommended to set Hilbish as your login shell. That
is expected to be a POSIX compliant shell, which Hilbish is not. Though if
you still decide to do it, there will just be a few variables missing in
your environment</div></div><p>To do that, simply run <code>chsh -s /usr/bin/hilbish</code>.
When prompted, you can put the path for Hilbish.</p><h3id=default-with-terminalclass=heading>Default with terminal
<ahref=#default-with-terminalclass=heading-link><iclass="fas fa-paperclip"></i></a></h3><p>The simpler way is to set the default shell for your terminal. The way of
doing this depends on how your terminal settings are configured.</p><h3id=run-after-login-shellclass=heading>Run after login shell
<ahref=#run-after-login-shellclass=heading-link><iclass="fas fa-paperclip"></i></a></h3><p>Some shells (like zsh) have an rc file, like <code>.zlogin</code>, which is ran when the shell session
is a login shell. In that file, you can run Hilbish. Example:</p><divclass=highlight><pretabindex=0class=chroma><codeclass=language-fallbackdata-lang=fallback><spanclass=line><spanclass=ln>1</span><spanclass=cl>exec hilbish -S -l
</span></span></code></pre></div><p>This will replace the shell with Hilbish, set $SHELL to Hilbish and launch it as a login shell.</p><h2id=configurationclass=heading>Configuration
<ahref=#configurationclass=heading-link><iclass="fas fa-paperclip"></i></a></h2><p>Once installation and setup has been done, you can then configure Hilbish.
It is configured and scripted via Lua, so the config file is a Lua file.
You can use any pure Lua library to do whatever you want.</p><p>Hilbish’s sample configuration is usually located in <code>hilbish.dataDir .. '/.hilbishrc.lua'</code>.
You can print that path via Lua to see what it is: <code>print(hilbish.dataDir .. '/.hilbishrc.lua')</code>.
As an example, it will usually will result in <code>/usr/share/hilbish/.hilbishrc.lua</code> on Linux.</p><p>To edit your user configuration, you can copy that file to <code>hilbish.userDir.config .. '/hilbish/init.lua'</code>,
which follows XDG on Linux and MacOS, and is located in %APPDATA% on Windows.</p><p>As the directory is usually <code>~/.config</code> on Linux, you can run this command to copy it:<br><code>cp /usr/share/hilbish/.hilbishrc.lua ~/.config/hilbish/init.lua</code></p><p>Now we can get to customization!</p><p>If we closely examine a small snippet of the default config:</p><divclass=highlight><pretabindex=0class=chroma><codeclass=language-luadata-lang=lua><spanclass=line><spanclass=ln> 1</span><spanclass=cl><spanclass=c1>-- Default Hilbish config</span>
</span></span><spanclass=line><spanclass=ln> 2</span><spanclass=cl><spanclass=c1>-- .. with some omitted code .. --</span>
</span></span></code></pre></div><p>We see a whopping <strong>three</strong> Hilbish libraries being used in this part of code.
First is of course, named after the shell itself, <ahref=../api/hilbish><code>hilbish</code></a>
. This is kind of a
“catch-all” namespace for functions that directly related to shell functionality/settings.</p><p>And as we can see, the <ahref=../api/hilbish/#prompt>hilbish.prompt</a>
function is used
to change our prompt. Change our prompt to what, exactly?</p><p>The doc for the function states that the verbs <code>%u</code> and <code>%d</code>are used for username and current directory
of the shell, respectively.</p><p>We wrap this in the <ahref=../lunacolors><code>lunacolors.format</code></a>
function, to give
our prompt some nice color.</p><p>But you might have also noticed that this is in the <code>doPrompt</code> function, which is called once,
and then used again in a <ahref=../api/bait>bait</a>
hook. Specifically, the <code>command.exit</code> hook,