Skip to content

Commit

Permalink
Add initial nanorc file (stable)
Browse files Browse the repository at this point in the history
  • Loading branch information
HanzCEO committed Jun 25, 2021
1 parent 44aeac8 commit 959e670
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Nano backups
*~
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# How To Contribute
1. Check if any issue are open and not resolved yet
1. Fork the repository
1. Modify the content
1. Install and test the rc file using installation procedure
1. Commit your edits
1. Open pull request to the main branch
1. Wait

Thank you for your interest in contributing, we are looking forward for your PR
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
# nano-gdscript
GDScript Syntax Highlighting in GNU Nano
GDScript Syntax Highlighting in GNU Nano. Updated regularly every minor updates.
Contributions are welcomed

# Installation
This is 100% free, proof:
1. Admit that `install` is an executable
```sh
chmod +x install
```
2. Start the installation
```sh
./install
```
3. Test it
```sh
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
59 changes: 59 additions & 0 deletions gdscript.nanorc
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# GNU Nano Syntax Highlighter for GDScript (*.gd)
# Contributors, please read CONTRIBUTING.md
# otherwise your pull request would be closed
syntax gdscript "\.gd$"

comment "#"

# Numbers
color orange "\<[0-9]*\>"
color orange "\<0x[0-9a-fA-F]*\>"

# Function Calls
color cyan "[_a-zA-Z]*[0-9]*\("

# Operators
color white "(\!|\%|\&|\*|\(|\)|\-|\+|\=|\{|\}|\[|\]|\/)"

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

# Constants
color white "\<[A-Z_]+\>"

# Keywords
## Conditions
color bold,lightred "\<(if|elif|else|match|switch|case)\>"
## Repeations
color bold,lightred "\<(for|while|break|continue)\>"
## Long-hand Operator
color bold,lightred "\<(is|as|not|in|and|or)\>"
## OOP
color bold,lightred "\<(null|self|owner|parent|tool)\>"
## Booleans
color bold,lightred "\<(true|false)\>"
## 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)"
6 changes: 6 additions & 0 deletions install
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /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"
26 changes: 26 additions & 0 deletions test.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
extends KinematicBody2D

export var speed: int = 200
export var jump_force: int = 0x5f

func _process(delta):
var direction = Vector2.ZERO

# Vertical movement
if Input.is_key_pressed(KEY_UP):
direction += Vector2.UP
elif Input.is_key_pressed(KEY_DOWN):
direction += Vector2.DOWN

# Horizontal movement
if Input.is_key_pressed(KEY_UP):
direction += Vector2.UP
elif Input.is_key_pressed(KEY_DOWN):
direction += Vector2.DOWN

# WARNING: Will be processed each frame
move_and_slide(Vector2.UP * speed * delta)

func _ready(delta):
print("Script is now ready!")
$AnimatedSprite.play("default")

0 comments on commit 959e670

Please sign in to comment.