Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to unfold by default #622

Open
glow12121 opened this issue Feb 1, 2023 · 7 comments
Open

How to unfold by default #622

glow12121 opened this issue Feb 1, 2023 · 7 comments

Comments

@glow12121
Copy link

glow12121 commented Feb 1, 2023

let g:vim_markdown_folding_level = 6
let g:vim_markdown_override_foldtext = 0

With the settings above, I cannot figure out how to keep everything in markdown texts unfolded by default.

Specifically, I don't see how to control lines and empty lines being folded. Probably let g:vim_markdown_override_foldtext = 0 has nothing to do with it.

## Title
+--  3 lines: ········································································································
### Title
+--  3 lines: Line of text···················································································
@ilya-vv
Copy link

ilya-vv commented Feb 3, 2023

@glow12121
You may add something like this to your ~/.vimrc file:

autocmd FileType markdown normal zR

This commands run zR and unfold whole file on opening. Result might depends on position the line in ~/.vimrc file...

@glow12121
Copy link
Author

Isn't it a workaround?

I cannot figure out why the plugin keeps on folding the text one way or another, whichever folding level I select. Even if it's, say, 6, still all the stuff is folded.

These are literally all my settings related to the plugin:

Plug 'godlygeek/tabular'
Plug 'preservim/vim-markdown'
" Syntax highlighting, matching rules and mappings for the original Markdown and extensions.
" The tabular plugin must come before vim-markdown.
" g:vim_markdown_folding_level setting (default 1) is set to foldlevel. Thus level 1 heading which is served as a document title is expanded by default.
" Folding level is a number between 1 and 6. By default, if not specified, it is set to 1.
let g:vim_markdown_folding_level = 0
" To prevent foldtext from being set add the following to your .vimrc:
" let g:vim_markdown_override_foldtext = 0

@ilya-vv
Copy link

ilya-vv commented Feb 5, 2023

Well, yes. My suggestion is a workaround.

Can't say about vim-markdown - use it for several days - but, as I remember, when Vim receives command set foldmethod=..., it applies folding for the whole buffer and folds everything, it's default behavior.

@mcookly
Copy link

mcookly commented Feb 9, 2023

@glow12121,

I think the problem might be that foldlevel is a hacky way of opening folds. Maybe set foldlevelstart=6. This page might help!

@Nan-Do
Copy link

Nan-Do commented Mar 22, 2023

@mcookly Thanks for the tip setting that variable fixed the problem for me

@polirritmico
Copy link

Thanks. This is working for me:

vim.cmd [[
    autocmd BufRead,BufNewFile *.markdown,*.md set conceallevel=2 foldlevelstart=6
]]

Don't know if there is a better way.

@vyrwu
Copy link

vyrwu commented Nov 20, 2023

I'm on lazy v10.15.1, based on this thread, I got it working with the following config:

{
  "preservim/vim-markdown",
  ft = "markdown",
  init = function()
    vim.cmd [[set foldlevelstart=6]]
  end,
  dependencies = {
    "godlygeek/tabular",
  },
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants