New Hoisting Method

View: New views
14 Messages — Rating Filter:   Alert me  

New Hoisting Method

by Noel Henson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Everyone,

Attached is a script that will enable a new method of hoisting. It edits
hoists within the same window/buffer/file.

Advantages
* No external files needed or used
* Hoists are nestable, you can hoist within a hoisted region
* Maintains undo/redo buffers
* Maintains state over saves
* Maintains state over editing sessions

Disadvantages
* "~" has been commandeered to be the hoist marker
        (but only in the first character of a line so level 1 headings
        will not be able to start with this character)

Notes
* It is normal to have a single invisible line at the top of the window
        (needed since there is no invisibile (0-line) folds in vim)
* It is normal to have two invisible lines at the bottom of the window
        (as above but an additional line is needed to create a fence)
* Commands have changed

Commands
        ,,hh Hoist the current region
                a region is the children of the node under the cursor
                or, if no children, the parent of the node under the
                cursor (this may not be the needed behavior)
        ,,hd Dehoist the current region
        ,,hD Dehoist all hoisted regions

Installation

1. Copy the attached script to ~/.vimoutliner/plugins
2. Edit .vimoutlinerrc (usually line 121)
        let g:vo_modules_load = "checkbox:newhoist:smartpaste"
3. Open an outline and hoist away!

Let me know how this works for you.

Noel

PS: To see the machinery of how it works, just comment out the "hi" line in
vo_newhoist.vim.

--

------------------------------------------------------------------
  Noel Henson
  www.noels-lab.com Chips, firmware and embedded systems
  www.vimoutliner.org Work fast. Think well.


"######################################################################
"# VimOutliner Hoisting
"# Copyright (C) 2003 by Noel Henson noel@...
"# The file is currently an experimental part of Vim Outliner.
"#
"# This program is free software; you can redistribute it and/or modify
"# it under the terms of the GNU General Public License as published by
"# the Free Software Foundation; either version 2 of the License, or
"# (at your option) any later version.
"#
"# This program is distributed in the hope that it will be useful,
"# but WITHOUT ANY WARRANTY; without even the implied warranty of
"# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
"# GNU General Public License for more details.
"######################################################################

" Detailed Revision Log {{{1
"vo_hoist.vim
"Internal RCS
"$Revision: 1.10 $"
"$Date: 2005/06/12 15:53:54 $
"$Log: vo_hoist.vim,v $
"Revision 1.10  2005/06/12 15:53:54  noel
"Moved key mappings so they work with Matej' new way to load plugins.
"
"Revision 1.9  2003/11/12 17:26:09  noel
"Added a command to place the cursor on the first line of
"a hoisted outline.
"
"Revision 1.8  2003/11/12 17:10:51  noel
"Fixed a bug that occurs on a level 1 heading with no children.
"
"Revision 1.7  2003/10/23 22:14:14  noel
"Minor changes to DeHoist() to compensate for current foldlevel settings.
"
"Revision 1.6  2003/08/17 15:35:24  noel
"Put the new mappings in the correct place this time.
"Added a : and <cr> to the ZZ command.
"
"Revision 1.5  2003/08/17 14:47:42  noel
"Added ZZ, qa, and x to the list of commands that de-hoist the current
"outline.
"
"Revision 1.4  2003/08/17 00:07:31  noel
"Added "silent" to commands generating tedious messages.
"
"Revision 1.3  2003/08/16 20:08:06  noel
"Removed a need to exclude fold level 1 headings.
"
"Revision 1.2  2003/08/16 19:02:44  noel
"First fully functional version. May need some tweaks but it works and is
"quite easy to use.
"
"Revision 1.1  2003/08/14 21:05:05  noel
"First publicly available, experiment verison
"
"}}}2

" Load the plugin {{{1
if exists("g:did_vo_hoist")
        finish
endif
if !exists("g:hoistParanoia")
        let g:hoistParanoia=0
