• This repository has been archived on 10/Jul/2023
  • Stars
    star
    125
  • Rank 286,335 (Top 6 %)
  • Language
    Objective-C
  • Created about 11 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An objective-C code editing component.

GMCodeEditor

This project is a code editing component for objective-C applications. My main motivation in writing this, was that for projects that need to edit code, but editing code isn't their sole purpose (i.e. you are not building an IDE), there should be a simple package that you link into your project, specify the class in interface builder and bam, you have something which is decent for writing code. This is the purpose of GMCodeEditor and its design philosophy.

Features

  • Syntax highlighted code
  • Context-aware (somewhat) code completion
  • Parenthesis matching
  • Paired character support (e.g. type in [, get ] typed automatically)
  • Indentation commands
  • Commands for toggling comments
  • Line numbers
  • Theme-able
  • Well documented

Try me!

Download the sample project that shows off the component (it's a text editor).

Download App

Subcomponents

GMCodeEditor has two subcomponents that are independent and may be used individually without anything else. The first is GMSyntaxHighlighter, a lightweight syntax highlighter written in objective-C and inspired by prism.js. It takes a string, a language description and a theme and produces an NSAttributedString with appropriate attributes for syntax highlighting. It can also optionally produce html.

The other is GMAutoCompleteTextView, which is an NSTextView subclass that allows rather sophisticated autocompletion.

Installation

GMCodeEditor is designed to be used with CocoaPods. You can install it by adding pod 'GMCodeEditor' into your Podfile and running $ pod install.

To install only GMSyntaxHighlighter put pod 'GMCodeEditor/GMSyntaxHighlighter' into your Podfile. To install GMAutoCompleteTextView add pod 'GMCodeEditor/GMAutoCompleteTextView'.

Usage

The easiest way to use GMCodeEditor is to add a NSTextView somewhere in Interface Builder. Then change the class to GMCodeEditor. Finally in awakeFromNib call setLanguage: with the name of the language you want to be editing. No step three.

Well kind of. You need to have the appropriate language file included in your project, the initial release only contains one for CSS and one for Ruby. Writing a language file isn't difficult, but hopefully more will become available over time.

Documentation

The aim of this project is to have well written documentation, which you can find at http://code.gampleman.eu/GMCodeEditor/html.

Contributing

Contributions are very welcome, please use the issue tracker to file bugs or feature requests. Pull requests are especially welcome. I hope that people will contribute language files to this project which then everyone can use.

License

The author of this project is Jakub Hampl.

The project is licensed under the MIT license. Attribution is welcome.

More Repositories

1

elm-visualization

A data visualization library for Elm
Elm
514
star
2

elm-mapbox

MapboxGL bindings for Elm
Elm
60
star
3

quick_check.js

A JS implementation of quick_check
CoffeeScript
46
star
4

elm-review-derive

Generate code for json encoders/decoders, codecs, fuzzers, generators, and more
Elm
26
star
5

elm-example-publisher

Make a beautiful website from your Elm examples
Elm
18
star
6

angular-keyboard

A user interface toolkit for adding declaratively keyboard navigation to your web apps
JavaScript
16
star
7

chartkit

Angular + Highcharts Integration
JavaScript
12
star
8

core-extra

Utility functions for an improved experience with elm/core
Elm
10
star
9

elm-geospatial

Geospatial analysis in elm
Elm
6
star
10

SE-Editor-Toolkit

Adds a few buttons on SE sites to make editing easier.
CoffeeScript
6
star
11

Khepera-Maze

Code to guide a Khepera robot through a maze.
Objective-C
5
star
12

icui

ICUI is a user interface component for buidling IceCube objects.
JavaScript
4
star
13

alfred-find-my-iphone

Alfred Workflow to Find your iPhone
Ruby
4
star
14

Laplace

A simple in-place editor
JavaScript
4
star
15

elm-examples-helper

A simple package that makes examples simpler yet nicer
Elm
3
star
16

Tableview

A DSL and output framework for defining views consisting of tables that can output to HTML, CSV, XLS or ascii.
Ruby
3
star
17

Robot-IAR

Robotics project for Intelligent Autonomous Robotics.
C
2
star
18

gampleman.github.com

My small site with some heavy interactivity,
Ruby
2
star
19

elm-webcomponents

Generate Elm modules from annotated Typescript web components
TypeScript
2
star
20

LESS3

LESS3 is an extension to LESS to allow you to start using CSS3 properties today with workarounds for legacy browsers.
Ruby
2
star
21

HCI-practical

Java
1
star
22

esbify

A small language for creating the input files for the ESB framework.
Ruby
1
star
23

equilibrium

A simple game about keeping balance in nature
Elm
1
star
24

Experiment

Experiment is a ruby library and environment for running scientific experiments (eg. AI, GA...), especially good for experiments in optimizing results by variations in algorithm or parameters.
Ruby
1
star
25

praxis-client-generator

Generates a client for accessing a Praxis API
CoffeeScript
1
star