mirror of
				https://github.com/sammy-ette/Hilbish
				synced 2025-08-10 02:52:03 +00:00 
			
		
		
		
	deploy: 32ed0d2348efdd2b5b29628f7a9ff0501845b25d
This commit is contained in:
		
							parent
							
								
									8c78d74a74
								
							
						
					
					
						commit
						9db08d1c23
					
				| @ -25,8 +25,29 @@ 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 you can get to editing it. Since it’s just a Lua file, having basic | ||||
| knowledge of Lua would help. All of Lua’s standard libraries and functions | ||||
| from Lua 5.4 are available. Hilbish has some custom and modules that are | ||||
| available. To see them, you can run the <code>doc</code> command. This also works as | ||||
| general documentation for other things.</p></div><div class="footer mt-auto"><p class="card-small text-muted">Want to help improve this page? <a href=https://github.com/Rosettea/Hilbish/issues/new/choose>Create an issue.</a></p></div></container></div><footer class="footer mt-auto mt-auto py-3 bg-light row border-top"><div class="col mb-3"></div><div class="col mb-3"><a href=/Hilbish class="d-flex align-items-center mb-3 link-dark text-decoration-none"><img src=/Hilbish/hilbish-logo-and-text.png alt height=48 class="d-inline-block align-text-top" style=margin-left:-20px></a><ul class="nav flex-column"><li class="nav-item mb-2"><a href=/Hilbish class="nav-link p-0 text-muted">Home</a></li><li class="nav-item mb-2"><a href=/Hilbish/docs/faq class="nav-link p-0 text-muted">FAQ</a></li><li class="nav-item mb-2"><a href=https://github.com/Rosettea/Hilbish class="nav-link p-0 text-muted">Source</a></li><li class="nav-item mb-2"><a href=https://github.com/Rosettea/Hilbish/releases class="nav-link p-0 text-muted">Releases</a></li><li class="nav-item mb-2"><a href=/Hilbish/docs class="nav-link p-0 text-muted">Documentation</a></li></ul></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"><p class="text-muted mt-4">Rosettea © 2022-2023<br>Made with <i class="fa-solid fa-heart" style=color:#f6345b></i></p></div><div class="col mb-3"></div></footer></body></html> | ||||
| 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><div class=highlight><pre tabindex=0 class=chroma><code class=language-lua data-lang=lua><span class=line><span class=ln> 1</span><span class=cl><span class=c1>-- Default Hilbish config</span> | ||||
| </span></span><span class=line><span class=ln> 2</span><span class=cl><span class=c1>-- .. with some omitted code .. --</span> | ||||
| </span></span><span class=line><span class=ln> 3</span><span class=cl> | ||||
| </span></span><span class=line><span class=ln> 4</span><span class=cl><span class=kd>local</span> <span class=kr>function</span> <span class=nf>doPrompt</span><span class=p>(</span><span class=n>fail</span><span class=p>)</span> | ||||
| </span></span><span class=line><span class=ln> 5</span><span class=cl>	<span class=n>hilbish.prompt</span><span class=p>(</span><span class=n>lunacolors.format</span><span class=p>(</span> | ||||
| </span></span><span class=line><span class=ln> 6</span><span class=cl>		<span class=s1>'{blue}%u {cyan}%d '</span> <span class=o>..</span> <span class=p>(</span><span class=n>fail</span> <span class=ow>and</span> <span class=s1>'{red}'</span> <span class=ow>or</span> <span class=s1>'{green}'</span><span class=p>)</span> <span class=o>..</span> <span class=s1>'∆ '</span> | ||||
| </span></span><span class=line><span class=ln> 7</span><span class=cl>	<span class=p>))</span> | ||||
| </span></span><span class=line><span class=ln> 8</span><span class=cl><span class=kr>end</span> | ||||
| </span></span><span class=line><span class=ln> 9</span><span class=cl> | ||||
| </span></span><span class=line><span class=ln>10</span><span class=cl><span class=n>doPrompt</span><span class=p>()</span> | ||||
| </span></span><span class=line><span class=ln>11</span><span class=cl> | ||||
| </span></span><span class=line><span class=ln>12</span><span class=cl><span class=n>bait.catch</span><span class=p>(</span><span class=s1>'command.exit'</span><span class=p>,</span> <span class=kr>function</span><span class=p>(</span><span class=n>code</span><span class=p>)</span> | ||||
| </span></span><span class=line><span class=ln>13</span><span class=cl>	<span class=n>doPrompt</span><span class=p>(</span><span class=n>code</span> <span class=o>~=</span> <span class=mi>0</span><span class=p>)</span> | ||||
| </span></span><span class=line><span class=ln>14</span><span class=cl><span class=kr>end</span><span class=p>)</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, <a href=../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 <a href=../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 <a href=../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 <a href=../api/bait>bait</a> | ||||
| hook. Specifically, the <code>command.exit</code> hook, | ||||
| which is called after a command exits, so when it finishes running.</p></div><div class="footer mt-auto"><p class="card-small text-muted">Want to help improve this page? <a href=https://github.com/Rosettea/Hilbish/issues/new/choose>Create an issue.</a></p></div></container></div><footer class="footer mt-auto mt-auto py-3 bg-light row border-top"><div class="col mb-3"></div><div class="col mb-3"><a href=/Hilbish class="d-flex align-items-center mb-3 link-dark text-decoration-none"><img src=/Hilbish/hilbish-logo-and-text.png alt height=48 class="d-inline-block align-text-top" style=margin-left:-20px></a><ul class="nav flex-column"><li class="nav-item mb-2"><a href=/Hilbish class="nav-link p-0 text-muted">Home</a></li><li class="nav-item mb-2"><a href=/Hilbish/docs/faq class="nav-link p-0 text-muted">FAQ</a></li><li class="nav-item mb-2"><a href=https://github.com/Rosettea/Hilbish class="nav-link p-0 text-muted">Source</a></li><li class="nav-item mb-2"><a href=https://github.com/Rosettea/Hilbish/releases class="nav-link p-0 text-muted">Releases</a></li><li class="nav-item mb-2"><a href=/Hilbish/docs class="nav-link p-0 text-muted">Documentation</a></li></ul></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"></div><div class="col mb-3"><p class="text-muted mt-4">Rosettea © 2022-2023<br>Made with <i class="fa-solid fa-heart" style=color:#f6345b></i></p></div><div class="col mb-3"></div></footer></body></html> | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user