Kakoune-kotlin.kak a plain *.kak filetype

Hi Duncan,

I have a question.
Today I tried to set my indent level to two spaces.
However, with Kotlin files it still indents with four spaces (e.g. after opening brace)
I looked through the code and I couldn’t find where the number of indent spaces is getting set.
Can you advise?

Thanks!

Note that Kakoune has two separate indentation-related options: tabstop tells Kakoune how wide actual tab characters should be drawn, while indentwidth describes how many spaces should be inserted by indentation commands like < and > (0 means “use a tab instead of spaces”).

If you’ve set tabstop to 2, that generally won’t affect auto-ident hooks, since they typically use < and > to change indentation.

Hi @Screwtapello,

Thanks for the suggestion. Unfortunately, it doesn’t apply to my case.
I have both options set to 2 spaces.
And it works in all other languages.
So, something in the new kotlin.kak file which I can’t figure out.

Follow the language standards. When in Rome! It makes me weep. :sob:

@yerlaser did you confirm the options are set properly when you are in the kotlin file by echo’ing them?

@robertmeta Hi, yes, I confirmed. The filetype is very new, so it’s somewhere in it.

Hey buddy, nice work on getting kolin.kak into the wider community.

Why would I not? I’ll put it down to a self doubting day.

Your kotlin.kak-patch-1 was awesome! It got my butt in gear and made some changes at Bitbucket check it out as it may give you some more ideas to play with as your kotlin.kak-patch-1 did for me.

Try this: comment out all changes to any preference in spaces and tabs. Then use a single source of truth https://editorconfig.org/ for your file-type preferences.

# Enable editor config: <https://github.com/mawww/config/blob/master/kakrc#L17>
# ────────────────────

hook global BufOpenFile .* %{ editorconfig-load }
hook global BufNewFile .* %{ editorconfig-load }

This line here is the only change for indentation I have made in recent memory, indentation is on my Readme.md todo list:

# https://bitbucket.org/KJ_Duncan/kakoune-kotlin.kak/src/master/rc/kotlin.kak#lines-136
fun aFunction() = <return>
<space><space>

For future readers, yerlaser was referring to these kakoune settings:

set-option global tabstop 2
set-option global indentwidth 2

Last but not least check your plugins and any settings they may have. I’ve been caught out with this before.

I think that’s it and THANK YOU YERLASER stay cool buddy. Bye :wave:

Hi Duncan,

Glad you’re back!
Yeah, I have pinpointed that tabulation error to dev version of Kakoune that I compiled on Ubuntu. I am currently on Fedora and on stable version and thus don’t have that problem any more. We’ll look into that later.

And, regarding that comment about listening, that was when maww requested changes and at that time I was nervous and ashamed that I couldn’t fix myself. So, your fixes came just in time and were big relief.
Since then I think I understand better the syntax of kakoune highlighters.

Thank you for kickstarting this!

Great documentation an OS that I want to play with.

Yerlaser I found the song, next time your shoulders are slumped give this a spin.

  • Baker Boy, 2019, ‘In Control’, Norman & Woods & Baker, Spotify or YouTube, viewed 13 June 2021,
    • https://open.spotify.com/track/5xgsrlbxfmAZR8t57ljK5t?si=91e280e3967f4a34
    • https://youtu.be/sucSnEIWf2g

Thanks yerlaser, and you can BUILD IT BETTER! It’s just time and persistence that make it all work. Bye :wave:

As a thank you @yerlaser for you efforts on github I put together some daily use scripts. Simple but good and instructions included.

Cue the kotlin theme song spotify || youtube.

Thats the link https://pl.kotl.in/Wjyxk_-TT?theme=darcula&readOnly=true

Bye :wave: .

Hi Duncan!

That’s very cool, let me compile those binaries and I’ll try.
I might even think about merging those into a single executable with the methods being supplied as an argument.

Thank you!

No worries, it’s nice to have someone take an interest and it has spurred me on to build it better myself. Give this a run for some fun.

New update to kakoune-kotlin.kak are auto-completers for import statements.
rc/kotlinInheritanceHierarchy.kak

Out-Of-The-Box

Lenormf’s kakoune welcome mat for users.

# Allow cycling to the next/previous candidate with <tab> and <s-tab> when completing a word

hook global InsertCompletionShow .* %{
  try %{
    execute-keys -draft 'h<a-K>\h<ret>'
    map window insert <tab> <c-n>
    map window insert <s-tab> <c-p>
  }
}

hook global InsertCompletionHide .* %{
  unmap window insert <tab> <c-n>
  unmap window insert <s-tab> <c-p>
}

What are Completers?

Bye all :wave: .

Hey all, I worked out how to do function indentation correctly. It will indent the next successive line for function continuation and de-dent the following line if no text was on the previous line.

fun hello() =
<space><space>\n
no indentation here as previous line contains no text

fun hello(): String = "hi"
<space><space>\n
fun noIndent(): Int = 1
try %< execute-keys -draft k <a-x> <a-k>^\h*?(?:\b(private|public|protected|internal)\b)?\h*?(?:\b(tailrec|inline|infix|operator|external|suspend)\b)?\h*?\b(fun|where)\b[\S\s]*?$ <ret> j<a-gt>
> catch %<
    execute-keys -draft JK <a-&>
>

Also realised I forgot kotlin keywords on kakoune static word completion list this is now fixed.

Hi Duncan,

I am so sorry that I haven’t read this before.
Looks like you already committed these changes yourself?

BR, Yerlan

Cried myself to sleep for the first week :sob: … Then was able to get git send-email up running, worked well got my name on the board YEAH :muscle:!

I’m starting to have some fun with kotlin-jupyter kernel for jupyter lab. It’s pretty easy to get up and running because it’s kotlin :grin:

Three emoji’s lets do four, bye :wave:

Haha :slight_smile: Cool, glad you’re on Git as well. I am sure you won’t regret as there are so many projects. I am more DevOps, but, will have a look at your suggestions. This whole thingy about big-data, AI, ML etc. becomes too big to ignore.