Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
wiki:vim [2015/03/31 17:10] – [Syntax Highlighting] martinrwiki:vim [2015/04/01 10:21] (aktuell) – [VIM] martinr
Zeile 1: Zeile 1:
 +====== VIM ======
 +
 1. vim ist besser als emacs 1. vim ist besser als emacs
 2. goto 1. 2. goto 1.
  
-=> vim ist der editor deiner wahl+=> vim ist der editor deiner wahl :!: 
 + 
 + 
 + 
 + 
 + 
  
-====== Tips und Tricks ====== 
 ===== Syntax Highlighting ===== ===== Syntax Highlighting =====
  
  
-=== Syntax Highlighting in HEREDOCS === +==== Syntax Highlighting in HEREDOCS ==== 
-When for instance writing mathematica scripts as a HEREDOC within a shell script to be passed to the mathematica kernel - as shown in the example below - it can be annoying reading the mathematica part for usually only shell script syntax highlighting is activated. The heredoc is then shown in completely one color, whereas the shell commands are fancyly coulored.+When for instance writing mathematica scripts as a HEREDOC within a shell script to be passed to the mathematica kernel - as shown in the example below - it can be annoying reading the mathematica part for usually only shell script syntax highlighting is activated. The heredoc is then shown in completely one color, whereas the shell commands are fancyly coloured.
 <code bash> <code bash>
-math -run "mymmavar1=\"Hello\"; mymmavar2=\" World!\""  << 'EOF+math -run "mymmavar1=\"Hello\"; mymmavar2=\" World!\""  <<'MMASH
           (* this is within the heredoc *)           (* this is within the heredoc *)
           (* we can write real mathamatica code here *)           (* we can write real mathamatica code here *)
           (* we also can use the initialized variables *)           (* we also can use the initialized variables *)
           Print[StringJoin[mymmavar1,mymmavar2]]           Print[StringJoin[mymmavar1,mymmavar2]]
-    EOF+MMASH
 </code> </code>
  
Zeile 27: Zeile 34:
 syntax include @MMA syntax/mma.vim syntax include @MMA syntax/mma.vim
 let b:current_syntax = s:bcs let b:current_syntax = s:bcs
-syntax region shHereDocMMA matchgroup=Statement start=+<<\z(MMASH\)+ end=+^\z1$+ contains=@MMA +syntax region shHereDoc matchgroup=shRedir start=+<<\z(MMASH\)+   matchgroup=shRedir end=+^\z1$+ contains=@MMA 
-syntax region shHereDocDashMMA matchgroup=Statement start=+<<'\z(MMASH\)'+ end=+^\z1$+ contains=@MMA +syntax region shHereDoc matchgroup=shRedir start=+<<'\z(MMASH\)'matchgroup=shRedir end=+^\z1$+ contains=@MMA 
 </code> </code>
  
 Now whenever a heredoc within a shell script begins with MMASH, vim recognises it as mathematica code highlighting the syntax correctly.  Now whenever a heredoc within a shell script begins with MMASH, vim recognises it as mathematica code highlighting the syntax correctly. 

QR-Code
QR-Code VIM (erstellt für aktuelle Seite)