Closed
Description
Hey there, awesome plugin BTW!
This might not be strictly Comment.nvim
specific but I'd love a pointer in the right direction.
This issue is about nested filetype support so as the readme says I'm using nvim-ts-context-commentstring which integrates great with the readme pre_hook snippet
Consider the following example
1 <html>
2 <body>
3 <script>
4 let name = "raafat"
5 function print_name(name) {
6 console.log(name)
7 }
8 </script>
9 </body>
10 </html>
Visually selecting lines 1 through 5 and commenting produces an unwanted mess:
<!-- <html> -->
<!-- <body> -->
<!-- <script> -->
<!-- let name = "Raafat" -->
<!-- function print_name(name) { -->
console.log(name)
}
</script>
</body>
</html>
My aim is to calculate the commentstring
at the start and end of the visual selection and only comment if they match.
I've found out that returning %s
in the pre_hook
results in "aborting" (is there a proper way to do this?).
Let me know what you think.