diff --git a/docs/getting-started/index.html b/docs/getting-started/index.html index f522d5f..2e21b76 100644 --- a/docs/getting-started/index.html +++ b/docs/getting-started/index.html @@ -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.

Hilbish’s sample configuration is usually located in hilbish.dataDir .. '/.hilbishrc.lua'. You can print that path via Lua to see what it is: print(hilbish.dataDir .. '/.hilbishrc.lua'). As an example, it will usually will result in /usr/share/hilbish/.hilbishrc.lua on Linux.

To edit your user configuration, you can copy that file to hilbish.userDir.config .. '/hilbish/init.lua', -which follows XDG on Linux and MacOS, and is located in %APPDATA% on Windows.

As the directory is usually ~/.config on Linux, you can run this command to copy it:
cp /usr/share/hilbish/.hilbishrc.lua ~/.config/hilbish/init.lua

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 doc command. This also works as -general documentation for other things.

\ No newline at end of file +which follows XDG on Linux and MacOS, and is located in %APPDATA% on Windows.

As the directory is usually ~/.config on Linux, you can run this command to copy it:
cp /usr/share/hilbish/.hilbishrc.lua ~/.config/hilbish/init.lua

Now we can get to customization!

If we closely examine a small snippet of the default config:

 1-- Default Hilbish config
+ 2-- .. with some omitted code .. --
+ 3
+ 4local function doPrompt(fail)
+ 5	hilbish.prompt(lunacolors.format(
+ 6		'{blue}%u {cyan}%d ' .. (fail and '{red}' or '{green}') .. '∆ '
+ 7	))
+ 8end
+ 9
+10doPrompt()
+11
+12bait.catch('command.exit', function(code)
+13	doPrompt(code ~= 0)
+14end)
+

We see a whopping three Hilbish libraries being used in this part of code. +First is of course, named after the shell itself, hilbish +. This is kind of a +“catch-all” namespace for functions that directly related to shell functionality/settings.

And as we can see, the hilbish.prompt +function is used +to change our prompt. Change our prompt to what, exactly?

The doc for the function states that the verbs %u and %dare used for username and current directory +of the shell, respectively.

We wrap this in the lunacolors.format +function, to give +our prompt some nice color.

But you might have also noticed that this is in the doPrompt function, which is called once, +and then used again in a bait +hook. Specifically, the command.exit hook, +which is called after a command exits, so when it finishes running.

\ No newline at end of file