Vim As Pim

In Linux, and on Windows with CygWin it is possible to use the VimTextEditor 6.x as a PersonalInformationManager that is very similar to a Wiki.

(Also much of the below is possible on normal Windows and Mac with GVim or the Mac equivalent)

Putting all the files in the same directory you can build up a collection of text files.


Forgive me for sneaking this to the top of the list, but I thought the instructions below were a bit too cumbersome for me. So, I spent the day (June 14, 2004) and created VimKi. Instead of all these steps, when the syntax and plugin file are added all you need to create and begin editing a new file is the ",nt" macro.


Also see PotWiki, VimViki.


Starting with a working file, WorkingFile? etc. then when you want to link with other files in the directory they can all be directly called up using the gf (go to file) command in Vim with the cursor placed on the name of any of the files in the directory that have been written in the working file.

Unlike a wiki there is not a HyperLink created by writing the file's name in the working file (however,see below :map gf :e <cfile>)

"Actually, vim has tags that can serve as a fair substitute, when handled right. A good example of the tag system is to look at vim's :help ex option. It uses the vim tags." -- BenWilson

(see http://vim.wikia.com/wiki/Browsing_programs_with_tags for tips about using tags with vim)

but using the command :!touch NewFile? (or files) Or :e Newfile

and then also if you wish

:r!ls New*

or writing in the name of the new file in the working file the file, or files, can be immediately created in the directory and then accessed in the working file.

The file name doesn't of course require camel case but it must be a continuous string without a break.

Also a search for file names can be done through

:!ls *New* or :r!ls *New*

Within files the search can be done with grep on linux with, for example

:r!grep -6hir John *

The results can be temporarily read into the file, looked at and saved or eliminated by u the undo command.

Recent Changes can be approximated by

:r!ls -t which sorts files according to modification time

A file index can be created by

:r!ls

The files brought up can be saved and arranged in the form of a hierarchical tree resulting in something similar to a tree editor. This can be enhanced by using the Vim folding function.

Background and foreground colors can be changed with the command

:hi Normal ctermfg=yellow ctermbg=blue

A calendar for the current month can be printed in the active file through the command :r!cal or :r! xx 2003 for another month, :r! 2003 for the year

a digital clock can be inserted in the file through the application vcstime

vcstime can now be found as part of kbd Linux Keyboard tools http://www.kbd-project.org/

http://handhelds.org/download/intimate/release/usr/sbin/vcstime

The file can be time and date stamped by the command

:r!date

Immediate access to the PIM can be arranged through the alias function.

In the file etc/profile (depending on the distribution) write, for example

alias g2pim="cd /;cd ..;cd /PathToMyHomeDirectoryWhateverItIs?/MyPim?;ls"

This creates the command g2pim, to go to your Pim.

Various plugins can be used to extend the functionality of the PIM. many of which can be found at http://www.vim.org/

For example:

For accessing local and external URLs you can use: thlnk http://www.bf-consulting.de/thlnk/vim/

 (note: the latest version 2008 is utl.vim, Universal Text Linking, found at
    http://vim.sourceforge.net/scripts/script.php?script_id=293)
or textlink.vim http://www.vim.org/scripts/script.php?script_id=347

bookmarks: handy bookmark functions

bookmark.vim at http://members.tripod.com/~josvanr/vim.html FavMenu?.vim at http://www.vim.org/scripts/script.php?script_id=161

With Vim where is the limit?!


Using the LynxBrowser to augment VimAsPim in Linux (and the w3m browser also adds similar functionality. -- SckotVokes)

the lynx browser can add functionality to vim and vice versa

  1. in a console fire up the lynx browser at the command prompt with lynx . (or just lynx if you want to see the introductory page first.)
  2. go to a file in the browser and press enter
  3. press O for options. press the down arrow to navigate
  4. go to save options to disk. press right arrow to mark it.
  5. go to editor. Write vim
  6. go to vi keys. mark on (right arrow, then up and down arrows)
  7. go to accept changes and press enter

Now your lynx browser is happily vim enabled with vim navigation commands and editing powers and can be used as part of VimAsPim above!

This adds browsing functionality as well as bookmarks, directory maintenance functions, html file viewing and use, internet browsing, and even image file viewing for advanced versions of lynx.


From 43 folders wiki http://wiki.43folders.com/index.php/Vim

Using text files as a proto-Wiki

Have you ever tried the gf command? It parses whatever word is under the cursor and tries to open that file in a new buffer. You don't need to use WikiCase for jump words, but it might be helpful. (On *nixes this operation will be case sensitive, I'm guessing on Windows it would be case insensitive.)

By way of example, this allows one to have a "todo" file containing text like projects/foo - Foo, the generic project. If you have your cursor over projects/foo and hit gf in command mode, the foo file in the projects directory will open in a new buffer. To navigate the jump history, use Tab or Ctrl-I to go forward and Ctrl-O to move backwards. Your todo file can now link to related files without any actual link markup! Maximum laziness. Of course, you don't need to organize them in subdirectories, either.

Since vim 6.x can also open directory listings, if you have a bunch of files in the projects directory and wish to link to a list of them, just use projects/!

For further wiki-like behavior, add this mapping to your .vimrc: (See the vim help on gf)

:map gf :e <cfile><CR> (for gvim on windows) (note :map gf :e <cfile> seems to work better on linux)

Now if you gf on a word that doesn't have a file yet, vim will create a buffer that will save to that file name - just like a wiki, essentially.


Posted by: Doug McInnes? | Thursday, August 18, 2005 http://www.43folders.com/2005/08/life_inside_one.html

I use multiple files and vim with the always-handy "gf" keystroke to jump to filename under cursor, but some of the single files get pretty big.

Handy methods for navigation:

- Markers: get friendly with them. m[A-Z] makes a "file mark" that can be ' jumped to from any buffer. :marks displays a list of your markers with a single line for context.

- Folding: yeah, folding rules. Definitely mess around with the different methods - indent is great for outlining. To quickly shunt things around, fold everything all the way up with zM, drill to where you need to go, and drop. You can also paste onto a hidden fold and it works as one would expect - put from above and it goes at the top, put from below and it goes at the bottom.

Posted by: D Fitch | Thursday, August 18, 2005

For those last two, an easy way to make that permanent is putting the following at the end of your file:

/* vi: set ts=2 sw=2 foldmethod=marker: */

The ts and sw just set the tab stop and shift width (if you use expandtab). Marking is key, and something I always forget about. I just always find myself using text files when all is said and done. Sadly beagle is a bit unstable (and Kat is seemingly unusable) at this point, but soon enough we'll have spotlight/gdsesque on free oses.

On the topic of markup, I'm not quite sure why it is necessary. I've never been fluent in markdown or textile or whatnot, as it just seems superflous to what really should be happening.


what are some quick ways to access files? Environment variables and the gf command.

http://vim.wikia.com/wiki/Quickly_Get_Files_in_your_Environment


Also see GreatVimFeatures.


EditText of this page (last edited November 12, 2013) or FindPage with title or text search