Closed GoogleCodeExporter closed 8 years ago
Original comment by habamax
on 29 Jun 2013 at 7:25
Hi,man. I found a way to solve this issue. We can modify the source code of vimwiki for the sake of this. We can find in /path-to-vimwiki/syntax/vimwiki_default.vim:
" text: $ equation_inline $
let s:default_syntax.rxEqIn = '\$[^$`]\+\$'
let s:default_syntax.char_eqin = '\$'
and we change it to:
let s:default_syntax.rxEqIn = '✹[^✹`]\+✹'
let s:default_syntax.char_eqin = '✹'
I hope this helps.
@nikinbaidarr didn't test your change.
Problem persists if you save source code snippets/gists
in vimwiki.
Using variable names with language syntax requiring a leading '$' (as i.e. in PHP) will transform into the code into invalid chunks. Useless to copy and paste. Only the line where the cursor is will be shown/copied/expanded correctly.
Very unfortunate.
Hello! @corbolais Have you tried placing your code snippets inside code blocks? If your using default vimwiki syntax use
{{{
" Snippet goes here
}}}
Or if you want language specific highlighting.
{{{php
" Snippet goes here
}}}
@nikinbaidarr Thanks, {{{
is working. Syntax highlighting is not, however.
@nikinbaidarr Thanks,
{{{
is working. Syntax highlighting is not, however. Check whether if you havesyntax enable
in your vimrc. If you do, vimwiki will use the syntax highlighting defined for you php files. But it if your using the fenced code for the first time in your file it does not work instantly after you place the code within{{{
, you have to reload your file. Now this does not work for everything but it most certainly does for major programming languages, and it works for PHP as well. Here's a screenshot
@nikinbaidarr Thank you for your feedback. VIM has syntax highlighting enabled. After Reloading the file PHP syntax highlighting is not working, though.
@corbolais Try putting the following line in your vimrc.
autocmd FileType vimwiki :syntax enable
@corbolais Try putting the following line in your vimrc.
autocmd FileType vimwiki :syntax enable
Not working.
@corbolais Try putting the following line in your vimrc.
autocmd FileType vimwiki :syntax enable
Not working.
Are you sure it's not working? Make sure you've included the opening php tag in your code snippet "<?php". Remember that without that opening tag PHP will treat any text as plaintext to be sent to stdout, and most syntax highlighters are aware of this:
Thanks for your feedback.
It is indeed working using:
{{{php
<?php
foreach ( is_iterable($this) )
}}}
The important bits are {{{php
and <?php
. Before I used either one but not both at the same time. Might be worth hinting at in the documentation. Just in case.
Thank you.
Original issue reported on code.google.com by
cyberdup...@gmail.com
on 26 Jun 2013 at 11:56