No syntax highlighting
Atcold opened this issue · comments
Describe the bug
I used let g:jupytext_fmt = 'py'
but there is no python syntax highlighting.
Diagnostics
-
vim --version
: VIM - Vi IMproved 8.1 (2018 May 18 -
Operating system information (e.g.
uname -a
): macOS 10.14.3 -
python --VV
: Python 2.7.10 -
Are you using Anaconda? No
-
Put
let g:jupytext_print_debug_msgs = 1
in your~/.vimrc
. What is the output of:messages
when reproducing the problem?
Messages maintainer: Mike Williams <mrw@eandem.co.uk>
DBG: filename: /Users/atcold/Work/GitHub/pytorch-minicourse/03-autograd_tutorial.ipynb
DBG: filename exists: 1
DBG: jupytext_file: /Users/atcold/Work/GitHub/pytorch-minicourse/03-autograd_tutorial.py
DBG: jupytext_file exists: 0
DBG: Generate file /Users/atcold/Work/GitHub/pytorch-minicourse/03-autograd_tutorial.py
DBG: cmd: !jupytext --to=py --output='/Users/atcold/Work/GitHub/pytorch-minicourse/03-autograd_tutorial.py' '/Users/atcold/Work/GitHub/pytorch-minicourse/03-autograd_tutorial.ipynb'
DBG: read /Users/atcold/Work/GitHub/pytorch-minicourse/03-autograd_tutorial.py
DBG: autocmd BufUnload <buffer> call s:cleanup("/Users/atcold/Work/GitHub/pytorch-minicourse/03-autograd_tutorial.py", 1)
DBG: filetype: py
Hi @Atcold
The reason is likely because the filetype
get set as py
and not python
. Either run :set filetype=python
as you enter vim after conversion or add the below to your vim settings
let g:jupytext_filetype_map = { 'py': 'python' }
That's very plausible... looks like the plugin has a bug, where the default s:jupytext_filetype_map
includes
...
\ 'py': 'py',
\ 'jl': 'jl',
...
which should be
...
\ 'py': 'python',
\ 'jl': 'julia',
...
I'm not quite sure how that happened, but thanks for finding the problem!
@Atcold, can you confirm that setting the filetype-map solves your issue?
This should be fixed in the newly released version 0.1.1. Please reopen if the issue persists.
I run across the same problem: the converted ipynb doesn't show syntax highlighting. Running :set filetype=python
works (the code within python blocks is highlighted), but adding let g:jupytext_filetype_map = { 'py': 'python' }
doesn't work.
I am using the latest version, 0.1.1, and I can see that the fix you mentioned above is included in the plugin file. My Vim version is 8.1.1343.
The last line of the debug message says:
DBG: filetype: markdown
Sorry, my bad, I misunderstood how this was supposed to work.