hsitz / VimOrganizer

VimOrganizer is partly a clone of Emacs' Org-mode, and partly a front end to Org-mode itself. Do Org in Vim.
http://vimeo.com/31531308
518 stars 67 forks source link

Allow spaces between headings #31

Closed punassuming closed 9 years ago

punassuming commented 12 years ago

I sometimes like to have spaces in between headings to make the structure more obvious. The current implementation of s:OrgSubtreeLastLine_l will search for the next star at the same level and subtract one. However, with this algorithm, you get this problem:

*** Headings 1
*** Heading 2
**** SubHead1

**** ^
*** Heading3

This fix skips over all blank lines to give the desired behavior:

*** Headings 1
*** Heading 2
**** SubHead1
**** ^

*** Heading3
hsitz commented 12 years ago

On Fri, Mar 2, 2012 at 12:31 PM, Rich Alesi reply@reply.github.com wrote:

-- Commit Summary --

  • Allow spaces between headings

-- File Changes --

M ftplugin/org.vim (16856)

-- Patch Links --

 https://github.com/hsitz/VimOrganizer/pull/31.patch  https://github.com/hsitz/VimOrganizer/pull/31.diff

Rich -- Thanks a lot, that functionality would be good to have, but I may change it to be an option (or have option not to have it). Unfortunately, the diff file for your changes seems to have flagged every line and it's hard for me to see what changes are. Are changes simple enough to give me a quick look via copy and past?

-- Herb

punassuming commented 12 years ago

That teaches me to not try the edit and fork functionality within Github. From now on, I'll just make my own branch for pull requests

Starts at line 1314

if l:lastline != 0 
    let l:lastline -= 1
+    while getline(l:lastline) =~ '^$'
+        let l:lastline -= 1
+    endwhile
else
    let l:lastline = line("$")
endif
return l:lastline
hsitz commented 12 years ago

On Fri, Mar 2, 2012 at 1:51 PM, Rich Alesi reply@reply.github.com wrote:

That teaches me to not try the edit and fork functionality within Github.  From now on, I'll just make my own branch for pull requests

I think it must be related from my having pushed up from Windows machine.

Starts at line 1314

   if l:lastline != 0        let l:lastline -= 1    +    while getline(l:lastline) =~ '^$'    +        let l:lastline -= 1    +    endwhile    else        let l:lastline = line("$")    endif    return l:lastline

My first thought is this will cause issues with the section-moving commands (e.g.., <c-a-[up-down-left-right]>) which depend on same function to find end of block to move. I assume we don't want to leave stay blank lines when moving sections. Hopefully that's only issue and further changes to accommodate that are simple. . .

-- Herb