Coder Social home page Coder Social logo

Comments (7)

atweiden avatar atweiden commented on August 31, 2024

+1

from vim-commentary.

jpflouret avatar jpflouret commented on August 31, 2024

+1

Should it be optional based on commentstring? Such that with commentstring=//%s you get:

//var example = "hi";
//var anotherExample = "hello";

But with commentstring=//\ %s you get

// var example = "hi";
// var anotherExample = "hello";

from vim-commentary.

tpope avatar tpope commented on August 31, 2024

And then what? Users can go and override every ftplugin's commentstring one by one in order to micromanage it?

from vim-commentary.

jpflouret avatar jpflouret commented on August 31, 2024

I was under the impression that commentstring was supposed to be how to format a comment in a given language and the plugin does not follow the format since it adds spaces around the given format. It stands to reason that if people want a different format for their comments then they would need to alter commentstring per file type they care.

I believe the current setting is inconsistent with vim's usage of commentstring since when you create a fold (with foldmethod=marker) the comment that vim introduces does not add spaces around the %s.

I don't know how else you would do that without introducing a global configuration variable which seems very ugly.

Or am I missing something?

from vim-commentary.

tpope avatar tpope commented on August 31, 2024

It's a practical consideration. About 2/3rds of Vim's default comment strings have spaces and about a 1/3rd don't. This has little to do with language consideration and everything to do with the whims of maintainers. I chose to add the space on those in the 1/3rd rather than subject the user to an arbitrary mess.

You're correct about foldmethod, but since foldmarkers count as "useful comments", your solution is now directly opposed to the original request.

One compromise might be to exempt b:commentary_format from the whitespace normalization, since that's free of defaults.

from vim-commentary.

jpflouret avatar jpflouret commented on August 31, 2024

I see. If we remove comentary_format from the normalization then users could have an autocmd/ftplugin to set commentary_format to whatever they please. Your compromise would be acceptable to me.

from vim-commentary.

jpflouret avatar jpflouret commented on August 31, 2024

Thank you!

from vim-commentary.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.