Kakoune-kotlin.kak a plain *.kak filetype

Supported file extensions: (kt|kts)

mv kotlin.kak ~/.config/kak/autoload/

plug.kak

plug "KJ_Duncan/kakoune-kotlin.kak" domain "bitbucket.org"

Kotlin language support for the Kakoune editor.

It’s now implemented as a plain kakoune filetype, no third party dependencies.

Cool, cool. Bye :wave:

Repo link: kotlin.kak

2 Likes

Hi,
This is really cool, thank you!
I’ve seen your discussion on your first attempt and that was apparently stalled because of third party dependency.
Now that there no third party dependency this can be included into the default installation.
I was just curious if there are reasons why you don’t want that to happen?
I am asking because I haven’t found an issue on GitHub about including this and I was going to create one, but thought it would be better to ask you first.

Hi yerlaser,

The bitbucket account is a signup for my university. Github is just one more thing to learn and I have my plate full with things to learn at work and university at the moment. Dazed and confused is my constant state.

Honestly, happy with what I’ve got and discuss.kakoune for me is a team meetup. There is a license to steal (unlicense) on my repositories so bring a backpack.

Click on my root name to see all my kakoune stuff, not the node name due to bitbucket project login will be required.

KJ_Duncan/kakoune/**

I’ve been working on kakoune-java.kak and still working on it, you might find something to pinch in there as well.

Jump into it and do some good. Have fun yerlaser. Bye :wave:


It’s a community, thanks for helping build it. I got a kt script for you to word-wrap in kakoune editor. Build with kotlin-native or jar or what ever you like, it’s kotlin :smiley:.

WordWrapRegex.kt
/**
 * Word Wrap Regex is adapted from source:
 * @author http://rosettacode.org/wiki/Word_wrap#Regex_Implementation
 */
object WordWrapRegex {

  private fun String.wordwrap(n: Int): String {
      return Regex("(.{1,$n})(?:\\s[^\\S\r\n]*|\\Z)")
             .findAll(this)
             .joinToString("\n")
             { it.value }
  }

  @JvmStatic fun main(args: Array<String>) {
      val stdin  = generateSequence(::readLine)
      val string = stdin.joinToString()
      val result = string.wordwrap(if (args.isEmpty()) 102 else args[0].toInt())
      println(result)
  }
}
map global user 'H' '| wordwrapregex 80<ret>'  -docstring "wrap selected text to column 80"
map global user 'W' '| wordwrapregex 102<ret>' -docstring "wrap selected text to column 102"
map global user 'K' '| wordwrapregex 120<ret>' -docstring "wrap selected text to column 120"

Till next time, bye.

Hi,
Thanks a lot man!
I have filed the pull request: Add Kotlin filetype by yerlaser · Pull Request #4073 · mawww/kakoune · GitHub
I did mention that you are the author, but didn’t find any other place to include you credits.

Have a nice day/evening, whatever it is in at your place and thanks again for your contribution!

Hi yerlaser, I have updated kotlin.kak to meet the criteria discussion on issue #4073.

All you have to do is clone it and delete any/all “Not in my repo pal” @mawww and the gang might have with it.

Need anything just let me know. Cool, bye :wave:


Sorry yerlaser, I forgot to mention the -override flags that I put in.
kakoune key sequence to remove them is:
<esc>%s\h-override<ret>d<esc>

High five on the teamwork :pray: cya buddy.

Hi Duncan,
Thanks a lot!
I pushed it for a new review.
I changed your file a bit by adding author and source.

Hi yerlaser, were getting there buddy.
clone or pull kotlin.kak again as I have fixed mawww’s issues 04 March 2021 and also removed those -override flags as well.

Cool, bye :mailbox_with_mail:

Hi Duncan,
Great, have just pushed your updates.
We’ll get there :slight_smile:
Take care!

Hi yerlaser, a couple of things might come back from mawww and the gang:

If it does go with your choice of colors. If in doubt just review other file-types in kakoune/rc/filetype or ask the community here.

