Skip to content
This repository has been archived by the owner on Feb 8, 2021. It is now read-only.

added folding #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

added folding #6

wants to merge 3 commits into from

Conversation

itmm
Copy link

@itmm itmm commented Jul 20, 2018

The change enables optional folding in vim for setext-like section headers.

Like the default markdown style it can be enabled by setting g:asciidoc_folding

@elextr
Copy link
Contributor

elextr commented Jul 20, 2018

Please update the readme to include installation of this and to document the setting.

@itmm
Copy link
Author

itmm commented Jul 22, 2018

ok, I did update the README.ascd and also included folding for other section formats.

@itmm
Copy link
Author

itmm commented Aug 27, 2018

No change for the last month :-(

Can you please specify anything that is missing to process this pull request?
Or is this project dead?

@elextr
Copy link
Contributor

elextr commented Aug 27, 2018

Or is this project dead?

No, but I don't use Vim, so I can't test your pull request, it would help if someone else tried it and said it worked for them.

In the longer term if someone who uses Vim and had an interest (and ability) stepped forward to review and guide the Asciidoc Vim support that would give it much more life.

@itmm
Copy link
Author

itmm commented Aug 27, 2018

Thanks for the fast reply. In the longer term I can take over the vim part (as I am a daily user of this editor and have no problems programming it). But I should not be the person who reviews my own pull request (of course, it is great ;-)).

On the other hand: only files are added and the folding must be enabled with an additional configuration entry. So the change should not do any harm. At least that was my intention :-)

@1094
Copy link

1094 commented Apr 22, 2019

Hello.
I have found this because I am looking to make AsciiDoc my main markup language and folding is very important to that decision. I'd love to help with this project; however, I have little knowledge of vim script outside of my vimrc. But I do know how to createlong files and test folds. I could (figure out how to) pull this branch and give reviewing it a go.

Also, have you thought about adding folding for another elements, like titles or blocks?

@itmm
Copy link
Author

itmm commented Apr 24, 2019

Hi 1094,

it would be great, if you can review my changes, so they get upstream :-) Maybe I can also add the folding of titles and blocks. Which syntax elements do you mean? I can augment the script to look for additional patterns.

Kind regards,
Timm

@1094
Copy link

1094 commented Apr 24, 2019

Okay.
And if I have questions, I should ask them in this thread?

@1094
Copy link

1094 commented Apr 24, 2019

As far additional elements, I mean lines that start with [ and .. Below you can see the type of folding and nesting I was searching for when I found this, I used some examples from the Quick Reference:

= Dream Folding
Here are some example tables:

== Three Columns, 2 Rows
Line one of filler text.
Line two of filler text.

.Table Title
|===
|Name of Column 1 |Name of Column 2 |Name of Column 3 

|Cell in column 1, row 1
|Cell in column 2, row 1
|Cell in column 3, row 1

|Cell in column 1, row 2
|Cell in column 2, row 2
|Cell in column 3, row 2
|===

Line one of filler text. 
Line two of filler text.

Here is some terms:

.Term title
Term 1 ::
:: Def 1
Term 2 ::
:: Def 2

Another line of filler text.

== Now for blocks.
Filler text line.

.app.rb
[source,ruby]
----
require 'sinatra'

get '/hi' do
  "Hello World!"
end
----

Filler text line.
Filler text line.

[source,ruby]
----
require 'sinatra' // <1>

get '/hi' do // <2>
  "Hello World!" // <3>
end
----

Filler text line.

[quote, Abraham Lincoln, Address delivered at the dedication of the Cemetery at Gettysburg]
____
Four score and seven years ago our fathers brought forth
on this continent a new nation...
____

Filler line of text. 
Another filler line of text.

Nested:

= Dream Folding
Here are some example tables: 
+--- 29 lines: -- Three Columns, 2 Rows ----------
+---  lines: -- Now for blocks ----------

Opened (I'm not sure if line breaks go in or out of the fold, so I'm not entirely consistant):

= Dream Folding
Here are some example tables:

== Three Columns, 2 Rows
Line one of filler text.
Line two of filler text.

+--- 13 lines: -- .table title ----------
Line one of filler text.
Line two of filler text.

Here are some terms:

+--- 6 lines: -- .Term title ----------
Another line of filler text.

== Now for blocks
Filler text line.

+--- 9 lines: -- .app.rb ----------

Filler text line.
Filler text line.

+--- 8 lines: -- [source,ruby] ----------
Filler text line.

+--- 6 lines: -- [quote, Abraham Lincoln] ----------
Filler line of text.
Another filler line of text.

Is something like that possible?

@1094
Copy link

1094 commented Apr 25, 2019

Here is a sample of the text I'm testing the folds on, right now it only contains 2 elements: sections (= and ==) and notes (NOTE:).

== Chapter 14

NOTE: A summary of the chapter.

A few sentences to start shaping the chapter.
Main ideas I don't want to forget but that might not actually appear in the tale.

= Part Two

== Chapter 01

NOTE: A summary of the chapter.

Same Idea as before.
But it may or may not have the same number of sentences,
this is just an detailed outline anyway.

== Chapter 02

NOTE: A summary of the chapter

When I fold this I expect to see the following:

+-- 10 lines: -- Chapter 14 ----------
= Part Two
+-- 5 lines: -- Chapter 01 ----------
+-- 3 lines: -- Chapter 02 ----------

What I am seeing is:

+-- 12 lines: -- Chapter 14 ----------
+-- 5 lines: -- Chapter 01 ----------
+-- 3 lines: -- Chapter 02 ----------

Which is the intended fold?

@itmm
Copy link
Author

itmm commented Apr 29, 2019

Hi 1094,

I added a new commit that also supports first level sections (parts) folding and the folding of code parts.

The folding of tables and terms is tricky because there is no clear end indicator. So I do not think, that I can implement that.

I'm blocked the next two weeks, so please have patience with me if I do not react.

@1094
Copy link

1094 commented Apr 30, 2019

I have added your branch to my vimrc so I will do a fresh PlugInstall to grab the changes.

In this case, specifically, any line that starts with either a . or a [. Some blocks can started with _ and - or by a space. So I thought that indicator would be any line starting with a non-alphanumeric character? Is that very complex or impossible?

Also, I understand about being busy. I'll use the two weeks to learn more about vim scripting and see if I can't be of more help.

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

Successfully merging this pull request may close these issues.

None yet

3 participants