jessekphillips / d.vim Goto Github PK
View Code? Open in Web Editor NEWVim Syntax highlighting file for the D Programming Language
Home Page: http://www.vim.org/scripts/script.php?script_id=379
License: MIT License
Vim Syntax highlighting file for the D Programming Language
Home Page: http://www.vim.org/scripts/script.php?script_id=379
License: MIT License
Email from Sohgo Takeuchi
I have written a patch to add a folding feature to d.vim.
This patch enables folding comments(/* */ and /+ +/) and blocks
({}) like c.vim when setting "foldmethod=syntax".
--- d.vim.old 2010-12-22 16:39:06.000000000 +0900
+++ d.vim 2010-12-22 16:36:57.000000000 +0900
@@ -161,12 +161,12 @@
syn region dBlockCommentString contained start=+"+ end=+"+ end=+*/+me=s-1,he=s-1 contains=dCommentStar,dUnicode,dEscSequence,@spell
syn region dNestedCommentString contained start=+"+ end=+"+ end="+"me=s-1,he=s-1 contains=dCommentPlus,dUnicode,dEscSequence,@spell
syn region dLineCommentString contained start=+"+ end=+$|"+ contains=dUnicode,dEscSequence,@spell
@@ -280,6 +280,10 @@
" TODO: Highlight following Integer and optional Filespec.
syn region dPragma start="#\s*(line>)" skip="$" end="$"
+" Block
+"
+syn region dBlock start="{" end="}" transparent fold
+
" The default highlighting.
"
struct testmodule { }
void main() {
}
In the above example, everything following the declaration of testmodule
has no syntax coloring, presumably because of the use of the word module
at the end of an identifier.
I am getting this error when importing class from file.
Error: module someclass is in file 'someclass.d' which cannot be read
First I thought I am the one who makes a mistake with having error in my code. I read part about modules in D tutorial one more time, but I think there's a bug in d.vim as output of the application is right.
Typing "int" triggers the indent rule for "in", but it doesn't get fixed as 't' is added.
Looking at neovim, I found that its D files are quite outdated. I'm not familiar with neither vim, nor neovim's development processes, so I'm not sure whom to reach to request an update.
Can you help me get neovim's D support updated?
The following declaration:
auto a = [
[ 1, 2, 3, 4 ],
[ 1, 2, 3, 4 ],
[ 1, 2, 3, 4 ],
[ 1, 2, 3, 4 ],
];
is indented like so (when using ==
):
auto a = [
[ 1, 2, 3, 4 ],
[ 1, 2, 3, 4 ],
[ 1, 2, 3, 4 ],
[ 1, 2, 3, 4 ],
];
Several keywords (e.g., in, out, inout) are both storage class and statements, depending on their context. Perhaps use pattern matching to figure out which and highlight appropriately. For now I have made such keywords storage classes so their highlighting is consistent with other keywords that are commonly used with them, but are true storage classes, such as lazy. Similarly, I made some statement keywords (e.g. body) storage classes.
-- Jason Mills
writefln(q"EOS
This
is a multi-line
heredoc string
EOS"
);
-- Jason Mills
I noticed the weirdest thing yesterday, when I wanted to change a void main()
to int main()
. Vim just froze, and refused to do anything until I did a Ctrl+c
.
On digging further, I saw that this happened only with .d
files, so I thought the d.vim
plugin may have something to do with it. If I disable d.vim
using:
set runtimepath-=~/.vim/bundle/d.vim
set runtimepath-=~/.vim/bundle/d.vim/after
in my vimrc, then Vim doesn't hang. This seems to confirm that the issue may lie in something that's going on in d.vim
.
To reproduce it, all you need to do is open any .d
file (with d.vim enabled of course), and type i
followed by n
. That's it. The CPU usage of Vim should spike to 100%, and it should just freeze. Ctrl+c
does get you out of it though.
Note that this happens only when typing i
followed by n
at the start of a line. I can happily type in
anywhere else without issues!
Using latest d.vim, with Vim version 7.3 running on Ubuntu 13.10 64 bit.
( SYSCALL and SYSRET )
---Shahid
Currently minlines is set to a large number to help prevent poor highlight. It would be good to find more areas that syntax can be synchronized with so this number can be reduced.
Suggested addition/modification:
syn region dAsmBody start="asm[\n]\s{"hs=e+1 end="}"he=e-1 contains=dAsmStatement,dAsmOpCode, dBlockComment,dNestedComment,dLineComment, dUserLabel
--- Shahid
module foo.bar;
/+
a (foo):
TIME=1
+/
struct Option{
string file;
}
void fun(){
int a;
}
/*
a (foo):
TIME=1
*/
struct Option{
string file;
}
void fun(){
int a;
}
Currently d.vim highlights 'static' and 'if' as distinct keywords: http://i.imgur.com/zO5j3.jpg
In the event of a multi-line comment, e.g.:
/* for (i = 0; i < 10; ++i)
{
writeln(i);
}*/
... deleting the opening /*
in C/C++ will result in the trailing */
being highlighted in red as an error. d.vim should similarly colour trailing comment end-marks (currently it just leaves them uncoloured).
The fix should also apply to /+ ... +/
comment blocks.
Hi! This repo contains a fix I'd like to downstream to Vim. Could we patch this?
Hi,
I suggest to allow folding D code. To do this just add this command
set foldmarker={,}
Then D code will be recognize to fold region where start by a { and end with }
Maybe this should be enhance to support one line condition as
if( isAscii )
doFoo();
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.