Also, its a team effort so get your name on the kotlin.kak file please:
Author Team: Yerlan & Kirk Duncan

I need another cool emoji :handshake: and the deal is done. Bye :wave:

Hi Duncan,
Thanks. I saw some additional comments.
My colleague is on vacation, so my time will be very limited in the coming weeks, but once freed I’ll review that.
Best regards, Yerlan

Ok yerlaser, how about I’ll take care of all @mawww’s issues and you do the git pull and git push for kakoune on github.

Since your limited for time, when you get some here is a problem I have failed to solve in kotlin.kak

Generics regex needs improvement, as after a colon the closet match is for a constant only.
Example:

val program: IOU = XXXX
val cat: DOG = XXXX

Always matches IOU or DOG as a CONSTANT when it could be generics. See the regex in action here: https://regex101.com/r/VPO5LE/7

I will do an update in a couple of days to kotlin.kak and let you know when its done. Bye :wave:.

Hi Duncan,

Sorry for late reply.
I just uploaded the latest changes from your repo.

May I ask you a question?
I am playing around with Kotlin, for now with the language itself and liking it.
Soon, however, I would like to try JetPack Compose as well.
However, I am not finding any resource which explains how to compile JetPack Compose apps with command line tools only, i.e. without Android Studio.
If you come accross such a resource, I would greatly appreciate if you share the link.

Thank you very much and have a nice day!
Yerlan

Mate, had the same problem and here’s the fix JetBrains/compose-jb.

Also TornadoFX as a comparison.

Hi,
Cool, I’ll check this out.

Meanwhile, I had to resubmit the pull request.
There are some strange characters in the bitbucket repo, don’t know if it’s my Linux setup or BitBucket itself, but the characters went into the original pull request.
I removed those characters and another pull request here:

Hope it will be easier to follow.

Great job, nothing to do but wait for the bosses feedback (@mawww) and hopeful sooner rather than later the wider community can enjoy a kotlin highlighter in kakoune. Yah! :clap:.

Hi @yerlaser and kotlin community,

If your interested in building your knowledge on functional programming for ‘Kotlin’: I am working my way through the below book, its on my preferred list of reads for the topic.

Vermeulen, M Bjarnason, R & Chiusano, P 2021, Functional Programming in Kotlin, MEAP began August 2019 Publication in June 2021 (estimated), viewed 28 March 2021, https://www.manning.com/books/functional-programming-in-kotlin

The authors last and final outstanding task for this book is: ‘Appendix E: Type Classes’.

You can purchase the book with all the available chapters and come back for the last ‘Appendix E’ later for free. Also for free is the books Github repository for you to work and play with kotlin code examples from the authors (see the above book reference for details).

I have no affiliations with either Manning Publications or Github. Bye :wave:

2 Likes

Hi yerlaser,
I set up mawww’s pedantic branch (mpb) to make things easier in regards to latest #4112 feedback. Grab it on:
git clone --branch mpb --depth 1 https://bitbucket.org/KJ_Duncan/kakoune-kotlin.kak.git

Mate can do this trick again for us as you know it best. I will copy and paste those changes back into mpb for the next go round.

Cool, bye yerlaser.

Hi duncan,

Wow, I was about (somewhat reluctantly) to look into this myself, knowing that it would be difficult as hell to understand and correct somebody else’s code, but, here you go, as if you listen to me :slight_smile:

Thanks a lot!
I’ll update the file and will let you know.

Regarding “pedantic”, he is the author and I understand he only wants good code to go in since he will mostly also maintain it.

Best regards,
Yerlan

Here’s the new pull request:

Hey man, congratulations!
The commit was merged, so, hopefully, next version will have kotlin support built-in.
Let’s hope the bits that you’ve written will serve people!

By the way, if you want to maintain your copy on bitbucket, would be good if you copy the file from github. The only change is removal of kotlin_ prefix from lines already containing kotlin/ in the path. But, that will make futher contributions easier.