I want to use the nuweb.vim extension for syntax highlighting nuweb files.

Long story short, nuweb files are basically a super-set of latex files. There is added syntax and markers to embed code-snippets in Latex so that one can do literate programming in the style of Knuth.

However, I have not been able to get the nuweb.vim file to get to work for nuweb files. (These typically have extensions .nw)

Here a sample nuweb file, titled fun.nw

$\alpha + \beta=\gamma$

@o output.cpp
@{# /* C++*/
int main(void){
  std::cout << "Hello World" << std::endl;
  return 0;


My .vimrc file looks like this

colorscheme torte
set guifont=Inconsolata\ 14
set laststatus=2

filetype on
filetype plugin on

set runtimepath^=/home/smilingbuddha/.vim/bundle/nuweb.vim

On opening the nuweb files, I don't get the necessary syntax highlightin. Doing :set syntax? I get output syntax=conf in the mode-line at the bottom.

Where am I going wrong? I am not used to Vim so I am pretty much a newbie.

  • put the syntax\nuweb.vim inside ~/.vim/syntax. If Vim already detects nuweb files, it should just work, else you would need an additional rule to detect a new filetype (see :h new-filetype) – Christian Brabandt Nov 25 '18 at 8:16
  • Check :set ft? – D. Ben Knoble Nov 25 '18 at 14:10

Simply put syntax on on your vimrc

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.