Fork me on GitHub

Vim Tips: window splits 0

I use Vim for pretty much everything on every machine I use. Using Vim requires constant learning of all the commands. Sometimes commands that I use get pushed out of my head by newer commands. Such is the case with splits. Here are a few commands that I find useful:

(You can find all the them here as well.)

:split - splits the current file into two panes
:split filename.c - splits the the window into 2 panes, one with filename.c, one with the current file.

CTRL-W + embiggens the pane by one line
CTRL-W - deembiggens the pane by one line

:close - close the current pane
:only - close all but the current pane

Liftweb + ctags + vim 0

[Updated: 2008/12/10]

This is how I set up /Lift/, ctags, and vim (on OS X and Ubuntu):

Add some scala definition to ctags:

ty@Astra:~$ cat /home/ty/.ctags
--langdef=scala
--langmap=scala:.scala
--regex-scala=/^[ \t]*class[ \t]+([a-zA-Z0-9_]+)/\1/c,classes/
--regex-scala=/^[ \t]*trait[ \t]+([a-zA-Z0-9_]+)/\1/t,traits/
--regex-scala=/^[ \t]*type[ \t]+([a-zA-Z0-9_]+)/\1/T,types/
--regex-scala=/^[ \t]*def[ \t]+([a-zA-Z0-9_\?]+)/\1/m,methods/
--regex-scala=/^[ \t]*val[ \t]+([a-zA-Z0-9_]+)/\1/C,constants/
--regex-scala=/^[ \t]*var[ \t]+([a-zA-Z0-9_]+)/\1/l,local variables/
--regex-scala=/^[ \t]*package[ \t]+([a-zA-Z0-9_.]+)/\1/p,packages/
--regex-scala=/^[ \t]*case class[ \t]+([a-zA-Z0-9_]+)/\1/c,case classes/
--regex-scala=/^[ \t]*final case class[ \t]+([a-zA-Z0-9_]+)/\1/c,case classes/
--regex-scala=/^[ \t]*object[ \t]+([a-zA-Z0-9_]+)/\1/o,objects/
--regex-scala=/^[ \t]*private def[ \t]+([a-zA-Z0-9_]+)/\1/pd,defs/

Build the tags file:

ty@Astra:~$ /opt/local/bin/ctags -h ".scala" -R --exclude=*.js -f liftags /Users/tjweir/g/clean/liftweb/

I prefer to keep the tags file, in this case liftags, in the root of home. Put it where you want.

Add the tags location to ~/.vimrc

set tags=/home/ty/liftags

Now you can open a file and execute

:tag LiftSession

and jump to the file.

Presentation on Vim 0

Vim has been my editor of choice for a long time and I try to expand my knowledge of commands all the time. I was particularly impressed with “Vim for PHP Programmers” by Andrei Zmievski.

It’s well worth a read as a refresher and as an introduction to new commands.

Vim blogging plugin 0

I’ve switched to vimpress as my blogging utility.

I like it more than the web interface of wordpress. Plus is one more thing that I can do from the comfort of Vim. Beautiful vim.

Taskpaper and Vim. 0

Taskpaper is for “…Mac users who want a simpler way to stay organized and get things done. TaskPaper is a simple to-do list that’s surprisingly adept. Unlike the competition, TaskPaper’s text based interface is focused on paper-like simplicity.”

It’s cool, simple to use and quite useful. What is more useful is the vim plugin that replicates the Taskpaper idea. [Link fixed]

It’s so good, I bought a copy of Taskpaper.

P.S. If you’re going to use taskpaper.vim I would highly recommend editing your favourite colourscheme to highlight the taskpaper bits.
I use vibrantInk and added this:

    hi taskpaperDone guifg=#444444
    hi taskpaperProject guifg=#66FF00
    hi taskpaperTodo gui=NONE guifg=#F0E68C guibg=#FF00FF (Line break)
       cterm=NONE ctermfg=lightyellow ctermbg=lightmagenta
    hi taskpaperListItem guifg=#FF6600
    hi taskpaperContext guifg=#33999