endif
let g:did_vo_hoist = 1
" mappings {{{1
map <silent> <buffer> <localleader>hh :call Hoist(line("."))<cr>
map <silent> <buffer> <localleader>hd :call DeHoist()<cr>
map <silent> <buffer> <localleader>hD :call DeHoistAll()<cr>
"}}}1
" syntax {{{1
" Hoisted {{{2
syntax match Invis +^\~.*$+
hi Invis guifg=bg ctermfg=bg
"}}}2
"}}}1
" New Fold Function (will be put into vo_base later {{{1
function! MyHoistableFoldLevel(line)
        let l:myindent = Ind(a:line)
        let l:nextindent = Ind(a:line+1)

        if HoistFold(a:line)
                if (a:line == 1)
                        return g:hlevel
                elseif (HoistFold(a:line-1) == 0)
                        return ">".0
                else
                        return g:hlevel
                endif

        elseif BodyText(a:line)
                if (BodyText(a:line-1) == 0)
                        return '>'.(l:myindent+1)
                endif
                if (BodyText(a:line+1) == 0)
                        return '<'.(l:myindent+1)
                endif
                return (l:myindent+1)
        elseif PreformattedBodyText(a:line)
                if (PreformattedBodyText(a:line-1) == 0)
                        return '>'.(l:myindent+1)
                endif
                if (PreformattedBodyText(a:line+1) == 0)
                        return '<'.(l:myindent+1)
                endif
                return (l:myindent+1)
        elseif PreformattedTable(a:line)
                if (PreformattedTable(a:line-1) == 0)
                        return '>'.(l:myindent+1)
                endif
                if (PreformattedTable(a:line+1) == 0)
                        return '<'.(l:myindent+1)
                endif
                return (l:myindent+1)
        elseif PreformattedUserText(a:line)
                if (PreformattedUserText(a:line-1) == 0)
                        return '>'.(l:myindent+1)
                endif
                if (PreformattedUserTextSpace(a:line+1) == 0)
                        return '<'.(l:myindent+1)
                endif
                return (l:myindent+1)
        elseif PreformattedUserTextLabeled(a:line)
                if (PreformattedUserTextLabeled(a:line-1) == 0)
                        return '>'.(l:myindent+1)
                endif
                if (PreformattedUserText(a:line+1) == 0)
                        return '<'.(l:myindent+1)
                endif
                return (l:myindent+1)
        elseif UserText(a:line)
                if (UserText(a:line-1) == 0)
                        return '>'.(l:myindent+1)
                endif
                if (UserTextSpace(a:line+1) == 0)
                        return '<'.(l:myindent+1)
                endif
                return (l:myindent+1)
        elseif UserTextLabeled(a:line)
                if (UserTextLabeled(a:line-1) == 0)
                        return '>'.(l:myindent+1)
                endif
                if (UserText(a:line+1) == 0)
                        return '<'.(l:myindent+1)
                endif
                return (l:myindent+1)
        else
                if l:myindent < l:nextindent
                        return '>'.(l:myindent+1)
                endif
                if l:myindent > l:nextindent
                        return (l:myindent)
                endif
                return l:myindent
        endif
endfunction
set foldexpr=MyHoistableFoldLevel(v:lnum)
"}}}2
"}}}1
" Functions {{{1
" RemoveTabs(line,tabs) {{{2
" remove specified number of tabs from the begining of line
function! RemoveTabs(start,end,tabs)
        if a:tabs > 0
                let l:doit = "silent ".a:start.",".a:end."s/^\\(\\t\\)\\{".a:tabs."}/"
                exe l:doit
        endif
endfunction
"}}}2
" IsParent(line) {{{2
" Return 1 if this line is a parent
function! IsParent(line)
        return (Ind(a:line)+1) == Ind(a:line+1)
endfunction
"}}}2
" FindParent(line) {{{2
" Return line if parent, parent line if not
function! FindParent(line)
        if IsParent(a:line)
                return a:line
        else
                let l:parentindent = Ind(a:line)-1
                let l:searchline = a:line
                while (Ind(l:searchline) != l:parentindent) && (l:searchline > 0)
                        let l:searchline = l:searchline-1
                endwhile
                return l:searchline
        endif
endfunction
"}}}2
" Hoisted() {{{2
" Return a flag indicating that there is a valid hoist
function! Hoisted()
        if strpart(getline(1),0,1) == "~"
                return 1
        else
                return 0
        endif
endfunction
"}}}2
" FindTopHoist(line) {{{2
" Return line number of the nearest (last line) top hoist tag
function! FindTopHoist(line)
        let l:line = a:line
        while (match(getline(l:line),"^\\~") == -1) && (l:line > 0)
                let l:line -= 1
        endwhile
        return l:line
endfunction
"}}}2
" FindBottomHoist(line) {{{2
" Return line number of the nearest (last line) top hoist tag
function! FindBottomHoist(line)
        let l:line = a:line
        while (match(getline(l:line),"^\\~") == -1) && (l:line > 0)
                let l:line += 1
        endwhile
        return l:line
