Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
f6e9213
Fix function call highlighting
Kiisu-Master Apr 23, 2024
e4ba7ab
Add anotation highlighting
Kiisu-Master Apr 23, 2024
71ee520
Add when condition for match
Kiisu-Master Apr 23, 2024
b5c8af2
Improve string highlighting
Kiisu-Master Apr 23, 2024
ac85bad
Fix file formatting
Kiisu-Master Apr 23, 2024
88cc9a2
Add new anotation style to test file
Kiisu-Master Apr 23, 2024
19b2d5e
Fix formatting and add highlighting for strings with '
Kiisu-Master Apr 23, 2024
9d92f76
Fix strings in comments getting highlighted
Kiisu-Master Apr 23, 2024
4eb7dfe
Fix node path highlighting
Kiisu-Master Apr 23, 2024
ef42f7e
Add string escape sequence highlighting
Kiisu-Master Apr 23, 2024
1d32270
Fix colors and escape sequence highlighting
Kiisu-Master Apr 23, 2024
dd03f28
Improve test.gd file
Kiisu-Master Apr 23, 2024
83d1455
Fix comments and fix weird string highlighting regex
Kiisu-Master Apr 23, 2024
7b63691
Improve test.gd file
Kiisu-Master Apr 23, 2024
67982a4
Remove builtin function highlighting
Kiisu-Master Apr 23, 2024
cb2f257
Update README.md
Kiisu-Master Apr 23, 2024
5928978
Fix highlight of nodepaths with spaces
Kiisu-Master Apr 23, 2024
5c3777f
Attempt to fix display of format strings
Kiisu-Master Apr 23, 2024
e5dc675
Highlight constructors and inline comments
Kiisu-Master Apr 23, 2024
52a3d2c
Fix test.gd formatting
Kiisu-Master Apr 23, 2024
b5610e2
Improve examples
Kiisu-Master Apr 23, 2024
79e5755
Add docstring highlighting
Kiisu-Master Apr 23, 2024
d26d050
Adjust color and improve test.gd
Kiisu-Master Apr 23, 2024
940333f
Add formatter and linter
Kiisu-Master Apr 23, 2024
c7a2482
Update README.md
Kiisu-Master Apr 23, 2024
0ca3ab1
Fix inline docstring comments
Kiisu-Master Apr 23, 2024
6800d5e
Merge branch 'update'
Kiisu-Master Apr 23, 2024
4fc3d61
Add inline docstring example
Kiisu-Master Apr 23, 2024
45c28e0
Merge branch 'update'
Kiisu-Master Apr 23, 2024
fa39224
Update gdscript.nanorc
Rito13 May 5, 2025
e86de14
Misc and Escape sequences
Rito13 May 5, 2025
8f6215d
Misc update
Rito13 May 5, 2025
8ef160d
Create install_android_termux
Rito13 May 5, 2025
3fa2e4f
Update README.md
Rito13 May 5, 2025
9184033
README.md fix
Rito13 May 5, 2025
e551000
Fix gdscript.nanorc
Rito13 May 5, 2025
4018a40
Update test.gd
Rito13 May 5, 2025
df8b54b
White rename
Rito13 May 6, 2025
fe84302
Operators test
Rito13 May 6, 2025
b65fe0b
Update .gitignore
Rito13 May 6, 2025
42acdaf
Add await keyword
Kiisu-Master May 7, 2025
1c22eb6
Update install
Rito13 May 7, 2025
b3aa18a
Update instalation instructions.
Rito13 May 7, 2025
a981b84
Fix syntax in README.md
Rito13 May 7, 2025
e69f34b
Remove install_android_termux
Rito13 May 7, 2025
99427c7
GDScript utility functions
Rito13 May 11, 2025
022c201
Built-in GDScript constants
Rito13 May 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
# Nano backups
*~

# Godot 4+ specific ignores
.godot/

# Godot-specific ignores
.import/
export.cfg
export_presets.cfg
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# nano-gdscript
GDScript Syntax Highlighting in GNU Nano. Updated regularly every minor updates.
Contributions are welcomed
GDScript Syntax Highlighting in GNU Nano.
Contributions are welcome!

