VimFlowy: The Simplest Outliner for VIM

By , 6 March 2016

VimFlowy: The Simplest Outliner for VIM

I was quite fond of the WorkFlowy outliner until the sync failed and broke my offline access. It was just lucky that I'd made an export of my data not too long before it failed.

But really, I didn't need sync that much. I just needed a fast outliner. And what could faster than Vim? With a bit of investigation into Vim's code folding capabilities, I came up with a single-file script to turn Vim into a fast and simple outliner.

To install VimFlowy, just copy vimflowy.vim to your $HOME/.vim/ftdetect directory and use a .out extension for your outliner files. You can also use :set filetype=vimflowy if you prefer not to use the .out extension.

Download vimflowy.vim to $HOME/.vim/ftdetect

Here is what it looks like. You just use <TAB> to open and close the folds, and navigate through your outline.

Here is the full code of vimflowy.vim for the curious.


" VimFlowy is the simplest outliner for vim. It uses vim's existing code 
" folding capabilities with some simple configuration. The result is a fast,
" powerful outliner using your favourite text editor.
" Install VimFlowy by saving this file to $HOME/.vim/ftdetect/vimflowy.vim
" on unix, or $HOME/vimfiles/ftdetect/vimflowy.vim on Windows.
" Save your outliner files with a .out extension for VimFlowy to be 
" autodetected. Otherwise, use :set filetype=vimflowy from within vim.
" The outliner uses an indentation level of 2 white spaces to create 
" new levels. You can use vim's default code folding shortcuts to move
" throughout your outline, or just use <TAB> to open and close levels.
" The most frequent shortcut keys you will use are:
" <TAB> open or close the current fold
"  zx  close all other folds
"  dd  to delete a fold (when it is closed)
"  [p  to paste it at the current indent level (use with dd to move outlines)
" Use :help fold-commands in vim for additional shorcuts.
" The fold function consumes blank lines. If you need to separate one
" fold from another, use a single dot or a dash on a line by itself.
" Check for updates to VimFlowy at
autocmd BufRead,BufNewFile *.out set filetype=vimflowy
autocmd FileType vimflowy set foldmethod=expr foldexpr=VimFlowyFold(v:lnum)
autocmd FileType vimflowy set foldtext=getline(v:foldstart)
autocmd FileType vimflowy set shiftwidth=2 expandtab autoindent
autocmd FileType vimflowy hi Folded ctermbg=black ctermfg=yellow
autocmd FileType vimflowy nnoremap <TAB> za

function! VimFlowyFold(lnum)
    if getline(a:lnum) =~? '\v^\s*$'
        return VimFlowyFold(a:lnum - 1)

    let this_indent = indent(a:lnum) / &shiftwidth
    let next_indent = indent(NextNonBlankLine(a:lnum)) / &shiftwidth

    if next_indent == this_indent
        return this_indent
    elseif next_indent < this_indent
        return this_indent
    elseif next_indent > this_indent
        return '>' . next_indent

function! NextNonBlankLine(lnum)
    let numlines = line('$')
    let current = a:lnum + 1

    while current <= numlines
        if getline(current) =~? '\v\S'
            return current

        let current += 1

    return -2

4 comments, post a comment!

XFCE4 Screen Flicker Switching Desktops [SOLVED]

By , 5 March 2016

XFCE4 Screen Flicker Switching Desktops [SOLVED]

I just finished install Debian 8.3 on my new laptop. I'm using the XFCE4 desktop environment because I don't want any of that fancy 3D crap that is all the rage nowadays. All I need is a dozen workspaces, and shortcut keys to switch between them.

XFCE4 does the job perfectly. It's light and fast, and doesn't get in your way. One problem I found with the new installation, is a screen flicker when switching between desktops. Many users wouldn't notice it, but because nearly all my applications run in a black text terminal, that flash of white as the screen redraws is really disturbing.

The problem is reported on the GTK mailing list with no solution. I did figure out a workaround though. The flicker is caused by the window manager redrawing the window background. To do this, it uses the theme colours. All you need to do is select a black theme, and the redraw becomes barely noticable.

XFCE4 comes with one dark theme, called 'xfce4-dusk' (select it in Applications > Settings > Appearance). It doesn't have a black window background, but it is close. I edited the theme to make it a pure black background, which reduces the problem as much as possible. Also, the dark theme is easier on the eyes when using Gnome-GTK applications.

To change the background colour, edit /usr/share/themes/Xfce-dusk/gtk-2.0/gtkrc as root, and look for the following block:

    bg[ACTIVE]        = "#151515"
    bg[INSENSITIVE]   = "#303030"
    #bg[NORMAL]        = "#232323"
    bg[NORMAL]        = "#000000"
    bg[PRELIGHT]      = "#003263"
    bg[SELECTED]      = "#002849"

You can see the change I made above.

This trick really makes a difference on my eyes. I spend about 9 hours a day looking at this screen. The last thing I need is things flashing at me.

I hope this helps you solve whatever problem bought you here.

53 comments, post a comment!

How to Install ASSP 2.x on Debian 7 Wheezy

By , 18 March 2015