endfunction
"}}}2
" FindLastChild(line) {{{2
" Return the line number of the last decendent of parent line
function! FindLastChild(line)
        let l:parentindent = Ind(a:line)
        let l:searchline = a:line+1
        while Ind(l:searchline) > l:parentindent
                let l:searchline = l:searchline+1
        endwhile
        return l:searchline-1
endfunction
"}}}2
" GetHoistedIndent(line) {{{2
" line is the line number containing the indent
" Returns the original indent of the hoisted region
function! GetHoistedIndent(line)
        return str2nr(strpart(getline(a:line),1,2))
endfunction
"}}}2
" HoistTagBefore(line,indent) {{{2
function! HoistTagBefore(line,indent)
        let l:doit = "silent 1,".(a:line-1)."s/^/\\~".a:indent." /"
        exe l:doit
endfunction
"}}}2
" HoistDeTagBefore(line) {{{2
function! HoistDeTagBefore(line)
        let l:doit = "silent 1,".a:line."s/^\\~\\d* //"
        exe l:doit
endfunction
"}}}2
" HoistTagAfter(line) {{{2
function! HoistTagAfter(line)
        let l:doit = "silent ".a:line.",$s/^/\\~/"
        exe l:doit
endfunction
"}}}2
" HoistDeTagAfter(line) {{{2
function! HoistDeTagAfter(line)
        let l:doit = "silent ".a:line.",$s/^\\~//"
        exe l:doit
endfunction
"}}}2
" Hoist(line) {{{2
" Write the offspring of a parent to a new file, open it and remove the
" leading tabs.
function! Hoist(line)
        let l:parent = FindParent(a:line)
        if l:parent == 0
                return
        endif
        call cursor(l:parent,1)
        let l:firstline = l:parent+1
        let l:childindent = Ind(l:firstline)
        let l:lastline = FindLastChild(l:parent)
        call HoistTagBefore(l:firstline,l:childindent)
        call HoistTagAfter(l:lastline+1)
        call RemoveTabs(l:firstline,l:lastline,l:childindent)
        call cursor(l:firstline,1)
endfunction
" MakeTabs(n) {{{2
" return a string of n tabs
function! MakeTabs(n)
        let l:tabs = ""
        let l:n = a:n
        while l:n > 0
                let l:tabs = l:tabs."\t"
                let l:n -= 1
        endwhile
        return l:tabs
endfunction
"}}}2
"}}}2
" DeHoist() {{{2
" Write the offspring of a parent to a new file, open it and remove the
" leading tabs.
function! DeHoist()
        if !Hoisted()
                return
        endif
        let l:line = line(".")
        let l:top = FindTopHoist(l:line)
        let l:bottom = FindBottomHoist(l:line)
        let l:indent = GetHoistedIndent(l:top)
        let l:tabs = MakeTabs(l:indent)
        let l:doit = "silent ".(l:top+1).",".(l:bottom-1)."s/^/".l:tabs."/"
        exe l:doit
        call HoistDeTagBefore(l:top)
        call HoistDeTagAfter(l:bottom)
        call cursor(l:line,l:indent)
endfunction
"}}}2
" DeHoistAll() {{{2
" Write the offspring of a parent to a new file, open it and remove the
" leading tabs.
function! DeHoistAll()
        while Hoisted()
                call DeHoist()
        endwhile
endfunction
"}}}2
"}}}1
" vim600: set foldlevel=0 foldmethod=marker:

_______________________________________________
VimOutliner mailing list
VimOutliner@...
http://www.lists.vimoutliner.org/mailman/listinfo

Re: New Hoisting Method

by Andy Todd :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Noel Henson wrote:

> Everyone,
>
> Attached is a script that will enable a new method of hoisting. It edits
> hoists within the same window/buffer/file.
>
> Advantages
> * No external files needed or used
> * Hoists are nestable, you can hoist within a hoisted region
> * Maintains undo/redo buffers
> * Maintains state over saves
> * Maintains state over editing sessions
>
> Disadvantages
> * "~" has been commandeered to be the hoist marker
> (but only in the first character of a line so level 1 headings
> will not be able to start with this character)
>
> Notes
> * It is normal to have a single invisible line at the top of the window
> (needed since there is no invisibile (0-line) folds in vim)
> * It is normal to have two invisible lines at the bottom of the window
> (as above but an additional line is needed to create a fence)
> * Commands have changed
>
> Commands
> ,,hh Hoist the current region
> a region is the children of the node under the cursor
> or, if no children, the parent of the node under the
> cursor (this may not be the needed behavior)
> ,,hd Dehoist the current region
> ,,hD Dehoist all hoisted regions
>
> Installation
>
> 1. Copy the attached script to ~/.vimoutliner/plugins
> 2. Edit .vimoutlinerrc (usually line 121)
> let g:vo_modules_load = "checkbox:newhoist:smartpaste"
> 3. Open an outline and hoist away!
>
> Let me know how this works for you.
>
> Noel
>
> PS: To see the machinery of how it works, just comment out the "hi" line in
> vo_newhoist.vim.
>