# Installation
This is 100% free, proof:
1. Admit that `install` is an executable
```sh
chmod +x install
```
2. Start the installation
2. Start the installation. On android use `-a` option.
```sh
./install
```
Expand All @@ -18,5 +17,4 @@ nano test.gd
```

# End Notes
Nano is a great tool overall, its simplicity allows us to improve it.
This rc file is unlicensed, use it in any way you want
This rc file is unlicensed, use it in any way you want.
148 changes: 105 additions & 43 deletions gdscript.nanorc
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,120 @@
# Contributors, please read CONTRIBUTING.md
# otherwise your pull request would be closed
syntax gdscript "\.gd$"

formatter gdformat
linter gdlint
comment "#"

# Numbers
color orange "\<[0-9]*\>"
color orange "\<0x[0-9a-fA-F]*\>"
# Operators.
# color white "(\!|\%|\&|\*|\(|\)|\-|\+|\=|\{|\}|\[|\]|\/)"

# Numbers.
color lightcyan "\<[+-]?[_0-9]+(\.[_0-9]+)?\>"
color lightcyan "\<0b[01]+\>"
color lightcyan "\<0x[0-9a-fA-F]+\>"

# Class.
color lime "\<[A-Z]+[_a-zA-Z0-9]*\>"
## Class Property.
color lightwhite "\.[_a-zA-Z]+[_a-zA-Z0-9]*"

# Function Calls.
color sky "[_a-zA-Z]+[_a-zA-Z0-9]*\("

# Function Calls
color cyan "[_a-zA-Z]*[0-9]*\("
# Constructors.
color bold,lime "[A-Z][_a-zA-Z0-9]*\("

# Operators
color white "(\!|\%|\&|\*|\(|\)|\-|\+|\=|\{|\}|\[|\]|\/)"
# Global functions.
## Trigonometric.
color plum "\<(a?(cos|sin|tan)h?)\("
## GDScript specific
color plum "\<(assert|char|convert|dict_to_inst|get_stack|inst_to_dict|is_instance_of)\("
color plum "\<(len|load|preload|print_debug|print_stack|range|type_exists)\("
## Others alphabetically.
color plum "\<(abs[fi]?|angle_difference|atan2)\("
color plum "\<(bezier_(derivative|interpolate)|bytes_to_var(_with_objects)?)\("
color plum "\<(ceil[fi]?|clamp[fi]?|cubic_interpolate(_angle)?(_in_time)?)\("
color plum "\<(db_to_linear|deg_to_rad)\("
color plum "\<(ease|error_string|exp)\("
color plum "\<(floor[fi]?|f(pos)?mod)\("
color plum "\<(hash)\("
color plum "\<(instance_from_id|inverse_lerp|is_((equal|zero)_approx|finite|inf|instance(_id)?_valid|nan|same))\("
color plum "\<(lerp(_angle|f)?|linear_to_db|log)\("
color plum "\<(max[fi]?|min[fi]?|move_toward)\("
color plum "\<(nearest_po2)\("
color plum "\<(pingpong|posmod|pow|print(_rich|_verbose|err|raw|s|t)?|push_(error|warning))\("
color plum "\<(rad_to_deg|rand(omize|_from_seed|fn)|rand[fi](_range)?|remap|rid_(allocate_id|from_int64)|rotate_toward|round[fi]?)\("
color plum "\<(seed|sign[fi]?|smoothstep|snapped[fi]?|sqrt|step_decimals|str|str_to_var)\("
color plum "\<(type(_convert|_string|of))\("
color plum "\<(var_to_(bytes(_with_objects)?|str))\("
color plum "\<(weakref|wrap[fi]?)\("

# Class
color lightcyan "\<[A-Z]+[_a-zA-Z0-9]*\>"
## Class Property
color white "\.[_a-zA-Z]+[0-9]*"
# Brackets.
color bold,sky "\(|\)"

# Constants
color white "\<[A-Z_]+\>"
# Constants.
color bold,normal "\<[A-Z_]+[_A-Z0-9]*\>"

# Keywords
# Keywords.
## Conditions
color bold,lightred "\<(if|elif|else|match|switch|case)\>"
## Repeations
color bold,lightred "\<(for|while|break|continue)\>"
color bold,lightmagenta "\<(if|elif|else|match|switch|case|when)\>"
## Repeations.
color bold,lightmagenta "\<(for|while|break|continue)\>"
## Long-hand Operator
color bold,lightred "\<(is|as|not|in|and|or)\>"
## OOP
## OOP.
color bold,lightred "\<(null|self|owner|parent|tool)\>"
## Booleans
color bold,lightred "\<(true|false)\>"
## Statements
## Booleans.
color red "\<(true|false)\>"
## Built-in GDScript constants
color red "\<(PI|TAU|INF|NAN)\>"
## Statements.
color bold,lightred "\<(remote|master|puppet|remotesync|mastersync|puppetsync|sync)\>"
color bold,lightred "\<(return|pass|static|const|enum|breakpoint|assert|onready)\>"
color bold,lightred "\<(class_name|extends|var|export|setget|class|func|signal)\>"
## Builtin Functions
color bold,lightred "\<(print|funcref)\>"
## Primitive Types
color bold,lightred "\<(void|bool|int|float)\>"

# Comment line
color lightblack "^\s*#.*"

# Strings
color yellow "\".*\""

# Child
color green "\$[\"]?[_a-zA-Z]*[0-9]*[\"]?"

# Misc
## Task Marker
color bold,lightcyan "^\s*#\s*(TODO|FIX|HACK|XXX|NOTE|BUG)"
## Notices
color bold,lightyellow "^\s*#\s*(WARNING|WARN|BUGGY)"
color bold,lightred "\<(static|const|enum|breakpoint|assert|onready)\>"
color bold,lightred "\<(class_name|extends|var|export|setget|class|func|signal|await)\>"
color bold,lightmagenta "\<(return|pass)\>"
## Primitive Types.
color bold,lightgreen "\<(void|bool|int|float)\>"

# Anotations.
color orange "@[_a-z]*"

# Node paths.
color green "(\$|%)\"[_/a-zA-Z0-9][_/ a-zA-Z0-9]+?\""
color green "(\$|%)[_/a-zA-Z0-9][_/a-zA-Z0-9]+?"

# Strings.
## prefixes
color lightyellow "(r|\^|\&)\""
color brown "r'"
## "
color sand ""([^"]|\\")*""
## '
color tawny "'([^']|\\')*'"

# Comments.
color lightblack "#.*$"

# Docstrings.
color lightblue "##.*$"

# Misc.
## Critical.
color bold,crimson "\<(ALERT|ATTENTION|CAUTION|CRITICAL|DANGER|SECURITY)\>"
## Warning.
color bold,brick "\<(BUG|DEPRECATED|FIXME|HACK)\>"
color bold,sand "\<(TBD|WARNING|BUGGY|WARN)\>"
## Notice.
color bold,tawny "\<(FIX|TEST|TESTING|XXX|TASK|TODO)\>"
color bold,teal "\<(INFO|NOTE|NOTICE)\>"

# Multi line strings.
color sand start="\"\"\"" end="\"\"\""
color tawny start="'''" end="'''"

# Escape sequences.
color italic,gray "\\([abcefnrtv'"\\])"
color green "%[+-]?([0-9]+|\*)?(\.([0-9]+|\*))?[scdoxXfv]"

# Blank end of line.
color ,slate "\s+$"
91 changes: 85 additions & 6 deletions install
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,85 @@
#! /usr/bin/env sh
echo "Installing requires sudo permission"
echo "What we need:"
echo " 1. Copy gdscript.nanorc to /usr/share/nano directory"
sudo cp gdscript.nanorc /usr/share/nano
echo "Done"
##! /usr/bin/env sh
rc_file="gdscript.nanorc"

Install() { # (nano_path,sudo_cmd)
echo "Installing requires $2permission"
echo "What we need:"
echo " 1. Copy $rc_file to $1 directory"
$2cp -f "$rc_file" "$1"
echo "Done"
}

Help() {
echo this is help message
}

Replace() { # (file_name,from,to)
while IFS='' read -r a; do
echo "${a//$2/$3}"
done < $1 > $1.t
echo "#replaced $2 with $3" >> $1.t
mv -f $1.t $1
}

instalation_path=/usr/share/nano
sudo_cmd="sudo "

while getopts ":ha" option; do
case $option in
h) # display Help
Help
exit;;
a) # android termux
instalation_path=~/../usr/share/nano
sudo_cmd=""
;;
\?) # Invalid option
echo "Error: Invalid option"
echo "try -h option for help"
exit;;
esac
done

ReplaceComplex() { # (file)
Replace $1 sand lightyellow
Replace $1 lime lightgreen
Replace $1 sky lightblue
Replace $1 plum magenta
Replace $1 orange yellow
Replace $1 brown lightyellow
Replace $1 tawny lightyellow
Replace $1 crimson red
Replace $1 brick red
Replace $1 slate gray
}

Invert() { # (file,color1,color2)
Replace $1 $2 "$2tmpname"
Replace $1 $3 $2
Replace $1 "$2tmpname" $3
}

cp $rc_file $rc_file.back
echo "Choose theme:"
echo "1.Default - for 256+ colors terminals"
echo "2.Simpler - using only 16 default colors"
echo "3.Light - for terminals with white background"
echo "4.Simple Light - combination of 2nd and 3rd"
read -p "your choice(number):" theme
case $theme in
1) Install "$instalation_path" "$sudo_cmd"
;;
2) ReplaceComplex $rc_file
Install "$instalation_path" "$sudo_cmd"
;;
3) Invert $rc_file white black
Install "$instalation_path" "$sudo_cmd"
;;
4) ReplaceComplex $rc_file
Invert $rc_file white black
Install "$instalation_path" "$sudo_cmd"
;;
\?) echo "invalid theme"
;;
esac
mv -f $rc_file.back $rc_file
Empty file added install_android_termux
Empty file.
Loading