This commit is contained in:
nelle 2023-08-08 00:07:25 -06:00
parent 64423c44ca
commit ed60f93061
69 changed files with 10702 additions and 1 deletions

1
.vscode/.version vendored Normal file
View file

@ -0,0 +1 @@
v0.0.8k3

217
.vscode/figura/_generic.lua vendored Normal file
View file

@ -0,0 +1,217 @@
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---Logs a value to Minecraft's chat and log output.
---If `jsonEncode` is true, it will try to encode the log into json text.
---@param value any
---@param jsonEncode? boolean
function log(value, jsonEncode) end
---Logs a value to Minecraft's chat and log output.
---If `jsonEncode` is true, it will try to encode the log into json text.
---
---Alias of `log`.
---@param value any
---@param jsonEncode? boolean
function print(value, jsonEncode) end
---Logs the contents of the given `table` to Minecraft's chat and log output.
---Attempting to log anything other than a pure `table` will log nothing.
---If the second parameter is true, the contents of nested tables will also be outputed.
---
---Note: This will not log a `Vector`, use `log` instead.
---@param tbl table
---@param showNested? boolean
function logTableContent(tbl, showNested) end
---Logs the contents of the given `table` to Minecraft's chat and log output.
---Attempting to log anything other than a pure `table` will log nothing.
---If the second parameter is true, the contents of nested tables will also be outputed.
---
---Alias of `logTableContent`
---@param tbl table
---@param showNested? boolean
function logTable(tbl, showNested) end
---Converts a string into a Lua function where the contents of the string become the function's body.
---
---Returns a string containing any compile errors if conversion failed.
---@param body string
---@return string|function
function loadstring(body) end
---@alias Type type
---| '"vector"'
---Returns the type of its only argument, coded as a string. The possible results of this function
---are `"nil"` (a string, not the value `nil`), `"number"`, `"string"`, `"boolean"`, `"table"`,
---`"function"`, `"thread"`, `"userdata"`, and `"vector"`.
---
---[View documents](command:extension.lua.doc?["en-us/52/manual.html/pdf-type"])
---@param v any
---@return Type type
function type(v) end
---**THIS FUNCTION DOES NOT EXIST UNTIL YOU CREATE IT!**
---You should not run this function, Figura will run it for you.
---
---Use the below code to create this function:
---```
---function tick()
--- --code here
---end
---```
---***
---This function runs its contents every Minecraft tick.
---
---Since almost all Minecraft data changes every tick, you should check that data in this function
---if you want it to change every tick.
---Some examples of code that could be placed here are:
---* Getting the health of the player,
---* Getting what the player is holding,
---* Checking the player's animation,
---* Checking a block in the world,
---* Updating tick timers,
---* Sending pings.
---
---Some things will appear too choppy if they are placed in this function, see the `render` function
---if you want your code to run more often than the `tick` function.
---
---Notes:
---* This function *can* be defined multiple times. This is unlike vanilla Lua where redefining
---a function will overwrite it.
---* Figura will run the contents of every instance of this function.
---* Try to define this function as few times as possible, this feature only exists to make combining
---different scripts easier.
function tick() end
---`delta`:
---  The distance between the last tick and next tick this frame sits on.
---  This is a value `0..1`.
---***
---**THIS FUNCTION DOES NOT EXIST UNTIL YOU CREATE IT!**
---You should not run this function, Figura will run it for you.
---
---Use the below code to create this function:
---```
---function render(delta)
--- --code here
---end
---```
---***
---This function runs its contents every frame that this script's avatar is visible.
---This will only run on the player if they are in third person or can see any part of their
---avatar that is connected to them (Not `NO_PARENT`) in first person.
---
---It is very ineffecient to run code here. Only run code that should change every frame.
---A few simple examples of code that could be placed here are:
---* Moving/rotating/scaling parts smoothly,
---* Getting the positions of parts.
---
---You should not get Minecraft data every frame as it only changes every tick.
---
---
---Notes:
---* This function *can* be defined multiple times. This is unlike vanilla Lua where redefining
---a function will overwrite it.
---* Figura will run the contents of every instance of this function.
---* Try to define this function as few times as possible, this feature only exists to make combining
---different scripts easier.
---@param delta number
function render(delta) end
---`delta`:
---  The distance between the last tick and next tick this frame sits on.
---  This is a value `0..1`.
---***
---**THIS FUNCTION DOES NOT EXIST UNTIL YOU CREATE IT!**
---You should not run this function, Figura will run it for you.
---
---Use the below code to create this function:
---```
---function world_render(delta)
--- --code here
---end
---```
---***
---This function runs its contents every frame, but will continue to run even if your model is not rendering.
---
---Notes:
---* This function *can* be defined multiple times. This is unlike vanilla Lua where redefining
---a function will overwrite it.
---* Figura will run the contents of every instance of this function.
---* Try to define this function as few times as possible, this feature only exists to make combining
---different scripts easier.
---@param delta number
function world_render(delta) end
---**THIS FUNCTION DOES NOT EXIST UNTIL YOU CREATE IT!**
---You should not run this function, Figura will run it for you.
---
---Use the below code to create this function:
---```
---function player_init()
--- --code here
---end
---```
---***
---This function runs its contents *once* when `player` becomes available.
---
---Notes:
---* This function *can* be defined multiple times. This is unlike vanilla Lua where redefining
---a function will overwrite it.
---* Figura will run the contents of every instance of this function.
---* Try to define this function as few times as possible, this feature only exists to make combining
---different scripts easier.
function player_init() end
---`cmd`:
---  Contains the *full* message (including the prefix) used to trigger this function.
---***
---**THIS FUNCTION DOES NOT EXIST UNTIL YOU CREATE IT!**
---You should not run this function, Figura will run it for you.
---
---Use the below code to create this function:
---```
---function onCommand(cmd)
--- --code here
---end
---```
---***
---This function runs its contents *once* when the player enters a message starting with the command
---prefix as defined by `chat.setFiguraCommandPrefix`.
---
---Notes:
---* This function *can* be defined multiple times. This is unlike vanilla Lua where redefining
---a function will overwrite it.
---* Figura will run the contents of every instance of this function.
---* Try to define this function as few times as possible, this feature only exists to make combining
---different scripts easier.
---@param cmd string
function onCommand(cmd) end
---**THIS FUNCTION DOES NOT EXIST UNTIL YOU CREATE IT!**
---You should not run this function, Figura will run it for you.
---
---Use the below code to create this function:
---```
---function onDamage(amount, source)
--- --code here
---end
---```
---***
---Runs every time you take damage.
---
---Notes:
---* This function *can* be defined multiple times. This is unlike vanilla Lua where redefining
---a function will overwrite it.
---* Figura will run the contents of every instance of this function.
---* Try to define this function as few times as possible, this feature only exists to make combining
---different scripts easier.
---@param amount number The amount of damage you would have taken before armor/resistance calculations.
---@param source string
function onDamage(amount, source) end

634
.vscode/figura/_help.lua vendored Normal file
View file