I get an error message that briefly appears and is then replaced by the
outline file. It says something like;

"""
Error detected while processing [...]/plugins/vo_newhoist.vim
line   75:
E420: BG color unknown
"""

In the opened outline file if I type ",,h" I see;

VimOutliner reserved command: ,,h

in the status line and no hoisting appears to happen.

Regards,
Andy
--
 From the desk of Andrew J Todd esq - http://www.halfcooked.com/
_______________________________________________
VimOutliner mailing list
VimOutliner@...
http://www.lists.vimoutliner.org/mailman/listinfo

Re: New Hoisting Method

by Noel Henson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wednesday 16 September 2009, Andy Todd wrote:

> Noel Henson wrote:
> > Everyone,
> >
> > Attached is a script that will enable a new method of hoisting. It
> > edits hoists within the same window/buffer/file.
> >
> > Advantages
> > * No external files needed or used
> > * Hoists are nestable, you can hoist within a hoisted region
> > * Maintains undo/redo buffers
> > * Maintains state over saves
> > * Maintains state over editing sessions
> >
> > Disadvantages
> > * "~" has been commandeered to be the hoist marker
> > (but only in the first character of a line so level 1 headings
> > will not be able to start with this character)
> >
> > Notes
> > * It is normal to have a single invisible line at the top of the
> > window (needed since there is no invisibile (0-line) folds in vim)
> > * It is normal to have two invisible lines at the bottom of the window
> > (as above but an additional line is needed to create a fence)
> > * Commands have changed
> >
> > Commands
> > ,,hh Hoist the current region
> > a region is the children of the node under the cursor
> > or, if no children, the parent of the node under the
> > cursor (this may not be the needed behavior)
> > ,,hd Dehoist the current region
> > ,,hD Dehoist all hoisted regions
> >
> > Installation
> >
> > 1. Copy the attached script to ~/.vimoutliner/plugins
> > 2. Edit .vimoutlinerrc (usually line 121)
> > let g:vo_modules_load = "checkbox:newhoist:smartpaste"
> > 3. Open an outline and hoist away!
> >
> > Let me know how this works for you.
> >
> > Noel
> >
> > PS: To see the machinery of how it works, just comment out the "hi"
> > line in vo_newhoist.vim.
>
> I get an error message that briefly appears and is then replaced by the
> outline file. It says something like;
>
> """
> Error detected while processing [...]/plugins/vo_newhoist.vim
> line   75:
> E420: BG color unknown
> """
>
> In the opened outline file if I type ",,h" I see;
>
> VimOutliner reserved command: ,,h
>
> in the status line and no hoisting appears to happen.
>
> Regards,
> Andy

What version of vim are you using? Also, is it Linux or Windows?
You can also try removing the "hi Invis" line from vo_newhoist.vim to the
.vim file of whatever color scheme you are using. Or, replace 'bg' with
whatever background color you are using.

Noel

--

------------------------------------------------------------------
  Noel Henson
  www.noels-lab.com Chips, firmware and embedded systems
  www.vimoutliner.org Work fast. Think well.

_______________________________________________
VimOutliner mailing list
VimOutliner@...
http://www.lists.vimoutliner.org/mailman/listinfo

Re: New Hoisting Method

by Matthew Weier O'Phinney-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Sep 15, 2009 at 12:45 PM, Noel Henson <noel@...> wrote:

> Attached is a script that will enable a new method of hoisting. It edits
> hoists within the same window/buffer/file.
>
> Advantages
> * No external files needed or used
> * Hoists are nestable, you can hoist within a hoisted region
> * Maintains undo/redo buffers
> * Maintains state over saves
> * Maintains state over editing sessions
>
> Disadvantages
> * "~" has been commandeered to be the hoist marker
>        (but only in the first character of a line so level 1 headings
>        will not be able to start with this character)
>
> Notes
> * It is normal to have a single invisible line at the top of the window
>        (needed since there is no invisibile (0-line) folds in vim)
> * It is normal to have two invisible lines at the bottom of the window
>        (as above but an additional line is needed to create a fence)
> * Commands have changed
>
> Commands
>        ,,hh    Hoist the current region
>                a region is the children of the node under the cursor
>                or, if no children, the parent of the node under the
>                cursor (this may not be the needed behavior)
>        ,,hd    Dehoist the current region
>        ,,hD    Dehoist all hoisted regions
>
> Installation
>
> 1. Copy the attached script to ~/.vimoutliner/plugins
> 2. Edit .vimoutlinerrc (usually line 121)
>        let g:vo_modules_load = "checkbox:newhoist:smartpaste"
> 3. Open an outline and hoist away!

