chreekat / vimin

:book: Folding for .in files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some vim support for IN files

What's an IN file?

Eh, it's just a file with an outline. Name it foo.in. It's "in" as in inbox — a place to keep todo lists or anything else. My IN.in once had almost 7000 items! Crap! (It's down to 3000 now, but hey, at least I know this plugin is performant.)

Outlines look like:

- This item is at the top
- Here's another item
    - Items nest and stuff
        - They can nest a lot.
    - Items can be really really long, so that they wrap over multiple
      lines. I've set vim options that make this happen automatically, for
      the most part.
    - baz

What's this plugin do?

Well, it used to do lots of questionably useful things! Now I've rebooted it, and it:

  • Sets some good options
  • Makes <cr> act sort of clever. Maybe too clever? Hopefully intuitive.
  • o and O also kinda do the right thing.

Recommendations

  • Keep items formatted with judicious use of gq.
  • Be careful moving items around. There's no notion of an "item" text object, so you have to do everything linewise at best.
  • Use the shift operators! >> and << in Normal mode, and <c-t> and <c-d> in Insert mode. It's fun.
  • Try using insort (from chreekat/usort) for sorting top-level items.
  • vim-unimpaired's "paste and indent" mappings are nice. I re-implemented them like so:
    function! VimrcIndentPaste(reg, dent, dir)
        set nofoldenable
        exec 'normal "' . a:reg . ']' . a:dir . a:dent . "']"
        set foldenable
    endfu
    
    for dent in ['>','<']
        for dire in ['p','P']
            exec 'nnoremap ' . dent . dire . " :call VimrcIndentPaste(v:register, '".dent."', '".dire."')<cr>zv"
        endfor
    endfor
    unlet dire dent
  • Works well with Goyo and NrrwRgn.

I'd like to make formatting and moving easier in the future.

License

GPLv3+, as in LICENSE.

About

:book: Folding for .in files

License:GNU General Public License v3.0


Languages

Language:Vim Script 100.0%