luke-gru / riml

Riml is a subset of VimL with some nice added features. It compiles to plain VimL.
MIT License
224 stars 6 forks source link

Syntax file for riml #3

Open dsawardekar opened 11 years ago

dsawardekar commented 11 years ago

This isn't a bug/issue. I have created a syntax highlighting file for riml. It's adapted from the coffeescript syntax file. It's pretty basic, but it looks ok with the Solarized theme.

https://github.com/dsawardekar/riml.vim

If you have any suggestions please let me know.

luke-gru commented 11 years ago

Awesome! I was in the middle of writing on too, and it was very similar in that I based it off the coffeescript one too :smile:

I'll take a look at it and play around with it, and I'll be sure to send you some PRs if I find some issues.

Thanks!

dsawardekar commented 11 years ago

Thanks. Yeah Riml looks just like my Coffeescript to my eyes as well. I started out looking at the vim ruby syntax. But that single file has more Regex wizardry that I have seen before. :)

luke-gru commented 10 years ago

Hey @dsawardekar, I've been working on a new syntax file for riml, as I wanted to learn how to write one from scratch, and the riml.vim one was kind of buggy. I also created an indent file. I've created a new repository at luke-gru/vim-riml, but I am in no way competing with your riml.vim project :smile: . I'd be happy to merge it all into your project.

Also, vim-riml is not done, there's more to do regarding the syntax file, but it supports a few more syntax items.

dsawardekar commented 10 years ago

@luke-gru This is outstanding! Mine is basically a result of mucking around and copy pasting from the ruby and coffeescript syntax files. Half the time with my fingers crossed, :laughing: I even had the crazy idea of doing a language grammar to viml syntax compiler, just to avoid writing the Regexes. :hamster:

You should write a blog post about this. Writing a proper syntax file is something that is not well understood.

luke-gru commented 10 years ago

Yeah, I was surprised that there weren't any involved blog posts covering the more advanced features of vim syntax files. There are a couple of helpful tutorials out there for the basics, but I found the most useful thing was having this function in my .vimrc:

" Show syntax highlighting groups for word under cursor.
nnoremap <C-S-P> :call <SID>SynStack()<CR>
function! <SID>SynStack()
  if !exists("*synstack")
    return
  endif
  echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunc
" /syntax groups

This function echoes the current syntax groups that the word under the cursor has. Without this function, it would have been impossible to do anything, really.

But yeah, I ended up still having to read most of pattern.txt and syntax.txt, and playing around a lot. I'd definitely blog about it, I need to get my own site up first :smile:

Maybe I'll contribute a piece to vim.wikia.com in the meantime.

dsawardekar commented 10 years ago

@luke-gru Good stuff, that is going straight into my vimrc!