This sounds awesome -- I've not used hoists much, in part because of the
tempfile/newbuffer requirement (had some bad experiences where I closed
a window without first de-hoisting).

I'd like to give this a try... but either (a) I've installed vimoutliner
incorrectly, (b) there are differences between platforms, or (c) the
above isn't against the stable vimoutliner version (currently 3.4?).

I don't have a .vimoutliner directory, much less a .vimoutliner/plugins/
directory. I *do* have a .vimoutlinerrc -- but it's nowhere near 121
lines long. I'm not sure it ever gets invoked, actually (I seem to need
to set vo_dark as my scheme manually). I placed vo_newhoist.vim into
.vim/plugin/, added "newhoist" to my vimoutlinerrc, and got no errors on
loading,

However, when I try to hoist a region, I get the following notice:

    "VimOutliner reserved command: ,,h"

and nothing happens. Ideas?

Also, what's the "smartpaste" module? and where might I get that to try
out?

--
Matthew Weier O'Phinney
mweierophinney@...
http://weierophinney.net/matthew/
_______________________________________________
VimOutliner mailing list
VimOutliner@...
http://www.lists.vimoutliner.org/mailman/listinfo

Re: New Hoisting Method

by Noel Henson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wednesday 16 September 2009, Matthew Weier O'Phinney wrote:

> On Tue, Sep 15, 2009 at 12:45 PM, Noel Henson <noel@...> wrote:
> > Attached is a script that will enable a new method of hoisting. It
> > edits hoists within the same window/buffer/file.
> >
> > Advantages
> > * No external files needed or used
> > * Hoists are nestable, you can hoist within a hoisted region
> > * Maintains undo/redo buffers
> > * Maintains state over saves
> > * Maintains state over editing sessions
> >
> > Disadvantages
> > * "~" has been commandeered to be the hoist marker
> >        (but only in the first character of a line so level 1 headings
> >        will not be able to start with this character)
> >
> > Notes
> > * It is normal to have a single invisible line at the top of the
> > window (needed since there is no invisibile (0-line) folds in vim) *
> > It is normal to have two invisible lines at the bottom of the window
> > (as above but an additional line is needed to create a fence) *
> > Commands have changed
> >
> > Commands
> >        ,,hh    Hoist the current region
> >                a region is the children of the node under the cursor
> >                or, if no children, the parent of the node under the
> >                cursor (this may not be the needed behavior)
> >        ,,hd    Dehoist the current region
> >        ,,hD    Dehoist all hoisted regions
> >
> > Installation
> >
> > 1. Copy the attached script to ~/.vimoutliner/plugins
> > 2. Edit .vimoutlinerrc (usually line 121)
> >        let g:vo_modules_load = "checkbox:newhoist:smartpaste"
> > 3. Open an outline and hoist away!
>
> This sounds awesome -- I've not used hoists much, in part because of the
> tempfile/newbuffer requirement (had some bad experiences where I closed
> a window without first de-hoisting).
>
> I'd like to give this a try... but either (a) I've installed vimoutliner
> incorrectly, (b) there are differences between platforms, or (c) the
> above isn't against the stable vimoutliner version (currently 3.4?).
>
> I don't have a .vimoutliner directory, much less a .vimoutliner/plugins/
> directory. I *do* have a .vimoutlinerrc -- but it's nowhere near 121
> lines long. I'm not sure it ever gets invoked, actually (I seem to need
> to set vo_dark as my scheme manually). I placed vo_newhoist.vim into
> .vim/plugin/, added "newhoist" to my vimoutlinerrc, and got no errors on
> loading,
>
> However, when I try to hoist a region, I get the following notice:
>
>     "VimOutliner reserved command: ,,h"
>
> and nothing happens. Ideas?
>
> Also, what's the "smartpaste" module? and where might I get that to try
> out?

Matthew,

