Closed gerazov closed 3 years ago
Good point. In general I let the user decide when to load the plugin, but in this instance I can see the default behavior being annoying if the plugin is enabled for all filetypes, which is not good.
I tried different methods but haven't found a satisfactory solution yet that works for e.g. different splits with different filetypes. And for some strange reason I can't reproduce the issue anymore. I'll look into it more tomorrow.
I've implemented a solution that works for me so far, please report back if you encounter any issues. After this change, cell headers are highlighted in only python
files by default.
Yeah it works! :sunglasses:
I was thinking that maybe it's better just to turn it off for markdown, as other programming languages can benefit from this plugin as well :wink:
:+1:
I considered your suggestion but it wasn't that straightforward, as e.g. the autocmd
in your first post would turn it off for all buffers, so if you open a Markdown file first and a Python file afterwards the highlighting would still be disabled for the Python file.
Ultimately I don't want to annoy people with unexpected behavior because they've installed this plugin, so it felt safer to only enable it for Python files by default.
Ah ok :+1: I'm not really proficient in Vim script :slightly_smiling_face:
But I think your plugin can be of more general use for other languages (as you mention Julia for example), so it's something to keep in mind :wink:
Ah ok :+1: I'm not really proficient in Vim script :slightly_smiling_face:
Me neither, it took some time of trial and error to get right. :sweat_smile:
But I think your plugin can be of more general use for other languages (as you mention Julia for example), so it's something to keep in mind :wink:
Yes, that's possible by changing the g:ipython_cell_highlight_cells_ft
variable. Currently the match format is fixed, I may make it configurable if somebody opens an issue about it (not sure how e.g. Julia users would write cells for example).
The cell highlighter messes with markdown headings due to the
###
cell type. This could be regulated by limiting cell recognition to Python files, but since the plugin can be used for other programming languages it makes sense to limit it to not highlight markdown.This can be done in the
init.vim
so maybe it can be noted in the documentation:Or maybe it could be built in by default in the plugin?