Skip to content

bjarneh/kotkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 

Repository files navigation

 · K O T K I T ·

kotlin starter kit

This repo contains a small starter-kit for those who want to try out the Kotlin language without the Intellij IDE.

content

  • bin/kz : is a script that helps you compile Kotlin source
  • misc: basic syntax files for Vim and Nano

compile

Compilation requires that the kotlin compiler has been installed naturally, see kotlin's github page for a howto.

To use the utility script (kz), a variable needs to be set to point at the root directory of kotlin (as checked out from github)

KOTLIN_GITROOT

$ git clone https://github.com/JetBrains/kotlin.git
$ export KOTLIN_GITROOT=$PWD/kotlin

should do the trick.

This variable could typically be set inside a file which is read each time you log in (.profile or .bashrc etc..)

kz

In order to use the Python script kz to help you compile kotlin, it must be located somewhere it can be found; i.e. in one of the directories pointed to by the $PATH variable typically.

example

Compiling a single file

$ cat Main.kt

 fun main(args: Array<String>){
     println("hello world!")
 }

$ kz Main.kt -o program
  compiling: Main.kt
  construct: program
  time used: 3.4 s

$ ./program
  hello world!

Compiling a project with multiple files

$ ls src/
Hello.kt  Main.kt

$ cat src/Main.kt

fun main(args: Array<String>){
    Hello("world!").say()
}

$ cat src/Hello.kt

class Hello(val whom: String){
    fun say() = println("hello $whom")
}

$ kz -o program src/
  compiling: Main.kt
  compiling: Hello.kt
  construct: program
  time used: 4.4 s

$ ./program
  hello world!

If source is place inside a directory named src as in the example, the src can be omitted, this is the default location.

vim

To get syntax highlighting is hopefully straightforward, create a symbolic link or copy the syntax file into your syntax folder $HOME/.vim/syntax/kotlin.syn, then add a file recognition pattern to your .vimrc

" kotlin files
au BufRead,BufNewFile *.kt set filetype=kotlin

note the syntax file (kotlin.vim) is taken from the kotlin-vim github repo.

nano

Put this inside your .nanorc

include "/path/to/kotkit/mics/syntax/nano/kotlin.nanorc"

About

kotlin syntax files and build script

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published