@ -0,0 +1,634 @@
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---This table does not actually exist in figura.
---This is only here to show off what this documentation can show you.
---***
---To see more help on a specific section of this documentation, index this like a normal lua
---`table`.
---
---If you do not see a description of the item to the side of the dropdown list,
---press `CTRL + SPACE` or whatever key(s) you have bound to `toggleSuggestionDetails`.
---
---If at any point the suggest menu closes, you can press `CTRL + SPACE` or whatever key(s) you have
---bound to `Trigger Suggest`.
help = {
---View the different literals for every alias in this documentation.
---
---Note: This page of the documentation uses a function format to expand the alias. See more at
---`help.format.func.expandedVariables`
["alias"] = {
---@return BiomeID string
["BiomeID"] = function() end,
---@return BlockID string
["BlockID"] = function() end,
---@return DimensionID string
["DimensionID"] = function() end,
---@return DamageSource string
["DamageSource"] = function() end,
---@return EquipmentSlot number
["EquipmentSlot"] = function() end,
---@return EntityID string
["EntityID"] = function() end,
---@return EntityAnimation string
["EntityAnimation"] = function() end,
---@return HandSlot number
["HandSlot"] = function() end,
---@return ItemID string
["ItemID"] = function() end,
---@return Key string
["Key"] = function() end,
---@return LightLevel number
["LightLevel"] = function() end,
---@return MoonPhase number
["MoonPhase"] = function() end,
---@return MinecraftKeybind string
["MinecraftKeybind"] = function() end,
---@return ParentType string
["ParentType"] = function() end,
---@return PingSupported type
["PingSupported"] = function() end,
---@return RedstonePower number
["RedstonePower"] = function() end,
---@return Shader string
["Shader"] = function() end,
---@return SlotNumber number
["SlotNumber"] = function() end,
---@return SlotSideNumber number
["SlotSideNumber"] = function() end,
---@return StatusEffectID string
["StatusEffectID"] = function() end
},
---View the descriptions of every class in this documentation.
---You can also attempt to index the classes to peek further into them.
["class"] = {
---@type ActionWheelSlot
ActionWheelSlot = {},
---@type BasicModelPart
BasicModelPart = {},
---@type BlockState
BlockState = {},
---@type BlockStateProperties
BlockStateProperties = {},
---@type Camera
Camera = {},
---@type CustomModelPart
CustomModelPart = {},
---@type CustomModelPartContainer
CustomModelPartContainer = {},
---@type Entity
Entity = {},
---@type EntityNameplate
EntityNameplate = {},
---@type FiguraKeybind
FiguraKeybind = {},
---@type FormatTable
FormatTable = {},
---@type ItemStack
ItemStack = {},
---@type LivingEntity
LivingEntity = {},
---@type Nameplate
Nameplate = {},
---@type Player
Player = {},
---@type RegisteredKeybind
RegisteredKeybind = {},
---@type StatusEffect
StatusEffect = {},
---@type VanillaModelPart
VanillaModelPart = {},
---@type Vector
Vector = {},
---@type Vector6
Vector6 = {},
---@type Vector5
Vector5 = {},
---@type Vector4
Vector4 = {},
---@type Vector3
Vector3 = {},
---@type Vector2
Vector2 = {},
---@type VectorAng
VectorAng = {},
---@type VectorColor
VectorColor = {},
---@type VectorHSV
VectorHSV = {},
---@type VectorPos
VectorPos = {},
---@type VectorUV
VectorUV = {},
---@type World
World = {}
},
---View how the documentation is formatted for faster gathering of information.
["format"] = {
---The basic documentation format is below.
---To see help on a specific part, index this help page with the name of the part below.
---***
---***
---> ```
---> scope name: type = value
---> ```
---> ***
---> description
["basic"] = {
---The "scope" can either be `global`, `local`, or `field`.
---
---A `global` scope means that this variable can be accessed from anywhere.
---A `local` scope means this variable can only be accessed where it was created.
---A `field` scope means this variable is inside a `table`.
["scope"] = {},
---The "name" is how you access this variable in its scope.
["name"] = {},
---The "type" of the variable is the type of value it is holding (or has the potential of holding)
---and is not set in stone. The type of a variable can change at any time by simply giving it a
---value with a new type.
---
---The "type" can also be a class. See `help.format.class` for more information on how classes are
---formatted.
["type"] = {},
---The "value" of the variable is the value that the variable holds currently.
["value"] = {},
---The "description" simply describes the variable.
["description"] = {}
},
---The class documentation format is below.
---To see help on a specific part, index this help page with the name of the part below.
---
---Note: `table`s also use this format. However, "class" and "inheritance" do not appear.
---***
---***
---> ```
---> scope name: class {
---> field: type,
---> field: type,
---> . . .
---> }
---> ```
---> ***
---> inheritance
---> ***
---> description
["class"] = {
---The "scope" can either be `global`, `local`, or `field`.
---
---A `global` scope means that this variable can be accessed from anywhere.
---A `local` scope means this variable can only be accessed where it was created.
---A `field` scope means this variable is inside a `table`.
["scope"] = {},
---The "name" is how you access this variable in its scope.
["name"] = {},
---The "class" is the class this variable takes the form of.
---When a variable contains a class, it can be indexed with the fields of the class it contains
---like a table.
---
---Note: Despite classes sounding like their own type, they are actually just a `table` with set
---fields. However, most of Figura's classes are read-only and cannot be modified.
["class"] = {},
---The "fields" are the variables inside the class that you can use like a normal `table` index.
---Some fields are functions and can be run to modify or get information from the object this
---class is connected to.
["field"] = {},
---The "type" of the field is the type of value it is holding.
---
---The "type" can also be another class.
["type"] = {},
---The "inheritance" is the chain of classes (starting with the class itself) that this class
---inherits fields from.
---Inheritance allows a class to use fields from other classes as if the class itself contained
---them.
---
---Note: This does not appear on classes that do not inherit from other classes.
["inheritance"] = {},
---The "description" simply describes the class and what it is used for.
["description"] = {}
},
---The class documentation format is below.
---To see help on a specific part, index this help page with the name of the part below.
---
---Note: `table`s also use this format. However, "class" and "inheritance" do not appear.
---***
---***
---> ```
---> function name(param: type, param: type, ...)
---> -> return
---> 2. return
---> . . .
---> ```
---> ***
---> definitionNotice
---> ***
---> description
--->
---> expandedVariables
["func"] = {
---The "name" is how you access this function in its scope.
["name"] = {},
---The "params" are the the names of the values passed into the function. They give some info as
---to what the param does.
["param"] = {},
---The "type" of a param is the type of value this param accepts.
["type"] = {},
---A `...` (or "vararg") signifies an infinite number of comma seperated values.
---A function will likely state what the "vararg" requires.
["..."] = {},
---The "return" value of a function. A function can have multiple return values.
["return"] = {},
---The "definition notice" is a notice that explains which definition a function uses if
---multiple show up.
---Sometimes, when classes inherit, they overwrite functions they inherit to change how they
---work.
["definitionNotice"] = {},
---The "description" simply describes the function and what it is used for.
["description"] = {},
---The "expanded variables" expands any parameters or returns that use literals to show every
---literal value they can accept or return.
["expandedVariables"] = {}
},
---Some other unexplained parts of the documentation format.
---Index this help page to learn more...
["other"] = {
---Arrays are displayed like so:
---```
---type[]
---```
---An array is a numbermerically indexed `table` of the given type.
---
---Note: This help page contains an example of what it would look like if a variable was a
---string array at the very top.
---@type string[]
array = {},
---Dictionaries are displayed like so:
---```
---table<key_type, value_type>
---```
---A dictionary is a `table` of values that is indexed by another (or the same) type of value.
---
---Note: This help page contains an example of what it would look like if a variable was a
---dictionary of booleans indexed by strings at the very top.
---@type table<string, boolean>
dictionary = {},
---A "literal" is, quite literally, a *literal* value.
---Literal values are used if a variable can only have specific values, such as specific strings
---or numbers.
---
---Note: This help page contains an example of what it would look like if a variable had a literal
---`string` value.
---@type '"This is a literal string"'
literal = {},
---A variable can have multiple types. When this happens, the types will be seperated by a bar:
---```
---string|number|table
---```
---This can also happen with literals:
---```
---"string1"|"string2"|"string3"|1|42|300
---```
---When this happens, you will need to carefully check to make sure the variable is the type you
---want.
---
---Note: This help page contains an example of what it would look like if a variable could be a
---`string`, `number`, or `table`.
---@type string|number|table
multiple_types = {}
}
},
---A table that libraries can put help topics in.
["library"] = {},
---Do you want to add your own documentation that other users can use?
---
---Index this help page for more information on how to document anything.
["owndoc"] = {
---You can create descriptions for any variable or function by using three dashes:
---```
------This is a description comment!
------I use markdown for formatting!
------
------> Hello world!
---```
---Descriptions use [**Markdown**](https://www.markdownguide.org/basic-syntax) for formatting
---and will support (mostly) anything that Markdown does.
---
---Note: Code blocks will automatically be formatted in Lua, you do not need to specify this.
["s1_Descriptions"] = {},
---You can add a specific type to your variable by using the `@type type` comment:
---```
------@type string
---local string_variable = "Hello, World!"
---```
---The type will then be visible when hovered over.
---> ***
---> ```
---> local string_varaible: string = "Hello, World!"
---> ```
---> ***
["s2_Typing"] = {},
---Functions can also be documented using `@param name type`, `@vararg type`, and
---`@return type`.
---If your function has multiple params or returns, then you need make multiple comments.
---
---You can use these comments like so:
---```
------This function does a thing with `a` and `b` specifically, then an infinite amount of
------numbers after that and then returns two values.
------@param a string
------@param b string
------@vararg number
------@return number
------@return boolean
---function does_a_thing(a, b, ...)
--- --does stuff
--- return ret1, ret2
---end
---```
---This function will then have its information visible when hovered over.
---> ```
---> function does_a_thing(a: string, b: string, ...)
---> -> number
---> 2. boolean
---> ```
---> ***
---> This function does a thing with `a` and `b` specifically, then an infinite amount of
---> numbers after that and then returns two values.
["s3_Functions"] = {},
---You can view more information on the EmmyLua annotation style used in this documentation
---[**here**](https://github.com/sumneko/lua-language-server/wiki/EmmyLua-Annotations).
["s4_More"] = {}
},
---This documentation comes packaged with a .vscode file that edits some of the settings in
---Sumneko's Lua Language Server to make it fit more for Figura's Lua style and allows you to read
---this documentation a little easier.
---
---The settings are explained in the `.\.vscode\settings.json` file, but are also explained here
---in case the explanations in the json file are not descriptive enough.
["settings"] = {
---View settings that change how the editor works.
["editor"] = {
---**Set to `"currentDocument"` by the settings.json**
---
---```json
---//(Supposedly) makes VSCode only search the current file for words to auto-complete.
---//Might not work... Who knows.
---```
---***
---Changes the editor to only suggest words found in the current file. This setting is very
---iffy and might not work sometimes, especially when regarding Lua-specific syntax.
---
---This is done because Figura scripts cannot interact with each other, therefore they have no
---reason to share information between themselves.
["wordBasedSuggestionsMode"] = {}
},
---View settings that change how the Lua Language Server works.
["Lua"] = {
---View settings that change how completion works.
["completion"] = {
---**Set to `false` by the settings.json**
---
---```json
---//(Supposedly) disables auto-completing words from other files.
---//Might not work... Who knows.
---```
---***
---Changes the language server to only suggest words found in the current file. This setting
---is very iffy and might not work most of the time.
---
---This is done because Figura scripts cannot interact with each other, therefore they have
---no reason to share information between themselves.
["workspaceWord"] = {},
---**Set to `0` by the settings.json**
---
---```json
---//Removes some clutter from the documentation screen.
---```
---***
---Removes context lines from the documentation that will just cause more confusion than
---help since the functions in this documentation do not have a context and will cause
---strange "context leak".
["displayContext"] = {}
},
---View settings that change how hints work.
["hint"] = {
---**Set to `true` by the settings.json**
---
---```json
---//Enables hint types, these show up next to a variable if the type of a variable is set or able to
---//be guessed by the language server.
---```
---***
---Enables hints, this feature allows you to keep track of how variables are working and
---what type of variables to expect from functions.
---Hints appear as a box to the right of variables and to the left of values:
---
---variable`:type`
---`name:`"1234"
["enable"] = {},
---**Set to `true` by the settings.json**
---
---```json
---//Enables hint types, these show up next to a variable if the type of a variable is set or able to
---//be guessed by the language server.
---```
---***
---Allows hints to show up when using assignments on variables:
---
---var`:number` = math.sqrt(81)
["setType"] = {}
},
---View settings that change how the runtime works.
["runtime"] = {
---**Set to `"Lua 5.2"` by the settings.json**
---
---```json
---//Sets the runtime version to the version used by Figura.
---```
---***
---Makes sure the language server is using the same version as Figura. This stops the user
---from accidentally using features that do not exist in Figura's version of Lua.
["version"] = {}
},
---View settings that change how telemetry works.
["telemetry"] = {
---**Set to `false` by the settings.json**
---
---```json
---//Boring Telemetry stuff. You can enable it I guess?
---```
---***
---Disables telemetry, just in case you don't want someone using information from you
---without your permission.
["enable"] = {}
},
---View settings that change how diagnostics work.
["diagnostics"] = {
---**Set to `-1` by the settings.json**
---
---```json
---//Stops the language server from re-diagnosing the whole model_files folder when you add or remove
---//a character in an unrelated file.
---```
---***
---Stops the language server from checking over every script file when you edit a single
---script file. Since script files do not have a way to relate to each other, there is no
---reason for diagnostics to check every other file anyways.
["workspaceDelay"] = {},
---**Set to the following by the settings.json:**
---```json
---[
--- "lowercase-global",
--- "trailing-space",
--- "unbalanced-assignments"
---]
---```
---
---```json
---//Disables some unneeded diagnostics that many will not care about.
---//Do not touch unless you know what you are doing.
---```
---***
---Disables specific diagnostics that do not matter to someone using Figura.
---This specifically:
---* Disables warnings when using all-lowercase globals.
---* Disables warnings for trailing spaces.
---* Disables warnings when assignments are not balanced.
["disable"] = {},
---**Set to the following by the settings.json:**
---```json
---{
--- "unused-local": "Information",
--- "unused-vararg": "Information",
--- "redundant-parameter": "Information",
--- "redundant-value": "Information",
--- "redefined-local": "Information"
---}
---```
---
---```json
---//Changes the severity of some diagnostics to reflect their actual severity in Figura.
---//Do not touch unless you know what you are doing.
---```
---***
---Changes the severity of specific diagnostics to fit their true severity in Figura.
---This specifically:
---* Reveals that a local variable is being useless, to clean up code and allow errors to
---be seen if not already noticed.
---* Reveals that a vararg is not being used in the function that contains it.
---* Reveals that a parameter that was given is not asked for by the function.
---* Reveals that a value given in an assignment operation is going unused because there is
---no variable to take the value.
---* Reveals that a local value was explicitly defined again in the same scope for no
---reason.
["severity"] = {}
},
---View settings that change how the workspace works.
["workspace"] = {
---**Set to the following by the settings.json:**
---```json
---[
--- "./.vscode/figura"
---]
---```
---
---```json
---//Enables the documentation.
---```
---***
---This enables the documentation for use inside your script files. Everything in this
---documentation will fail to show if this setting is not set to the value shown above.
["library"] = {}
}
}
}
}

153
.vscode/figura/action_wheel.lua vendored Normal file
View file

@ -0,0 +1,153 @@
--================================================================================================--
--===== CLASSES ================================================================================--
--================================================================================================--
---A side slot number.
---@alias SlotSideNumber 1|2|3|4
---A wheel slot number.
---@alias SlotNumber 1|2|3|4|5|6|7|8
---@alias ActionWheelTextureType
---| "None" #Nothing, uses an item instead.
---| TextureType
---A slot on the action wheel.
---@class ActionWheelSlot
local ActionWheelSlot = {}
---Clears the slot of all of its changes.
function ActionWheelSlot.clear() end
---Returns the current color of the slot.
---Returns `nil` if the color has not been set by `.setColor()`.
---@return VectorColor?
function ActionWheelSlot.getColor() end
---Returns the current function of the slot.
---Returns `nil` if the function has not been set by `.setFunction()`.
---@return function?
function ActionWheelSlot.getFunction() end
---Returns the current hover color of the slot.
---Returns `nil` if the hover color has not been set by `.setHoverColor()`.
---@return VectorColor?
function ActionWheelSlot.getHoverColor() end
---Returns the current hover item of the slot.
---Returns `nil` if the hover item has not been set by `.setHoverItem()`.
---@return ItemStack?
function ActionWheelSlot.getHoverItem() end
---Returns the current item icon of the slot.
---Returns `nil` if the item has not been set by `.setItem()`.
---@return ItemStack?
function ActionWheelSlot.getItem() end
---Returns the type of texture used.
---@return ActionWheelTextureType
function ActionWheelSlot.getTexture() end
---Returns the scale of the texture set by setTextureScale
---@return Vector2
function ActionWheelSlot.getTextureScale() end
---Returns the current title of the slot.
---Returns `nil` if the title has not been set by `.setTitle()`.
---@return string?
function ActionWheelSlot.getTitle() end
---Returns the UV used for rendering the texture as well as the texture size.
---
---First two numbers are the offset, next two numbers are the size of the UV,
---last two numbers are the size of the texture itself.
---@return Vector6
function ActionWheelSlot.getUV() end
---Sets the color that the slot should be when idle.
---@param color VectorColor
function ActionWheelSlot.setColor(color) end
---Sets the function to run when the slot is clicked.
---If a `parameter` is given, the *current value* is saved as soon as the function is set and then
---used every time the slot is activated.
---@param func function
---@param parameter? any
function ActionWheelSlot.setFunction(func, parameter) end
---Sets the color that the slot should be when hovered over.
---@param col VectorColor
function ActionWheelSlot.setHoverColor(col) end
---Sets the item that should appear when the slot is hovered over.
---@param item ItemStack|string
function ActionWheelSlot.setHoverItem(item) end
---Sets the item that should appear when the slot is idle.
---@param item ItemStack|string
function ActionWheelSlot.setItem(item) end
---Sets the action wheel custom texture.
---`resource` is only needed if the texture type is set to `"Resource"`.
---@param type ActionWheelTextureType
---@param resource? string
function ActionWheelSlot.setTexture(type, resource) end
---Sets the scale of the texture.
---@param vector Vector2
function ActionWheelSlot.setTextureScale(vector) end
---Sets the title of the slot.
---@param str string
function ActionWheelSlot.setTitle(str) end
---Sets the UV and the texture size
---@param uvOffset Vector2
---@param uvSize Vector2
---@param textureSize Vector2
function ActionWheelSlot.setUV(uvOffset, uvSize, textureSize) end
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---The action wheel. This has up to 8 slots that can be customized to do whatever you want.
---Hold the `Figura: Action Wheel key` keybind to use the action wheel.
action_wheel = {
SLOT_1 = ActionWheelSlot,
SLOT_2 = ActionWheelSlot,
SLOT_3 = ActionWheelSlot,
SLOT_4 = ActionWheelSlot,
SLOT_5 = ActionWheelSlot,
SLOT_6 = ActionWheelSlot,
SLOT_7 = ActionWheelSlot,
SLOT_8 = ActionWheelSlot
}
---Returns the amount of slots on the left side of the action wheel.
---@return SlotSideNumber
function action_wheel.getLeftSize() end
---Returns the amount of slots on the right side of the action wheel.
---@return SlotSideNumber
function action_wheel.getRightSize() end
---Returns the slot that is currently being hovered over.
---@return SlotNumber
function action_wheel.getSelectedSlot() end
---Executes the function of the hovered over action wheel slot.
function action_wheel.runAction() end
---Sets the amount of slots on the left side of the action wheel.
---@param size SlotSideNumber
function action_wheel.setLeftSize(size) end
---Sets the amount of slots on the right side of the action wheel.
---@param size SlotSideNumber
function action_wheel.setRightSize(size) end
---Returns if the action wheel is currently open or not.
---@return boolean
function action_wheel.isOpen() end

175
.vscode/figura/animation.lua vendored Normal file
View file

@ -0,0 +1,175 @@
--================================================================================================--
--===== CLASSES ================================================================================--
--================================================================================================--
---An animation Loop Mode.
---
---Determines what an animation does when it reaches the end.
---@alias LoopMode
---| "ONCE" #Stop the animation with blending.
---| "HOLD" #Hold the animation on the last frame.
---| "LOOP" #Restart the animation.
---Animation play state.
---@alias PlayState
---| "PLAYING" #Playing normally.
---| "STOPPED" #Not currently running.
---| "PAUSED" #Paused with `.pause()`.
---| "ENDED" #Holding on last frame.
---| "STOPPING" #Blending to `"STOPPED"` state.
---| "STARTING" #Blending to `"PLAYING"` state.
---A Blockbench animation.
---@class Animation
local Animation = {}
---Stops the animation without using blending.
function Animation.cease() end
---Returns the blend time of the animation.
---@return number
function Animation.getBlendTime() end
---Returns the blend weight of the animation.
---@return number
function Animation.getBlendWeight() end
---Returns the length of the animation.
---@return number
function Animation.getLength() end
---Returns the loop delay of the animation.
---@return number
function Animation.getLoopDelay() end
---Returns the loop mode fo the animation.
---@return LoopMode
function Animation.getLoopMode() end
---Returns the name of the animation.
---@return string
function Animation.getName() end
---Returns if vanilla rotations are locked.
---@return boolean
function Animation.getReplace() end
---Returns the current state of the animation.
---@return PlayState
function Animation.getPlayState() end
---Returns the priority of the animation.
---@return integer
function Animation.getPriority() end
---Returns whether the animation overrides in blockbench or not.
---@return boolean
function Animation.getOverride() end
---Returns the current speed of the animation.
---@return number
function Animation.getSpeed() end
---Returns the start delay of the animation
---@return number
function Animation.getStartDelay() end
---Returns the start offset of the animation.
---@return number
function Animation.getStartOffset() end
---Returns if the animation is playing.
---@return boolean
function Animation.isPlaying() end
---Pauses the animation.
---You can resume by using `.play()` or `.start()`.
function Animation.pause() end
---Starts/restarts the animation.
function Animation.play() end
---Sets the blend time of the animation in seconds.
---Blending is done when an animation is starting or ending.
---@param time number
function Animation.setBlendTime(time) end
---Sets the blend weight of the animation.
---@param weight number
function Animation.setBlendWeight(weight) end
---Sets the length of the animation.
---@param length number
function Animation.setLength(length) end
---Sets the delay between each animation loop.
---@param delay number
function Animation.setLoopDelay(delay) end
---Sets the loop mode of the animation.
---@param mode LoopMode
function Animation.setLoopMode(mode) end
---If replace is enabled, the animation will stop vanilla rotations on parts that are part of the
---animation's timeline.
---They will still be able to move.
---
---Similar to how mimic parts work, but instead of only rotations, it is only for positions.
---@param bool boolean
function Animation.setReplace(bool) end
---Sets the current state of the animation.
---@param state PlayState
function Animation.setPlayState(state) end
---With override enabled, the animation will use the pivots defined in the animation editor instead
---of the ones defined in the default editor.
---@param bool boolean
function Animation.setOverride(bool) end
---Sets the priority of an animation over the others, you must put this value yourself.
---
---Priority determines how animations interact.
---Animations with the same priority will blend together while animations of lower priority will not
---run at all if higher priority animation is running.
---@param priority integer
function Animation.setPriority(priority) end
---Sets the speed of the animation. (1 = 100%)
---@param speed number
function Animation.setSpeed(speed) end
---After calling play() or start(), delay playing the animation for the given amount of seconds.
---@param delay number
function Animation.setStartDelay(delay) end
---Offset the start of the animation by the given amount of seconds.
---@param offset number
function Animation.setStartOffset(offset) end
---Starts the animation if it isn't already playing.
function Animation.start() end
---Stops the animation, using blending to smoothly move back into place.
function Animation.stop() end
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---@class AnimTableProxy
---@field [string] Animation
---A `table` containing functions relating to animations and the avatar's animations.
---@class AnimationTable : AnimTableProxy
animation = {}
---Stops ALL animations without using blending.
function animation.ceaseAll() end
---Returns a table with the name of each animation you have.
---@return string[]
function animation.listAnimations() end
---Stops ALL animations, using blending to smoothly move back into place.
function animation.stopAll() end

181
.vscode/figura/biome.lua vendored Normal file
View file

@ -0,0 +1,181 @@
--================================================================================================--
--===== CLASSES ================================================================================--
--================================================================================================--
---A Minecraft biome.
---@class Biome
local Biome = {}
---Returns the category the biome belongs to.
---@return BiomeCategory
function Biome.getCategory() end
---Returns how wet the biome is where `0` is dry and `1` is wet.
---@return number
function Biome.getDownfall() end
---Returns the biome fog color.
---@return VectorColor
function Biome.getFogColor() end
---Returns the biome color used on leaves.
---@return VectorColor
function Biome.getFoliageColor() end
---Returns the biome grass color.
---@return VectorColor
function Biome.getGrassColor() end
---Returns the ID of the biome.
---@return BiomeID
function Biome.getID() end
---Returns the rain type of the biome.
---@return BiomePrecipitationType
function Biome.getPrecipitation() end
---Returns the biome sky color as a vector.
---@return VectorColor
function Biome.getSkyColor() end
---Returns the temperature of the biome.
---@return number
function Biome.getTemperature() end
---Returns the biome water color.
---@return VectorColor
function Biome.getWaterColor() end
---Returns the biome underwater fog color.
---@return VectorColor
function Biome.getWaterFogColor() end
---Returns true if the temperature is less than 0.15.
---@return boolean
function Biome.isCold() end
---Returns true if the temperature is greather than 1.
---@return boolean
function Biome.isHot() end
---@alias BiomeCategory
---| "forest"
---| "beach"
---| "plains"
---| "desert"
---| "savana"
---| "river"
---| "jungle"
---| "mesa"
---| "icy"
---| "taiga"
---| "mountain"
---| "underground"
---| "swamp"
---| "extreme_hills"
---A Minecraft biome identifier.
---
---Only the default Minecraft biomes are auto-completed.
---You can use any biome from any mod, even if it does not auto-complete.
---@alias BiomeID
---| "minecraft:ocean" #Ocean
---| "minecraft:deep_ocean" #Deep Ocean
---| "minecraft:frozen_ocean" #Frozen Ocean
---| "minecraft:deep_frozen_ocean" #Deep Frozen Ocean
---| "minecraft:cold_ocean" #Cold Ocean
---| "minecraft:deep_cold_ocean" #Deep Cold Ocean
---| "minecraft:lukewarm_ocean" #Lukewarm Ocean
---| "minecraft:deep_lukewarm_ocean" #Deep Lukewarm Ocean
---| "minecraft:warm_ocean" #Warm Ocean
---| "minecraft:deep_warm_ocean" #Deep Warm Ocean
---| "minecraft:river" #River
---| "minecraft:frozen_river" #Frozen River
---| "minecraft:beach" #Beach
---| "minecraft:stone_shore" #Stone Shore
---| "minecraft:snowy_beach" #Snowy Beach
---| "minecraft:forest" #Forest
---| "minecraft:wooded_hills" #Wooded Hills
---| "minecraft:flower_forest" #Flower Forest
---| "minecraft:birch_forest" #Birch Forest
---| "minecraft:birch_forest_hills" #Birch Forest Hills
---| "minecraft:tall_birch_forest" #Tall Birch Forest
---| "minecraft:tall_birch_hills" #Tall Birch Hills
---| "minecraft:dark_forest" #Dark Forest
---| "minecraft:dark_forest_hills" #Dark Forest Hills
---| "minecraft:jungle" #Jungle
---| "minecraft:jungle_hills" #Jungle Hills
---| "minecraft:modified_jungle" #Modified Jungle
---| "minecraft:jungle_edge" #Jungle Edge
---| "minecraft:modified_jungle_edge" #Modified Jungle Edge
---| "minecraft:bamboo_jungle" #Bamboo Jungle
---| "minecraft:bamboo_jungle_hills" #Bamboo Jungle Hills
---| "minecraft:taiga" #Taiga
---| "minecraft:taiga_hills" #Taiga Hills
---| "minecraft:taiga_mountains" #Taiga Mountains
---| "minecraft:snowy_taiga" #Snowy Taiga
---| "minecraft:snowy_taiga_hills" #Snowy Taiga Hills
---| "minecraft:snowy_taiga_mountains" #Snowy Taiga Mountains
---| "minecraft:giant_tree_taiga" #Giant Tree Taiga
---| "minecraft:giant_tree_taiga_hills" #Giant Tree Taiga Hills
---| "minecraft:giant_spruce_taiga" #Giant Spruce Taiga
---| "minecraft:giant_spruce_taiga_hills" #Giant Spruce Taiga Hills
---| "minecraft:mushroom_fields" #Mushroom Fields
---| "minecraft:mushroom_field_shore" #Mushroom Field Shore
---| "minecraft:swamp" #Swamp
---| "minecraft:swamp_hills" #Swamp Hills
---| "minecraft:savanna" #Savanna
---| "minecraft:savanna_plateau" #Savanna Plateau
---| "minecraft:shattered_savanna" #Shattered Savanna
---| "minecraft:shattered_savanna_plateau" #Shattered Savanna Plateau
---| "minecraft:plains" #Plains
---| "minecraft:sunflower_plains" #Sunflower Plains
---| "minecraft:desert" #Desert
---| "minecraft:desert_hills" #Desert Hills
---| "minecraft:desert_lakes" #Desert Lakes
---| "minecraft:snowy_tundra" #Snowy Tundra
---| "minecraft:snowy_mountains" #Snowy Mountains
---| "minecraft:ice_spikes" #Ice Spikes
---| "minecraft:mountains" #Mountains
---| "minecraft:wooded_mountains" #Wooded Mountains
---| "minecraft:gravelly_mountains" #Gravelly Mountains
---| "minecraft:modified_gravelly_mountains" #Gravelly Mountains+
---| "minecraft:mountain_edge" #Mountain Edge
---| "minecraft:badlands" #Badlands
---| "minecraft:badlands_plateau" #Badlands Plateau
---| "minecraft:modified_badlands_plateau" #Modified Badlands Plateau
---| "minecraft:wooded_badlands_plateau" #Wooded Badlands Plateau
---| "minecraft:modified_wooded_badlands_plateau" #Modified Wooded Badlands Plateau
---| "minecraft:eroded_badlands" #Eroded Badlands
---| "minecraft:dripstone_caves" #Dripstone Caves
---| "minecraft:lush_caves" #Lush Caves
---| "minecraft:nether_wastes" #Nether Wastes
---| "minecraft:crimson_forest" #Crimson Forest
---| "minecraft:warped_forest" #Warped Forest
---| "minecraft:soul_sand_valley" #Soul Sand Valley
---| "minecraft:basalt_deltas" #Basalt Deltas
---| "minecraft:the_end" #The End
---| "minecraft:small_end_islands" #Small End Islands
---| "minecraft:end_midlands" #End Midlands
---| "minecraft:end_highlands" #End Highlands
---| "minecraft:end_barrens" #End Barrens
---| "minecraft:the_void" #The Void
---@alias BiomePrecipitationType
---| "NONE"
---| "RAIN"
---| "SNOW"
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---Functions relating to biomes
biome = {}
---Returns a biome table of the biome id.
---@param biome BiomeID
---@param pos VectorPos
---@return Biome
function biome.getBiome(biome, pos) end

1643
.vscode/figura/block.lua vendored Normal file

File diff suppressed because one or more lines are too long

45
.vscode/figura/camera.lua vendored Normal file
View file

@ -0,0 +1,45 @@
--================================================================================================--
--===== CLASSES ================================================================================--
--================================================================================================--
---A camera that displays whatever is in front of it to the player's screen.
---@class Camera
local Camera = {}
---Returns the current pivot of the camera.
---@return VectorPos
function Camera.getPivot() end
---Returns the current position of the camera.
---@return VectorPos
function Camera.getPos() end
---Returns the current rotation of the camera.
---@return VectorAng
function Camera.getRot() end
---Sets the pivot point of the camera.
---@param pos VectorPos
function Camera.setPivot(pos) end
---Sets the position of the camera.
---@param pos VectorPos
function Camera.setPos(pos) end
---Sets the rotation of the camera.
---@param ang VectorAng
function Camera.setRot(ang) end
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---A table containing the firstperson and thirdperson cameras.
camera = {
---The firstperson camera.
FIRST_PERSON = Camera,
---The thirdperson camera.
THIRD_PERSON = Camera
}

34
.vscode/figura/chat.lua vendored Normal file
View file

@ -0,0 +1,34 @@
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---Contains functions relating to the chat.
chat = {}
---Retrieves a message from chat.
---Messages are ordered from bottom to top, starting at 1.
---
---Returns `nil` if there is no message at the given location.
---@param num number
---@return string?
function chat.getMessage(num) end
---Returns if the chat is currently open.
---@return boolean
function chat.isOpen() end
---Sends a message as the current player.
---
---This only works on the host.
---@param str string
function chat.sendMessage(str) end
---Sets the command prefix to the given string.
---
---Create a function `onCommand(cmd)` to catch custom commands typed into chat.
---@param str? string
function chat.setFiguraCommandPrefix(str) end
---Returns the text from the message input field, or nil if its empty.
---@return string?
function chat.getInputText() end

222
.vscode/figura/client.lua vendored Normal file
View file

@ -0,0 +1,222 @@
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---Contains functions allowing access to client variables.
---Only accessable with the host script.
---For all other players running your script, it will return nil. (except for isHost())
client={}
---Returns whether the first given version is ahead or behind the second given version.
---Both parameters must be valid semantic versions.
---* `-1` if `version < compareTo`
---* `0` if `version == compareTo`
---* `1` if `version > compareTo`
---@param version string
---@param compareTo string
---@return number
function client.checkVersion(version, compareTo) end
---Clears the title and subtitle text.
function client.clearTitle() end
---Returns the most recently shown actionbar text.
---This persists through worlds.
---
---Note: This will cause a VM error if no action bar text has been shown since the game started.
---@return string
function client.getActionBar() end
---Returns the namespaced ID of the currently active shader.
---Returns nil if no shader is active.
---@return string
function client.getActiveShader() end
---Returns the currently allocated memory in bytes.
---@return number
function client.getAllocatedMemory() end
---Returns the chunk count debug line from the debug screen.
---
---Note: This is not actually the count, this is the entire debug line containing that information
---and may look similar to the example below.
---`"C: 497/15000 (s) D: 12, pC: 000, pU: 00, aB: 12"`
---@return string
function client.getChunksCount() end
---Returns if the crosshair is enabled or not.
---@return boolean
function client.getCrosshairEnabled() end
---Returns the offset of the crosshair.
---Returns nil if it hasn't been set yet.
---@return Vector2
function client.getCrosshairPos() end
---Returns the entity count debug line from the debug screen.
---
---Note: This is not actually the count, this is the entire debug line containing that information
---and may look similar to the example below.
---`"E: 17/83, B: 0, SD: 12"`
---@return string
function client.getEntityCount() end
---Returns the current FOV.
---@return number
function client.getFOV() end
---Returns the frame count debug line from the debug screen.
---
---Note: This is not actually the FPS, this is the entire debug line containing that information
---and may look similar to the example below.
---`"67 fps T: 120 vsyncfancy fancy-clouds B: 2"`
---@return string
function client.getFPS() end
---Returns the GUI scale as set in Minecraft's settings.
---Auto is `0`.
---@return number
function client.getGUIScale() end
---Returns if there are any Iris Shaders active.
---@return boolean
function client.getIrisShadersEnabled() end
---Returns the version of Java currently running.
---@return string
function client.getJavaVersion() end
---Returns the maximum allowed allocated memory in bytes.
---@return number
function client.getMaxMemory() end
---Returns the currently used memory in bytes.
---@return number
function client.getMemoryInUse() end
---Returns the position of the mouse from the top left corner in pixels.
---@return Vector2
function client.getMousePos() end
---Returns the most recent direction the scroll wheel has scrolled.
---Calling this function resets the scroll wheel's direction back to neutral.
---* Neutral: `0`
---* Up: `1`
---* Down: `-1`
---@return number
function client.getMouseScroll() end
---Returns the name of the currently open GUI.
---
---Note: This is *not* the ID of the GUI, it is the display name. This can be changed on certain
---blocks by renaming them in an anvil.
---@return string
function client.getOpenScreen() end
---Returns the number of particles as a string.
---@return string
function client.getParticleCount() end
---Returns the GUI scale.
---This might not be the same as the GUI scale set in Minecraft's settings due to a small window or
---the GUI scale being set to `Auto`.
---@return number
function client.getScaleFactor() end
---Returns the size of the window scaled by the GUI scale.
---@return Vector2
function client.getScaledWindowSize() end
---Returns the brand of the server.
---@return string
function client.getServerBrand() end
---Returns the sound count debug line from the debug screen.
---
---Note: This is not actually the count, this is (almost) the entire debug line containing that
---information and may look similar to the example below.
---`"Sounds: 1/247 + 0/8"`
---@return string
function client.getSoundCount() end
---Returns the most recently shown subtitle.
---
---Note: This will cause a VM error if no subtitle has been shown since the game started or since
---`.clearTitle()` was last called.
---@return string
function client.getSubtitle() end
---Returns the amount of miliseconds since the Unix Epoch.
---@return number
function client.getSystemTime() end
---Returns the most recently shown title.
---
---Note: This will cause a VM error if no title has been shown since the game started or since
---`.clearTitle()` was last called.
---@return string
function client.getTitle() end
---Returns the version number of Minecraft as a string.
---@return string
function client.getVersion() end
---Returns the "type" of Minecraft currently running.
---This is usually the currently running mod loader.
---@return string
function client.getVersionType() end
---Returns the size of the Minecraft window in pixels
---@return Vector2
function client.getWindowSize() end
---Returns if the game instance running the script is the player with the avatar.
---@return boolean
function client.isHost() end
---Returns if the hud is visible or not using the F1 key.
---@return boolean
function client.isHudEnabled() end
---Returns if the singleplayer world is paused.
---Multiplayer games cannot be paused.
---@return boolean
function client.isPaused() end
---Returns if the Minecraft window is focused.
---@return boolean
function client.isWindowFocused() end
---Sets the text of the actionbar and shows it.
---@param text string
function client.setActionbar(text) end
---Sets the visibility of the crosshair.
---@param bool boolean
function client.setCrosshairEnabled(bool) end
---Moves the crosshair by the given offset.
---
---This does not change the player's aim direction.
---@param offset Vector2
function client.setCrosshairPos(offset) end
---Sets if the mouse is forced to be unlocked during normal gameplay.
---
---Locking the mouse in some GUIs closes them.
---@param bool boolean
function client.setMouseUnlocked(bool) end
---Sets the subtitle of the title. Does not show the title or subtitle.
---@param text string
function client.setSubtitle(text) end
---Set the text of the title and shows the title and subtitle.
---@param text string
function client.setTitle(text) end
---Sets the fade durations for the title/subtitle.
---@param fadeIn number
---@param hold number
---@param fadeOut number
function client.setTitleTimes(fadeIn, hold, fadeOut) end

49
.vscode/figura/data.lua vendored Normal file
View file

@ -0,0 +1,49 @@
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---Contains functions involving saving and loading data to and from files.
---It uses the avatar name as the default file name.
---
---Data files can be found at `./minecraft/figura/stored_vars`
data = {}
---Sets if you are allowed to appear in `world.getPlayers()`.
---
---This is enabled by default.
---@param bool boolean
function data.allowTracking(bool) end
---Completely removes the active data file.
function data.deleteFile() end
---Gets the name of the active data file.
---@return string
function data.getName() end
---Returns if you are allowed to appear in `world.getPlayers()`.
---@return boolean
function data.hasTracking() end
---Returns a value from the given key in the active data file.
---Returns nil if the key does not exist.
---@param key string
---@return string|table|Vector
function data.load(key) end
---Returns a table containing all the saved variables in the active data file.
---@return table<string, string|table|Vector>
function data.loadAll() end
---Removes the given key from the active data file.
---@param key string
function data.remove(key) end
---Save a value in the active data file.
---@param key string
---@param value any
function data.save(key, value) end
---Makes a different file the active data file.
---@param name string
function data.setName(name) end

526
.vscode/figura/entity.lua vendored Normal file
View file

@ -0,0 +1,526 @@
--================================================================================================--
--===== CLASSES ================================================================================--
--================================================================================================--
---A Minecraft dimension identifier.
---
---Only the default Minecraft dimensions are auto-completed.
---You can use any dimension from any mod, even if it does not auto-complete.
---@alias DimensionID
---| "minecraft:overworld"
---| "minecraft:the_nether"
---| "minecraft:the_end"
---An equipment slot.
---@alias EquipmentSlot
---| 1 #Main Hand
---| 2 #Off Hand
---| 3 #Feet
---| 4 #Legs
---| 5 #Chest
---| 6 #Head
---A Minecraft entity identifier.
---
---Only the default Minecraft entities are auto-completed.
---You can use any entity from any mod, even if it does not auto-complete.
---@alias EntityID
---| "minecraft:axolotl" #Axolotl
---| "minecraft:bat" #Bat
---| "minecraft:bee" #Bee
---| "minecraft:blaze" #Blaze
---| "minecraft:cat" #Cat
---| "minecraft:cave_spider" #Cave Spider
---| "minecraft:chicken" #Chicken
---| "minecraft:cod" #Cod
---| "minecraft:cow" #Cow
---| "minecraft:creeper" #Creeper
---| "minecraft:dolphin" #Dolphin
---| "minecraft:donkey" #Donkey
---| "minecraft:drowned" #Drowned
---| "minecraft:elder_guardian" #Elder Guardian
---| "minecraft:ender_dragon" #Ender Dragon
---| "minecraft:enderman" #Enderman
---| "minecraft:endermite" #Endermite
---| "minecraft:evoker" #Evoker
---| "minecraft:fox" #Fox
---| "minecraft:ghast" #Ghast
---| "minecraft:giant" #Giant
---| "minecraft:glow_squid" #Glow Squid
---| "minecraft:goat" #Goat
---| "minecraft:guardian" #Guardian
---| "minecraft:hoglin" #Hoglin
---| "minecraft:horse" #Horse
---| "minecraft:husk" #Husk
---| "minecraft:illusioner" #Illusioner
---| "minecraft:iron_golem" #Iron Golem
---| "minecraft:llama" #Llama
---| "minecraft:magma_cube" #Magma Cube
---| "minecraft:mooshroom" #Mooshroom
---| "minecraft:mule" #Mule
---| "minecraft:ocelot" #Ocelot
---| "minecraft:panda" #Panda
---| "minecraft:parrot" #Parrot
---| "minecraft:phantom" #Phantom
---| "minecraft:pig" #Pig
---| "minecraft:piglin_brute" #Piglin Brute
---| "minecraft:piglin" #Piglin
---| "minecraft:pillager" #Pillager
---| "minecraft:polar_bear" #Polar Bear
---| "minecraft:pufferfish" #Pufferfish
---| "minecraft:rabbit" #Rabbit
---| "minecraft:ravager" #Ravager
---| "minecraft:salmon" #Salmon
---| "minecraft:sheep" #Sheep
---| "minecraft:shulker" #Shulker
---| "minecraft:silverfish" #Silverfish
---| "minecraft:skeleton_horse" #Skeleton Horse
---| "minecraft:skeleton" #Skeleton
---| "minecraft:slime" #Slime
---| "minecraft:snow_golem" #Snow Golem
---| "minecraft:spider" #Spider
---| "minecraft:squid" #Squid
---| "minecraft:stray" #Stray
---| "minecraft:strider" #Strider
---| "minecraft:trader_llama" #Trader Llama
---| "minecraft:tropical_fish" #Tropical Fish
---| "minecraft:turtle" #Turtle
---| "minecraft:vex" #Vex
---| "minecraft:villager" #Villager
---| "minecraft:vindicator" #Vindicator
---| "minecraft:wandering_trader" #Wandering Trader
---| "minecraft:witch" #Witch
---| "minecraft:wither_skeleton" #Wither Skeleton
---| "minecraft:wither" #Wither
---| "minecraft:wolf" #Wolf
---| "minecraft:zoglin" #Zoglin
---| "minecraft:zombie_horse" #Zombie Horse
---| "minecraft:zombie_villager" #Zombie Villager
---| "minecraft:zombie" #Zombie
---| "minecraft:zombified_piglin" #Zombified Piglin
---An entity animation.
---@alias EntityAnimation
---| "STANDING" #All: Default animation.
---| "FALL_FLYING" #Player: Using elytra.
---| "SLEEPING" #Player: Is sleeping in a bed.
---| "SWIMMING" #Player: Sprint swimming.
---| "SPIN_ATTACK" #Player: Flying with trident.
---| "CROUCHING" #Player: Sneaking.
---| "DYING" #Player: Falling over death animation.
---A damage source name.
---
---Only the default Minecraft damage sources are auto-completed.
---You can use any damage source, even if it does not auto-complete.
---@alias DamageSource
---| "anvil" #Anvil
---| "arrow" #Arrow
---| "badRespawnPoint" #Exploding bed or respawn
---| "cactus" #Contact with cactus
---| "cramming" #Entity cramming
---| "dragonBreath" #Dragon Breath (Unused, the dragon breath attack does magic damage.)
---| "drown" #Drowning
---| "dryout" #Squid air suffocation
---| "even_more_magic" #Unused
---| "explosion" #Explosion
---| "explosion.player" #Explosion caused by something else
---| "fall" #Falling
---| "fallingBlock" #Hit by falling block
---| "fallingStalactite" #Hit by a falling stalactite
---| "fireworks" #Firework explosion
---| "flyIntoWall" #Elytra gliding too fast into a wall
---| "freeze" #Freezing in powder snow
---| "generic" #Unknown damage
---| "hotFloor" #Magma block
---| "indirectMagic" #Indirectly hit with magic
---| "inFire" #Standing in a fire block
---| "inWall" #Suffocation
---| "lava" #Swimming in lava
---| "lightingBolt" #Struck by lightning
---| "magic" #Directly hit with magic
---| "mob" #Attacked by an entity
---| "onFire" #Burning
---| "outOfWorld" #Void or /kill
---| "player" #Attacked by a player
---| "stalagmite" #Falling on a stalagmite
---| "starve" #Starvation
---| "sting" #Bee Sting
---| "sweetBerryBush" #Contact with sweet berry bush
---| "thorns" #Thorns enchantment
---| "thrown" #Thrown projectile
---| "trident" #Trident
---| "wither" #Wither effect
---| "witherSkull" #Wither skull projectile
---A Minecraft status effect identifier.
---
---Only the default Minecraft status effects are auto-completed.
---You can use any status effect from any mod, even if it does not auto-complete.
---@alias StatusEffectID
---| "minecraft:absorption" #Absorption
---| "minecraft:bad_omen" #Bad Omen
---| "minecraft:blindness" #Blindness
---| "minecraft:conduit_power" #Conduit Power
---| "minecraft:dolphins_grace" #Dolphin's Grace
---| "minecraft:fire_resistance" #Fire Resistance
---| "minecraft:glowing" #Glowing
---| "minecraft:haste" #Haste
---| "minecraft:health_boost" #Health Boost
---| "minecraft:hero_of_the_village" #Hero of the Village
---| "minecraft:hunger" #Hunger
---| "minecraft:instant_health" #Instant Health
---| "minecraft:instant_damage" #Instant Damage
---| "minecraft:invisibility" #Invisibility
---| "minecraft:jump_boost" #Jump Boost
---| "minecraft:levitation" #Levitation
---| "minecraft:luck" #Luck
---| "minecraft:mining_fatigue" #Mining Fatigue
---| "minecraft:nausea" #Nausea
---| "minecraft:night_vision" #Night Vision
---| "minecraft:poison" #Poison
---| "minecraft:regeneration" #Regeneration
---| "minecraft:resistance" #Resistance
---| "minecraft:saturation" #Saturation
---| "minecraft:slow_falling" #Slow Falling
---| "minecraft:slowness" #Slowness
---| "minecraft:speed" #Speed
---| "minecraft:strength" #Strength
---| "minecraft:unluck" #Bad Luck
---| "minecraft:water_breathing" #Water Breathing
---| "minecraft:weakness" #Weakness
---| "minecraft:wither" #Wither
---@alias PlayerGamemode
---| "SURVIVAL"
---| "CREATIVE"
---| "ADVENTURE"
---| "SPECTATOR"
---A `table` containing the duration and amplifier of a status effect.
---@class StatusEffect
---@field amplifier number #The effect's level.
---@field duration number #The amount of ticks remaining.
---A hand slot.
---@alias HandSlot
---| 1 #Main Hand
---| 2 #Off Hand
---String literal of Hand
---@alias HandString
---| "MAIN_HAND"
---| "OFF_HAND"
---A non-living entity.
---@class Entity
local Entity = {}
---Returns the ticks of air this entity has left.
---@return number
function Entity.getAir() end
---Returns the remaining air of this entity as a percentage. (`0..1`)
---@return number
function Entity.getAirPercentage() end
---Returns the currently playing animation of this entity.
---@return EntityAnimation string
function Entity.getAnimation() end
---Returns the size of this entity's bounding box in blocks.
---@return Vector3
function Entity.getBoundingBox() end
---Returns the item in this entity's given equipment slot.
---
---Note: An empty slot will still return an `ItemStack` of air.
---@param slot EquipmentSlot
---@return ItemStack
function Entity.getEquipmentItem(slot) end
---Returns the height from the base of this entity to their eye level in blocks.
---@return number
function Entity.getEyeHeight() end
---Returns the world coords of the entity's eyes.
---@return VectorPos
function Entity.getEyeY() end
---Returns how long this entity will be on fire for.
---If this number is negative, it is how long the entity is immune to being set on fire.
---@return number
function Entity.getFireTicks() end
---Returns the amount of ticks this entity has been frozen in deep snow for.
---
---Note: Always returns `0` if playing on 1.16.
---@return number
function Entity.getFrozenTicks() end
---Returns the normalized direction that this entity is looking in.
---@return VectorPos
function Entity.getLookDir() end
---Returns the maximum air this entity can have.
---@return number
function Entity.getMaxAir() end
---Returns this entity's display name.
---
---Note: Returns the entity's translated name if it has no custom name.
---@return string
function Entity.getName() end
---Returns an NBT value from this entity using the given SNBT path.
---
---`List`, `Compound`, `Byte_Array`, `Int_Array`, `Long_Array` tags return a `table`.
---`Byte`, `Short`, `Int`, `Long`, `Float`, and `Double` tags return a `number`.
---`String` tags return a `string`.
---@param nbtpath string
---@return string|number|table
function Entity.getNbtValue(nbtpath) end
---Returns the position of this entity.
---@param delta? number
---@return VectorPos
function Entity.getPos(delta) end
---Returns the rotation of this entity.
---
---Note: When used on the local player, the yaw will build up past the normal limits when in first
---person.
---@param delta? number
---@return VectorAng
function Entity.getRot(delta) end
---Returns the position of the block this entity is looking at.
---Returns `nil` if not looking at any blocks.
---@param targetLiquid boolean
---@return VectorPos?
function Entity.getTargetedBlockPos(targetLiquid) end
---Returns the entity identifier of this entity.
---@return EntityID string
function Entity.getType() end
---Returns the UUID4 of this entity.
---@return string
function Entity.getUUID() end
---Returns the entity that this entity is riding.
---@return (Entity|LivingEntity|Player)?
function Entity.getVehicle() end
---Returns the velocity of this entity.
---@return VectorPos
function Entity.getVelocity() end
---Returns the dimension identifier of the world this entity is in.
---@return DimensionID string
function Entity.getWorldName() end
---Returns if the entity has a Figura avatar.
---@return boolean
function Entity.hasAvatar() end
---Returns if the entity is glowing.
---@return boolean
function Entity.isGlowing() end
---Returns if the entity is a Hamburger.
---@return boolean
---function Entity.isHamburger() end
---Returns if the entity is touching lava.
---@return boolean
function Entity.isInLava() end
---Returns if the entity has contact with rain.
---@return boolean
function Entity.isInRain() end
---Returns if the entity is invisible.
---@return boolean
function Entity.isInvisible() end
---Returns if this entity is standing on solid ground.
---@return boolean
function Entity.isOnGround() end
---Returns if the entity has the silent NBT tag.
---@return boolean
function Entity.isSilent() end
---Returns if the entity is sneaking.
---@return boolean
function Entity.isSneaking() end
---Returns if this entity is sneaky.
---@return boolean
function Entity.isSneaky() end
---Returns is the entity is sprinting.
---@return boolean
function Entity.isSprinting() end
---Returns if the entity has contact with water or waterlogged blocks.
---@return boolean
function Entity.isTouchingWater() end
---Returns if the entity is fully submerged in water.
---@return boolean
function Entity.isUnderwater() end
---Returns if this entity is being rained on or in water.
---@return boolean
function Entity.isWet() end
---LivingEntity ⇐ Entity
---***
---A living entity.
---@class LivingEntity : Entity
local LivingEntity = {}
---Returns which hand is active.
---Active hand is determined by the last hand to use an item.
---Returns nil if no item has been used.
---@return HandString?
function LivingEntity.getActiveHand() end
---Returns the item that is currently being used.
---@return ItemStack
function LivingEntity.getActiveItem() end
---Returns the total armor value of this entity.
---
---Note: Some entities have natural armor that is added on top of the armor they are wearing.
---@return number
function LivingEntity.getArmor() end
---Returns the yaw of this entity's body.
---@param delta? number
---@return number
function LivingEntity.getBodyYaw(delta) end
---Returns how long this entity has been dead for in ticks.
---An entity is deleted after being dead for 20 ticks.
---@return number
function LivingEntity.getDeathTime() end
---Returns the current health of this entity.
---@return number
function LivingEntity.getHealth() end
---Returns the current health of this entity as a percentage. (`0..1`)
---@return number
function LivingEntity.getHealthPercentage() end
---Returns the max health of this entity.
---@return number
function LivingEntity.getMaxHealth() end
---Returns the duration and amplifier of the given status effect on this entity.
---Returns `nil` if the given status effect does not exist on this entity.
---@param effect StatusEffectID
---@return StatusEffect
function LivingEntity.getStatusEffect(effect) end
---Returns a list of all status effects on this entity.
---@return StatusEffectID[]
function LivingEntity.getStatusEffectTypes() end
---Returns the amount of stingers stuck in this entity.
---@return number
function LivingEntity.getStingerCount() end
---Returns the amount of arrows stuck in this entity.
---@return number
function LivingEntity.getStuckArrowCount() end
---Returns if the entity is climbing.
---@return boolean
function LivingEntity.isClimbing() end
---Returns if this entity is left-handed.
---@return boolean
function LivingEntity.isLeftHanded() end
---Returns if this entity is using an item.
---@return boolean
function LivingEntity.isUsingItem() end
---Player ⇐ LivingEntity ⇐ Entity
---***
---A player entity.
---@class Player : LivingEntity
local Player = {}
---Returns the current level of this entity.
---@return number
function Player.getExperienceLevel() end
---Returns the progress between this entity's current level and next level as a percentage. (`0..1`)
---@return number
function Player.getExperienceProgress() end
---Returns the amount of hunger this entity has.
---@return number
function Player.getFood() end
---Returns the player's gamemode as a string.
---@return PlayerGamemode
function Player.getGamemode() end
---Returns an item held in this entity's hands.
---Returns `nil` if the slot is empty.
---@param slot HandSlot
---@return ItemStack?
function Player.getHeldItem(slot) end
---Returns the vanilla model type, either "default" or "slim".
---@return "default"|"slim"
function Player.getModelType() end
---Returns the amount of saturation this entity has.
---@return number
function Player.getSaturation() end
---Returns the cross-script value stored in the player at the specified key.
---@param key string
---@return any
function Player.getStoredValue(key) end
---Returns the table of the entity under the crosshair.
---
---Note: This only works if the `Player` is the player running the current instance of the script.
---@return (Entity|LivingEntity|Player)?
function Player.getTargetedEntity() end
---Returns if the player is flying via creative flight.
---@return boolean
function Player.isFlying() end
---Returns the last source of damage this entity has taken.
---
---Note: Does not work unless the server is running Figura. (LAN or Integrated server.)
---@return DamageSource string
function Player.lastDamageSource() end
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---The player linked to this script.
---
---Note: This table is unreadable until `player_init()` has run.
---@type Player
player = {}
---Stores the value in the player executing the script at the specified key.
---@param key string
---@param value any
function storeValue(key, value) end

1247
.vscode/figura/item_stack.lua vendored Normal file

File diff suppressed because it is too large Load diff

250
.vscode/figura/keybind.lua vendored Normal file
View file

@ -0,0 +1,250 @@
--================================================================================================--
--===== CLASSES ================================================================================--
--================================================================================================--
---A button on the keyboard or mouse.
---@alias Key
---| "0"
---| "1"
---| "2"
---| "3"
---| "4"
---| "5"
---| "6"
---| "7"
---| "8"
---| "9"
---| "A"
---| "B"
---| "C"
---| "D"
---| "E"
---| "F"
---| "G"
---| "H"
---| "I"
---| "J"
---| "K"
---| "L"
---| "M"
---| "N"
---| "O"
---| "P"
---| "Q"
---| "R"
---| "S"
---| "T"
---| "U"
---| "V"
---| "W"
---| "X"
---| "Y"
---| "Z"
---| "RIGHT"
---| "LEFT"
---| "DOWN"
---| "UP"
---| "F1"
---| "F2"
---| "F3"
---| "F4"
---| "F5"
---| "F6"
---| "F7"
---| "F8"
---| "F9"
---| "F10"
---| "F11"
---| "F12"
---| "F13"
---| "F14"
---| "F15"
---| "F16"
---| "F17"
---| "F18"
---| "F19"
---| "F20"
---| "F21"
---| "F22"
---| "F23"
---| "F24"
---| "F25"
---| "KP_0"
---| "KP_1"
---| "KP_2"
---| "KP_3"
---| "KP_4"
---| "KP_5"
---| "KP_6"
---| "KP_7"
---| "KP_8"
---| "KP_9"
---| "KP_MULTIPLY"
---| "KP_DIVIDE"
---| "KP_SUBTRACT"
---| "KP_ADD"
---| "KP_DECIMAL"
---| "KP_ENTER"
---| "KP_EQUAL"
---| "MOUSE_BUTTON_1"
---| "MOUSE_BUTTON_2"
---| "MOUSE_BUTTON_3"
---| "MOUSE_BUTTON_4"
---| "MOUSE_BUTTON_5"
---| "MOUSE_BUTTON_6"
---| "MOUSE_BUTTON_7"
---| "MOUSE_BUTTON_8"
---| "SPACE"
---| "APOSTROPHE"
---| "GRAVE_ACCENT"
---| "_"
---| "COMMA"
---| "MINUS"
---| "PERIOD"
---| "SLASH"
---| "SEMICOLON"
---| "EQUAL"
---| "BACKSLASH"
---| "LEFT_BRACKET"
---| "RIGHT_BRACKET"
---| "UNKNOWN"
---| "PAGE_UP"
---| "PAGE_DOWN"
---| "END"
---| "CAPS_LOCK"
---| "SCROLL_LOCK"
---| "NUM_LOCK"
---| "PAUSE"
---| "WORLD_1"
---| "WORLD_2"
---| "ESCAPE"
---| "ENTER"
---| "TAB"
---| "BACKSPACE"
---| "PRINT_SCREEN"
---| "LEFT_SHIFT"
---| "LEFT_CONTROL"
---| "LEFT_ALT"
---| "LEFT_SUPER"
---| "RIGHT_SHIFT"
---| "RIGHT_CONTROL"
---| "RIGHT_ALT"
---| "RIGHT_SUPER"
---| "MENU"
---| "INSERT"
---| "DELETE"
---| "HOME"
---A keybind registered by Minecraft or a mod.
---This value is not limited to keybinds registered by Minecraft, any keybind registered by a mod
---will also work (but will not be auto-completed here.)
---@alias MinecraftKeybind
---| "key.jump" #Movement: Jump
---| "key.sneak" #Movement: Sneak
---| "key.sprint" #Movement: Sprint
---| "key.left" #Movement: Strafe Left
---| "key.right" #Movement: Strafe Right
---| "key.back" #Movement: Walk Backwards
---| "key.forward" #Movement: Walk Forwards
---| "key.attack" #Gameplay: Attack/Destroy
---| "key.pickItem" #Gameplay: Pick Block
---| "key.use" #Gameplay: Use Item/Place Block
---| "key.drop" #Inventory: Drop Selected Item
---| "key.hotbar.1" #Inventory: Hotbar Slot 1
---| "key.hotbar.2" #Inventory: Hotbar Slot 2
---| "key.hotbar.3" #Inventory: Hotbar Slot 3
---| "key.hotbar.4" #Inventory: Hotbar Slot 4
---| "key.hotbar.5" #Inventory: Hotbar Slot 5
---| "key.hotbar.6" #Inventory: Hotbar Slot 6
---| "key.hotbar.7" #Inventory: Hotbar Slot 7
---| "key.hotbar.8" #Inventory: Hotbar Slot 8
---| "key.hotbat.9" #Inventory: Hotbar Slot 9
---| "key.inventory" #Inventory: Open/Close Inventory
---| "key.swapOffHand" #Inventory: Swap Item With Offhand
---| "key.loadToolbarActivator" #Creative Mode: Load Hotbar Activator
---| "key.saveToolbarActivator" #Creative Mode: Save Hotbar Activator
---| "key.playerlist" #Multiplayer: List Players
---| "key.chat" #Multiplayer: Open Chat
---| "key.command" #Multiplayer: Open Command
---| "key.socialInteractions" #Multiplayer: Social Interactions Screen
---| "key.advancements" #Miscellaneous: advancements
---| "key.spectatorOutlines" #Miscellaneous: Highlight Players (Spectators)
---| "key.screenshot" #Miscellaneous: Take Screenshot
---| "key.smoothCamera" #Miscellaneous: Toggle Cinematic Camera
---| "key.fullscreen" #Miscellaneous: Toggle Fullscreen
---| "key.togglePerspective" #Miscellaneous: Toggle Perspective
---A keybind that is bound to a key.
---You can use this to determine when you are pressing a key or registered control.
---@class Keybind
local Keybind = {}
---Returns if the key was pressed. Handled as if the key was being typed into a text box.
---
---When holding, `.wasPressed()` returns `true` for 1 tick, then returns `false` for 9 ticks, then
---returns `true` until the button is released (plus some undefined extra ticks based on how long
---the key was held.)
---@return boolean
function Keybind.wasPressed() end
---Returns if the key is being pressed this tick.
---@return boolean
function Keybind.isPressed() end
---Returns the current key bound to this keybind.
---@return Key
function Keybind.getKey() end
---Returns the name of the keybind.
---@return string
function Keybind.getName() end
---FiguraKeybind ⇐ Keybind
---***
---A custom keybind created by the script.
---These binds can be changed by the player later in Figura's keybind menu.
---@class FiguraKeybind : Keybind
local FiguraKeybind = {}
---Rebinds the keybind to the given key.
---@param key Key
function FiguraKeybind.setKey(key) end
---Resets the half-second delay from wasPressed()
function FiguraKeybind.reset() end
---RegisteredKeybind ⇐ Keybind
---***
---A keybind registered by Minecraft or another mod.
---These binds are changed Minecraft's controls menu.
---@class RegisteredKeybind : Keybind
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---Contains functions for working with keybinds.
keybind = {}
---Returns a list of all valid keys.
---@return Key[]
function keybind.getKeyList() end
---Returns a list of all keybinds.
---@return Keybind[]
function keybind.getRegisteredKeyList() end
---Returns a value that represents a registered keybind.
---
---Any registered keybind by both Minecraft and mods can be used.
---@param bind MinecraftKeybind
---@return RegisteredKeybind
function keybind.getRegisteredKeybind(bind) end
---Returns a new named keybind that can be tracked.
---@param name string
---@param key Key
---@param persistent? boolean If set to true, keybind will be detected even if a gui is open such as chat/inventory.
---@return FiguraKeybind
function keybind.newKey(name, key, persistent) end

21
.vscode/figura/math.lua vendored Normal file
View file

@ -0,0 +1,21 @@
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---Interpolates numbers or vectors between a and b.
---
---Will not accept a raw table as input.
---Use vectors.of() to convert from raw table to vector table.
---@generic T : number|Vector
---@param a T
---@param b T
---@param delta number
---@return T
function math.lerp(a, b, delta) end
---Returns a value that never goes below min or above max.
---@param val number
---@param min number
---@param max number
---@return number
function math.clamp(val, min, max) end

135
.vscode/figura/meta.lua vendored Normal file
View file

@ -0,0 +1,135 @@
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---Contains functions involving Figura's more technical parts such as limits, the version, and the
---current count of certain things.
meta = {}
---Returns the animation limit in this client's instance of the script.
---@return integer
function meta.getAnimationLimit() end
---Returns a number based on the current status of the Figura backend.
---@return
---| 2 #Disconnected
---| 3 #Connecting
---| 4 #Connected
function meta.getBackendStatus() end
---Returns if the player can use custom render layers (shaders).
---@return boolean
function meta.getCanHaveCustomRenderLayer() end
---Returns if the nameplate can be modified in this client's instance of the script.
---
---This is affected by the "Nameplate/Chat Name Changes" trust setting.
---@return boolean
function meta.getCanModifyNameplate() end
---Returns if the vanilla playermodel can be edited in this client's instance of the script.
---
---This is affected by the "Vanilla Avatar Changes" trust setting.
---@return boolean
function meta.getCanModifyVanilla() end
---Returns the complexity limit in this client's instance of the script.
---
---This is affected by the "Max Complexity" trust setting.
---@return integer
function meta.getComplexityLimit() end
---Returns the current animation complexity.
---@return integer
function meta.getCurrentAnimationCount() end
---Returns the current complexity of the avatar in this client's instance of the script.
---
---The complexity is the amount of verticies being rendered on the client's screen.
---@return integer
function meta.getCurrentComplexity() end
---Returns the amount of particles the avatar is creating per second in this client's instance of
---the script.
---@return integer
function meta.getCurrentParticleCount() end
---Returns the amount of render instructions the avatar is running in this client's instance of the
---script at this frame.
---
---The amount of render instructions is affected by whatever is running in the `render()` function.
---@return integer
function meta.getCurrentRenderCount() end
---Returns the amount of sounds the avatar is emitting per second in this client's instance of the
---script.
---@return integer
function meta.getCurrentSoundCount() end
---Returns the amount of tick instruction the avatar is running in this client's instance of the
---script at this tick.
---
---The amount of tick instructions is affected by whatever is running in the `tick()` function.
---@return integer
function meta.getCurrentTickCount() end
---Returns if the avatar is allowed to render offscreen in this client's instance of the script.
---
---This is affected by the "Offscreen Rendering" trust setting.
---@return boolean
function meta.getDoesRenderOffscreen() end
---Returns the current version of Figura in this client's instance of the script.
---@return string
function meta.getFiguraVersion() end
---Returns the init instruction limit in this client's instance of the script.
---
---This is affected by the "Max Init Instructions" trust setting.
---@return integer
function meta.getInitLimit() end
---Returns a number based on the current status of the model.
---@return
---| 1 #No model
---| 2 #Too big (>100KB)
---| 3 #Big (75KB -100KB)
---| 4 #Normal
function meta.getModelStatus() end
---Returns the particles-per-second limit in this client's instance of the script.
---
---This is affected by the "Maximum Particles Per Second" trust setting.
---@return integer
function meta.getParticleLimit() end
---Returns the render instruction limit in this client's instance of the script.
---
---This is affected by the "Max Render Instructions" trust setting.
---@return integer
function meta.getRenderLimit() end
---Returns a number based on the current status of the script.
---@return
---| 1 #No script
---| 2 #Errored
---| 4 #Normal
function meta.getScriptStatus() end
---Returns the sounds-per-second limit in this client's instance of the script.
---
---This is affected by the "Maximum Sounds Per Second" trust setting.
---@return integer
function meta.getSoundLimit() end
---Returns a number based on the current status of the texture.
---@return
---| 1 #No texture
---| 4 #Normal
function meta.getTextureStatus() end
---Returns the tick instruction limit in this client's instance of the script.
---
---This is affected by the "Max Tick Instructions" trust setting.
---@return integer
function meta.getTickLimit() end

510
.vscode/figura/model.lua vendored Normal file
View file

@ -0,0 +1,510 @@
--================================================================================================--
--===== CLASSES ================================================================================--
--================================================================================================--
---The sides of a cube.
---@alias CubeSide
---| "NORTH"
---| "SOUTH"
---| "EAST"
---| "WEST"
---| "UP"
---| "DOWN"
---| "ALL"
---A parent type that the part will rotate with.
---@alias ParentType
---| "None" #Rotate with the origin of the player.
---| "WORLD" #Rotate with the world.
---| "Model" #Rotate with the entire model.
---| "Head" #Rotate with the player's head.
---| "Torso" #Rotate with the player's body.
---| "LeftArm" #Rotate with the player's left arm.
---| "RightArm" #Rotate with the player's right arm.
---| "LeftLeg" #Rotate with the player's left leg.
---| "RightLeg" #Rotate with the player's right leg.
---| "LeftItemOrigin" #Rotate with the player's left held item.
---| "RightItemOrigin" #Rotate with the player's right held item.
---| "LeftElytraOrigin" #Rotate with the player's left elytra wing's origin.
---| "RightElytraOrigin" #Rotate with the player's right elytra wing's origin.
---| "LeftParrotOrigin" #Rotate with the player's left parrot spot.
---| "RightParrotOrigin" #Rotate with the player's right parrot spot.
---| "LeftElytra" #Rotate with the player's left elytra wing.
---| "RightElytra" #Rotate with the player's right elytra wing.
---| "Camera" #Rotate to always face the camera.
---The possible types of a CustomModelPart
---@alias CustomModelPartType
---| "CUBE"
---| "GROUP"
---| "MESH"
---@alias Shader
---| "None" #Do not use a shader.
---| "EndPortal" #Use the end portal shader.
---| "Glint" #Use the enchantment glint.
---@alias TextureType
---| "Custom" #The custom texture suplied with the avatar.
---| "Skin" #Your Minecraft skin.
---| "Cape" #Your cape, or Steve if you dont have a cape.
---| "Elytra" #Your elytra texture (NOT the cape-provided elytra!) (vanilla probably dont even use it at all)
---| "Resource" #Any loaded texture including resource packs! or missing texture if not found.
---A basic model part with very few options for modifying it.
---@class BasicModelPart
local BasicModelPart = {}
---Returns if the part is enabled or not.
---Returns `nil` if the part has not been toggled with `.setEnabled()` yet.
---
---If the function returns `nil` assume the part is enabled.
---@return boolean?
function BasicModelPart.getEnabled() end
---Returns the position offset of the part.
---Returns `nil` if the part has not been moved with `.setPos()` yet.
---
---If the function returns `nil` assume the part is at `0,0,0`
---@return VectorPos?
function BasicModelPart.getPos() end
---Returns the rotation offset of the part.
---Returns `nil` if the part has not been moved with `.setRot()` yet.
---@return VectorAng?
function BasicModelPart.getRot() end
---Returns the scale of the part set by `.setScale()`.
---@return VectorPos?
function BasicModelPart.getScale() end
---Sets the visibility of the part.
---@param state boolean
function BasicModelPart.setEnabled(state) end
---Sets the position offset of the part.
---@param pos VectorPos
function BasicModelPart.setPos(pos) end
---Sets the rotation offset of the part.
---@param ang VectorAng
function BasicModelPart.setRot(ang) end
---Sets the scale of the part.
---@param pos VectorPos
function BasicModelPart.setScale(pos) end
---VanillaModelPart ⇐ BasicModelPart
---***
---A vanilla model part, has more options than a basic part.
---@class VanillaModelPart : BasicModelPart
local VanillaModelPart = {}
---Returns if the part is enabled before any `.setEnabled()` operations are applied.
---Always seems to return `false`.
---@return boolean
function VanillaModelPart.getOriginEnabled() end
---Returns the part's original position before any `.setPos()` operations are applied.
---@return VectorPos
function VanillaModelPart.getOriginPos() end
---Returns the part's original angle *in radians*.
---If you want the angle in degrees, use `math.deg()` or `<Vector>.toDeg()`.
---@return VectorAng
function VanillaModelPart.getOriginRot() end
---Returns if the part's skin customization setting is enabled.
---Returns `nil` if the part does not have a setting.
---@return boolean?
function VanillaModelPart.isOptionEnabled() end
---The proxy for the `CustomModelPart` class.
---This only exists to fix inheritance of `CustomModelPart`s inside `CustomModelPart`s.
---@class CustomModelPartProxy : BasicModelPart
---@field [string] CustomModelPart
local CustomModelPartProxy = {}
---@class CustomModelPart : CustomModelPartProxy
---CustomModelPart ⇐ BasicModelPart
---***
---A custom model part. These are the parts from the bbmodel file.
---`CustomModelPart`s can contain other `CustomModelPart`s.
---
---Note: Despite the list saying so, a `function` cannot be a `CustomModelPart`! It simply looks
---like that to allow any key to become a `CustomModelPart` if needed.
local CustomModelPart = {}
---Adds a new render task attached to this model part.
---
---Note: This function does not return the render task. Use `<CustomModelPart>.getRenderTask()`
---instead.
---@overload fun(type: "TEXT", name: string, value: string, emissive?: boolean, pos?: VectorPos, rot?: VectorAng, scale?: VectorPos)
---@overload fun(type: "ITEM", name: string, value: ItemStack|ItemID, renderMode: RenderMode, emissive?: boolean, pos?: VectorPos, rot?: VectorAng, scale?: VectorPos, renderLayer?: string)
---@overload fun(type: "BLOCK", name: string, value: BlockState|BlockID, emissive?: boolean, pos?: VectorPos, rot?: VectorAng, scale?: VectorPos, renderLayer?: string)
function CustomModelPart.addRenderTask(type, name, value, ...) end
---Remove ALL render tasks from this part.
function CustomModelPart.clearAllRenderTasks() end
---Returns the sum of all position keyframes at this time.
---@return VectorPos
function CustomModelPart.getAnimPos() end
---Returns the sum of all rotation keyfrmaes at this time.
---@return VectorAng
function CustomModelPart.getAnimRot() end
---Returns the sum of all scale keyframes at this time.
---@return Vector3
function CustomModelPart.getAnimScale() end
---Returns a table containing this part's children.
---@return CustomModelPart[]
function CustomModelPart.getChilderen() end
---Returns the current color of the part.
---The default color is `<1,1,1>`.
---@return VectorColor
function CustomModelPart.getColor() end
---Returns if culling is enabled on the part.
---@return boolean
function CustomModelPart.getCullEnabled() end
---Returns if extra textures such as emissive textures are rendered.
---@return boolean
function CustomModelPart.getExtraTexEnabled() end
---Returns the light value set by `.setLight()`.
---Returns `nil` if it hasn't been set yet.
---@return Vector2?
function CustomModelPart.getLight() end
---Returns if the part is only mimicing its parent part instead of having its origin connected to
---the parent part's origin.
---@return boolean
function CustomModelPart.getMimicMode() end
---Returns the name assigned in Blockbench of this part.
---@return string
function CustomModelPart.getName() end
---Returns the opacity of a part.
---
---Note: Opacity is a value from 0 to 1.
---@return number
function CustomModelPart.getOpacity() end
---Returns the overlay value set by `.setOverlay()`.
---Returns `nil` if it hasn't been set yet.
---@return Vector2?
function CustomModelPart.getOverlay() end
---Returns the parent type of the part.
---@return ParentType
function CustomModelPart.getParentType() end
---Returns the position offset of the part's pivot point.
---@return VectorPos
function CustomModelPart.getPivot() end
---Returns a render task table of the given name, if any
---@param name string
---@return (BlockTaskTable|ItemTaskTable|TextTaskTable)?
function CustomModelPart.getRenderTask(name) end
---Returns the *absolute* rotation of the part.
---
---Note: This does *not* return the rotation offset.
---@return VectorAng
function CustomModelPart.getRot() end
---Returns the shader of the part.
---@return Shader
function CustomModelPart.getShader() end
---Returns the type of texture that the part uses
---@return TextureType
function CustomModelPart.getTexture() end
---Returns the size of the part's texture.
---@return Vector2
function CustomModelPart.getTextureSize() end
---Returns the type of the part.
---@return CustomModelPartType
function CustomModelPart.getType() end
---Returns the UV offset of the part.
---
---Note: This does *not* return the actual UV of the part.
---@return VectorUV
function CustomModelPart.getUV() end
---Returns the UV data of the specified face.
---@param face CubeSide
---@return Vector4
function CustomModelPart.getUVData(face) end
---Takes a `Vector` with a direction relative to the part and returns a `Vector` with the direction
---in world-space.
---@param dir VectorPos
---@return VectorPos
function CustomModelPart.partToWorldDir(dir) end
---*Just a word of caution, this function is very complicated. Do not expect to get how it works
---right from the start.*
---
---Takes a `Vector` with a blockbench position, then:
---* Makes a pivot `x` (which is *not* this part's pivot) at the center of the player's neck.
---* Offsets pivot `x` by this part's Lua position offset,
---* Rotates pivot `x`'s position around this part's `(Lua position offset + Lua pivot offset)`,
---* Adds the given blockbench position to the position of pivot `x`,
---* Rotates the new blockbench position around pivot `x` by the absolute rotation of this part.
---* Converts to an absolute world position and returns that position.
---@param pos VectorPos
---@return VectorPos
function CustomModelPart.partToWorldPos(pos) end
---Removes a render task from this part.
---@param name string
function CustomModelPart.removeRenderTask(name) end
---Sets the color of the model.
---
---Note: The color is set by *tinting* the model, use grayscale textures for best results.
---@param col VectorColor
function CustomModelPart.setColor(col) end
---Enable/disable the inner faces of the part.
---@param boolean boolean
function CustomModelPart.setCullEnabled(boolean) end
---Enable/disable extra texture rendering (ie emissive textures)
---@param boolean boolean
function CustomModelPart.setExtraTexEnabled(boolean) end
---Overrides the light level the part is rendered at.
---Any value below 0 or above 15 will render the part invisible.
---`nil` returns the part to normal.
---
---The first value of the vector controls block light, the second controls sky light.
---@param vector? Vector2
function CustomModelPart.setLight(vector) end
---Sets the mimic mode of the model.
---If true, the model will *mimic* its parent as set by `.setParentType()` instead of having its
---origin connected to the parent part's origin.
---@param state boolean
function CustomModelPart.setMimicMode(state) end
---Sets the opacity of the part.
---
---Note: Opacity is a value from 0 to 1.
---@param num number
function CustomModelPart.setOpacity(num) end
---Overrides the overlay level the part is rendered at.
---Any value below 0 or above 15 will render the part black.
---`nil` returns the part to normal.
---
---The first value controls a white overlay, the second value controls the hurt overlay.
---@param vector? Vector2
function CustomModelPart.setOverlay(vector) end
---Sets the parent type of the part.
---@param parent ParentType
function CustomModelPart.setParentType(parent) end
---Sets the part's pivot point.
---@param vector VectorPos
function CustomModelPart.setPivot(vector) end
---Sets the render layer (custom shader) of the part.
---@param string string
function CustomModelPart.setRenderLayer(string) end
---Sets the *absolute* rotation of the part.
---
---Note: This does *not* set the rotation offset.
---@param ang VectorAng
function CustomModelPart.setRot(ang) end
---Sets the shader of the part.
---@param shader Shader
function CustomModelPart.setShader(shader) end
---Changes which texture is applied to the part.
---`resource` is only needed if the texture type is set to `"Resource"`.
---@param type TextureType
---@param resource? string
function CustomModelPart.setTexture(type, resource) end
---Set the size of the part's texture.
---@param vector Vector2
function CustomModelPart.setTextureSize(vector) end
---Sets the UV offset of the part.
---
---Note: This does *not* set the actual UV of the part.
---@param uv VectorUV
function CustomModelPart.setUV(uv) end
---Sets the UV data of the given side.
---UV's must be in BlockBench format.
---@param face CubeSide
---@param vector Vector4
function CustomModelPart.setUVData(face, vector) end
---Takes a `Vector` with a direction in world-space and returns a `Vector` with the direction
---relative to the part.
---
---Seems to act similar to `.partToWorldDir()`.
---@param dir VectorPos
---@return VectorPos
function CustomModelPart.worldToPartDir(dir) end
---Takes a `Vector` with a a blockbench position and returns a `Vector` with the world position
---relative to the player rotated by the part's rotation.
---@param pos VectorPos
---@return VectorPos
function CustomModelPart.worldToPartPos(pos) end
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---The `table` containing the parts and folders from your blockbench model.
---
---If you want to get the Top hat on your model's head in this example...
---```
---Player
---├ Head
---│ └ TopHat
---└ Body
--- └ Belt
---```
---...then you need to use `model.Player.Head.TopHat` to access it.
---
---Note: Auto-completion does not know what folders and parts you have in your model at first, but
---will learn based on what folders and parts you access yourself.
---If you want autocompletion for model paths, use
---[*Manuel-Underscore*'s Figura VSCode extension](https://marketplace.visualstudio.com/items?itemName=Manuel-Underscore.figura).
---If you use the above extension, guessed parts will have a different icon from parts found in the
---model.
---@type table<string, CustomModelPart>
model = {}
---A `table` containing the vanilla playermodel.
vanilla_model = {
---@type VanillaModelPart
HEAD = {},
---@type VanillaModelPart
HAT = {},
---@type VanillaModelPart
CAPE = {},
---@type VanillaModelPart
TORSO = {},
---@type VanillaModelPart
JACKET = {},
---@type VanillaModelPart
LEFT_ARM = {},
---@type VanillaModelPart
LEFT_SLEEVE = {},
---@type VanillaModelPart
RIGHT_ARM = {},
---@type VanillaModelPart
RIGHT_SLEEVE = {},
---@type VanillaModelPart
LEFT_LEG = {},
---@type VanillaModelPart
LEFT_PANTS_LEG = {},
---@type VanillaModelPart
RIGHT_LEG = {},
---@type VanillaModelPart
RIGHT_PANTS_LEG = {},
---@type VanillaModelPart
LEFT_EAR = {},
---@type VanillaModelPart
RIGHT_EAR = {}
}
---A `table` containing the armor model.
armor_model = {
---@type BasicModelPart
HELMET = {},
---@type BasicModelPart
HEAD_ITEM = {},
---@type BasicModelPart
CHESTPLATE = {},
---@type BasicModelPart
LEGGINGS = {},
---@type BasicModelPart
BOOTS = {}
}
---A `table` containing the elytra model.
elytra_model = {
---@type BasicModelPart
LEFT_WING = {},
---@type BasicModelPart
RIGHT_WING = {}
}
---A `table` containing the held item models.
held_item_model = {
---@type BasicModelPart
LEFT_HAND = {},
---@type BasicModelPart
RIGHT_HAND = {}
}
---A `table` containing the parrot models.
parrot_model = {
---@type BasicModelPart
LEFT_PARROT = {},
---@type BasicModelPart
RIGHT_PARROT = {}
}
---A `table` containing the first person models.
first_person_model = {
---@type BasicModelPart
MAIN_HAND = {},
---@type BasicModelPart
OFF_HAND = {}
}
---A `table` containing the spyglass models.
spyglass_model = {
---@type BasicModelPart
LEFT_SPYGLASS = {},
---@type BasicModelPart
RIGHT_SPYGLASS = {}
}

107
.vscode/figura/nameplate.lua vendored Normal file
View file

@ -0,0 +1,107 @@
--================================================================================================--
--===== CLASSES ================================================================================--
--================================================================================================--
---A space with the player's name visible in it.
---@class Nameplate
local Nameplate = {}
---Returns whatever was passed through `.setEnabled()` last.
---@return boolean?
function Nameplate.getEnabled() end
---Returns whatever was passed through `.setPos()` last.
---@return VectorPos?
function Nameplate.getPos() end
---Returns whatever was passed through `.setScale()` last.
---@return VectorPos?
function Nameplate.getScale() end
---Returns the text in the nameplate.
---Returns `nil` if the text has not been set by `.setText()`.
---@return string?
function Nameplate.getText() end
---Does nothing...
---For a version that does something, check the ENTITY nameplate.
---@param bool? boolean
function Nameplate.setEnabled(bool) end
---Does nothing...
---For a version that does something, check the ENTITY nameplate.
---@param vec3? VectorPos
function Nameplate.setPos(vec3) end
---Does nothing...
---For a version that does something, check the ENTITY nameplate.
---@param vec3? VectorPos
function Nameplate.setScale(vec3) end
---Sets the text of the nameplate.
---All text is placed to the left of the Figura mark.
---Set to `nil` to reset to default.
---
---Can use [Raw JSON Text](https://minecraft.fandom.com/wiki/Raw_JSON_text_format) formatting.
---@param str? string
function Nameplate.setText(str) end
---EntityNameplate ⇐ Nameplate
---***
---Contains nameplate functions specific to the ENTITY nameplate.
---@class EntityNameplate : Nameplate
local EntityNameplate = {}
---Returns if the nameplate is visible.
---Returns `nil` if it has not been set by `.setEnabled()`.
---@return boolean?
function EntityNameplate.getEnabled() end
---Returns the position offset of the nameplate in blocks.
---Returns `nil` if the position offset has not been set by `.setPos()`.
---
---Note: This value might not be accurate if the player's entity is scaled.
---@return VectorPos?
function EntityNameplate.getPos() end
---Returns the scale of the nameplate.
---Returns nil if the scale has not been set by `.setScale()`.
---@return VectorPos?
function EntityNameplate.getScale() end
---Sets if the nameplate is visible.
---Set to `nil` to reset to default.
---@param bool? boolean
function EntityNameplate.setEnabled(bool) end
---Sets the position offset of the nameplate in blocks.
---Set to `nil` to reset to default.
---
---Note: This value is not accurate if the player's entity is scaled.
---@param vec3? VectorPos
function EntityNameplate.setPos(vec3) end
---Sets the scale of the nameplate.
---Set to `nil` to reset to default.
---@param vec3? VectorPos
function EntityNameplate.setScale(vec3) end
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---Contains the player's nameplates.
---
---`CHAT` is the player's name in chat.
---`ENTITY` is the nameplate above their head.
---`LIST` is the player's name in the player list.
nameplate = {
---@type Nameplate
CHAT = {},
---@type EntityNameplate
ENTITY = {},
---@type Nameplate
LIST = {}
}

95
.vscode/figura/network.lua vendored Normal file
View file

@ -0,0 +1,95 @@
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---A type of function that is run on all instances of a script if the host runs it.
---
---Pings are 5 bytes big without a value.
---
---A ping may also contain a value to send with the ping. This adds the following bytes based on the
---type of value:
---* Nil: 0 bytes (`nil`)
---* Boolean: 1 byte (`true/false`)
---* Integer: 4 bytes (`-2147483648`..`2147483647`)
---* Float: 4 bytes (`-3.4028236692094e+38`..`3.4028236692094e+38`)
---* String: 2 bytes + (`0`..`1000` characters) bytes
---* Table: 2 bytes + (Table contents) bytes
---
---You may only send up to 1024 bytes of pings a second, and only up to 32 pings a tick.
---@class PingFunction : function
---@alias PingSupported nil|boolean|number|string|table|Vector
---**THERE IS A MUCH BETTER WAY TO HANDLE PINGS. SEE THE `ping` TABLE FOR MORE INFORMATION.**
---***
---Contains functions that handle pings.
---@deprecated
network = {}
---Avoid deprecation errors in this file
---@diagnostic disable: deprecated
---**THERE IS A MUCH BETTER WAY TO HANDLE PINGS. SEE THE `ping` TABLE FOR MORE INFORMATION.**
---***
---Registers a ping that allows you to send information to all clients running this script.
---This is mainly used to sync variables that do not sync normally. (`Keybind`s, `action_wheel`
---functions, NBT, etc.)
---You may register up to *65535* pings in one script.
---
---All examples in this description will assume that the ping is called *"pingname"*.
---```
---network.registerPing("pingname")
---```
---The ping is linked to a function of the same name, this function is not defined by default
---and it will need to defined so it can be used:
---```
---function pingname(param) --(Param is optional!)
--- --code here
---end
---```
---You can call this function by using:
---```
---network.ping("pingname", param) --(Param is optional!)
---```
---
---Note: Pings are also sent to yourself and will run their function on your script as well.
---@param ping string
---@deprecated
function network.registerPing(ping) end
---**THERE IS A MUCH BETTER WAY TO HANDLE PINGS. SEE THE `ping` TABLE FOR MORE INFORMATION.**
---***
---Sends a ping out to all clients running this script.
---Pings are 5 bytes big without a value.
---
---A ping may also contain a value to send with the ping. This adds the following bytes based on the
---type of value:
---* Nil: 0 bytes (`nil`)
---* Boolean: 1 byte (`true/false`)
---* Integer: 4 bytes (`-2147483648`..`2147483647`)
---* Float: 4 bytes (`-3.4028236692094e+38`..`3.4028236692094e+38`)
---* String: 2 bytes + (`0`..`1000` characters) bytes
---* Table: 2 bytes + (Table contents) bytes
---
---You may only send up to 1024 bytes of pings a second, and only up to 32 pings a tick.
---
---Note: Pings are also sent to yourself.
---@param ping string
---@param value? PingSupported
---@deprecated
function network.ping(ping, value) end
---@diagnostic enable: deprecated
---A table containing pings. You can create a new ping by defining a function here.
---
---Pings are mainly used to sync variables that do not sync normally. (`Keybind`s, `action_wheel`
---functions, NBT, etc.)
---You may have up to 65,535 pings in one script.
---
---Note: Functions placed in this table are converted. A `PingFunction` of a given function will not
---be equal to the function it is made from.
---This also means that calling the normal function will
---not call the `PingFunction` made from it.
---@type table<string, PingFunction>
ping = {}

282
.vscode/figura/particle.lua vendored Normal file
View file

@ -0,0 +1,282 @@
--================================================================================================--
--===== CLASSES ================================================================================--
--================================================================================================--
---A Minecraft particle identifier.
---
---Only the default Minecraft particles are auto-completed.
---You can use any particle from any mod, even if it does not auto-complete.
---
---Note: Modded particles that require an `extra` will not work and will instead error.
---@alias ParticleID
---| "minecraft:ambient_entity_effect"
---| "minecraft:angry_villager"
---| "minecraft:ash"
---| "minecraft:barrier"
---| "minecraft:block"
---| "minecraft:bubble"
---| "minecraft:bubble_column_up"
---| "minecraft:bubble_pop"
---| "minecraft:campfire_cosy_smoke"
---| "minecraft:campfire_signal_smoke"
---| "minecraft:cloud"
---| "minecraft:composter"
---| "minecraft:crimson_spore"
---| "minecraft:crit"
---| "minecraft:current_down"
---| "minecraft:damage_indicator"
---| "minecraft:dolphin"
---| "minecraft:dragon_breath"
---| "minecraft:dripping_dripstone_lava"
---| "minecraft:dripping_dripstone_water"
---| "minecraft:dripping_honey"
---| "minecraft:dripping_lava"
---| "minecraft:dripping_obsidian_tear"
---| "minecraft:dripping_water"
---| "minecraft:dust"
---| "minecraft:dust_color_transition"
---| "minecraft:effect"
---| "minecraft:elder_guardian"
---| "minecraft:electric_spark"
---| "minecraft:enchant"
---| "minecraft:enchanted_hit"
---| "minecraft:end_rod"
---| "minecraft:entity_effect"
---| "minecraft:explosion"
---| "minecraft:explosion_emitter"
---| "minecraft:falling_dripstone_lava"
---| "minecraft:falling_dripstone_water"
---| "minecraft:falling_dust"
---| "minecraft:falling_honey"
---| "minecraft:falling_lava"
---| "minecraft:falling_nectar"
---| "minecraft:falling_obsidian_tear"
---| "minecraft:falling_spore_blossom"
---| "minecraft:falling_water"
---| "minecraft:firework"
---| "minecraft:fishing"
---| "minecraft:flame"
---| "minecraft:flash"
---| "minecraft:glow"
---| "minecraft:glow_squid_ink"
---| "minecraft:happy_villager"
---| "minecraft:heart"
---| "minecraft:instant_effect"
---| "minecraft:item"
---| "minecraft:item_slime"
---| "minecraft:item_snowball"
---| "minecraft:landing_honey"
---| "minecraft:landing_lava"
---| "minecraft:landing_obsidian_tear"
---| "minecraft:large_smoke"
---| "minecraft:lava"
---| "minecraft:light"
---| "minecraft:mycelium"
---| "minecraft:nautilus"
---| "minecraft:note"
---| "minecraft:poof"
---| "minecraft:portal"
---| "minecraft:rain"
---| "minecraft:reverse_portal"
---| "minecraft:scrape"
---| "minecraft:smoke"
---| "minecraft:sneeze"
---| "minecraft:snowflake"
---| "minecraft:soul"
---| "minecraft:soul_fire_flame"
---| "minecraft:spit"
---| "minecraft:spore_blossom_air"
---| "minecraft:splash"
---| "minecraft:squid_ink"
---| "minecraft:sweep_attack"
---| "minecraft:totem_of_undying"
---| "minecraft:underwater"
---| "minecraft:vibration"
---| "minecraft:warped_spore"
---| "minecraft:wax_off"
---| "minecraft:wax_on"
---| "minecraft:white_ash"
---| "minecraft:witch"
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---Contains a single `function` for creating a particle.
particle = {}
---Adds a particle to the world.
---
---Only the default Minecraft particles are auto-completed.
---You can use modded particles as long as they only take a position and velocity to function.
---
---Certain particles change how the parameters of this function work.
---If a particle is not on this list, assume it functions normally:
---> **minecraft:ambient_entity_effect** / **minecraft:entity_effect**
--->
---> The last three values of `pos_vel` set the velocity *and* color of the particle.
---> Velocity is converted into a direction.
---> Any horizontal velocity is applied in all horizontal directions randomly.
---> Each color is a number `0..1` or `1..255`. If the color is above 1, then the color is
---`(255 - num) / 255` If the color is above 255, set color to `(-num % 255) / 255` then calculate
---as if color was above 1.
---> (2 -> 253, 255 -> 0).
---> It is possible to mix different ranges of colors. A color of `1,0,1` is the same as `1,255,1`
---but the second color will move up instead of spreading out because of the high Y velocity.
---> ***
---
---> **minecraft:angry_villager** / **minecraft:heart**
--->
---> Velocity is completely ignored and always moves up about half a block.
---> ***
---
---> **minecraft:ash**
--->
---> Velocity is completely ignored and always falls in a random direction.
---> ***
---
---> **minecraft:barrier** / **minecraft:flash** / **minecraft:underwater**
--->
---> Velocity is completely ignored and never moves.
---> ***
---
---> **minecraft:block** / **minecraft:falling_dust**
--->
---> The `extra` is a `string` set to the blockstate string of the selected block.
---> ***
---
---> **minecraft:bubble** / **minecraft:bubble_column_up** / **minecraft:current_down**
--->
---> Dies after 1 tick if out of water at any point
---> ***
---
---> **minecraft:composter** / **minecraft:dolphin** / **minecraft:happy_villager** /
---**minecraft:mycelium**
--->
---> Velocity is capped at a very slow speed per axis.
---> ***
---
---> **minecraft:crimson_spore** / **minecraft:item_slime** / **minecraft:item_snowball** /
---**minecraft:lava** / **minecraft:rain** / **minecraft:warped_spore**
--->
---> Velocity is completely ignored and flies in a random direction, preferring any upward
---direction.
---> ***
---
---> **minecraft:dripping_honey** / **minecraft:dripping_lava** /
---**minecraft:dripping_obsidian_tear** / **minecraft:dripping_water** /
---**minecraft:dripping_dripstone_lava** / **minecraft:dripping_dripstone_water**
--->
---> Velocity is completely ignored and always sticks for a while before falling until hitting
---something solid.
---> ***
---
---> **minecraft:dust**
--->
---> Velocity is capped at a very slow speed per axis.
---> The `extra` is a `Vector4` set to the color and size of the particle.
---> `x`, `y`, and `z` are numbers `0..1` for red, green, and blue respectively.
---> `w` is a number `0..10` for the size of the particle.
---> ***
---
---> **minecraft:dust_color_transition**
--->
---> The last three values of `pos_vel` set the end color of the particle.
---> Each color is a number `0..1`.
---> The `extra` is a `Vector4` set to the start color and transition speed of the particle.
---> `x`, `y`, and `z` are numbers `0..1` for red, green, and blue respectively.
---> `w` is a number `1..` for the amount of ticks it takes to transition from the start color to
---the end color.
---> ***
---
---> **minecraft:elder_guardian**
--->
---> Ignores position and velocity, always circles the viewer's camera from top to bottom.
---> ***
---
---> **minecraft:enchant** / **minecraft:nautilus**
--->
---> The first three values of `pos_vel` set the end position of the particle.
---> The end postion Y is always decreased by ~1.125.
---> The last three values of `pos_vel` set the start position offset of the particle.
---> The offset is *not* moved by the decrease of the end position Y.
---> ***
---
---> **minecraft:explosion** / **minecraft:sweep_attack**
--->
---> Velocity is completely ignored.
---> The `w` of `pos_vel` is a number that sets the size of the particle.
---> 0 is the default size of the particle, negative numbers increase the size, postitive numbers
---> decrease it. If the number is >2, the explosion particle will be inverted and will increase in
---> size as the number gets bigger.
---> ***
---
---> **minecraft:explosion_emitter**
--->
---> Velocity is completely ignored.
---> Spawns many "minecraft:explosion" particles around it.
---> ***
---
---> **minecraft:falling_honey** / **minecraft:falling_lava** / **minecraft:falling_nectar** /
---**minecraft:falling_obsidian_tear** / **minecraft:falling_water** / **minecraft:landing_honey** /
---**minecraft:landing_lava** / **minecraft:landing_obsidian_tear** /
---**minecraft:falling_dripstone_lava** / **minecraft:falling_dripstone_water**
--->
---> Velocity is completely ignored and falls until hitting something solid.
---> ***
---
---> **minecraft:instant_effect** / **minecraft:witch**
--->
---> Velocity is converted into a direction.
---> Any horizontal velocity is applied in all horizontal directions randomly.
---> ***
---
---> **minecraft:item**
--->
---> The `extra` is a `string` set to the item and NBT string of the selected item.
---> ***
---
---> **minecraft:note**
--->
---> The `w` of `pos_vel` is a number `0..1` that sets the hue of the note, starting at lime and
---shifting backwards.
---> Velocity is completely ignored and the note always moves up about half a block.
---> ***
---
---> **minecraft:portal**
--->
---> The first three values of `pos_vel` set the end position of the particle.
---> The last three values of `pos_vel` set the start position offset of the particle.
---> The offset Y is always increased by 1.
---> ***
---
---> **minecraft:vibration** *1.17 only!*
--->
---> The last three values of `pos_vel` set the end position of the particle.
---> The `extra` is a `Vector4` set to the start position and speed of the particle.
---> `w` is a number `1..` for the amount of ticks it takes to reach the end positon.
---> ***
---
---> **minecraft:white_ash**
--->
---> Velocity is completely ignored and flies in a random direction, preferring any negative
---direction.
--->***
---
---> **PARTICLES WITH AN UNKNOWN EFFECT**
---> These particles are placed here since some 1.17 particle have yet to be tested.
---> *If you have information on exactly how these particles work, let me know.*
--->
---> minecraft:falling_spore_blossom (Possibly acts like a slower minecraft:falling_honey?)
---> minecraft:glow (Possibly acts like minecraft:barrier?)
---> minecraft:light (Possibly acts like minecraft:composter?)
---> minecraft:scrape (Possibly acts like minecraft:composter?)
---> minecraft:snowflake
---> minecraft:spore_blossom_air
---> minecraft:wax_off (Possibly acts like minecraft:composter?)
---> minecraft:wax_on (Possibly acts like minecraft:composter?)
---@param name ParticleID
---@param pos_vel Vector6
---@param extra1? Vector3 | Vector4 | string
---@param extra2? Vector3 | Vector4
function particle.addParticle(name, pos_vel, extra1, extra2) end

123
.vscode/figura/renderer.lua vendored Normal file
View file

@ -0,0 +1,123 @@
--================================================================================================--
--===== CLASSES ================================================================================--
--================================================================================================--
---@alias RaycastShapeHandling
---| "COLLIDER" #The shape entities collide with
---| "OUTLINE" #The block outline when looked at
---| "VISUAL" #What Minecraft believes is the sight-blocking shape
---@alias RaycastFluidHandling
---| "NONE" #Do not raycast fluids
---| "SOURCE_ONLY" #Only raycast fluid sources
---| "ANY" #Raycast any fluid
---A predicate that tests for a block.
---
---Return `true` to stop raycasting and return the current block.
---Return `false` to continue and ignore the current block.
---@alias BlockPredicate fun(block: BlockState, pos: VectorPos): boolean
---A predicate that tests for an entity.
---
---Return `true` to stop raycasting and return the current entity.
---Return `false` to continue and ignore the current entity.
---@alias EntityPredicate fun(entity: Entity|LivingEntity|Player): boolean
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---Contains generic functions related to rendering. Also contains some raycasting.
renderer = {}
---Returns the camera position of the player executing the script.
---@return VectorPos
function renderer.getCameraPos() end
---Returns the camera rotation.
---@return VectorAng
function renderer.getCameraRot() end
---Returns if fire can be rendered on the avatar.
---Returns `nil` if it has not been set by `.setRenderFire()`.
---@return boolean?
function renderer.getRenderFire() end
---Returns if your player head shows your Figura HEAD/SKULL (true) or your vanilla head (false).
---@return boolean
function renderer.getRenderPlayerHead() end
---Returns the radius of the player's shadow.
---Returns `nil` if the size has not been set by `.setShadowSize()`.
---@return number?
function renderer.getShadowSize() end
---Returns the length in pixels of a string or Raw JSON Text.
---@param text string
---@return integer
function renderer.getTextWidth(text) end
---Returns if the camera is in front of or behind the player.
---@return boolean
function renderer.isCameraBackwards() end
---Returns if the model is being viewed in first-person.
---This will always return false for other clients since they cannot see your first-person model.
---@return boolean
function renderer.isFirstPerson() end
---Returns if your mount is enabled.
---@return boolean
function renderer.isMountEnabled() end
---Returns if your mount's shadow is enabled.
---@return boolean
function renderer.isMountShadowEnabled() end
---Casts a ray from startPos to endPos, looking at the blocks on the way.
---If the ray never hits anything, then the function returns nil.
---@param startPos VectorPos
---@param endPos VectorPos
---@param shapeHandling RaycastShapeHandling
---@param fluidHandling RaycastFluidHandling
---@param predicate? BlockPredicate
---@return {state: BlockState, pos: VectorPos}?
function renderer.raycastBlocks(startPos, endPos, shapeHandling, fluidHandling, predicate) end
---Casts a ray from startPos to endPos, returning the first entity it sees on the way.
---If the ray never hits anything, then the function returns nil.
---@param startPos VectorPos
---@param endPos VectorPos
---@param predicate? EntityPredicate
---@return {entity:Entity|LivingEntity|Player, pos:VectorPos}?
function renderer.raycastEntities(startPos, endPos, predicate) end
---Toggle the render of the entity you are riding.
---@param enabled boolean
function renderer.setMountEnabled(enabled) end
---Toggle the shadow of the entity you are riding.
---@param enabled boolean
function renderer.setMountShadowEnabled(enabled) end
---Toggle the rendering of fire on your avatar.
---Set to `nil` to reset to default.
---@param enabled? boolean
function renderer.setRenderFire(enabled) end
---Toggle whether your playerhead renders your avatar's HEAD/SKULL or your vanilla skin.
---@param enabled boolean
function renderer.setRenderPlayerHead(enabled) end
---Sets the radius of the player's shadow.
---Set the radius to `nil` to reset the shadow.
---@param radius number?
function renderer.setShadowSize(radius) end
---Shows the animation of you swinging your arm.
---Set `offhand` to swing the offhand arm instead.
---
---Note: This is automatically synced to other players.
---@param offhand? boolean
function renderer.swingArm(offhand) end

318
.vscode/figura/renderlayers.lua vendored Normal file
View file

@ -0,0 +1,318 @@
--================================================================================================--
--===== CLASSES ================================================================================--
--================================================================================================--
---@alias GL_BlendEquationMode
---|'32774' #GL_FUNC_ADD
---|'32778' #GL_FUNC_SUBTRACT
---|'32779' #GL_FUNC_REVERSE_SUBTRACT
---@alias GL_BlendingFactorSrc
---|'0' #GL_ZERO
---|'1' #GL_ONE
---|'768' #GL_SRC_COLOR
---|'769' #GL_ONE_MINUS_SRC_COLOR
---|'770' #GL_SRC_ALPHA
---|'771' #GL_ONE_MINUS_SRC_ALPHA
---|'772' #GL_DST_ALPHA
---|'773' #GL_ONE_MINUS_DST_ALPHA
---|'774' #GL_DST_COLOR
---|'775' #GL_ONE_MINUS_DST_COLOR
---|'776' #GL_SRC_ALPHA_SATURATE
---|'32769' #GL_CONSTANT_COLOR
---|'32770' #GL_ONE_MINUS_CONSTANT_COLOR
---|'32771' #GL_CONSTANT_ALPHA
---|'32772' #GL_ONE_MINUS_CONSTANT_ALPHA
---@alias GL_BlendingFactorDest GL_BlendingFactorSrc
---@alias GL_DepthFunction
---|'512' #GL_NEVER
---|'513' #GL_LESS
---|'514' #GL_EQUAL
---|'515' #GL_LEQUAL
---|'516' #GL_GREATER
---|'517' #GL_NOTEQUAL
---|'518' #GL_GEQUAL
---|'519' #GL_ALWAYS
---@alias GL_StencilFunction GL_DepthFunction
---@alias GL_StencilOp
---|'0' #GL_ZERO
---|'5386' #GL_INVERT
---|'7680' #GL_KEEP
---|'7681' #GL_REPLACE
---|'7682' #GL_INCR
---|'7683' #GL_DECR
---|'34055' #GL_INCR_WRAP
---|'34056' #GL_DECR_WRAP
---@alias GL_All GL_BlendEquationMode|GL_BlendingFactorDest|GL_StencilFunction|GL_StencilOp
---|'5376' #GL_CLEAR
---|'5377' #GL_AND
---|'5378' #GL_AND_REVERSE
---|'5379' #GL_COPY
---|'5380' #GL_AND_INVERTED
---|'5381' #GL_NOOP
---|'5382' #GL_XOR
---|'5383' #GL_OR
---|'5384' #GL_NOR
---|'5385' #GL_EQUIV
---|'5387' #GL_OR_REVERSE
---|'5388' #GL_COPY_INVERTED
---|'5389' #GL_OR_INVERTED
---|'5390' #GL_NAND
---|'5391' #GL_SET
---|'32775' #GL_MIN
---|'32776' #GL_MAX
---|'number'
---@alias GL_Texture
---|'"MY_TEXTURE"'
---|'"MY_TEXTURE_EMISSIVE"'
---|'"MAIN_FRAMEBUFFER"'
---|'"LAST_FRAMEBUFFER"'
---|'string'
---@alias CustomUniformID string
---@alias CClass
---|'string'
---|'"vec3"'
---@class RegisterRenderLayerParams
---@field vertexFormat ShaderFormat
---@field hasCrumbling boolean
---@field translucent boolean
---I only know of one... Does anyone know of any others?
---@alias ShaderFormat
---|'"POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL"'
---|'string'
---@alias StringifiedC string
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
renderlayers = {}
---Gets the priority of the chosen render layer, or nil if it doesn't exist
---@param renderlayerName string
---@return number
function renderlayers.getPriority(renderlayerName) end
---Returns true or false depending on if the shader exists yet
---@param shaderName string
---@return boolean
function renderlayers.isShaderReady(shaderName) end
---Registers a new render layer with the given name
---params is a table where you can set certain keys
------vertexFormat - needs to match with the format of any shader you want to use. Same default as in registerShader()
------hasCrumbling - don't know what this does, but it's true by default
------translucent - also don't know this one, but true by default
---startFunction and endFunction are two lua functions, called when you start rendering and when you stop rendering this layer.
---Functions which interact with openGL can only be called inside these
---@param renderLayerName string
---@param params RegisterRenderLayerParams
---@param startFunction fun()
---@param endFunction fun()
function renderlayers.registerRenderLayer(renderLayerName, params, startFunction, endFunction) end
---Registers a new custom shader with the given name
---@param shaderName string
---@param format ShaderFormat #Defaults to "POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL"
---@param vertexSource StringifiedC
---@param fragmentSource StringifiedC
---@param numSamplers number
---@param customUniforms table<CustomUniformID,CClass>
function renderlayers.registerShader(shaderName, format, vertexSource, fragmentSource, numSamplers, customUniforms) end
---Sets the priority of a render layer. Layers with lower priorities are rendered first. By default, all priorities are 0
---@param renderLayerName string
---@param value number
function renderlayers.setPriority(renderLayerName, value) end
---Sets the value of the specified uniform in the specified shader. If the shader does not exist yet, does nothing
---@param shaderName string
---@param uniformName CustomUniformID
---@param value any
function renderlayers.setUniform(shaderName, uniformName, value) end
--================================================================================================--
--===== SHADER ONLY FUNCTIONS ==================================================================--
--================================================================================================--
---Sets the GL blend equation
---@param equation GL_BlendEquationMode
function renderlayers.blendEquation(equation) end
---Sets the GL blend function
---@param src GL_BlendingFactorSrc
---@param dst GL_BlendingFactorDest
function renderlayers.blendFunc(src, dst) end
---Sets the GL blend function
---@param srcRGB GL_BlendingFactorSrc
---@param dstRGB GL_BlendingFactorDest
---@param srcAlpha GL_BlendingFactorSrc
---@param dstAlpha GL_BlendingFactorDest
function renderlayers.blendFuncSeperate(srcRGB, dstRGB, srcAlpha, dstAlpha) end
---Enables/disables the GL color mask
---@param boolean boolean
function renderlayers.colorMask(boolean) end
---A minecraft→specific function, resets the GL blend function to default
function renderlayers.defaultBlendFunc() end
---Sets the GL depth function
---@param func GL_DepthFunction
function renderlayers.depthFunc(func) end
---Enables/disables the GL depth mask
---@param boolean boolean
function renderlayers.depthMask(boolean) end
---Disables blending
function renderlayers.disableBlend() end
---Disables color logic operations
function renderlayers.disableColorLogicOp() end
---Disables culling
function renderlayers.disableCull() end
---Disables depth testing
function renderlayers.disableDepthTest() end
---Disables lightmap testing
function renderlayers.disableLightmap() end
---Disables overlay
function renderlayers.disableOverlay() end
---Disables GL scissors
function renderlayers.disableScissors() end
---Disables stencil testing
function renderlayers.disableStencil() end
---Enables blending
function renderlayers.enableBlend() end
---Enables color logic operations
function renderlayers.enableColorLogicOp() end
---Enables culling
function renderlayers.enableCull() end
---Enables depth testing
function renderlayers.enableDepthTest() end
---Enables lightmap testing
function renderlayers.enableLightmap() end
---Enables overlay
function renderlayers.enableOverlay() end
---Enables GL scissors with those values
---@param x number
---@param y number
---@param width number
---@param height number
function renderlayers.enableScissors(x, y, width, height) end
---Enables stencil testing
function renderlayers.enableStencil() end
---Sets the shader line width
---@param float number
function renderlayers.lineWidth(float) end
---Sets the GL color logic operation
---@param operation GL_All
function renderlayers.logicOp(operation) end
renderlayers.logicOp()
---Resets the rendering to default state
function renderlayers.restoreDefaults() end
---Sets the designated texture based on the name
---@param index number
---@param textureName GL_Texture
function renderlayers.setTexture(index, textureName) end
---Sets the GL stencil function
---@param func GL_StencilFunction
---@param ref number
---@param mask number
function renderlayers.stencilFunc(func, ref, mask) end
---Sets the GL stencil mask
---@param number number
function renderlayers.stencilMask(number) end
---Sets the GL stencil operations
---@param sfail GL_StencilOp
---@param dpfail GL_StencilOp
---@param dppass GL_StencilOp
function renderlayers.stencilOp(sfail, dpfail, dppass) end
---Uses the designated shader
---@param shaderName string
function renderlayers.useShader(shaderName) end
renderlayers.GL_ALWAYS=519
renderlayers.GL_AND=5377
renderlayers.GL_AND_INVERTED=5380
renderlayers.GL_AND_REVERSE=5378
renderlayers.GL_CLEAR=5376
renderlayers.GL_CONSTANT_ALPHA=32771
renderlayers.GL_CONSTANT_COLOR=32769
renderlayers.GL_COPY=5379
renderlayers.GL_COPY_INVERTED=5388
renderlayers.GL_DECR=7683
renderlayers.GL_DECR_WRAP=34056
renderlayers.GL_DST_ALPHA=772
renderlayers.GL_DST_COLOR=774
renderlayers.GL_EQUAL=514
renderlayers.GL_EQUIV=5385
renderlayers.GL_FUNC_ADD=32774
renderlayers.GL_FUNC_REVERSE_SUBTRACT=32779
renderlayers.GL_FUNC_SUBTRACT=32778
renderlayers.GL_GEQUAL=518
renderlayers.GL_GREATER=516
renderlayers.GL_INCR=7682
renderlayers.GL_INCR_WRAP=34055
renderlayers.GL_INVERT=5386
renderlayers.GL_KEEP=7680
renderlayers.GL_LEQUAL=515
renderlayers.GL_LESS=513
renderlayers.GL_MAX=32776
renderlayers.GL_MIN=32775
renderlayers.GL_NAND=5390
renderlayers.GL_NEVER=512
renderlayers.GL_NOR=5384
renderlayers.GL_NOOP=5381
renderlayers.GL_NOTEQUAL=517
renderlayers.GL_ONE=1
renderlayers.GL_ONE_MINUS_CONSTANT_ALPHA=32772
renderlayers.GL_ONE_MINUS_CONSTANT_COLOR=32770
renderlayers.GL_ONE_MINUS_DST_ALPHA=773
renderlayers.GL_ONE_MINUS_DST_COLOR=775
renderlayers.GL_ONE_MINUS_SRC_ALPHA=771
renderlayers.GL_ONE_MINUS_SRC_COLOR=769
renderlayers.GL_OR=5383
renderlayers.GL_OR_INVERTED=5389
renderlayers.GL_OR_REVERSE=5387
renderlayers.GL_REPLACE=7681
renderlayers.GL_SET=5391
renderlayers.GL_SRC_ALPHA=770
renderlayers.GL_SRC_ALPHA_SATURATE=776
renderlayers.GL_SRC_COLOR=768
renderlayers.GL_XOR=5382
renderlayers.GL_ZERO=0

94
.vscode/figura/rendertasks.lua vendored Normal file
View file

@ -0,0 +1,94 @@
--================================================================================================--
--===== CLASSES ================================================================================--
--================================================================================================--
---Render task modes for items
---@alias RenderMode
---| "NONE"
---| "THIRD_PERSON_LEFT_HAND"
---| "THIRD_PERSON_RIGHT_HAND"
---| "FIRST_PERSON_LEFT_HAND"
---| "FIRST_PERSON_RIGHT_HAND"
---| "HEAD"
---| "GUI"
---| "GROUND"
---| "FIXED
---@class RenderTaskTable
local RenderTaskTable = {}
---Returns if the renderTask uses emissive textures.
---@return boolean
function RenderTaskTable.getEmissive() end
---Returns if the renderTask is currently enabled.
---@return boolean
function RenderTaskTable.getEnabled() end
---Returns the relative position of the renderTask.
---@return VectorPos
function RenderTaskTable.getPos() end
---Returns the relative rotation of the renderTask.
---@return VectorAng
function RenderTaskTable.getRot() end
---Returns the relative scale of the renderTask.
---@return Vector3
function RenderTaskTable.getScale() end
---Sets whether the renderTask uses emissive textures.
---@param bool boolean
function RenderTaskTable.setEmissive(bool) end
---Sets whether the renderTask is enabled.
---@param enabled boolean
function RenderTaskTable.setEnabled(enabled) end
---Sets the renderTask's position relative to the attatched model part.
---@param pos VectorPos
function RenderTaskTable.setPos(pos) end
---Sets the renderTask's rotation relative to the attatched model part.
---@param rot VectorAng
function RenderTaskTable.setRot(rot) end
---Sets the renderTask's scale relative to the attatched model part.
---@param scale Vector3
function RenderTaskTable.setScale(scale) end
---@class ShaderAllowedTaskTable : RenderTaskTable
local ShaderAllowedTaskTable = {}
---Sets the renderlayer this rendertask will use.
---@param name string
function ShaderAllowedTaskTable.setRenderLayer(name) end
---@class BlockTaskTable : ShaderAllowedTaskTable
local BlockTaskTable = {}
---Change the block the task is rendering.
---@param block BlockState|BlockID
function BlockTaskTable.setBlock(block) end
---@class ItemTaskTable : ShaderAllowedTaskTable
local ItemTaskTable = {}
---Change the item the task is rendering.
---@param item ItemStack|ItemID
function ItemTaskTable.setItem(item) end
---Change how the item will be rendered.
---@param mode RenderMode
function ItemTaskTable.setItemMode(mode) end
---@class TextTaskTable : RenderTaskTable
local TextTaskTable = {}
---Sets the vertical space between newlines in pixels.
---@param space number
function TextTaskTable.setLineSpacing(space) end
---Change the text the task is rendering.
---@param text string
function TextTaskTable.setText(text) end

52
.vscode/figura/sound.lua vendored Normal file
View file

@ -0,0 +1,52 @@
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---Contains functions relating to sounds.
sound = {}
---Returns a table of all currently playing custom sounds.
---
---If `owners` is set, the returned table will alternate sound names and their owner UUIDs.
---@param owners? boolean
---@return string[]
function sound.getCustomSounds(owners) end
---Returns a list of all registered custom sound names.
---@return string[]
function sound.getRegisteredCustomSounds() end
---Returns a list of all sounds the player can hear.
---@return string[]
function sound.getSounds() end
---Returns if a custom sound with the given name is registered.
---@param name string
---@return boolean
function sound.isCustomSoundRegistered(name) end
---Plays a custom sound at the given world position.
---@param name string
---@param pos VectorPos
---@param vol_pitch? Vector2
function sound.playCustomSound(name, pos, vol_pitch) end
---`vol_pitch: Vector2`
---&emsp;Two numbers that represent the volume and pitch of the sound.
---***
---Plays a sound event at the given world position.
---Sounds are played on the `player` channel.
---@param name string
---@param pos VectorPos
---@param vol_pitch? Vector2
function sound.playSound(name, pos, vol_pitch) end
---Adds a new custom sound to your model, using data from either a table of bytes, OR a
---base64-encoded string.
---@param name string
---@param data string|integer[]
function sound.registerCustomSound(name, data) end
---Stops the custom sound with the given name.
---@param name string
function sound.stopCustomSound(name) end

388
.vscode/figura/vectors.lua vendored Normal file
View file

@ -0,0 +1,388 @@
--================================================================================================--
--===== CLASSES ================================================================================--
--================================================================================================--
---A list of up to 6 numbers that can mean anything.
---You can either use the fields or index by a number to get a value from the vector.
---
---The following accessors correspond to the following numbers:
--->1: x, r, u, pitch
--->2: y, g, v, yaw, volume
--->3: z, b, roll
--->4: w, a
--->5: t
--->6: h
---
---You can use a `table` with up to 6 values in place of a `Vector`.
---The `table` can contain other `table`s to merge them.
---
---@class Vector
---@field [1] number
---@field [2] number
---@field [3] number
---@field [4] number
---@field [5] number
---@field [6] number
---@field x number
---@field y number
---@field z number
---@field w number
---@field t number
---@field h number
---@field pitch number
---@field yaw number
---@field roll number
---@field r number
---@field g number
---@field b number
---@field a number
---@field u number
---@field v number
---@field volume number
local Vector = {}
---Returns the (smallest) angle between this `Vector` and the given `Vector` in radians.
---@param vec Vector
---@return number
function Vector.angleTo(vec) end
---Converts a Vector to a table.
---The table is created with numeric indexes.
---@return number[]
function Vector.asTable() end
---Returns the cross product of this `Vector` and the given `Vector`.
---@param vec Vector
---@return Vector
function Vector.cross(vec) end
---Gets the distance between this `Vector` and the given `Vector`.
---@param vec Vector
---@return number
function Vector.distanceTo(vec) end
---Returns the dot product of this `Vector` and the given `Vector`.
---@param vec Vector
---@return number
function Vector.dot(vec) end
---Gets the distance between `<0,0,0,0,0,0>` and this `Vector`.
---@return number
function Vector.getLength() end
---Returns a `Vector` which is a copy of this `Vector` but resized to have a length of 1.
---@return Vector
function Vector.normalized() end
---Returns the vector converted into degrees.
---@return Vector
function Vector.toDeg() end
---Returns the vector converted into radians.
---@return Vector
function Vector.toRad() end
---Vector6 ⇐ Vector
---***
---A list of six numbers that can mean anything.
---You can either use the fields or index by a number to get a value from the vector.
---
---The following accessors correspond to the following numbers:
--->1: x, r, u, pitch
--->2: y, g, v, yaw
--->3: z, b, roll
--->4: w, a
--->5: t
--->6: h
---
---You can use a `table` with up to 6 values in place of a `Vector6`.
---The `table` can contain other `table`s to merge them.
---
---@class Vector6 : Vector
---Vector5 ⇐ Vector
---***
---A list of five numbers that can mean anything.
---You can either use the fields or index by a number to get a value from the vector.
---
---The following accessors correspond to the following numbers:
--->1: x, r, u, pitch
--->2: y, g, v, yaw
--->3: z, b, roll
--->4: w, a
--->5: t
---
---You can use a `table` with up to 5 values in place of a `Vector5`.
---The `table` can contain other `table`s to merge them.
---
---@class Vector5 : Vector
---Vector4 ⇐ Vector
---***
---A list of four numbers that can mean anything.
---You can either use the fields or index by a number to get a value from the vector.
---
---The following accessors correspond to the following numbers:
--->1: x, r, u, pitch
--->2: y, g, v, yaw
--->3: z, b, roll
--->4: w, a
---
---If you wish to get a number past the fourth, you will need to use
---different accessors or directly index it. (`Vector[#]`)
---
---You can use a `table` with up to 4 values in place of a `Vector4`.
---The `table` can contain other `table`s to merge them.
---@class Vector4 : Vector
---Vector3 ⇐ Vector
---***
---A list of three numbers that can mean anything.
---You can either use the fields or index by a number to get a value from the vector.
---
---The following accessors correspond to the following numbers:
--->1: x, r, u, pitch
--->2: y, g, v, yaw
--->3: z, b, roll
---
---If you wish to get a number past the third, you will need to use
---different accessors or directly index it. (`Vector[#]`)
---
---You can use a `table` with up to 3 values in place of a `Vector3`.
---The `table` can contain other `table`s to merge them.
---@class Vector3 : Vector
---Vector2 ⇐ Vector
---***
---A list of two numbers that can mean anything.
---You can either use the fields or index by a number to get a value from the vector.
---
---The following accessors correspond to the following numbers:
--->1: x, r, u, pitch
--->2: y, g, v, yaw
---
---If you wish to get a number past the second, you will need to use
---different accessors or directly index it. (`Vector[#]`)
---
---You can use a `table` with up to 2 values in place of a `Vector2`.
---The `table` can contain other `table`s to merge them.
---@class Vector2 : Vector
---VectorPos ⇐ Vector
---***
---A position in 3D space.
---This can also be used for 3D scales.
---
---The following accessors correspond to the following numbers:
--->1: x
--->2: y
--->3: z
---
---If you wish to get a number past the third, you will need to use
---different accessors or directly index it. (`Vector[#]`)
---
---You can use a `table` with up to 3 values in place of a `VectorPos`.
---The `table` can contain other `table`s to merge them.
---@class VectorPos : Vector
---VectorAng ⇐ Vector
---***
---A list of up to three Euler Angles: pitch, yaw, and (sometimes) roll.
---
---The following accessors correspond to the following numbers:
--->1: pitch
--->2: yaw
--->3: roll
---
---If you wish to get a number past the third, you will need to use
---different accessors or directly index it. (`Vector[#]`)
---
---You can use a `table` with up to 3 values in place of a `VectorAng`.
---The `table` can contain other `table`s to merge them.
---@class VectorAng : Vector
---VectorColor ⇐ Vector
---***
---A color value. Stored in `Red, Green, Blue, Alpha` format.
---Color vectors use numbers between 0 and 1.
---
---If your numbers are between 0 and 255, divide your numbers by 255.
---Ex: To change `<100,237,76>` to fit in a color vector, change it to `<100/255,237/255,76/255>`.
---
---Note: Despite there being an `a` accessor, it is very rarely used. Assume it is not used unless
---otherwise specified.
---
---The following accessors correspond to the following numbers:
--->1: r
--->2: g
--->3: b
--->4: a
---
---If you wish to get a number past the fourth, you will need to use
---different accessors or directly index it. (`Vector[#]`)
---
---You can use a `table` with up to 4 values in place of a `VectorColor`.
---The `table` can contain other `table`s to merge them.
---@class VectorColor : Vector
---VectorHSV ⇐ VectorColor ⇐ Vector
---***
---A color value. Stored in `Hue, Saturation, Value, Alpha` format.
---Color vectors use numbers between 0 and 1.
---
---If your hue is between 0-360, divide it by 360.
---If your saturation or value are between 0 and 100, divide them by 100.
---Ex: To change `<290,75,50>` to fit in a color vector, change it to `<290/360,75/100,50/100>`.
---
---Note: Despite there being an `a` accessor, it is very rarely used. Assume it is not used unless
---othewise specified.
---
---The following accessors correspond to the following numbers:
--->1: r (Hue)
--->2: g (Saturation)
--->3: b (Value)
--->4: a
---
---If you wish to get a number past the fourth, you will need to use
---different accessors or directly index it. (`Vector[#]`)
---
---You can use a `table` with up to 4 values in place of a `VectorHue`.
---The `table` can contain other `table`s to merge them.
---@class VectorHSV : VectorColor
---VectorUV ⇐ Vector
---***
---A UV position offset.
---UV vectors use numbers between 0 and 1.
---Ex: To convert a UV offset of 10 pixels right and 5 pixels down, use
---`10/image_width,5/image_height`
---where `image_width` and `image_height` are the size of your texture in pixels.
---
---The following accessors correspond to the following numbers:
--->1: u
--->2: v
---
---If you wish to get a number past the second, you will need to use
---different accessors or directly index it. (`Vector[#]`)
---
---You can use a `table` with up to 2 values in place of a `VectorUV`.
---The `table` can contain other `table`s to merge them.
---@class VectorUV : Vector
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---Contains functions for creating and modifying `Vector`s.
vectors = {}
---Returns an XYZ Euler representation of the rotation around (axis) by (angle) degrees.
---@param axis Vector3
---@param angle number
---@return VectorAng
function vectors.axisAngleToEuler(axis, angle) end
---Returns the XYZ Euler rotation from the given quaternion
---@param quaternion Vector4
---@return Vector3
function vectors.fromQuaternion(quaternion) end
---Creates a Vector with `x` amount of numbers.
---@param x 1|2|3|4|5|6
---@return Vector
function vectors.getVector(x) end
---Creates a Color Vector from an HSV vector.
---
---Note: The resulting color will not have `a` set.
---@param vec VectorHSV
---@return VectorColor
function vectors.hsvToRGB(vec) end
---Creates a Color Vector from a 24 bit integer.
---
---Note: The resulting color will not have `a` set.
---@param x integer
---@return VectorColor
function vectors.intToRGB(x) end
---Applies linear interpolation to two Vectors.
---Returns a `Vector` that is between `Vector a` and `Vector b`,
---using `c` as the distance from `Vector a` to `Vector b`.
---
---Ex: A `c` of .5 will be in directly between the two `Vector`s
---and a `c` of .25 will be 25% of the way from `Vector a` to `Vector b`
---@param a Vector
---@param b Vector
---@param c number
---@return Vector
function vectors.lerp(a, b, c) end
---Creates a Vector from a table.
---@param t number[]
---@return Vector
---
function vectors.of(t) end
---Creates an HSV Vector from a Color Vector.
---@param vec VectorColor
---@return VectorHSV
function vectors.rgbToHSV(vec) end
---Creates a number from a Color Vector.
---@param vec VectorColor
---@return integer
function vectors.rgbToINT(vec) end
---Return a vector after it has been rotated around the given axis by `angle` degrees.
---@param vector Vector
---@param axis Vector
---@param angle number
---@return Vector
function vectors.rotateAroundAxis(vector, axis, angle) end
---Returns a vector after it is rotated by the given quaternion.
---The vectors given must be in radians.
---The output will also be in radians.
---@param vector VectorAng
---@param quaternion Vector4
---@return VectorAng
function vectors.rotateWithQuaternion(vector, quaternion) end
---Returns a quaternion from the given XYZ Euler rotation.
---@param vector Vector3
---@return Vector4
function vectors.toQuaternion(vector) end
---Creates a Position Vector from a block coordinate.
---
---You can use this function to place a `NO_PARENT` part at an exact block coordinate.
---@param vec VectorPos
---@return VectorPos
function vectors.worldToPart(vec) end
---Same as `<CustomModelPart>.worldToPartPos()` but tied with the camera instead.
---@param offset VectorPos
---@return VectorPos
function vectors.worldToCameraPos(offset) end
---Returns the position on the screen where a given world position is.
---
---The first two values are the X and Y position of the coordinate on the screen. (From `-1` to `1`)
---The third value is some value that is `>1` when the coordinate is in front of the screen and `<1`
---when behind the screen.
---The fourth value is the distance of the coordinate from the camera.
---@param pos VectorPos
---@return Vector4
function vectors.worldToScreenSpace(pos) end

120
.vscode/figura/world.lua vendored Normal file
View file

@ -0,0 +1,120 @@
--================================================================================================--
--===== CLASSES ================================================================================--
--================================================================================================--
---A 4-bit int.
---@alias NibbleInt 0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15
---A phase of the moon.
---@alias MoonPhase
---| 0 #Full Moon
---| 1 #Waning Gibbous
---| 2 #Third Quarter
---| 3 #Waning Crescent
---| 4 #New Moon
---| 5 #Waxing Crescent
---| 6 #First Quarter
---| 7 #Waxing Gibbous
---A Minecraft world.
---@class World
local World = {}
---Returns the `Biome` at the specified world position.
---@param pos VectorPos
---@return Biome
function World.getBiome(pos) end
---Returns the block-light level at the given block position.
---
---Note: Returns `15` if the block position is not loaded.
---@param pos VectorPos
---@return NibbleInt
function World.getBlockLightLevel(pos) end
---Returns the block state at the given block position.
---
---Note: Always returns a valid block state, even if the block position is unloaded.
---@param pos VectorPos
---@return BlockState
function World.getBlockState(pos) end
---Returns all players in view distance (including yourself.)
---@return table<string, Player>
function World.getPlayers() end
---Returns the combined light level at the given block position.
---
---Note: Returns `15` if the block position is not loaded.
---@param pos VectorPos
---@return NibbleInt
function World.getLightLevel(pos) end
---See `.getTimeOfDay()`.
---@deprecated
---@return integer
function World.getLunarTime() end
---Returns the current moon phase.
---@return MoonPhase
function World.getMoonPhase() end
---Returns how heavy rain is falling in this world.
---`0` is no rain, `1` is full rain.
---@param delta number
---@return number
function World.getRainGradient(delta) end
---Returns the redstone power the given block position is receiving.
---This does *not* return the redstone power the block is sending.
---
---Note: Returns `0` if the block position is not loaded.
---@param pos VectorPos
---@return NibbleInt
function World.getRedstonePower(pos) end
---Returns the sky-light level of the given block position.
---
---Note: Returns `15` if the block position is not loaded.
---@param pos VectorPos
---@return NibbleInt
function World.getSkyLightLevel(pos) end
---Returns the strong redstone power of the block position is receiving.
---This does *not* return the redstone power the block is sending.
---This *only* checks for direct connections, redstone power sent through non-redstone blocks are
---ignored.
---@param pos VectorPos
---@return NibbleInt
function World.getStrongRedstonePower(pos) end
---Returns the total amount of ticks the server has run for.
---@return integer
function World.getTime() end
---Returns the total amount of ticks that have passed since the start of day 0.
---This will not always sync up with `getTime` if the world's time is modified.
---@return integer
function World.getTimeOfDay() end
---Returns if the world actually exists.
---This is useful for checking if the avatar is currently in a "fake" world.
---@return boolean
function World.hasWorld() end
---Returns if the current weather is thunder.
---@return boolean
function World.isLightning() end
---Returns if the given position has sky access.
---@param pos VectorPos
---@return boolean
function World.isOpenSky(pos) end
--================================================================================================--
--===== FUNCTIONS ==============================================================================--
--================================================================================================--
---The world that this script is running in currently.
---@type World
world = {}

54
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,54 @@
{
//Stops VSCode from making suggestions.
"editor.wordBasedSuggestions": false,
//(Supposedly) makes VSCode only search the current file for words to auto-complete.
//Might not work... Who knows.
"editor.wordBasedSuggestionsMode": "currentDocument",
//(Supposedly) disables auto-completing words from other files.
//Might not work... Who knows.
"Lua.completion.workspaceWord": false,
//Removes some clutter from the documentation screen.
"Lua.completion.displayContext": 0,
//Enables hint types, these show up next to a variable if the type of a variable is set or able to
//be guessed by the language server.
"Lua.hint.enable": true,
"Lua.hint.setType": true,
//Sets the runtime version to the version used by Figura.
"Lua.runtime.version": "Lua 5.2",
//Boring Telemetry stuff. You can enable it I guess?
"Lua.telemetry.enable": false,
//Stops the language server from re-diagnosing the whole model_files folder when you add or remove
//a character in an unrelated file.
"Lua.diagnostics.workspaceDelay": -1,
//Disables some unneeded diagnostics that many will not care about.
//Do not touch unless you know what you are doing.
"Lua.diagnostics.disable": [
"lowercase-global",
"trailing-space",
"unbalanced-assignments",
"duplicate-doc-class"
],
//Changes the severity of some diagnostics to reflect their actual severity in Figura.
//Do not touch unless you know what you are doing.
"Lua.diagnostics.severity": {
"unused-local": "Information",
"unused-vararg": "Information",
"redundant-parameter": "Information",
"redundant-value": "Information",
"redefined-local": "Information"
},
//Enables the documentation.
"Lua.workspace.library": [
"./.vscode/figura"
],
}

View file

@ -0,0 +1,54 @@
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# Load starship prompt if starship is installed
if [ -x /usr/bin/starship ]; then
__main() {
local major="${BASH_VERSINFO[0]}"
local minor="${BASH_VERSINFO[1]}"
if ((major > 4)) || { ((major == 4)) && ((minor >= 1)); }; then
source <("/usr/bin/starship" init bash --print-full-init)
else
source /dev/stdin <<<"$("/usr/bin/starship" init bash --print-full-init)"
fi
}
__main
unset -f __main
fi
# Advanced command-not-found hook
source /usr/share/doc/find-the-command/ftc.bash
# Aliases
alias dir='dir --color=auto'
alias egrep='grep -E --color=auto'
alias fgrep='grep -F --color=auto'
alias fixpacman="sudo rm /var/lib/pacman/db.lck"
alias grep='grep --color=auto'
alias grubup="sudo update-grub"
alias hw='hwinfo --short'
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
alias psmem='ps auxf | sort -nr -k 4'
alias rmpkg="sudo pacman -Rdd"
alias tarnow='tar -acf '
alias untar='tar -zxvf '
alias upd='/usr/bin/update'
alias vdir='vdir --color=auto'
alias wget='wget -c '
# Help people new to Arch
alias apt-get='man pacman'
alias apt='man pacman'
alias helpme='cht.sh --shell'
alias please='sudo'
alias tb='nc termbin.com 9999'
# Cleanup orphaned packages
alias cleanup='sudo pacman -Rns `pacman -Qtdq`'
# Get the error messages from journalctl
alias jctl="journalctl -p 3 -xb"
# Recent installed packages
alias rip="expac --timefmt='%Y-%m-%d %T' '%l\t%n %v' | sort | tail -200 | nl"

View file

@ -0,0 +1,80 @@
source $__fish_data_dir/completions/git.fish
# Merge command
complete -f -x -c merge -a '(__fish_git_branches)'
complete -f -x -c merge \
-s h -l help \
-d "Show information about the options for this command"
complete -f -x -c merge \
-s a -l abort \
-d "Abort conflicted merge"
complete -f -x -c merge \
-s c -l continue \
-d "Continue merge"
# Move command
complete -f -x -c move -a '(__fish_git_branches)'
complete -f -x -c move \
-s h -l help \
-d "Show information about the options for this command"
complete -f -x -c move \
-s p -l prev \
-d "Switch to a previous branch using the `--no-apply-stash` option (equivalent to \"move -\")"
complete -f -x -c move \
-s n -l no-apply-stash \
-a '(__fish_git_branches)' \
-d "Switch to a local branch but without applying current stash"
complete -f -x -c move \
-s u -l upstream \
-a '(__fish_git_branches)' \
-d "Fetch a remote branch and switch to it applying current stash"
# Tag command
complete -f -x -c tag \
-d "List all tags in a lexicographic order and treating tag names as versions"
complete -f -x -c tag -a '(__fish_git_tags)'
complete -f -x -c tag \
-s h -l help \
-d "Show information about the options for this command"
complete -f -x -c tag \
-s l -l latest \
-d "Show only the latest Semver release tag version (no suffixed ones or others)"
complete -f -x -c tag \
-s x -l major \
-d "Tag auto-incrementing a major version number"
complete -f -x -c tag \
-s y -l minor \
-d "Tag auto-incrementing a minor version number"
complete -f -x -c tag \
-s z -l patch \
-d "Tag auto-incrementing a patch version number"
# TODO: pre-release versions are not supported yet
# complete -f -x -c tag \
# -s a -l premajor \
# -d "Tag auto-incrementing a premajor version number"
# complete -f -x -c tag \
# -s b -l preminor \
# -d "Tag auto-incrementing a preminor version number"
# complete -f -x -c tag \
# -s c -l prepatch \
# -d "Tag auto-incrementing a prepatch version number"

View file

@ -0,0 +1,21 @@
complete --command nvm --exclusive
complete --command nvm --exclusive --long version --description "Print version"
complete --command nvm --exclusive --long help --description "Print help"
complete --command nvm --long silent --description "Suppress standard output"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments install --description "Download and activate the specified Node version"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments use --description "Activate the specified Node version in the current shell"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments list --description "List installed Node versions"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments list-remote --description "List available Node versions to install"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments current --description "Print the currently-active Node version"
complete --command nvm --exclusive --condition "__fish_seen_subcommand_from install" --arguments "(
test -e $nvm_data && string split ' ' <$nvm_data/.index
)"
complete --command nvm --exclusive --condition "__fish_seen_subcommand_from use" --arguments "(_nvm_list | string split ' ')"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments uninstall --description "Uninstall the specified Node version"
complete --command nvm --exclusive --condition "__fish_seen_subcommand_from uninstall" --arguments "(
_nvm_list | string split ' ' | string replace system ''
)"
complete --command nvm --exclusive --condition "__fish_seen_subcommand_from use uninstall" --arguments "(
set --query nvm_default_version && echo default
)"

View file

@ -0,0 +1,243 @@
# Defines autocompletion for SDKMAN!
# Copyright (c) 2018-2023 Raphael Reitzig
# MIT License (MIT)
# https://github.com/reitzig/sdkman-for-fish
# Guard: SDKMAN! needs to be installed
if not test -f "$SDKMAN_DIR/bin/sdkman-init.sh"
exit 0
end
# # # # # #
# Completion trigger predicates
# # # # # #
# Test if there is no command
function __fish_sdkman_no_command
set cmd (commandline -opc)
if [ (count $cmd) -eq 1 ]
return 0
end
return 1
end
# Test if the main command matches one of the parameters
function __fish_sdkman_using_command
set cmd (commandline -opc)
if [ (count $cmd) -eq 2 ]
if contains $cmd[2] $argv
return 0
end
end
return 1
end
function __fish_sdkman_specifying_candidate
set cmd (commandline -opc)
if [ (count $cmd) -eq 3 ] # currently, sdk does not support multiple versions
if contains $cmd[2] $argv
return 0
end
end
return 1
end
function __fish_sdkman_command_has_enough_parameters
set cmd (commandline -opc)
if [ (count $cmd) -ge (math $argv[1] + 2) ]; and contains $cmd[2] $argv[2..-1]
return 0
end
return 1
end
# # # # # #
# Data collectors
# # # # # #
function __fish_sdkman_candidates
cat "$HOME"/.sdkman/var/candidates | tr ',' '\n'
end
function __fish_sdkman_candidates_with_versions
set regexpHome (string replace -a '/' '\\/' "$HOME/")
find "$HOME"/.sdkman/candidates/ -mindepth 2 -maxdepth 2 -name '*current' \
| awk -F '/' '{ print $(NF-1) }' \
| sort -u
end
function __fish_sdkman_installed_versions
set cmd (commandline -opc)
if [ -d "$HOME"/.sdkman/candidates/$cmd[3]/current ]
ls -v1 "$HOME"/.sdkman/candidates/$cmd[3] | grep -v current
end
end
# # # # # #
# Completion specification
# # # # # #
# install
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'i install' \
-d 'Install new version'
complete -c sdk -f -n '__fish_sdkman_using_command i install' \
-a "(__fish_sdkman_candidates)"
# TODO complete available versions --> issue #4
complete -c sdk -f -n '__fish_sdkman_specifying_candidate i install' \
-a 'a.b.c' \
-d "version list unavailable"
complete -c sdk -f -n '__fish_sdkman_specifying_candidate i install' \
-a 'x.y.z' \
-d "Specify path to install custom version."
# Implicit: complete files as fourth parameter
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 3 i install'
# block
# uninstall
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'rm uninstall' -d 'Uninstall version'
complete -c sdk -f -n '__fish_sdkman_using_command rm uninstall' \
-a "(__fish_sdkman_candidates_with_versions)"
complete -c sdk -f -n '__fish_sdkman_specifying_candidate rm uninstall' \
-a "(__fish_sdkman_installed_versions)"
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 2 rm uninstall'
# block
# list
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'ls list' \
-d 'List versions'
complete -c sdk -f -n '__fish_sdkman_using_command ls list' \
-a "(__fish_sdkman_candidates)"
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 ls list'
# block
# use
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'u use' \
-d 'Use specific version'
complete -c sdk -f -n '__fish_sdkman_using_command u use' \
-a "(__fish_sdkman_candidates_with_versions)"
complete -c sdk -f -n '__fish_sdkman_specifying_candidate u use' \
-a "(__fish_sdkman_installed_versions)"
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 2 u use'
# block
# default
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'd default' \
-d 'Set default version'
complete -c sdk -f -n '__fish_sdkman_using_command d default' \
-a "(__fish_sdkman_candidates_with_versions)"
complete -c sdk -f -n '__fish_sdkman_specifying_candidate d default' \
-a "(__fish_sdkman_installed_versions)"
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 2 d default'
# block
# current
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'c current' \
-d 'Display current version'
complete -c sdk -f -n '__fish_sdkman_using_command c current' \
-a "(__fish_sdkman_candidates)"
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 c current'
# block
# upgrade
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'ug upgrade' \
-d 'Display what is outdated'
complete -c sdk -f -n '__fish_sdkman_using_command ug upgrade' \
-a "(__fish_sdkman_candidates_with_versions)"
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 ug upgrade'
# block
# version
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'v version' \
-d 'Display version'
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 0 v version'
# block
# help
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'help' \
-d 'Display help message'
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 0 h help'
# block
# offline
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'offline' \
-d 'Set offline status'
complete -c sdk -f -n '__fish_sdkman_using_command offline' \
-a 'enable' \
-d 'Make sdk work while offline'
complete -c sdk -f -n '__fish_sdkman_using_command offline' \
-a 'disable' \
-d 'Turn on all features'
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 offline'
# block
# selfupdate
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'selfupdate' \
-d 'Update sdk'
complete -c sdk -f -n '__fish_sdkman_using_command selfupdate' \
-a 'force' \
-d 'Force re-install of current version'
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 selfupdate'
# block
# update
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'update' \
-d 'Reload the candidate list'
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 0 update'
# block
# flush
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'flush' \
-d 'Clear out archives and temporary storage folders'
complete -c sdk -f -n '__fish_sdkman_using_command flush' \
-a 'temp' \
-d 'Clear out staging work folder'
complete -c sdk -f -n '__fish_sdkman_using_command flush' \
-a 'version' \
-d 'Flush version file'
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 flush'
# block
# env
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'e env' \
-d 'Load environment from .sdkmanrc file'
complete -c sdk -f -n '__fish_sdkman_using_command e env' \
-a 'init' \
-d 'Initialize .sdkmanrc file'
complete -c sdk -f -n '__fish_sdkman_using_command e env' \
-a 'install' \
-d 'Install all candidate versions listed in .sdkmanrc'
complete -c sdk -f -n '__fish_sdkman_using_command e env' \
-a 'clear' \
-d 'Unload currently loaded environment'
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 e env'
# block
# home
complete -c sdk -f -n '__fish_sdkman_no_command' \
-a 'h home' \
-d 'Show installation folder of given candidate'
complete -c sdk -f -n '__fish_sdkman_using_command h home' \
-a "(__fish_sdkman_candidates_with_versions)"
complete -c sdk -f -n '__fish_sdkman_specifying_candidate h home' \
-a "(__fish_sdkman_installed_versions)"
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 2 h home'
# block

View file

@ -0,0 +1,4 @@
complete --command spark --exclusive --long min --description "Minimum range"
complete --command spark --exclusive --long max --description "Maximum range"
complete --command spark --exclusive --long version --description "Print version"
complete --command spark --exclusive --long help --description "Print this help message"

View file

@ -0,0 +1,40 @@
[ options ]
# Read text from system clipboard or from the standard input
# only when using Gitflow keybindings
clipboard = false
[ keybindings ]
# Alt + S
state = \es
# Alt + E
stage = \ee
# Ctrl + E
unstage = \ce
# Alt + M
show = \em
# Alt + C
commit-all = \ec
# Alt + D
pull = \ed
# Alt + P
push = \ep
# Alt + U
upstream = \eu
# Alt + L
logs = \el
# Alt + F
feature = \ef
# Alt + H
hotfix = \eh

View file

@ -0,0 +1,296 @@
# MIT License
# Copyright (c) 2016 Francisco Lourenço & Daniel Wehner
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
set -g __done_version 1.16.3
function __done_run_powershell_script
set -l powershell_exe (command --search "powershell.exe")
if test $status -ne 0
and command --search wslvar
set -l powershell_exe (wslpath (wslvar windir)/System32/WindowsPowerShell/v1.0/powershell.exe)
end
if string length --quiet "$powershell_exe"
and test -x "$powershell_exe"
set cmd (string escape $argv)
eval "$powershell_exe -Command $cmd"
end
end
function __done_windows_notification -a title -a message
if test "$__done_notify_sound" -eq 1
set soundopt "<audio silent=\"false\" src=\"ms-winsoundevent:Notification.Default\" />"
else
set soundopt "<audio silent=\"true\" />"
end
__done_run_powershell_script "
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null
[Windows.UI.Notifications.ToastNotification, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
\$toast_xml_source = @\"
<toast>
$soundopt
<visual>
<binding template=\"ToastText02\">
<text id=\"1\">$title</text>
<text id=\"2\">$message</text>
</binding>
</visual>
</toast>
\"@
\$toast_xml = New-Object Windows.Data.Xml.Dom.XmlDocument
\$toast_xml.loadXml(\$toast_xml_source)
\$toast = New-Object Windows.UI.Notifications.ToastNotification \$toast_xml
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier(\"fish\").Show(\$toast)
"
end
function __done_get_focused_window_id
if type -q lsappinfo
lsappinfo info -only bundleID (lsappinfo front) | cut -d '"' -f4
else if test -n "$SWAYSOCK"
and type -q jq
swaymsg --type get_tree | jq '.. | objects | select(.focused == true) | .id'
else if begin
test "$XDG_SESSION_DESKTOP" = gnome; and type -q gdbus
end
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval 'global.display.focus_window.get_id()'
else if type -q xprop
and test -n "$DISPLAY"
# Test that the X server at $DISPLAY is running
and xprop -grammar >/dev/null 2>&1
xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2
else if uname -a | string match --quiet --ignore-case --regex microsoft
__done_run_powershell_script '
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class WindowsCompat {
[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();
}
"@
[WindowsCompat]::GetForegroundWindow()
'
else if set -q __done_allow_nongraphical
echo 12345 # dummy value
end
end
function __done_is_tmux_window_active
set -q fish_pid; or set -l fish_pid %self
# find the outermost process within tmux
# ppid != "tmux" -> pid = ppid
# ppid == "tmux" -> break
set tmux_fish_pid $fish_pid
while set tmux_fish_ppid (ps -o ppid= -p $tmux_fish_pid | string trim)
and ! string match -q "tmux*" (basename (ps -o command= -p $tmux_fish_ppid))
set tmux_fish_pid $tmux_fish_ppid
end
# tmux session attached and window is active -> no notification
# all other combinations -> send notification
tmux list-panes -a -F "#{session_attached} #{window_active} #{pane_pid}" | string match -q "1 1 $tmux_fish_pid"
end
function __done_is_screen_window_active
string match --quiet --regex "$STY\s+\(Attached" (screen -ls)
end
function __done_is_process_window_focused
# Return false if the window is not focused
if set -q __done_allow_nongraphical
return 1
end
set __done_focused_window_id (__done_get_focused_window_id)
if test "$__done_sway_ignore_visible" -eq 1
and test -n "$SWAYSOCK"
string match --quiet --regex "^true" (swaymsg -t get_tree | jq ".. | objects | select(.id == "$__done_initial_window_id") | .visible")
return $status
else if test "$__done_initial_window_id" != "$__done_focused_window_id"
return 1
end
# If inside a tmux session, check if the tmux window is focused
if type -q tmux
and test -n "$TMUX"
__done_is_tmux_window_active
return $status
end
# If inside a screen session, check if the screen window is focused
if type -q screen
and test -n "$STY"
__done_is_screen_window_active
return $status
end
return 0
end
function __done_humanize_duration -a milliseconds
set -l seconds (math --scale=0 "$milliseconds/1000" % 60)
set -l minutes (math --scale=0 "$milliseconds/60000" % 60)
set -l hours (math --scale=0 "$milliseconds/3600000")
if test $hours -gt 0
printf '%s' $hours'h '
end
if test $minutes -gt 0
printf '%s' $minutes'm '
end
if test $seconds -gt 0
printf '%s' $seconds's'
end
end
# verify that the system has graphical capabilities before initializing
if test -z "$SSH_CLIENT" # not over ssh
and count (__done_get_focused_window_id) >/dev/null # is able to get window id
set __done_enabled
end
if set -q __done_allow_nongraphical
and set -q __done_notification_command
set __done_enabled
end
if set -q __done_enabled
set -g __done_initial_window_id ''
set -q __done_min_cmd_duration; or set -g __done_min_cmd_duration 5000
set -q __done_exclude; or set -g __done_exclude 'git (?!push|pull|fetch)'
set -q __done_notify_sound; or set -g __done_notify_sound 0
set -q __done_sway_ignore_visible; or set -g __done_sway_ignore_visible 0
function __done_started --on-event fish_preexec
set __done_initial_window_id (__done_get_focused_window_id)
end
function __done_ended --on-event fish_prompt
set -l exit_status $status
# backwards compatibility for fish < v3.0
set -q cmd_duration; or set -l cmd_duration $CMD_DURATION
if test $cmd_duration
and test $cmd_duration -gt $__done_min_cmd_duration # longer than notify_duration
and not __done_is_process_window_focused # process pane or window not focused
and not string match -qr $__done_exclude $history[1] # don't notify on git commands which might wait external editor
# Store duration of last command
set -l humanized_duration (__done_humanize_duration "$cmd_duration")
set -l title "Done in $humanized_duration"
set -l wd (string replace --regex "^$HOME" "~" (pwd))
set -l message "$wd/ $history[1]"
set -l sender $__done_initial_window_id
if test $exit_status -ne 0
set title "Failed ($exit_status) after $humanized_duration"
end
if set -q __done_notification_command
eval $__done_notification_command
if test "$__done_notify_sound" -eq 1
echo -e "\a" # bell sound
end
else if type -q terminal-notifier # https://github.com/julienXX/terminal-notifier
if test "$__done_notify_sound" -eq 1
terminal-notifier -message "$message" -title "$title" -sender "$__done_initial_window_id" -sound default
else
terminal-notifier -message "$message" -title "$title" -sender "$__done_initial_window_id"
end
else if type -q osascript # AppleScript
osascript -e "display notification \"$message\" with title \"$title\""
if test "$__done_notify_sound" -eq 1
echo -e "\a" # bell sound
end
else if type -q notify-send # Linux notify-send
# set urgency to normal
set -l urgency normal
# use user-defined urgency if set
if set -q __done_notification_urgency_level
set urgency "$__done_notification_urgency_level"
end
# override user-defined urgency level if non-zero exitstatus
if test $exit_status -ne 0
set urgency critical
if set -q __done_notification_urgency_level_failure
set urgency "$__done_notification_urgency_level_failure"
end
end
notify-send --urgency=$urgency --icon=utilities-terminal --app-name=fish "$title" "$message"
if test "$__done_notify_sound" -eq 1
echo -e "\a" # bell sound
end
else if type -q notify-desktop # Linux notify-desktop
set -l urgency
if test $exit_status -ne 0
set urgency "--urgency=critical"
end
notify-desktop $urgency --icon=utilities-terminal --app-name=fish "$title" "$message"
if test "$__done_notify_sound" -eq 1
echo -e "\a" # bell sound
end
else if uname -a | string match --quiet --ignore-case --regex microsoft
__done_windows_notification "$title" "$message"
else # anything else
echo -e "\a" # bell sound
end
end
end
end
function __done_uninstall -e done_uninstall
# Erase all __done_* functions
functions -e __done_ended
functions -e __done_started
functions -e __done_get_focused_window_id
functions -e __done_is_tmux_window_active
functions -e __done_is_screen_window_active
functions -e __done_is_process_window_focused
functions -e __done_windows_notification
functions -e __done_run_powershell_script
functions -e __done_humanize_duration
# Erase __done variables
set -e __done_version
end

View file

@ -0,0 +1,695 @@
# GitNow — Speed up your Git workflow. 🐠
# https://github.com/joseluisq/gitnow
# Default global variables
set -g g_current_branch
function __gitnow_install -e gitnow_install
echo (gitnow -v)" is installed and ready to use!"
echo "Just run the `gitnow` command if you want explore the API."
end
function __gitnow_uninstall -e gitnow_uninstall
echo "GitNow was uninstalled successfully."
end
function gitnow -d "Gitnow: Speed up your Git workflow. 🐠" -a xversion
if [ "$xversion" = "-v" ]; or [ "$xversion" = "--version" ]
echo "GitNow version $gitnow_version"
else
__gitnow_manual | command less -r
end
end
function state -d "Gitnow: Show the working tree status in compact way"
if not __gitnow_is_git_repository
__gitnow_msg_not_valid_repository "state"
return
end
command git status -sb
end
function stage -d "Gitnow: Stage files in current working directory"
if not __gitnow_is_git_repository
__gitnow_msg_not_valid_repository "stage"
return
end
set -l len (count $argv)
set -l opts .
if test $len -gt 0
set opts $argv
end
command git add $opts
end
function unstage -d "Gitnow: Unstage files in current working directory"
if not __gitnow_is_git_repository
__gitnow_msg_not_valid_repository "unstage"
return
end
set -l len (count $argv)
set -l opts .
if test $len -gt 0
set opts $argv
end
command git reset $opts
end
function show -d "Gitnow: Show commit detail objects"
if not __gitnow_is_git_repository
__gitnow_msg_not_valid_repository "show"
return
end
set -l len (count $argv)
if test $len -gt 0
command git show $argv
else
command git show --compact-summary --patch HEAD
end
end
function untracked -d "Gitnow: Check for untracked files and directories on current working directory"
if not __gitnow_is_git_repository
__gitnow_msg_not_valid_repository "untracked"
return
end
command git clean --dry-run -d
end
function commit -d "Gitnow: Commit changes to the repository"
if not __gitnow_is_git_repository
__gitnow_msg_not_valid_repository "commit"
return
end
set -l len (count $argv)
if test $len -gt 0
command git commit $argv
else
command git commit
end
end
function commit-all -d "Gitnow: Add and commit all changes to the repository"
if not __gitnow_is_git_repository
__gitnow_msg_not_valid_repository "commit-all"
return
end
stage
commit .
end
function pull -d "Gitnow: Pull changes from remote server but stashing uncommitted changes"
if not __gitnow_is_git_repository
__gitnow_msg_not_valid_repository "pull"
return
end
set -l len (count $argv)
set -l xorigin (__gitnow_current_remote)
set -l xbranch (__gitnow_current_branch_name)
set -l xcmd ""
echo "⚡️ Pulling changes..."
set -l xdefaults --rebase --autostash --tags
if test $len -gt 2
set xcmd $argv
echo "Mode: Manual"
echo "Default flags: $xdefaults"
echo
else
echo "Mode: Auto"
echo "Default flags: $xdefaults"
if test $len -eq 1
set xbranch $argv[1]
end
if test $len -eq 2
set xorigin $argv[1]
set xbranch $argv[2]
end
set xcmd $xorigin $xbranch
set -l xremote_url (command git config --get "remote.$xorigin.url")
echo "Remote URL: $xorigin ($xremote_url)"
echo "Remote branch: $xbranch"
echo
end
command git pull $xcmd $xdefaults
end
# Git push with --set-upstream
# Shortcut inspired from https://github.com/jamiew/git-friendly
function push -d "Gitnow: Push commit changes to remote repository"
if not __gitnow_is_git_repository
__gitnow_msg_not_valid_repository "push"
return
end
set -l opts $argv
set -l xorigin (__gitnow_current_remote)
set -l xbranch (__gitnow_current_branch_name)
if test (count $opts) -eq 0
set opts $xorigin $xbranch
set -l xremote_url (command git config --get "remote.$xorigin.url")
echo "🚀 Pushing changes..."
echo "Mode: Auto"
echo "Remote URL: $xorigin ($xremote_url)"
echo "Remote branch: $xbranch"
else
set -l v_mode "auto"
for v in $argv
switch $v
case -t --tags
set opts $xorigin $xbranch --follow-tags
set -l xremote_url (command git config --get "remote.$xorigin.url")
echo "🚀 Pushing changes..."
echo "Mode: Auto (incl. tags)"
echo "Remote URL: $xorigin ($xremote_url)"
echo "Remote branch: $xbranch"
case -h --help
echo "NAME"
echo " Gitnow: push - Push current branch to default origin"
echo "OPTIONS:"
echo " -t --tags (auto mode) include annotated tags that relate to the commits"
echo " -h --help Show information about the options for this command"
return
case -\*
case '*'
set -l v_mode "manual"
echo "Mode: Manual"
end
end
end
echo
command git push --set-upstream $opts
end
function upstream -d "Gitnow: Commit all changes and push them to remote server"
if not __gitnow_is_git_repository
__gitnow_msg_not_valid_repository "upstream"
return
end
commit-all
push
end
function feature -d "GitNow: Creates a new Gitflow feature branch from current branch" -a xbranch
if not __gitnow_is_git_repository
__gitnow_msg_not_valid_repository "feature"
return
end
__gitnow_gitflow_branch "feature" $xbranch
end
function hotfix -d "GitNow: Creates a new Gitflow hotfix branch from current branch" -a xbranch
if not __gitnow_is_git_repository
__gitnow_msg_not_valid_repository "hotfix"
return
end
__gitnow_gitflow_branch "hotfix" $xbranch
end
function bugfix -d "GitNow: Creates a new Gitflow bugfix branch from current branch" -a xbranch
if not __gitnow_is_git_repository
__gitnow_msg_not_valid_repository "bugfix"
return
end
__gitnow_gitflow_branch "bugfix" $xbranch
end
function release -d "GitNow: Creates a new Gitflow release branch from current branch" -a xbranch
if not __gitnow_is_git_repository
__gitnow_msg_not_valid_repository "release"
return
end
__gitnow_gitflow_branch "release" $xbranch
end
function merge -d "GitNow: Merges given branch into the active one"
if not __gitnow_is_git_repository
__gitnow_msg_not_valid_repository "merge"
return
end
set -l len (count $argv)
if test $len -eq 0
echo "Merge: No argument given, needs one parameter"
return
end
set -l v_abort
set -l v_continue
set -l v_branch
for v in $argv
switch $v
case -a --abort
set v_abort $v
case -c --continue
set v_continue $v
case -h --help
echo "NAME"
echo " Gitnow: merge - Merge given branch into the active one"
echo "EXAMPLES"
echo " merge <branch to merge>"
echo "OPTIONS:"
echo " -a --abort Abort a conflicted merge"
echo " -c --continue Continue a conflicted merge"
echo " -h --help Show information about the options for this command"
return
case -\*
case '*'
set v_branch $v
end
end
# abort
if test "$v_abort";
echo "Abort the current merge"
command git merge --abort
return
end
# continue
if test "$v_continue";
echo "Continue the current merge"
command git merge --continue
return
end
# No branch defined
if not test -n "$v_branch"
echo "Provide a valid branch name to merge."
return
end
set -l v_found (__gitnow_check_if_branch_exist $v_branch)
# Branch was not found
if test $v_found -eq 0;
echo "Local branch `$v_branch` was not found. Not possible to merge."
return
end
# Detect merging current branch
if [ "$v_branch" = (__gitnow_current_branch_name) ]
echo "Branch `$v_branch` is the same as current branch. Nothing to do."
return
end
command git merge $v_branch
end
function move -d "GitNow: Switch from current branch to another but stashing uncommitted changes" -a args
if not __gitnow_is_git_repository
__gitnow_msg_not_valid_repository "move"
return
end
set -l v_upstream
set -l v_no_apply_stash
set -l v_branch
set -l v_prev
for v in $argv
switch $v
case -u --upstream
set v_upstream $v
case -n --no-apply-stash
set v_no_apply_stash $v
case -nu -un
set v_upstream "-u"
set v_no_apply_stash "-n"
case -p --prev
set v_prev "true"
case -h --help
echo "NAME"
echo " Gitnow: move - Switch from current branch to another but stashing uncommitted changes"
echo "EXAMPLES"
echo " move <branch to switch to>"
echo " move -"
echo "OPTIONS:"
echo " -n --no-apply-stash Switch to a local branch but without applying current stash"
echo " -u --upstream Fetch a remote branch and switch to it applying current stash. It can be combined with --no-apply-stash"
echo " -p --prev Switch to a previous branch if different than the current one (equivalent to \"move -\"). It uses `--no-apply-stash` option by default."
echo " -h --help Show information about the options for this command"
return
case -\*
case '*'
set v_branch $v
end
end
# Move to prev branch either via the --prev option or the "-" shorthand char
if begin test -n "$v_prev"; or [ "$args" = "-" ]; end
if begin test -z "$g_current_branch"; or [ "$g_current_branch" = (__gitnow_current_branch_name) ]; end
echo "Previous branch not found or the same as current one. Nothing to do."
echo "Tip: Previous branch switching only works via the `move` command."
return
end
echo "Previous branch found, switching to `$g_current_branch` (using `--no-apply-stash` option)."
move -n $g_current_branch
return
end
# No branch defined
if not test -n "$v_branch"
echo "Provide a valid branch name to switch to."
return
end
set -l v_fetched 0
# Fetch branch from remote
if test -n "$v_upstream"
set -l v_remote (__gitnow_current_remote)
command git fetch $v_remote $v_branch:refs/remotes/$v_remote/$v_branch
command git checkout --track $v_remote/$v_branch
return
end
set -l v_found (__gitnow_check_if_branch_exist $v_branch)
# Branch was not found
if begin test $v_found -eq 0; and test $v_fetched -eq 0; end
echo "Branch `$v_branch` was not found locally. No possible to switch."
echo "Tip: Use -u (--upstream) flag to fetch a remote branch."
return
end
# Prevent same branch switching
if [ "$v_branch" = (__gitnow_current_branch_name) ]
echo "Branch `$v_branch` is the same as current branch. Nothing to do."
return
end
set -l v_uncommited (__gitnow_has_uncommited_changes)
# Stash changes before checkout for uncommited changes only
if test $v_uncommited
command git stash
end
set g_current_branch (__gitnow_current_branch_name)
command git checkout $v_branch
# --no-apply-stash
if test -n "$v_no_apply_stash"
echo "Changes were stashed but not applied by default. Use `git stash pop` to apply them."
end
if begin test $v_uncommited; and not test -n "$v_no_apply_stash"; end
command git stash pop
echo "Stashed changes were applied."
end
end
function logs -d "Gitnow: Shows logs in a fancy way"
if not __gitnow_is_git_repository
__gitnow_msg_not_valid_repository "logs"
return
end
set -l v_max_commits "80"
set -l v_args
for v in $argv
switch $v
case -h --help
echo "NAME"
echo " Gitnow: logs - Show logs in a fancy way (first $v_max_commits commits by default)"
echo "EXAMPLES"
echo " logs [git log options]"
echo "EXTRA OPTIONS:"
echo " -h, --help Show information about the options for this command"
return
case -\*
case '*'
set v_args $argv
break
end
end
if test -n "$v_args"
set v_max_commits
else
set v_max_commits "-$v_max_commits"
end
LC_ALL=C command git log $v_max_commits $v_args --color --graph \
--pretty=format:"%C(red)%h%C(reset)%C(yellow)%d%Creset %s %C(green italic)(%cr)%C(reset) %C(blue)%an%C(reset) %C(white dim)%GK %C(reset)" --abbrev-commit \
| command less -R
end
function tag -d "Gitnow: Tag commits following Semver"
if not __gitnow_is_git_repository
__gitnow_msg_not_valid_repository "tag"
return
end
set -l v_major
set -l v_minor
set -l v_patch
set -l v_premajor
set -l v_preminor
set -l v_prepatch
set -l opts
# NOTE: this function only gets the latest *Semver release version* but no suffixed ones or others
set -l v_latest (__gitnow_get_latest_semver_release_tag)
for v in $argv
switch $v
case -x --major
set v_major $v
case -y --minor
set v_minor $v
case -z --patch
set v_patch $v
case -a --annotate
set opts $opts $v
# TODO: pre-release versions are not supported yet
# case -a --premajor
# set v_premajor $v
# case -b --preminor
# set v_preminor $v
# case -c --prepatch
# set v_prepatch $v
case -l --latest
if not test -n "$v_latest"
echo "There is no any tag created yet."
else
echo $v_latest
end
return
case -h --help
echo "NAME"
echo " Gitnow: tag - List or tag commits following The Semantic Versioning 2.0.0 (Semver) [1]"
echo " [1] https://semver.org/"
echo "EXAMPLES"
echo " List tags: tag"
echo " Custom tag: tag <my tag name>"
echo " Semver tag: tag --major"
echo "OPTIONS:"
echo " Without options all tags are listed in a lexicographic order and tag names are treated as versions"
echo " -x --major Tag auto-incrementing a major version number"
echo " -y --minor Tag auto-incrementing a minor version number"
echo " -z --patch Tag auto-incrementing a patch version number"
echo " -l --latest Show only the latest Semver release tag version (no suffixed ones or others)"
echo " -a --annotate Create as annotated tag"
echo " -h --help Show information about the options for this command"
# TODO: pre-release versions are not supported yet
# echo " -a --premajor Tag auto-incrementing a premajor version number"
# echo " -b --preminor Tag auto-incrementing a preminor version number"
# echo " -c --prepatch Tag auto-incrementing a prepatch version number"
return
case -\*
case '*'
return
end
end
# List all tags in a lexicographic order and treating tag names as versions
if test -z "$argv"
__gitnow_get_tags_ordered
return
end
# Major version tags
if test -n "$v_major"
if not test -n "$v_latest"
command git tag $opts v1.0.0
echo "First major tag \"v1.0.0\" was created."
return
else
set -l vstr (__gitnow_get_valid_semver_release_value $v_latest)
# Validate Semver format before to proceed
if not test -n "$vstr"
echo "The latest tag \"$v_latest\" has no a valid Semver format."
return
end
set -l x (echo $vstr | LC_ALL=C command awk -F '.' '{print $1}')
set -l prefix (echo $v_latest | LC_ALL=C command awk -F "$vstr" '{print $1}')
set x (__gitnow_increment_number $x)
set -l xyz "$prefix$x.0.0"
command git tag $opts $xyz
echo "Major tag \"$xyz\" was created."
return
end
end
# Minor version tags
if test -n "$v_minor"
if not test -n "$v_latest"
command git tag $opts v0.1.0
echo "First minor tag \"v0.1.0\" was created."
return
else
set -l vstr (__gitnow_get_valid_semver_release_value $v_latest)
# Validate Semver format before to proceed
if not test -n "$vstr"
echo "The latest tag \"$v_latest\" has no a valid Semver format."
return
end
set -l x (echo $vstr | LC_ALL=C command awk -F '.' '{print $1}')
set -l y (echo $vstr | LC_ALL=C command awk -F '.' '{print $2}')
set -l prefix (echo $v_latest | LC_ALL=C command awk -F "$vstr" '{print $1}')
set y (__gitnow_increment_number $y)
set -l xyz "$prefix$x.$y.0"
command git tag $opts $xyz
echo "Minor tag \"$xyz\" was created."
return
end
end
# Patch version tags
if test -n "$v_patch"
if not test -n "$v_latest"
command git tag $opts v0.0.1
echo "First patch tag \"v0.1.0\" was created."
return
else
set -l vstr (__gitnow_get_valid_semver_release_value $v_latest)
# Validate Semver format before to proceed
if not test -n "$vstr"
echo "The latest tag \"$v_latest\" has no a valid Semver format."
return
end
set -l x (echo $vstr | LC_ALL=C command awk -F '.' '{print $1}')
set -l y (echo $vstr | LC_ALL=C command awk -F '.' '{print $2}')
set -l z (echo $vstr | LC_ALL=C command awk -F '.' '{print $3}')
set -l s (echo $z | LC_ALL=C command awk -F '-' '{print $1}')
if __gitnow_is_number $s
set -l prefix (echo $v_latest | LC_ALL=C command awk -F "$vstr" '{print $1}')
set s (__gitnow_increment_number $s)
set -l xyz "$prefix$x.$y.$s"
command git tag $opts $xyz
echo "Patch tag \"$xyz\" was created."
else
echo "No patch version found."
end
return
end
end
# TODO: pre-release versions are not supported yet
# TODO: Premajor version tags
# TODO: Preminor version tags
# TODO: Prepatch version tags
end
function assume -d "Gitnow: Ignore files temporarily"
if not __gitnow_is_git_repository
__gitnow_msg_not_valid_repository "assume"
return
end
set -l v_assume_unchanged "--assume-unchanged"
set -l v_files
for v in $argv
switch $v
case -n --no-assume
set v_assume_unchanged "--no-assume-unchanged"
case -h --help
echo "NAME"
echo " Gitnow: assume - Ignores changes in certain files temporarily"
echo "OPTIONS:"
echo " -n --no-assume No assume unchanged files to be ignored (revert option)"
echo " -h --help Show information about the options for this command"
return
case -\*
case '*'
set v_files $v_files $v
end
end
if test (count $v_files) -lt 1
echo "Provide files in order to ignore them temporarily. E.g `assume Cargo.lock`"
return
end
command git update-index $v_assume_unchanged $v_files
end
function github -d "Gitnow: Clone a GitHub repository using SSH"
set -l repo (__gitnow_clone_params $argv)
__gitnow_clone_repo $repo "github"
end
function bitbucket -d "Gitnow: Clone a Bitbucket Cloud repository using SSH"
set -l repo (__gitnow_clone_params $argv)
__gitnow_clone_repo $repo "bitbucket"
end

View file

@ -0,0 +1,32 @@
# GitNow — Speed up your Git workflow. 🐠
# https://github.com/joseluisq/gitnow
set -g gitnow_version 2.11.0
if set -q __fish_config_dir
set -g fish_config "$__fish_config_dir"
else
set -q XDG_CONFIG_HOME
and set -g fish_config "$XDG_CONFIG_HOME/fish"
or set -g fish_config "~/.config/fish"
end
set -q fish_snippets; or set -g fish_snippets "$fish_config/conf.d"
set -q fish_functions; or set -g fish_functions "$fish_config/functions"
set -q fish_completions; or set -g fish_completions "$fish_config/completions"
set -q GITNOW_CONFIG_FILE; or set -g GITNOW_CONFIG_FILE ~/.gitnow
if functions -q __fundle_plugins_dir
set -l fundledir (__fundle_plugins_dir)
source "$fundledir/joseluisq/gitnow/functions/__gitnow_functions.fish"
source "$fundledir/joseluisq/gitnow/functions/__gitnow_manual.fish"
source "$fundledir/joseluisq/gitnow/functions/__gitnow_config_file.fish"
source "$fundledir/joseluisq/gitnow/completions/__gitnow_completions.fish"
else
source "$fish_functions/__gitnow_functions.fish"
source "$fish_functions/__gitnow_manual.fish"
source "$fish_functions/__gitnow_config_file.fish"
source "$fish_completions/__gitnow_completions.fish"
end
__gitnow_read_config

View file

@ -0,0 +1,2 @@
if test -e /home/limepot/.nix-profile/etc/profile.d/nix.fish; . /home/limepot/.nix-profile/etc/profile.d/nix.fish; end # added by Nix installer

View file

@ -0,0 +1,28 @@
set --query nvm_mirror || set --global nvm_mirror https://nodejs.org/dist
set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
set --global nvm_data $XDG_DATA_HOME/nvm
function _nvm_install --on-event nvm_install
test ! -d $nvm_data && command mkdir -p $nvm_data
echo "Downloading the Node distribution index..." 2>/dev/null
_nvm_index_update
end
function _nvm_update --on-event nvm_update
set --query --universal nvm_data && set --erase --universal nvm_data
set --query --universal nvm_mirror && set --erase --universal nvm_mirror
set --query nvm_mirror || set --global nvm_mirror https://nodejs.org/dist
end
function _nvm_uninstall --on-event nvm_uninstall
command rm -rf $nvm_data
set --query nvm_current_version && _nvm_version_deactivate $nvm_current_version
set --names | string replace --filter --regex -- "^nvm" "set --erase nvm" | source
functions --erase (functions --all | string match --entire --regex -- "^_nvm_")
end
if status is-interactive && set --query nvm_default_version && ! set --query nvm_current_version
nvm use --silent $nvm_default_version
end

View file

@ -0,0 +1,25 @@
status is-interactive || exit
function _puffer_fish_key_bindings --on-variable fish_key_bindings
set -l modes
if test "$fish_key_bindings" = fish_default_key_bindings
set modes default insert
else
set modes insert default
end
bind --mode $modes[1] . _puffer_fish_expand_dots
bind --mode $modes[1] ! _puffer_fish_expand_bang
bind --mode $modes[1] '$' _puffer_fish_expand_lastarg
bind --mode $modes[2] --erase . ! '$'
end
_puffer_fish_key_bindings
set -l uninstall_event puffer_fish_key_bindings_uninstall
function _$uninstall_event --on-event $uninstall_event
bind -e .
bind -e !
bind -e '$'
end

View file

@ -0,0 +1,104 @@
#!/usr/bin/fish
# Makes command and binaries from SDKMAN! available in fish.
# Delegates to bash for the `sdk` command.
# Copyright (c) 2018-2023 Raphael Reitzig
# MIT License (MIT)
# https://github.com/reitzig/sdkman-for-fish
# Account for custom install locations
if set -q __sdkman_custom_dir
set -gx SDKMAN_DIR "$__sdkman_custom_dir"
else
# This is the default location:
set -gx SDKMAN_DIR "$HOME/.sdkman"
end
set __fish_sdkman_init "$SDKMAN_DIR/bin/sdkman-init.sh"
# Copied from https://github.com/jorgebucaran/fisher/blob/main/functions/fisher.fish to be consistent:
set --query fisher_path || set --local fisher_path $__fish_config_dir
set __fish_sdkman_noexport_init "$fisher_path/functions/__sdkman-noexport-init.sh"
# Guard: SDKMAN! needs to be installed
if not test -f "$__fish_sdkman_init"
exit 0
end
# Hack for issue #19:
# Create version of sdkman-init that doesn't export any environment variables.
# Refresh if sdkman-init changed.
if begin not test -f "$__fish_sdkman_noexport_init";
or env test "$__fish_sdkman_init" -nt "$__fish_sdkman_noexport_init"
end
mkdir -p (dirname $__fish_sdkman_noexport_init)
sed -E -e 's/^(\s*).*(export|to_path).*$/\1:/g' "$__fish_sdkman_init" \
> "$__fish_sdkman_noexport_init"
end
# Runs the given command in bash, capturing some side effects
# and repeating them on the current fish shell.
# Returns the same status code as the given command.
function __fish_sdkman_run_in_bash
# We need to leave stdin and stdout of sdk free for user interaction.
# So, pipe relevant environment variables (which might have changed)
# through a file.
# But since now getting the exit code of sdk itself is a hassle,
# pipe it as well.
#
# TODO: Can somebody get this to work without the overhead of a file?
set pipe (mktemp)
bash -c "$argv[1];
echo -e \"\$?\" > $pipe;
env | grep -e '^SDKMAN_\|^PATH' >> $pipe;
env | grep -i -E \"^(`echo \${SDKMAN_CANDIDATES_CSV} | sed 's/,/|/g'`)_HOME\" >> $pipe;
echo \"SDKMAN_OFFLINE_MODE=\${SDKMAN_OFFLINE_MODE}\" >> $pipe;
echo \"SDKMAN_ENV=\${SDKMAN_ENV}\" >> $pipe" # it's not an environment variable!
set bashDump (cat $pipe; rm $pipe)
set sdkStatus $bashDump[1]
set bashEnv $bashDump[2..-1]
# If SDKMAN! succeeded, copy relevant environment variables
# to the current shell (they might have changed)
if [ $sdkStatus = 0 ]
for line in $bashEnv
set parts (string split "=" $line)
set var $parts[1]
set value (string join "=" $parts[2..-1])
switch "$var"
case "PATH"
# Special treatment: need fish list instead
# of colon-separated list.
set value (string split : "$value")
end
if test -n value
set -gx $var $value
# Note: This makes SDKMAN_{OFFLINE_MODE,ENV} environment variables.
# That gives it the behaviour we _want_!
end
end
end
return $sdkStatus
end
# If this is a subshell of a(n initialized) fish owned by the same user,
# no initialization necessary.
# Otherwise:
if not set -q SDKMAN_CANDIDATES_DIR; or test (ls -ld "$SDKMAN_CANDIDATES_DIR" | awk '{print $3}') != (whoami)
__fish_sdkman_run_in_bash "source $__fish_sdkman_init"
end
# Set up auto_env
if grep -q "^sdkman_auto_env=true" "$SDKMAN_DIR/etc/config"
function __fish_sdkman_autoenv --on-variable PWD
# Run the (modified) init script, which performs the checks and calls for us!
__fish_sdkman_run_in_bash "source \"$__fish_sdkman_noexport_init\""
set -x SDKMAN_OLD_PWD "$PWD" # needed by the Bash implementation
end
end

View file

@ -0,0 +1,52 @@
# Sponge version
set --global sponge_version 1.1.0
# Allow to repeat previous command by default
if not set --query --universal sponge_delay
set --universal sponge_delay 2
end
# Purge entries both after `sponge_delay` entries and on exit by default
if not set --query --universal sponge_purge_only_on_exit
set --universal sponge_purge_only_on_exit false
end
# Add default filters
if not set --query --universal sponge_filters
set --universal sponge_filters sponge_filter_failed sponge_filter_matched
end
# Don't filter out commands that already have been in the history by default
if not set --query --universal sponge_allow_previously_successful
set --universal sponge_allow_previously_successful true
end
# Consider `0` the only successful exit code by default
if not set --query --universal sponge_successful_exit_codes
set --universal sponge_successful_exit_codes 0
end
# No active regex patterns by default
if not set --query --universal sponge_regex_patterns
set --universal sponge_regex_patterns
end
# Attach event handlers
functions --query \
_sponge_on_prompt \
_sponge_on_preexec \
_sponge_on_postexec \
_sponge_on_exit
# Initialize empty state for the first run
function _sponge_install --on-event sponge_install
set --global _sponge_current_command ''
set --global _sponge_current_command_exit_code 0
set --global _sponge_current_command_previously_in_history false
end
# Clean up variables
function _sponge_uninstall --on-event sponge_uninstall
_sponge_clear_state
set --erase sponge_version
end

View file

@ -0,0 +1,163 @@
## Set values
# Hide welcome message
set fish_greeting
set VIRTUAL_ENV_DISABLE_PROMPT "1"
set -x MANPAGER "sh -c 'col -bx | bat -l man -p'"
# Set settings for https://github.com/franciscolourenco/done
set -U __done_min_cmd_duration 10000
set -U __done_notification_urgency_level low
## Environment setup
# Apply .profile: use this to put fish compatible .profile stuff in
if test -f ~/.fish_profile
source ~/.fish_profile
end
# Add ~/.local/bin to PATH
if test -d ~/.local/bin
if not contains -- ~/.local/bin $PATH
set -p PATH ~/.local/bin
end
end
# Add depot_tools to PATH
if test -d ~/Applications/depot_tools
if not contains -- ~/Applications/depot_tools $PATH
set -p PATH ~/Applications/depot_tools
end
end
## Starship prompt
#if status --is-interactive
# source ("/usr/bin/starship" init fish --print-full-init | psub)
#end
## Functions
# Functions needed for !! and !$ https://github.com/oh-my-fish/plugin-bang-bang
function __history_previous_command
switch (commandline -t)
case "!"
commandline -t $history[1]; commandline -f repaint
case "*"
commandline -i !
end
end
function __history_previous_command_arguments
switch (commandline -t)
case "!"
commandline -t ""
commandline -f history-token-search-backward
case "*"
commandline -i '$'
end
end
if [ "$fish_key_bindings" = fish_vi_key_bindings ];
bind -Minsert ! __history_previous_command
bind -Minsert '$' __history_previous_command_arguments
else
bind ! __history_previous_command
bind '$' __history_previous_command_arguments
end
# Fish command history
function history
builtin history --show-time='%F %T '
end
function backup --argument filename
cp $filename $filename.bak
end
# Copy DIR1 DIR2
function copy
set count (count $argv | tr -d \n)
if test "$count" = 2; and test -d "$argv[1]"
set from (echo $argv[1] | trim-right /)
set to (echo $argv[2])
command cp -r $from $to
else
command cp $argv
end
end
## Import colorscheme from 'wal' asynchronously
if type "wal" >> /dev/null 2>&1
cat ~/.cache/wal/sequences
end
## Useful aliases
# Replace ls with exa
alias ls='exa -al --color=always --group-directories-first --icons' # preferred listing
alias la='exa -a --color=always --group-directories-first --icons' # all files and dirs
alias ll='exa -l --color=always --group-directories-first --icons' # long format
alias lt='exa -aT --color=always --group-directories-first --icons' # tree listing
alias l.="exa -a | egrep '^\.'" # show only dotfiles
# Replace some more things with better alternatives
alias cat='bat --style header --style rules --style snip --style changes --style header'
[ ! -x /usr/bin/yay ] && [ -x /usr/bin/paru ] && alias yay='paru'
# Common use
alias grubup="sudo update-grub"
alias fixpacman="sudo rm /var/lib/pacman/db.lck"
alias tarnow='tar -acf '
alias untar='tar -zxvf '
alias wget='wget -c '
alias rmpkg="sudo pacman -Rdd"
alias psmem='ps auxf | sort -nr -k 4'
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
alias upd='/usr/bin/update'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias ......='cd ../../../../..'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias hw='hwinfo --short' # Hardware Info
alias big="expac -H M '%m\t%n' | sort -h | nl" # Sort installed packages according to size in MB (expac must be installed)
alias gitpkg='pacman -Q | grep -i "\-git" | wc -l' # List amount of -git packages
# Get fastest mirrors
alias mirror="sudo reflector -f 30 -l 30 --number 10 --verbose --save /etc/pacman.d/mirrorlist"
alias mirrord="sudo reflector --latest 50 --number 20 --sort delay --save /etc/pacman.d/mirrorlist"
alias mirrors="sudo reflector --latest 50 --number 20 --sort score --save /etc/pacman.d/mirrorlist"
alias mirrora="sudo reflector --latest 50 --number 20 --sort age --save /etc/pacman.d/mirrorlist"
# Help people new to Arch
alias apt='man pacman'
alias apt-get='man pacman'
alias please='sudo'
alias tb='nc termbin.com 9999'
# Cleanup orphaned packages
alias cleanup='sudo pacman -Rns (pacman -Qtdq)'
# Get the error messages from journalctl
alias jctl="journalctl -p 3 -xb"
# Recent installed packages
alias rip="expac --timefmt='%Y-%m-%d %T' '%l\t%n %v' | sort | tail -200 | nl"
## Run paleofetch if session is interactive
if status --is-interactive
neofetch
end
# pnpm
set -gx PNPM_HOME "/home/limepot/.local/share/pnpm"
set -gx PATH "$PNPM_HOME" $PATH
# pnpm end
set PATH $HOME/.cargo/bin $PATH

View file

@ -0,0 +1,9 @@
jorgebucaran/spark.fish
joseluisq/gitnow@2.11.0
meaningful-ooo/sponge
jorgebucaran/getopts.fish
nickeb96/puffer-fish
catppuccin/fish
edc/bass
jorgebucaran/nvm.fish
reitzig/sdkman-for-fish@v2.0.0

View file

@ -0,0 +1,57 @@
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR __done_min_cmd_duration:10000
SETUVAR __done_notification_urgency_level:low
SETUVAR __fish_initialized:3400
SETUVAR _fisher_catppuccin_2F_fish_files:\x7e/\x2econfig/fish/themes/Catppuccin\x20Frappe\x2etheme\x1e\x7e/\x2econfig/fish/themes/Catppuccin\x20Latte\x2etheme\x1e\x7e/\x2econfig/fish/themes/Catppuccin\x20Macchiato\x2etheme\x1e\x7e/\x2econfig/fish/themes/Catppuccin\x20Mocha\x2etheme
SETUVAR _fisher_edc_2F_bass_files:\x7e/\x2econfig/fish/functions/__bass\x2epy\x1e\x7e/\x2econfig/fish/functions/bass\x2efish
SETUVAR _fisher_jorgebucaran_2F_getopts_2E_fish_files:\x7e/\x2econfig/fish/functions/getopts\x2efishSETUVAR _fisher_jorgebucaran_2F_spark_2E_fish_files:\x7e/\x2econfig/fish/functions/spark\x2efish\x1e\x7e/\x2econfig/fish/completions/spark\x2efish
SETUVAR _fisher_joseluisq_2F_gitnow_40_32_2E_31_31_2E_30__files:\x7e/\x2econfig/fish/functions/__gitnow_config_file\x2efish\x1e\x7e/\x2econfig/fish/functions/__gitnow_functions\x2efish\x1e\x7e/\x2econfig/fish/functions/__gitnow_manual\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/gitnow\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/gitnow_config\x2efish\x1e\x7e/\x2econfig/fish/completions/__gitnow_completions\x2efish
SETUVAR _fisher_meaningful_2D_ooo_2F_sponge_files:\x7e/\x2econfig/fish/functions/_sponge_clear_state\x2efish\x1e\x7e/\x2econfig/fish/functions/_sponge_on_exit\x2efish\x1e\x7e/\x2econfig/fish/functions/_sponge_on_postexec\x2efish\x1e\x7e/\x2econfig/fish/functions/_sponge_on_preexec\x2efish\x1e\x7e/\x2econfig/fish/functions/_sponge_on_prompt\x2efish\x1e\x7e/\x2econfig/fish/functions/_sponge_remove_from_history\x2efish\x1e\x7e/\x2econfig/fish/functions/sponge_filter_failed\x2efish\x1e\x7e/\x2econfig/fish/functions/sponge_filter_matched\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/sponge\x2efish
SETUVAR _fisher_nickeb96_2F_puffer_2D_fish_files:\x7e/\x2econfig/fish/functions/_puffer_fish_expand_bang\x2efish\x1e\x7e/\x2econfig/fish/functions/_puffer_fish_expand_dots\x2efish\x1e\x7e/\x2econfig/fish/functions/_puffer_fish_expand_lastarg\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/puffer_fish_key_bindings\x2efish
SETUVAR _fisher_upgraded_to_4_4:\x1d
SETUVAR fish_color_autosuggestion:6e738d
SETUVAR fish_color_cancel:ed8796
SETUVAR fish_color_command:8aadf4
SETUVAR fish_color_comment:8087a2
SETUVAR fish_color_cwd:eed49f
SETUVAR fish_color_cwd_root:red
SETUVAR fish_color_end:f5a97f
SETUVAR fish_color_error:ed8796
SETUVAR fish_color_escape:ee99a0
SETUVAR fish_color_gray:6e738d
SETUVAR fish_color_history_current:\x2d\x2dbold
SETUVAR fish_color_host:8aadf4
SETUVAR fish_color_host_remote:a6da95
SETUVAR fish_color_keyword:ed8796
SETUVAR fish_color_normal:cad3f5
SETUVAR fish_color_operator:f5bde6
SETUVAR fish_color_option:a6da95
SETUVAR fish_color_param:f0c6c6
SETUVAR fish_color_quote:a6da95
SETUVAR fish_color_redirection:f5bde6
SETUVAR fish_color_search_match:\x2d\x2dbackground\x3d363a4f
SETUVAR fish_color_selection:\x2d\x2dbackground\x3d363a4f
SETUVAR fish_color_status:ed8796
SETUVAR fish_color_user:8bd5ca
SETUVAR fish_color_valid_path:\x2d\x2dunderline
SETUVAR fish_key_bindings:fish_default_key_bindings
SETUVAR fish_pager_color_background:\x1d
SETUVAR fish_pager_color_completion:cad3f5
SETUVAR fish_pager_color_description:6e738d
SETUVAR fish_pager_color_prefix:f5bde6
SETUVAR fish_pager_color_progress:6e738d
SETUVAR fish_pager_color_secondary_background:\x1d
SETUVAR fish_pager_color_secondary_completion:\x1d
SETUVAR fish_pager_color_secondary_description:\x1d
SETUVAR fish_pager_color_secondary_prefix:\x1d
SETUVAR fish_pager_color_selected_background:\x1d
SETUVAR fish_pager_color_selected_completion:\x1d
SETUVAR fish_pager_color_selected_description:\x1d
SETUVAR fish_pager_color_selected_prefix:\x1d
SETUVAR sponge_allow_previously_successful:true
SETUVAR sponge_delay:2
SETUVAR sponge_filters:sponge_filter_failed\x1esponge_filter_matched
SETUVAR sponge_purge_only_on_exit:false
SETUVAR sponge_regex_patterns:\x1d
SETUVAR sponge_successful_exit_codes:0

View file

@ -0,0 +1,138 @@
"""
To be used with a companion fish function like this:
function refish
set -l _x (python /tmp/bass.py source ~/.nvm/nvim.sh ';' nvm use iojs); source $_x; and rm -f $_x
end
"""
from __future__ import print_function
import json
import os
import signal
import subprocess
import sys
import traceback
BASH = 'bash'
FISH_READONLY = [
'PWD', 'SHLVL', 'history', 'pipestatus', 'status', 'version',
'FISH_VERSION', 'fish_pid', 'hostname', '_', 'fish_private_mode'
]
IGNORED = [
'PS1', 'XPC_SERVICE_NAME'
]
def ignored(name):
if name == 'PWD': # this is read only, but has special handling
return False
# ignore other read only variables
if name in FISH_READONLY:
return True
if name in IGNORED or name.startswith("BASH_FUNC"):
return True
return False
def escape(string):
# use json.dumps to reliably escape quotes and backslashes
return json.dumps(string).replace(r'$', r'\$')
def escape_identifier(word):
return escape(word.replace('?', '\\?'))
def comment(string):
return '\n'.join(['# ' + line for line in string.split('\n')])
def gen_script():
# Use the following instead of /usr/bin/env to read environment so we can
# deal with multi-line environment variables (and other odd cases).
env_reader = "%s -c 'import os,json; print(json.dumps({k:v for k,v in os.environ.items()}))'" % (sys.executable)
args = [BASH, '-c', env_reader]
output = subprocess.check_output(args, universal_newlines=True)
old_env = output.strip()
pipe_r, pipe_w = os.pipe()
if sys.version_info >= (3, 4):
os.set_inheritable(pipe_w, True)
command = 'eval $1 && ({}; alias) >&{}'.format(
env_reader,
pipe_w
)
args = [BASH, '-c', command, 'bass', ' '.join(sys.argv[1:])]
p = subprocess.Popen(args, universal_newlines=True, close_fds=False)
os.close(pipe_w)
with os.fdopen(pipe_r) as f:
new_env = f.readline()
alias_str = f.read()
if p.wait() != 0:
raise subprocess.CalledProcessError(
returncode=p.returncode,
cmd=' '.join(sys.argv[1:]),
output=new_env + alias_str
)
new_env = new_env.strip()
old_env = json.loads(old_env)
new_env = json.loads(new_env)
script_lines = []
for k, v in new_env.items():
if ignored(k):
continue
v1 = old_env.get(k)
if not v1:
script_lines.append(comment('adding %s=%s' % (k, v)))
elif v1 != v:
script_lines.append(comment('updating %s=%s -> %s' % (k, v1, v)))
# process special variables
if k == 'PWD':
script_lines.append('cd %s' % escape(v))
continue
else:
continue
if k == 'PATH':
value = ' '.join([escape(directory)
for directory in v.split(':')])
else:
value = escape(v)
script_lines.append('set -g -x %s %s' % (k, value))
for var in set(old_env.keys()) - set(new_env.keys()):
script_lines.append(comment('removing %s' % var))
script_lines.append('set -e %s' % var)
script = '\n'.join(script_lines)
alias_lines = []
for line in alias_str.splitlines():
_, rest = line.split(None, 1)
k, v = rest.split("=", 1)
alias_lines.append("alias " + escape_identifier(k) + "=" + v)
alias = '\n'.join(alias_lines)
return script + '\n' + alias
script_file = os.fdopen(3, 'w')
if not sys.argv[1:]:
print('__bass_usage', file=script_file, end='')
sys.exit(0)
try:
script = gen_script()
except subprocess.CalledProcessError as e:
sys.exit(e.returncode)
except Exception:
print('Bass internal error!', file=sys.stderr)
raise # traceback will output to stderr
except KeyboardInterrupt:
signal.signal(signal.SIGINT, signal.SIG_DFL)
os.kill(os.getpid(), signal.SIGINT)
else:
script_file.write(script)

View file

@ -0,0 +1,199 @@
# GitNow — Speed up your Git workflow. 🐠
# https://github.com/joseluisq/gitnow
set -g gitnow_xpaste
set -g gitnow_commands 'all' 'assume' 'bitbucket' 'bugfix' 'commit' 'commit-all' 'feature' 'github' 'gitnow' 'hotfix' 'logs' 'merge' 'move' 'pull' 'push' 'release' 'show' 'stage' 'state' 'tag' 'unstage' 'untracked' 'upstream'
function __gitnow_read_config -d "Reads the GitNow config file"
# Sets a clipboard program
set gitnow_xpaste (__gitnow_get_clip_program)
# Config file path used by default
set -l config_file "$fish_snippets/.gitnow"
# Download the default .gitnow file
# Used as workaround for Fisher. see https://github.com/jorgebucaran/fisher/pull/573
if not test -e $config_file
curl -sSo $config_file https://raw.githubusercontent.com/joseluisq/gitnow/master/conf.d/.gitnow
end
# Prefer custom config file if it exists
if test -e $GITNOW_CONFIG_FILE
set config_file $GITNOW_CONFIG_FILE
else if not test -e $config_file
# Otherwise checks if default `.gitnow` file exists,
# if doesn't then skip out file parsing
return
end
# Parse `.gitnow` file content
# 2 = keybindings
# 3 = options
set -l v_section 0
# Valid sections
set -l v_keybindings "keybindings"
set -l v_options "options"
# Options set
set -l v_clipboard 0
# Loop every line
while read -la l
set -l v_str ""
set -l v_comment 0
set -l v_command_sep 0
set -l v_command_key ""
set -l v_command_val ""
# Loop every char for current line
echo $l | while read -n 1 -la c;
switch $c
case '['
if test $v_comment -eq 1; continue; end
# if test $v_section -gt 0
# set v_section 0
# continue
# end
# Start section
if test $v_section -eq 0; set v_section 1; end
case ']'
if test $v_comment -eq 1; continue; end
# Check section name
if test $v_section -eq 1
# options
if [ "$v_str" = "$v_options" ]
set v_section 3
continue
end
# keybindings
if [ "$v_str" = "$v_keybindings" ]
set v_section 2
continue
end
end
set v_section 0
case ' '
case '\n'
case '\t'
case '\r'
continue
case '#'
if test $v_comment -eq 0; set v_comment 1; end
continue
case '*'
if test $v_comment -eq 1; continue; end
# If section has started then accumulate chars and continue
if test $v_section -eq 1
set v_str "$v_str$c"
continue
end
# A [ abcde ] section is found so proceed with chars handling
# NOTE: only alphabetic and hyphens chars are allowed
if test $v_section -eq 2; or test $v_section -eq 3
switch $c
case 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 'u' 'v' 'w' 'x' 'y' 'z' '-'
if test $v_command_sep -eq 0
set v_command_key "$v_command_key$c"
continue
end
if test $v_command_sep -eq 2
set v_command_val "$v_command_val$c"
continue
end
case \\
if test $v_command_sep -eq 1
set v_command_sep 2
end
continue
case '='
set v_command_sep 1
if test $v_section -eq 3
set v_command_sep 2
continue
end
case '*'
continue
end
end
end
end
# 1. Handle options set
if test $v_section -eq 3
switch $v_command_key
# Clipboard option
case 'clipboard'
if [ "$v_command_val" = "true" ]
set v_clipboard 1
end
# NOTE: handle future new options using a new case
case '*'
continue
end
# continue loop after current option processed
set v_section 0
continue
end
# 2. Handle keybindings set
if not [ "$v_command_key" = "" ]; and not [ "$v_command_val" = "" ]
set -l cmd
switch $v_command_key
case 'release' 'hotfix' 'feature' 'bugfix'
# Read text from clipboard if there is a valid clipboard program
# and if the "clipboard" option is "true"
if test -n $gitnow_xpaste; and test $v_clipboard -eq 1
set cmd (echo -n "bind \\$v_command_val \"echo; if $v_command_key ($gitnow_xpaste); commandline -f repaint; else ; end\"")
else
# Otherwise read text from standard input
set cmd (echo -n "bind \\$v_command_val \"echo; if $v_command_key (read); commandline -f repaint; else ; end\"")
end
case '*'
# Check command key against a list of valid commands
set -l v_valid 0
for v in $gitnow_commands
if [ "$v" = "$v_command_key" ]
set v_valid 1
break
end
end
# If command key is not valid then just skip out
if test $v_valid -eq 0; continue; end
set cmd (echo -n "bind \\$v_command_val \"echo; $v_command_key; commandline -f repaint;\"")
end
eval $cmd
end
end < $config_file
end
function __gitnow_get_clip_program -d "Gets the current clip installed program"
set -l v_paste
if type -q xclip
set v_paste "xclip -selection clipboard -o"
else if type -q wl-clipboard
set v_paste "wl-paste"
else if type -q xsel
set v_paste "xsel --clipboard --output"
else if type -q pbpaste
set v_paste "pbpaste"
end
echo -n $v_paste
end

View file

@ -0,0 +1,187 @@
# GitNow — Speed up your Git workflow. 🐠
# https://github.com/joseluisq/gitnow
function __gitnow_new_branch_switch
set -l branch_name $argv[1]
if test (count $argv) -eq 1
set branch_name $branch_name
command git checkout -b $branch_name
else
echo "Provide a branch name."
end
end
# adapted from https://gist.github.com/oneohthree/f528c7ae1e701ad990e6
function __gitnow_slugify
echo $argv | LC_ALL=C command iconv -t ascii//TRANSLIT | LC_ALL=C command sed -E 's/[^a-zA-Z0-9\-]+/_/g' | LC_ALL=C command sed -E 's/^(-|_)+|(-|_)+$//g'
end
function __gitnow_clone_repo
set -l repo $argv[1]
set -l platform $argv[2]
if test -n "$repo"
set -l ok 1
if echo $repo | LC_ALL=C command grep -q -E '^[\%S].+'
set -l user (command git config --global user.$platform)
if test -n "$user"
set -l repor (echo $repo | LC_ALL=C command sed -e "s/^%S/$user/")
set repo $repor
else
set ok 0
end
end
if test $ok -eq 1
if [ "$platform" = "github" ]
set url github.com
end
if [ "$platform" = "bitbucket" ]
set url bitbucket.org
end
set -l repo_url git@$url:$repo.git
echo "📦 Remote repository: $repo_url"
command git clone $repo_url
else
__gitnow_clone_msg $platform
end
else
__gitnow_clone_msg $platform
end
end
function __gitnow_clone_msg
set -l msg $argv[1]
echo "Repository name is required!"
echo "Example: $msg your-repo-name"
echo "Usages:"
echo " a) $msg username/repo-name"
echo " b) $msg username repo-name"
echo " c) $msg repo-name"
echo " For this, it's necessary to set your $msg username (login)"
echo " to global config before like: "
echo " git config --global user.$msg \"your-username\""
echo
end
function __gitnow_check_if_branch_exist
set -l xfound 0
if test (count $argv) -eq 1
set -l xbranch $argv[1]
set -l xbranch_list (__gitnow_current_branch_list)
for b in $xbranch_list
if [ "$xbranch" = "$b" ]
set xfound 1
break
end
end
end
echo $xfound
end
function __gitnow_clone_params
set -l repo
if count $argv >/dev/null
if test (count $argv) -gt 1
set repo $argv[1]/$argv[2]
else if echo $argv | LC_ALL=C command grep -q -E '^([a-zA-Z0-9\_\-]+)\/([a-zA-Z0-9\_\-]+)$'
set repo $argv
else
set repo "%S/$argv"
end
end
echo $repo
end
function __gitnow_gitflow_branch -a xprefix -a xbranch
set xbranch (__gitnow_slugify $xbranch)
set -l xbranch_full "$xprefix/$xbranch"
set -l xfound (__gitnow_check_if_branch_exist $xbranch_full)
if test $xfound -eq 1
echo "Branch `$xbranch_full` already exists. Nothing to do."
else
command git stash
__gitnow_new_branch_switch "$xbranch_full"
command git stash pop
end
end
function __gitnow_msg_not_valid_repository -a cmd
echo "Gitnow ($cmd): Current directory is not a valid Git repository."
end
function __gitnow_current_branch_name
command git symbolic-ref --short HEAD 2>/dev/null
end
function __gitnow_current_branch_list
command git branch --list --no-color | LC_ALL=C command sed -E "s/^(\*?[ \t]*)//g" 2>/dev/null
end
function __gitnow_current_remote
set -l branch_name (__gitnow_current_branch_name)
command git config "branch.$branch_name.remote" 2>/dev/null; or echo origin
end
function __gitnow_is_git_repository
command git rev-parse --git-dir >/dev/null 2>&1
end
function __gitnow_has_uncommited_changes
command git diff-index --quiet HEAD -- || echo "1" 2>&1
end
function __gitnow_get_latest_tag
command git tag --sort=-creatordate | head -n1 2>/dev/null
end
# lexicographic order and tag names treated as versions
# https://stackoverflow.com/a/52680984/2510591
function __gitnow_get_tags_ordered
command git -c 'versionsort.suffix=-' tag --list --sort=-version:refname
end
function __gitnow_get_latest_semver_release_tag
for tg in (__gitnow_get_tags_ordered)
if echo $tg | LC_ALL=C command grep -qE '^v?([0-9]+).([0-9]+).([0-9]+)$'
echo $tg 2>/dev/null
break
end
end
end
function __gitnow_increment_number -a strv
command echo $strv | LC_ALL=C command awk '
function increment(val) {
if (val ~ /[0-9]+/) { return val + 1 }
return val
}
{ print increment($0) }
' 2>/dev/null
end
function __gitnow_get_valid_semver_release_value -a tagv
command echo $tagv | LC_ALL=C command sed -n 's/^v\\{0,1\\}\([0-9].[0-9].[0-9]*\)\([}]*\)/\1/p' 2>/dev/null
end
function __gitnow_get_valid_semver_prerelease_value -a tagv
command echo $tagv | LC_ALL=C command sed -n 's/^v\\{0,1\\}\([0-9].[0-9].[0-9]-[a-zA-Z0-9\-_.]*\)\([}]*\)/\1/p' 2>/dev/null
end
function __gitnow_is_number -a strv
command echo -n $strv | LC_ALL=C command grep -qE '^([0-9]+)$'
end

View file

@ -0,0 +1,115 @@
# GitNow — Speed up your Git workflow. 🐠
# https://github.com/joseluisq/gitnow
function __gitnow_manual -d "Gitnow: Manual page like"
echo (set_color --bold)"NAME"(set_color normal)
echo " GitNow — Speed up your Git workflow. 🐠"
echo
echo (set_color --bold)"VERSION"(set_color normal)
echo " $gitnow_version"
echo
echo (set_color --bold)"DESCRIPTION"(set_color normal)
echo " GitNow contains a rich command set that provides high-level operations on the top of Git(1)."
echo " A Fish Shell(2) alternative inspired by git-friendly(3)."
echo
echo " (1) https://git-scm.com/"
echo " (2) https://fishshell.com/"
echo " (3) https://github.com/jamiew/git-friendly"
echo
echo (set_color --bold)"COMMANDS"(set_color normal)
echo " "(set_color --bold)"state"(set_color normal)
echo " Show the working tree status in a compact way."
echo
echo " "(set_color --bold)"stage"(set_color normal)
echo " Stage files in the current working directory."
echo
echo " "(set_color --bold)"unstage"(set_color normal)
echo " Unstage files in the current working directory."
echo
echo " "(set_color --bold)"show"(set_color normal)
echo " Show commit detail objects."
echo
echo " "(set_color --bold)"untracked"(set_color normal)
echo " Check for untracked files and directories that could be removed."
echo
echo " "(set_color --bold)"commit"(set_color normal)
echo " Commit changes to the current repository."
echo
echo " "(set_color --bold)"commit-all"(set_color normal)
echo " Add and commit all changes to the current repository."
echo
echo " "(set_color --bold)"pull"(set_color normal)
echo " Pull changes from remote server but auto-stashing uncommitted changes."
echo
echo " "(set_color --bold)"push"(set_color normal)
echo " Push commit changes to the current remote repository."
echo
echo " "(set_color --bold)"upstream"(set_color normal)
echo " Commit all changes and push them to the current remote server."
echo
echo " "(set_color --bold)"move"(set_color normal)
echo " Switch from current branch to another but stashing uncommitted changes."
echo
echo " "(set_color --bold)"merge"(set_color normal)
echo " Merge given branch into the active one"
echo
echo " "(set_color --bold)"tag"(set_color normal)
echo " List and create release tag versions following Semver 2.0."
echo
echo " "(set_color --bold)"assume"(set_color normal)
echo " Ignore changes in certain files temporarily."
echo
echo " "(set_color --bold)"feature"(set_color normal)
echo " Create a new Gitflow feature branch from the current branch."
echo
echo " "(set_color --bold)"hotfix"(set_color normal)
echo " Create a new Gitflow hotfix branch from the current branch."
echo
echo " "(set_color --bold)"bugfix"(set_color normal)
echo " Create a new Gitflow bugfix branch from the current branch."
echo
echo " "(set_color --bold)"release"(set_color normal)
echo " Create a new Gitflow release branch from the current branch."
echo
echo " "(set_color --bold)"logs"(set_color normal)
echo " Show logs in a fancy way."
echo
echo " "(set_color --bold)"github"(set_color normal)
echo " Clone a GitHub repository over SSH."
echo
echo " "(set_color --bold)"bitbucket"(set_color normal)
echo " Clone a Bitbucket Cloud repository over SSH."
echo
echo (set_color --bold)"KEYBINDINGS"(set_color normal)
echo " state Alt + S"
echo " stage Alt + E"
echo " unstage Ctrl + E"
echo " show Alt + M"
echo " commit-all Alt + C"
echo " pull Alt + D"
echo " push Alt + P"
echo " upstream Alt + U"
echo " feature(1) Alt + F"
echo " hotfix(1) Alt + H"
echo " logs Alt + L"
echo
echo " (1) This command key binding will creates a new branch taking as name some text of the clipboard."
echo
echo (set_color --bold)"CONFIGURATION"(set_color normal)
echo " For a custom configuration (for example keybindings) place a "(set_color --bold)"~/.gitnow"(set_color normal)" file (1) in your home directory."
echo
echo " (1) An example file it can be found on "(set_color --bold)https://github.com/joseluisq/gitnow/tree/master/.gitnow(set_color normal)
echo
echo (set_color --bold)"FURTHER DOCUMENTATION"(set_color normal)
echo " For more details and examples check out "(set_color --bold)https://github.com/joseluisq/gitnow/blob/master/README.md(set_color normal)
echo
echo (set_color --bold)"CONTRIBUTIONS"(set_color normal)
echo " Send bug reports or pull requests to "(set_color --bold)https://github.com/joseluisq/gitnow(set_color normal)
echo
echo (set_color --bold)"LICENSE"(set_color normal)
echo " GitNow licensed under the MIT License "(set_color --bold)https://github.com/joseluisq/gitnow/blob/master/LICENSE.md(set_color normal)
echo
echo (set_color --bold)"AUTHOR"(set_color normal)
echo " (c) 2016-present Jose Quintana "(set_color --bold)"https://github.com/joseluisq"(set_color normal)
echo
end

View file

@ -0,0 +1,10 @@
function _puffer_fish_expand_bang
switch (commandline -t)
case '!'
commandline -t $history[1]
commandline -f repaint
case '*'
commandline -i '!'
end
end

View file

@ -0,0 +1,16 @@
function _puffer_fish_expand_dots -d 'expand ... to ../.. etc'
set -l cmd (commandline --cut-at-cursor)
set -l split (string split ' ' $cmd)
switch $split[-1]
case './*'; commandline --insert '.'
case '*..'
# Only expand if the string consists of dots and slashes.
# We don't want to expand strings like `bazel build target/...`.
if string match --quiet --regex '^[/.]*$' $split[-1]
commandline --insert '/..'
else
commandline --insert '.'
end
case '*'; commandline --insert '.'
end
end

View file

@ -0,0 +1,9 @@
function _puffer_fish_expand_lastarg
switch (commandline -t)
case '!'
commandline -t ""
commandline -f history-token-search-backward
case '*'
commandline -i '$'
end
end

View file

@ -0,0 +1,5 @@
function _sponge_clear_state
set --erase --global _sponge_current_command
set --erase --global _sponge_current_command_exit_code
set --erase --global _sponge_current_command_previously_in_history
end

View file

@ -0,0 +1,3 @@
function _sponge_on_exit --on-event fish_exit
sponge_delay=0 _sponge_remove_from_history
end

View file

@ -0,0 +1,24 @@
function _sponge_on_postexec --on-event fish_postexec
set --global _sponge_current_command_exit_code $status
# Remove command from the queue if it's been added previously
if set --local index (contains --index -- $_sponge_current_command $_sponge_queue)
set --erase _sponge_queue[$index]
end
# Ignore empty commands
if test -n $_sponge_current_command
set --local command ''
# Run filters
for filter in $sponge_filters
if $filter \
$_sponge_current_command \
$_sponge_current_command_exit_code \
$_sponge_current_command_previously_in_history
set command $_sponge_current_command
break
end
end
set --prepend --global _sponge_queue $command
end
end

View file

@ -0,0 +1,16 @@
function _sponge_on_preexec --on-event fish_preexec \
--argument-names command
_sponge_clear_state
set --global _sponge_current_command $command
builtin history search --case-sensitive --exact --max=1 --null $command \
| read --local --null found_entries
# If a command is in the history and in the queue, ignore it, like if it wasnt in the history
if test (count $found_entries) -ne 0; and not contains $command $_sponge_queue
set --global _sponge_current_command_previously_in_history true
else
set --global _sponge_current_command_previously_in_history false
end
end

View file

@ -0,0 +1,5 @@
function _sponge_on_prompt --on-event fish_prompt
if test $sponge_purge_only_on_exit = false
_sponge_remove_from_history
end
end

View file

@ -0,0 +1,9 @@
function _sponge_remove_from_history
while test (count $_sponge_queue) -gt $sponge_delay
builtin history delete --case-sensitive --exact -- $_sponge_queue[-1]
set --erase _sponge_queue[-1]
end
builtin history save
end

View file

@ -0,0 +1,29 @@
function bass
set -l bash_args $argv
set -l bass_debug
if test "$bash_args[1]_" = '-d_'
set bass_debug true
set -e bash_args[1]
end
set -l script_file (mktemp)
if command -v python3 >/dev/null 2>&1
command python3 -sS (dirname (status -f))/__bass.py $bash_args 3>$script_file
else
command python -sS (dirname (status -f))/__bass.py $bash_args 3>$script_file
end
set -l bass_status $status
if test $bass_status -ne 0
return $bass_status
end
if test -n "$bass_debug"
cat $script_file
end
source $script_file
command rm $script_file
end
function __bass_usage
echo "Usage: bass [-d] <bash-command>"
end

View file

@ -0,0 +1,139 @@
function fish_prompt
# This prompt shows:
# - green lines if the last return command is OK, red otherwise
# - your user name, in red if root or yellow otherwise
# - your hostname, in cyan if ssh or blue otherwise
# - the current path (with prompt_pwd)
# - date +%X
# - the current virtual environment, if any
# - the current git status, if any, with fish_git_prompt
# - the current battery state, if any, and if your power cable is unplugged, and if you have "acpi"
# - current background jobs, if any
# It goes from:
# ┬─[nim@Hattori:~][11:39:00]
# ╰─>$ echo here
# To:
# ┬─[nim@Hattori:~/w/dashboard][11:37:14][V:django20][G:master↑1|111][B:85%, 05:41:42 remaining]
# │ 2 15054 0% arrêtée sleep 100000
# │ 1 15048 0% arrêtée sleep 100000
# ╰─>$ echo there
set -l retc red
test $status = 0; and set retc green
set -q __fish_git_prompt_showupstream
or set -g __fish_git_prompt_showupstream auto
function _nim_prompt_wrapper
set retc $argv[1]
set -l field_name $argv[2]
set -l field_value $argv[3]
set_color normal
set_color $retc
echo -n '─'
set_color -o green
echo -n '['
set_color normal
test -n $field_name
and echo -n $field_name:
set_color $retc
echo -n $field_value
set_color -o green
echo -n ']'
end
set_color $retc
echo -n '┬─'
set_color -o green
echo -n [
if functions -q fish_is_root_user; and fish_is_root_user
set_color -o red
else
set_color -o yellow
end
echo -n $USER
set_color -o white
echo -n @
if test -z "$SSH_CLIENT"
set_color -o blue
else
set_color -o cyan
end
echo -n (prompt_hostname)
set_color -o white
echo -n :(prompt_pwd)
set_color -o green
echo -n ']'
# Date
_nim_prompt_wrapper $retc '' (date +%X)
# Vi-mode
# The default mode prompt would be prefixed, which ruins our alignment.
function fish_mode_prompt
end
if test "$fish_key_bindings" = fish_vi_key_bindings
or test "$fish_key_bindings" = fish_hybrid_key_bindings
set -l mode
switch $fish_bind_mode
case default
set mode (set_color --bold red)N
case insert
set mode (set_color --bold green)I
case replace_one
set mode (set_color --bold green)R
echo '[R]'
case replace
set mode (set_color --bold cyan)R
case visual
set mode (set_color --bold magenta)V
end
set mode $mode(set_color normal)
_nim_prompt_wrapper $retc '' $mode
end
# Virtual Environment
set -q VIRTUAL_ENV_DISABLE_PROMPT
or set -g VIRTUAL_ENV_DISABLE_PROMPT true
set -q VIRTUAL_ENV
and _nim_prompt_wrapper $retc V (basename "$VIRTUAL_ENV")
# git
set -l prompt_git (fish_git_prompt '%s')
test -n "$prompt_git"
and _nim_prompt_wrapper $retc G $prompt_git
# Battery status
type -q acpi
and test (acpi -a 2> /dev/null | string match -r off)
and _nim_prompt_wrapper $retc B (acpi -b | cut -d' ' -f 4-)
# New line
echo
# Background jobs
set_color normal
for job in (jobs)
set_color $retc
echo -n '│ '
set_color brown
echo $job
end
set_color normal
set_color $retc
echo -n '╰─>'
set_color -o red
echo -n '$ '
set_color normal
end

View file

@ -0,0 +1,24 @@
function getopts --description "Parse CLI options"
set --query argv[1] || return
printf "%s\n" $argv | command awk '
{ argv[n++] = $0 }
END {
for (i = 0; i < n; i++) {
a = argv[i]
if (a == "-" || a !~ /^-/) print "_", a
else if (a == "--") while (++i < n) print "_", argv[i]
else if (a ~ /^--/)
print (m = index(a, "=")) ? substr(a, 3, m - 3) : substr(a, 3),
m ? substr(a, m + 1) : (n == i + 1 || argv[i + 1] ~ /^-/ ? "true" : argv[++i])
else {
v = substr(a, (m = match(substr(a, 3), /$|[!-@[-`{-~]|[[:space:]]/) + 2))
for (j = 2; j < m; j++)
print substr(a, j, 1),
(j + 1 < m ? "true": v == "" ? \
n == i + 1 || argv[i + 1] ~ /^-/ ? "true" : argv[++i] : v)
}
}
}
'
end

View file

@ -0,0 +1,33 @@
function spark --description Sparklines
argparse --ignore-unknown --name=spark v/version h/help m/min= M/max= -- $argv || return
if set --query _flag_version[1]
echo "spark, version 1.1.0"
else if set --query _flag_help[1]
echo "Usage: spark <numbers ...>"
echo " stdin | spark"
echo "Options:"
echo " --min=<number> Minimum range"
echo " --max=<number> Maximum range"
echo " -v or --version Print version"
echo " -h or --help Print this help message"
echo "Examples:"
echo " spark 1 1 2 5 14 42"
echo " seq 64 | sort --random-sort | spark"
else if set --query argv[1]
printf "%s\n" $argv | spark --min="$_flag_min" --max="$_flag_max"
else
command awk -v min="$_flag_min" -v max="$_flag_max" '
{
m = min == "" ? m == "" ? $0 : m > $0 ? $0 : m : min
M = max == "" ? M == "" ? $0 : M < $0 ? $0 : M : max
nums[NR] = $0
}
END {
n = split("▁ ▂ ▃ ▄ ▅ ▆ ▇ █", sparks, " ") - 1
while (++i <= NR)
printf("%s", sparks[(M == m) ? 3 : sprintf("%.f", (1 + (nums[i] - m) * n / (M - m)))])
}
' && echo
end
end

View file

@ -0,0 +1,11 @@
function sponge_filter_failed \
--argument-names command exit_code previously_in_history
if test $previously_in_history = true -a $sponge_allow_previously_successful = true
return 1
end
if contains $exit_code $sponge_successful_exit_codes
return 1
end
end

View file

@ -0,0 +1,11 @@
function sponge_filter_matched \
--argument-names command
for pattern in $sponge_regex_patterns
if string match --regex --quiet $pattern -- $command
return
end
end
return 1
end

View file

@ -0,0 +1,30 @@
# name: 'Catppuccin frappe'
# url: 'https://github.com/catppuccin/fish'
# preferred_background: 303446
fish_color_normal c6d0f5
fish_color_command 8caaee
fish_color_param eebebe
fish_color_keyword e78284
fish_color_quote a6d189
fish_color_redirection f4b8e4
fish_color_end ef9f76
fish_color_comment 838ba7
fish_color_error e78284
fish_color_gray 737994
fish_color_selection --background=414559
fish_color_search_match --background=414559
fish_color_option a6d189
fish_color_operator f4b8e4
fish_color_escape ea999c
fish_color_autosuggestion 737994
fish_color_cancel e78284
fish_color_cwd e5c890
fish_color_user 81c8be
fish_color_host 8caaee
fish_color_host_remote a6d189
fish_color_status e78284
fish_pager_color_progress 737994
fish_pager_color_prefix f4b8e4
fish_pager_color_completion c6d0f5
fish_pager_color_description 737994

View file

@ -0,0 +1,30 @@
# name: 'Catppuccin latte'
# url: 'https://github.com/catppuccin/fish'
# preferred_background: eff1f5
fish_color_normal 4c4f69
fish_color_command 1e66f5
fish_color_param dd7878
fish_color_keyword d20f39
fish_color_quote 40a02b
fish_color_redirection ea76cb
fish_color_end fe640b
fish_color_comment 8c8fa1
fish_color_error d20f39
fish_color_gray 9ca0b0
fish_color_selection --background=ccd0da
fish_color_search_match --background=ccd0da
fish_color_option 40a02b
fish_color_operator ea76cb
fish_color_escape e64553
fish_color_autosuggestion 9ca0b0
fish_color_cancel d20f39
fish_color_cwd df8e1d
fish_color_user 179299
fish_color_host_remote 40a02b
fish_color_host 1e66f5
fish_color_status d20f39
fish_pager_color_progress 9ca0b0
fish_pager_color_prefix ea76cb
fish_pager_color_completion 4c4f69
fish_pager_color_description 9ca0b0

View file

@ -0,0 +1,30 @@
# name: 'Catppuccin macchiato'
# url: 'https://github.com/catppuccin/fish'
# preferred_background: 24273a
fish_color_normal cad3f5
fish_color_command 8aadf4
fish_color_param f0c6c6
fish_color_keyword ed8796
fish_color_quote a6da95
fish_color_redirection f5bde6
fish_color_end f5a97f
fish_color_comment 8087a2
fish_color_error ed8796
fish_color_gray 6e738d
fish_color_selection --background=363a4f
fish_color_search_match --background=363a4f
fish_color_option a6da95
fish_color_operator f5bde6
fish_color_escape ee99a0
fish_color_autosuggestion 6e738d
fish_color_cancel ed8796
fish_color_cwd eed49f
fish_color_user 8bd5ca
fish_color_host 8aadf4
fish_color_host_remote a6da95
fish_color_status ed8796
fish_pager_color_progress 6e738d
fish_pager_color_prefix f5bde6
fish_pager_color_completion cad3f5
fish_pager_color_description 6e738d

View file

@ -0,0 +1,30 @@
# name: 'Catppuccin mocha'
# url: 'https://github.com/catppuccin/fish'
# preferred_background: 1e1e2e
fish_color_normal cdd6f4
fish_color_command 89b4fa
fish_color_param f2cdcd
fish_color_keyword f38ba8
fish_color_quote a6e3a1
fish_color_redirection f5c2e7
fish_color_end fab387
fish_color_comment 7f849c
fish_color_error f38ba8
fish_color_gray 6c7086
fish_color_selection --background=313244
fish_color_search_match --background=313244
fish_color_option a6e3a1
fish_color_operator f5c2e7
fish_color_escape eba0ac
fish_color_autosuggestion 6c7086
fish_color_cancel f38ba8
fish_color_cwd f9e2af
fish_color_user 94e2d5
fish_color_host 89b4fa
fish_color_host_remote a6e3a1
fish_color_status f38ba8
fish_pager_color_progress 6c7086
fish_pager_color_prefix f5c2e7
fish_pager_color_completion cdd6f4
fish_pager_color_description 6c7086

View file

@ -0,0 +1,16 @@
-- Pull in the wezterm API
local wezterm = require 'wezterm'
-- This table will hold the configuration.
local config = {}
-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then
config = wezterm.config_builder()
end
-- window decorations
config.color_scheme = 'Catppuccin Mocha'
config.window_background_opacity = .96
return config

View file

@ -125,3 +125,4 @@ xl2tpd
zsh
bottom
fish
wezterm