Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3949506
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:30:06+00:00 2026-05-20T01:30:06+00:00

I am currently editing a C++ file with twp function similar to int func_name_1(int

  • 0

I am currently editing a C++ file with twp function similar to

int func_name_1(int param) {
   do_stuff();
   and_more();
}

int func_name_2(int param) {
   do_different_stuff();

   STRUCT_TYPE s = {5, 8, 10, 12};
   do_something_with(s);
}

If I do a zc on the word func_name_1, vim folds the function, as expected, so that it now looks like

int func_name_1(int param) {--------------------

On func_name_2 however, the function is folded like so:

int func_name_2(int param) {---------------------
   do_something_with(s);
}

which is not exactly what I want. For some reason the opening and closing {} on one line seem to disturb the folding algortithm.

If someone knows how I can get a “better” folding, I’d appreciate any hinter into the right direction.

Edit the options that I believe are relevant for this problem are set in my buffer like so

set foldmarker={,}
set foldmethod=marker
set foldtext=getline(v:foldstart)

Edit II: If I change the line with the opening and closing {…} to STRUCT_TYPE s = { 5, 8, 10, 12}; (Note the space after the {), then the folding works as expected.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T01:30:07+00:00Added an answer on May 20, 2026 at 1:30 am

    Oh…. I see….

    :help fold-marker tells me: Markers can have a level included [..] The following number specifies the fold
    level

    So, the 5 immediatly after the { specified the fold level, which messed things up.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble editing an XML file. I'm currently trying to use Nokogiri ,
How do I sync my project explorer tree-view with the file I'm currently editing?
I am currently editing a c++ application (only using plain api ),When i compiled
I'm using latexsuite with vim and I am currently editing files that have the
Im using the emacs binary from http://emacsformacosx.com/ When I'm editing a file in a
I'm trying to restore a database from an sql file through phpmyadmin import function.
Currently, I don't really have a good method of debugging JavaScript in Internet Explorer and
Currently my workflow with Emacs when I am coding in C or C++ involves
Currently we have a hybrid ASP/PHP setup connecting to a SQL Server 2005 database.
Currently we have a project with a standard subversion repository layout of: ./trunk ./branches

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.