I'll attach the smartepaste script. If you are using Linux, just create
a .vimoutliner/plugins directory and put the scripts there. I am assuming
that you're running Linux so that should work just fine.

The smartpaste module is just an outline aware paste function. If you yank
and put a line or section from an outline using VO without smartpaste, you
just get vim's yank and put functions. There is no awareness of indentation
levels. With smartpaste, pasted lines assume the sibling position of the
line the cursor is on when you paste.

Noel

--

------------------------------------------------------------------
  Noel Henson
  www.noels-lab.com Chips, firmware and embedded systems
  www.vimoutliner.org Work fast. Think well.

_______________________________________________
VimOutliner mailing list
VimOutliner@...
http://www.lists.vimoutliner.org/mailman/listinfo

VO Groupware : was Re: New Hoisting Method

by Steve Litt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tuesday 15 September 2009 12:45:48 Noel Henson wrote:

> Everyone,
>
> Attached is a script that will enable a new method of hoisting. It edits
> hoists within the same window/buffer/file.
>
> Advantages
> * No external files needed or used
> * Hoists are nestable, you can hoist within a hoisted region
> * Maintains undo/redo buffers
> * Maintains state over saves
> * Maintains state over editing sessions
>
> Disadvantages
> * "~" has been commandeered to be the hoist marker
> (but only in the first character of a line so level 1 headings
> will not be able to start with this character)
>
> Notes
> * It is normal to have a single invisible line at the top of the window
> (needed since there is no invisibile (0-line) folds in vim)
> * It is normal to have two invisible lines at the bottom of the window
> (as above but an additional line is needed to create a fence)
> * Commands have changed
>
> Commands
> ,,hh Hoist the current region
> a region is the children of the node under the cursor
> or, if no children, the parent of the node under the
> cursor (this may not be the needed behavior)
> ,,hd Dehoist the current region
> ,,hD Dehoist all hoisted regions
>
> Installation
>
> 1. Copy the attached script to ~/.vimoutliner/plugins
> 2. Edit .vimoutlinerrc (usually line 121)
> let g:vo_modules_load = "checkbox:newhoist:smartpaste"
> 3. Open an outline and hoist away!
>
> Let me know how this works for you.
>
> Noel
>
> PS: To see the machinery of how it works, just comment out the "hi" line in
> vo_newhoist.vim.

Noel -- have you considered making hoisting the center of VO groupware, or
some other groupware  methodology?

Just to put pressure on you, I promised vaporware VO groupware, in 2003, just
before I gave up maintainership, here:

http://video.google.com/videoplay?docid=8810772602188234059#

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US
Twitter: http://www.twitter.com/stevelitt


_______________________________________________
VimOutliner mailing list
VimOutliner@...
http://www.lists.vimoutliner.org/mailman/listinfo

Re: New Hoisting Method

by Andy Todd :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Noel Henson wrote:

> On Wednesday 16 September 2009, Andy Todd wrote:
>> Noel Henson wrote:
>>> Everyone,
>>>
>>> Attached is a script that will enable a new method of hoisting. It
>>> edits hoists within the same window/buffer/file.
>>>
>>> Advantages
>>> * No external files needed or used
>>> * Hoists are nestable, you can hoist within a hoisted region
>>> * Maintains undo/redo buffers
>>> * Maintains state over saves
>>> * Maintains state over editing sessions
>>>
>>> Disadvantages
>>> * "~" has been commandeered to be the hoist marker
>>> (but only in the first character of a line so level 1 headings
>>> will not be able to start with this character)
>>>
>>> Notes
>>> * It is normal to have a single invisible line at the top of the
>>> window (needed since there is no invisibile (0-line) folds in vim)
>>> * It is normal to have two invisible lines at the bottom of the window
>>> (as above but an additional line is needed to create a fence)
>>> * Commands have changed
>>>
>>> Commands
>>> ,,hh Hoist the current region
>>> a region is the children of the node under the cursor
>>> or, if no children, the parent of the node under the
>>> cursor (this may not be the needed behavior)
>>> ,,hd Dehoist the current region
>>> ,,hD Dehoist all hoisted regions
>>>
>>> Installation
>>>
>>> 1. Copy the attached script to ~/.vimoutliner/plugins
>>> 2. Edit .vimoutlinerrc (usually line 121)
>>> let g:vo_modules_load = "checkbox:newhoist:smartpaste"
>>> 3. Open an outline and hoist away!
>>>
>>> Let me know how this works for you.
>>>
>>> Noel
>>>
>>> PS: To see the machinery of how it works, just comment out the "hi"
>>> line in vo_newhoist.vim.
>> I get an error message that briefly appears and is then replaced by the
>> outline file. It says something like;
>>
>> """
>> Error detected while processing [...]/plugins/vo_newhoist.vim
>> line   75:
>> E420: BG color unknown
>> """
>>
>> In the opened outline file if I type ",,h" I see;
>>
>> VimOutliner reserved command: ,,h
>>
>> in the status line and no hoisting appears to happen.
>>
>> Regards,
>> Andy
>
> What version of vim are you using? Also, is it Linux or Windows?

