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

  • SEARCH
  • Home
  • 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 7098091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:00:46+00:00 2026-05-28T11:00:46+00:00

I set vim’s foldmethod to indent which works very well when writing Python except

  • 0

I set vim’s foldmethod to indent which works very well when writing Python except when I have a comment line. For example, if I have this bit of code:

def myFunction():
    # here is my comment
    myString = "hello"
    myInt = 2

If I have my cursor on the comment line and type “za” I get get an error saying “E490: No fold found.” If I have the cursor on the line beginning with “myString = ” I will geta fold like this:

def myFunction():
    # here is my comment
+--- 2 lines: myString = "hello" -------------------------

In both cases I would like to get this fold:

def myFunction():
+--- 3 lines: # here is my comment -------------------------

Basically the comment line should be treated like anything else. I haven’t come up with an answer from searching the web. Any ideas? Thanks!

  • 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-28T11:00:47+00:00Added an answer on May 28, 2026 at 11:00 am

    You have to set foldignore to nothing.

    :set foldignore=
    

    From :help foldignore:

    'foldignore' 'fdi'  string (default: "#")
    
        Used only when 'foldmethod' is "indent".  Lines starting with
        characters in 'foldignore' will get their fold level from surrounding
        lines.  White space is skipped before checking for this character.
        The default "#" works well for C programs.  See |fold-indent|.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Vim set up, with +python ( :version says it's ok). My .vimrc
I have Vim set up to use the excellent NERDTree plugin. However, there are
VIM can be configured to highlight current line via :hi cursorline guibg=green and set
So I've figured out how to add line numbers to vim (:set no or
Inn ~/script.vim , I have: set runtimepath+=string(substitute(expand(%:p), 'script\.vim', '', 'g')) I have an alias
I have my Vim window set to 90 columns using set columns=90 , but
I have vim set up to save empty files automatically when I create one:
In Vim, I set a mapping to move a line up with each press
You can set the Vim color scheme by issuing :colorscheme SCHEME_NAME but, oddly enough,
I would like to set some vim options in one file in the comments

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.