Coder Social home page Coder Social logo

vim-slim's Introduction

vim-slim

slim syntax highlighting for vim.

Install with pathogen

If you are already using pathogen, you can skip to step 3.

  1. Install pathogen (if you haven't already)

     mkdir -p ~/.vim/autoload ~/.vim/bundle && \
     curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
    
  2. Edit ~/.vimrc to run pathogen as the first line of the file (if you haven't already)

    execute pathogen#infect()
    syntax on
    filetype plugin indent on
  3. Install slim-vim

     pushd ~/.vim/bundle; \
     git clone git://github.com/slim-template/vim-slim.git; \
     popd
    

Install with Vundle

  1. Install Vundle into ~/.vim/bundle/.
    mkdir -p ~/.vim/bundle; pushd ~/.vim/bundle; \
    git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
    popd
  1. Configure your vimrc for Vundle. Here's a bare-minimum vimrc that enables vim-slim :

    set rtp+=~/.vim/bundle/Vundle.vim
    call vundle#begin()
    
    Plugin 'gmarik/Vundle.vim'
    Plugin 'slim-template/vim-slim.git'
    
    call vundle#end()
    syntax enable
    filetype plugin indent on

If you're adding Vundle to a built-up vimrc, just make sure all these calls are in there and that they occur in this order.

  1. Open vim and run :PluginInstall.

To update, open vim and run :PluginInstall! (notice the bang!)

Known Issues

We use setfiletype upon autodetect, which does not overrides filetype once it was set. That leads into an issue when filetype is set to html before we took our chance (happens when slim file has doctype html header):

Vim's filetype.vim has an autocmd that tries to detect html files based on doctype and this is triggered before scripts in ftdetect/* are sourced.

-- #38 (comment)

To avoid that you have two options. Either using doctype 5 instead of doctype html or adding your own enforced version of autocmd to your .vimrc:

autocmd BufNewFile,BufRead *.slim setlocal filetype=slim

See Also:

vim-slim's People

Contributors

andrewdsmith avatar andrewradev avatar antonrogov avatar bahanix avatar cjhveal avatar darthdeus avatar euricovidal avatar fb avatar guange2015 avatar igrep avatar ixti avatar jacknagel avatar jtmkrueger avatar kpfefferle avatar leebo avatar losingkeys avatar micke avatar minad avatar mtimkovich avatar pabuisson avatar scottillogical avatar scottwater avatar sorah avatar whiteleaf7 avatar zakj avatar zealot128 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-slim's Issues

Nested code

Would be nice to support (like vim jade) this slim syntax:

p: a(href="foo") bar

Thanks!

< and > markers

.x< attr=""

expected behaviour: attr="" is highlighted
actual behaviour: it's not highlighted

Syntax highlight doesn't work with brackets

Hi guys, I'm having this issue with brackets:

When you don't have any space before closing the bracket, it does not highlight the rest of the file.
screen shot 2014-09-01 at 3 38 32 pm

But if there are some space, it does.
screen shot 2014-09-01 at 3 38 48 pm

Any help to solve it?

nested parens mismatch

this here is not rendered correctly:

a{:href => url("/#{e.short}")}

it'll color the first {and the first }

UPDATE
ok, this was via the haml2slim converter and not exactly slim syntax. Just figured that out. But the nesting should work anyway.

Slow

Running MacVim 7.3 (62) with Janus (https://github.com/carlhuda/janus) and vim-slim.

Navigating a 241 line slim file is slow and painful. Disabling vim-slim and having no syntax highlighting speeds things right up.

Anyone else experiencing this?

web components

well, non-standard tags are not highlighted. So using polymer with vim-slim is a difficult thing

<TAB> Seems Messed Up

Tab key in INSERT mode tends to jump around in the document instead of indent... Planned behavior, or bug?

Slim comment syntax is wrong

I'm not sure if this is the fault of the syntax file or not. I've tried in both NERDCommenter and vim-commentary to make comments in a slim template and both render the same (incorrect way).

This line:

  = breadcrumb_to 'New Plan'

becomes this:

  /* = breadcrumb_to 'New Plan' */

According to the docs, it should be (I believe)

  / = breadcrumb_to 'New Plan'

Let me know if I'm on the right track or if this is doesn't belong here. Thanks.

XML namespace highlighting broken

urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"

In this example, xmlns:xhtml and its associated value should be highlighted, but they are not.

Slim syntax highlighting not working?

Hi, syntax highlighting doesn't work for my Vundle set up. Does it only happen for me or everyone? Thanks in advance.

Here is my vimrc

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'kana/vim-textobj-user'
Plugin 'nelstrom/vim-textobj-rubyblock'
Plugin 'kien/ctrlp.vim' "Ctrl + p to find your file
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-dispatch'
Plugin 'tpope/vim-surround'
Plugin 'vim-scripts/tComment'
Plugin 'ervandew/supertab' 
Plugin 'jiangmiao/auto-pairs' 
Plugin 'mileszs/ack.vim'
Plugin 'ngmy/vim-rubocop'
Plugin 'slim-template/vim-slim'

" Auto-save
Plugin 'vim-scripts/vim-auto-save'
let g:auto_save = 1
let g:auto_save_in_insert_mode = 0
" Disable auto-save in Python
autocmd FileType python let g:auto_save=0

" For polygloting programming
" Plugin 'sheerun/vim-polyglot'

" Ruby Plugins
Plugin 'tpope/vim-rails'
Plugin 'vim-ruby/vim-ruby'
Plugin 'tpope/vim-endwise'
Plugin 'jgdavey/vim-blockle'
Bundle 'thoughtbot/vim-rspec'

" Multiple Cursors
Plugin 'terryma/vim-multiple-cursors'

" File Browser Plugin
Plugin 'scrooloose/nerdtree'
let g:NERDTreeShowHidden = 1
let g:NERDTreeMinimalUI = 1
let g:NERDTreeAutoDeleteBuffer = 1

call vundle#end()            " required

syntax enable
filetype plugin indent on

Missing License

I like your bundle, but I can't find the license. You have a bunch of commits from different people, they technically need to agree to whatever license you pick -- the longer you wait the more difficult it might get to retroactively slap a license on the project.

Or am I missing something?

Some incorrect highlighting

It's easy to see in the following example:
h1 this is header h1
p this is paragraph p

div
  h1 this is header h1
  p this is paragraph p 

vim-slim incorrect highlighting example

Highlight for Rails helpers

If you take a look at HAML highlighting in VIM you'll see that in expression like:
= link_to ... helper link_to will be highlighted via ruby/rails syntax highlighter. This feature is missing for Slim.

Vim sets filetype to HTML (not Slim) when using 'doctype html'

I was editing my Rails application layout file in Vim 7.3 with this vim-slim plugin installed and noticed that Vim was using a filetype of HTML instead of Slim for my application.html.slim file and not providing syntax highlighting.

My other views that followed the *.html.slim naming convention were correctly using the Slim filetype and syntax.

The culprit seemed to be the first line of the file, which was doctype html. I changed it to the equivalent doctype 5 and now Vim correctly sets the filetype to Slim for this file.

Install trouble with spf13/spf13-vim

Trying to get this working with spf13-vim setup. Can't get it to syntax highlight. Added Bundle 'slim-template/vim-slim.git' to the vimrc.bundles.local file and bundle installed to no avail.

Syntax highlight data attributes

When using html5 data attributes syntax highlight is only applied to some of the attribute name.

E.g.:
h1 data-my-attribute="some value" Heading

Only data is colored and -my-attribute is not

Vundle instructions out of date?

here's my setup:

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'

Plugin 'slim-template/vim-slim'

call vundle#end()            " required


filetype plugin indent on    " required

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.