I'm using 7.2.22 (system installed version of Vim) and MacVim snapshot
49 (built on 7.2.245). I'm not running on Linux or Windows but a Mac.

> You can also try removing the "hi Invis" line from vo_newhoist.vim to the
> .vim file of whatever color scheme you are using. Or, replace 'bg' with
> whatever background color you are using.
>
> Noel
>

I'm not sure what you mean by this statement. Do you mean simply remove
line 75 from vo_newhoist.vim and place it in my colors file? This could
be complicated by the fact that I only set this for gvim and not plain vim.

FYI In gvim (and MacVim) I'm using the Wombat colour scheme -
http://dengmao.wordpress.com/2007/01/22/vim-color-scheme-wombat/

This doesn't seem to define a 'bg' attribute.

Regards,
Andy
--
 From the desk of Andrew J Todd esq - http://www.halfcooked.com/
_______________________________________________
VimOutliner mailing list
VimOutliner@...
http://www.lists.vimoutliner.org/mailman/listinfo

Re: VO Groupware : was Re: New Hoisting Method

by Noel Henson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wednesday 16 September 2009, Steve Litt wrote:
[snip]

>
> Noel -- have you considered making hoisting the center of VO groupware,
> or some other groupware  methodology?
>
> Just to put pressure on you, I promised vaporware VO groupware, in 2003,
> just before I gave up maintainership, here:
>
> http://video.google.com/videoplay?docid=8810772602188234059#
>
> SteveT
>
> Steve Litt
> Recession Relief Package
> http://www.recession-relief.US
> Twitter: http://www.twitter.com/stevelitt

Steve,

Thanks for the reminder of the deadline. I may be a bit late on that. :)

Groupware is a messy problem. There has been some thought on it from you,
me and others. But as you have pointed out in the past, it's all about the
data; and we're just using text files.

The xxx big problems as I see it are:

1. no hidden meta data method available in vim or in text files in general.
2. no locking mechanisms available for chars, words, lines or any other
region in vim or text files in general.
3. no mechanism for multiple, simultaneous read/write editing sessions
exists in vim.

With the old method of hoisting (which does not work reliably) it may have
been possible. This new method, which has yet to fail on me, is just
a single editing session on a single file. This actually moves it further
away from the groupware space. But there's always hope. Before I figured
out a way to do it, I didn't think hoisting in a single file would work
anyway.

Noel


--

------------------------------------------------------------------
  Noel Henson
  www.noels-lab.com Chips, firmware and embedded systems
  www.vimoutliner.org Work fast. Think well.

_______________________________________________
VimOutliner mailing list
VimOutliner@...
http://www.lists.vimoutliner.org/mailman/listinfo

Re: New Hoisting Method

by Noel Henson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andy,

Let's try this more simply. What happens when you do this:

: hi bonk guifg=bg[enter]

Noel

--

------------------------------------------------------------------
  Noel Henson
  www.noels-lab.com Chips, firmware and embedded systems
  www.vimoutliner.org Work fast. Think well.

_______________________________________________
VimOutliner mailing list
VimOutliner@...
http://www.lists.vimoutliner.org/mailman/listinfo

Re: VO Groupware : was Re: New Hoisting Method

by Steve Litt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Can CVS, RCS or SubVersion check out parts of files, or just whole files?

SteveT

On Friday 25 September 2009 11:22:18 Noel Henson wrote:

