GithubHelp home page GithubHelp logo

terrastruct / d2-vim Goto Github PK

View Code? Open in Web Editor NEW
65.0 2.0 6.0 28 KB

The Vim plugin for D2 files

Home Page: https://d2-lang.com

License: BSD 3-Clause "New" or "Revised" License

Vim Script 98.72% Shell 1.28%
diagrams diagram diagramming

d2-vim's Introduction

D2

The Vim plugin for D2 files.

Install

" Using https://github.com/junegunn/vim-plug
Plug 'terrastruct/d2-vim'

Documentation

See :help d2-vim or ./doc/d2.txt for options and additional documentation.

x -> y

# d2-vim can syntax highlight nested markdown correctly.
y: |`md
  # d2-vim
  The Vim plugin for [D2](https://d2lang.com) files.
`|

d2-vim's People

Contributors

alixander avatar charlespascoe avatar nhooyr avatar pleshevskiy 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

Watchers

 avatar  avatar

d2-vim's Issues

neovim v0.9.5 and astonvim install

How do I install this with AstoNvim?

nvim ~/.config/nvim/lua/user/plugins.lua

return {
  { "terrastruct/d2-vim", lazy = "false" },
}

but ft=d2 is not available when I open up a file with a .d2 suffix.

E121 & E116 on LunarVim v1.3 & Neovim v0.9.4

image

I'm hitting the following errors:

  • E121: Undefined variable: b:included_syntaxes
  • E116: Invalid arguments for function index

I didn't do any customisations apart from installing the plugin.

Any ideas on how to fix this?


Running LunarVim 1.3 with:

NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1699801871

This is the d2-vim plugin version that I'm currently using:
image


Maybe related to #3

Undefined variable: g:d2_block_string_syntaxes

Using

~ % vim --version
NVIM v0.8.1
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by bmizerany@blaptopvm

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

I installed d2-vim using vim's built-in plugins like:

; git clone https://github.com/terrastruct/d2-vim/ /home/bmizerany/.config/nvim/pack/github/start/d2-vim

Current HEAD is d1cb1e7e22bc0fb4d4034a1b93c2a13cc471acc6

When I opened vim x.d2, I got:

Error detected while processing /home/bmizerany/.config/nvim/init.lua:
E5113: Error while calling lua chunk: /home/bmizerany/.config/nvim/init.lua:5: Vim(if):E121: Undefined variable: g:d2_block_string_syntaxes
stack traceback:
        [C]: in function 'cmd'
        /home/bmizerany/.config/nvim/init.lua:5: in main chunk
Press ENTER or type command to continue

I tried pre-defining in my ~/.vimrc like:

" d2
let g:d2_block_string_syntaxes = {
        \ 'd2': ['d2'],
        \ 'markdown': ['md', 'markdown'],
        \ 'javascript': ['javascript', 'js'],
        \ 'html': ['html'],
        \ 'json': ['json'],
        \ 'c': ['c'],
        \ 'go': ['go'],
        \ 'sh': ['sh', 'ksh', 'bash'],
        \ 'css': ['css'],
        \ 'vim': ['vim'],
        \ }

but that didn't help.

I'm a little stumped because my vim-script fu is weak. Any pointers would be appreciated.

Error on startup after install (`BufReadPost Autocommands` `d2#syntax_post` `Undefined variable: b:included_syntaxes`)

I just added the plugin in my Nvchad nvim config, and I'm getting this error when I open a .d2 file:

Error detected while processing BufReadPost Autocommands for "*.d2"..FileType Autocommands for "*"..Syntax Autocommands for "d2"..function d2#syntax_post:
line    1:
E121: Undefined variable: b:included_syntaxes
E116: Invalid arguments for function index
Press ENTER or type command to continue

After pressing enter, the syntax highlighting is actually working.

If I close nvim again, then first open a file with a different file type, for example a .md file, I don't get an error. And when I then open the .d2 file in a second buffer, I still don't get an error, but the syntax is not working. When I enter :e! I do get the error again, and then afterwards the syntax highlighting is also working again.

No such highlight group name: markdownCodeBlock

Error detected while processing BufRead Autocommands for ".d2"..FileType Autocommands for ""..Syntax Autocommands for "d2"..function d2#syntax_post:
line 2:
E28: No such highlight group name: markdownCodeBlock
image

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.