How to Install ASSP 2.x on Debian 7 Wheezy

ASSP is an SMTP proxy than runs infront of your mailserver to filter out all the spam email. Despite being implemented as a monolothic, indecipherable perl script, it is actually very effective and runs with very little intervention once you have it configured correctly.


Get the code from and extract it to /opt/assp-2.4.3 or wherever you would like to deploy it.

Install dependencies

The README has some details about downloading dependencies from CPAN, however my preference is to use the Debian packages wherever possible, so I figured out which packages those were and came up with this list:


3 comments, post a comment!

10 Cloud Storage and Backup Services

By , 17 January 2014

10 Cloud Storage and Backup Services

The company that was storing our backups online was always a little flakey and recently the scripts just started failing altogether. Time to find a new backup service methinks.

Since I first looked at backup online the market has changed a lot. It's now called "cloud storage" for starters, and the number of companies providing competing services has ballooned.

Here is a quick comparison a few key players on the market, and the monthly cost of storing 100GB of backups. The server being backed up is running Ubuntu, so the last column shows how the backups are run. Rsync is our preferred method.


No comments yet, be the first to comment!

How To Export Google Reader Feeds Into Opera

By , 19 March 2013

How To Export Google Reader Feeds Into Opera

Everyone is up in a storm since Google announced they were killing Google Reader. Although I liked Google Reader, I believe change creates opportunities and unsurprisingly a better solution for feed reading presented itself almost immediately. In fact it was already installed on my system.

It's called Opera.

I installed Opera to read email when Mozilla killed Thunderbird and after some heavy customisation I'd say it works pretty well. It's much faster than Thunderbird for a start.

Now it looks like Opera is not only going to save my RSS feeds, but make my news reading more organised thanks to it's flexible user interface.

So here is a quick howto with screenshots for people who need to get off Google Reader and want to try out Opera.


1 comment, post a comment!

How To Install Ruby On Rails On Ubuntu Hardy 8.04

By , 20 September 2012

How To Install Ruby On Rails On Ubuntu Hardy 8.04

Okay, Ubuntu Hardy is pretty old now but my Hardy server is still humming along just fine and I don't see a good reason to break it just to run a few Ruby On Rails apps. The ruby, ruby1.9 and rubygems packages on Hardy simply don't work anymore and the rails package is too old to run my app.

So here is how I got the latest rails running on this 4 year old server. I hope it saves you some pain.

1. Install JRuby 1.6.8. The Ubuntu ruby1.9 package just hangs silently when trying to install rubygems, but JRuby does the job.

    # cd /opt
    # wget
    # tar -zxf jruby-bin-1.6.8.tar.gz
    # export PATH=$PATH:/opt/jruby-1.6.8/bin

2. Install Rubygems 1.8.24

    # wget
    # unzip
    # cd /opt/rubygems-1.8.24
    # jruby setup.rb


No comments yet, be the first to comment!

The Ultimate VIM TODO List

By , 9 August 2012

The Ultimate VIM TODO List

With a TODO list of over 500 items I clearly need advanced software to manage my tasks. And finally I have found just the tool for the job...


After trying web based project trackers, spreadsheets, desktop project management apps, calendar based, email-based, smartphone apps and everything else I could think of, it looks like I'll be sticking with my plain text todo file with a couple of handy VIM scripts.

Here's how it works.


2 comments, post a comment!

Tomcat 6 vs Tomcat 7 Threads

By , 8 April 2012

The blue line is max threads, the green area is used threads. The same code is run on Tomcat 6 and Tomcat 7.

No comments yet, be the first to comment!

Alt-Tab Shortcuts Broken In Ubuntu Lucid With XModMap

By , 15 December 2011

I use xmodmap to turn caps-lock into an extra modifier for special keys and shortcuts. Since upgrading finally to Ubuntu Lucid 10.04 LTS, I've had a problem with the Caps-Lock modifier key (Mode_switch) getting stuck when I accidentally press the Shift key. When I get it unstuck by pressing the same combination of Caps, Shift and one of my special keys, all my X-Windows shortcuts like Alt-Tab and Function keys stop working.

It's freaking annoying, however I finally found a workaround in Red Hat Bug 513815 and Bug 508434...

$ setxkbmap -layout jp

This resets your keyboard to it's original state. In my case the layout is japanese. You will probably want 'us' for US keyboards. Now you can reapply your xmodmap settings:

$ xmodmap ~/.xmodmaprc

It's still flaky, but it gets me back on the road.

No comments yet, be the first to comment!

More Travelers Browse With Safari

By , 1 December 2011

More Travelers Browse With Safari

Here are the visitor browser stats for the Travel Lifestyle website for November 2011. I was surprised to see that the most popular browser is Safari. I guess travelers like their Apple products.

Safari 37.1 %
Internet Explorer 27.3 %
Firefox 18.6 %
Mozilla 13.7 %
Opera 1.5 %

I have a sneaking suspicion that all those browsers that identify themselves as "Mozilla" aren't really the Mozilla Browser. I haven't seen anybody using Mozilla since... well, since it became Firefox.



2 comments, post a comment!

< Prev1 2 3 4 Next >