> On Wednesday 16 September 2009, Steve Litt wrote:
> [snip]
>
> > Noel -- have you considered making hoisting the center of VO groupware,
> > or some other groupware  methodology?
> >
> > Just to put pressure on you, I promised vaporware VO groupware, in 2003,
> > just before I gave up maintainership, here:
> >
> > http://video.google.com/videoplay?docid=8810772602188234059#
> >
> > SteveT
> >
> > Steve Litt
> > Recession Relief Package
> > http://www.recession-relief.US
> > Twitter: http://www.twitter.com/stevelitt
>
> Steve,
>
> Thanks for the reminder of the deadline. I may be a bit late on that. :)
>
> Groupware is a messy problem. There has been some thought on it from you,
> me and others. But as you have pointed out in the past, it's all about the
> data; and we're just using text files.
>
> The xxx big problems as I see it are:
>
> 1. no hidden meta data method available in vim or in text files in general.
> 2. no locking mechanisms available for chars, words, lines or any other
> region in vim or text files in general.
> 3. no mechanism for multiple, simultaneous read/write editing sessions
> exists in vim.
>
> With the old method of hoisting (which does not work reliably) it may have
> been possible. This new method, which has yet to fail on me, is just
> a single editing session on a single file. This actually moves it further
> away from the groupware space. But there's always hope. Before I figured
> out a way to do it, I didn't think hoisting in a single file would work
> anyway.
>
> Noel


_______________________________________________
VimOutliner mailing list
VimOutliner@...
http://www.lists.vimoutliner.org/mailman/listinfo

Re: VO Groupware : was Re: New Hoisting Method

by Tim Roberts :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Steve Litt wrote:
> Can CVS, RCS or SubVersion check out parts of files, or just whole files?
>  

They all work on whole files.

--
Tim Roberts, timr@...
Providenza & Boekelheide, Inc.

_______________________________________________
VimOutliner mailing list
VimOutliner@...
http://www.lists.vimoutliner.org/mailman/listinfo

Re: New Hoisting Method

by Andy Todd :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Noel Henson wrote:
> Andy,
>
> Let's try this more simply. What happens when you do this:
>
> : hi bonk guifg=bg[enter]
>
> Noel
>

Nothing. If I then do ':hi' Vim displays a long list at the bottom of
which is the line 'bonk guifg=bg'.

But after entering that command if I try ',,h' I still get the message
'VimOutliner reserved command ,,h'

Regards,
Andy
--
 From the desk of Andrew J Todd esq - http://www.halfcooked.com/
_______________________________________________
VimOutliner mailing list
VimOutliner@...
http://www.lists.vimoutliner.org/mailman/listinfo

Re: New Hoisting Method

by Noel Henson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tuesday 29 September 2009, Andy Todd wrote:

> Noel Henson wrote:
> > Andy,
> >
> > Let's try this more simply. What happens when you do this:
> > : hi bonk guifg=bg[enter]
> >
> > Noel
>
> Nothing. If I then do ':hi' Vim displays a long list at the bottom of
> which is the line 'bonk guifg=bg'.
>
> But after entering that command if I try ',,h' I still get the message
> 'VimOutliner reserved command ,,h'
>
> Regards,
> Andy

Interesting. Let's address the second one first. Did you edit your
.vimoutlinerrc file to add 'newhoist' to vo_modules_load? It would be in or
around line 93.

Noel

--

------------------------------------------------------------------
  Noel Henson
  www.noels-lab.com Chips, firmware and embedded systems
  www.vimoutliner.org Work fast. Think well.

_______________________________________________
VimOutliner mailing list
VimOutliner@...
http://www.lists.vimoutliner.org/mailman/listinfo

Re: New Hoisting Method

by Andy Todd :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Noel Henson wrote:

> On Tuesday 29 September 2009, Andy Todd wrote:
>> Noel Henson wrote:
>>> Andy,
>>>
>>> Let's try this more simply. What happens when you do this:
>>> : hi bonk guifg=bg[enter]
>>>
>>> Noel
>> Nothing. If I then do ':hi' Vim displays a long list at the bottom of
>> which is the line 'bonk guifg=bg'.
>>
>> But after entering that command if I try ',,h' I still get the message
>> 'VimOutliner reserved command ,,h'
>>
>> Regards,
>> Andy
>
> Interesting. Let's address the second one first. Did you edit your
> .vimoutlinerrc file to add 'newhoist' to vo_modules_load? It would be in or
> around line 93.
>
> Noel
>

Yes, the appropriate line now reads;

let g:vo_modules_load = "checkbox:newhoist"

And the vo_newhoist.vim file is in my 'plugins' directory. The error
message I mentioned is still appearing on startup.

I think that my Vim setup may be the cause of some confusion here so I
will attempt to strip it back to just a simple .vimrc, .vimoutlinerrc
and no other plugins or Vim modules and see if this makes a difference.

Regards,
Andy
--
 From the desk of Andrew J Todd esq - http://www.halfcooked.com/
_______________________________________________
VimOutliner mailing list
VimOutliner@...
http://www.lists.vimoutliner.org/mailman/listinfo