From 959e6706761cea51de89d7fd9a17ca715bc24f1e Mon Sep 17 00:00:00 2001 From: HanzCEO Date: Fri, 25 Jun 2021 07:53:15 +0700 Subject: [PATCH] Add initial nanorc file (stable) --- .gitignore | 2 ++ CONTRIBUTING.md | 10 +++++++++ README.md | 22 +++++++++++++++++- gdscript.nanorc | 59 +++++++++++++++++++++++++++++++++++++++++++++++++ install | 6 +++++ test.gd | 26 ++++++++++++++++++++++ 6 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 CONTRIBUTING.md create mode 100644 gdscript.nanorc create mode 100644 install create mode 100644 test.gd diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1c56bc1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Nano backups +*~ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..8982efd --- /dev/null +++ b/CONTRIBUTING.md @@ -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 diff --git a/README.md b/README.md index 80652af..78eae18 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/gdscript.nanorc b/gdscript.nanorc new file mode 100644 index 0000000..14e2822 --- /dev/null +++ b/gdscript.nanorc @@ -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)" diff --git a/install b/install new file mode 100644 index 0000000..601a92d --- /dev/null +++ b/install @@ -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" diff --git a/test.gd b/test.gd new file mode 100644 index 0000000..df33d2c --- /dev/null +++ b/test.gd @@ -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")