" version = 1.01 of currentline.vim 2006 Nov 24 " 2006 Nov 24: 1.01 use redir! to force overwrite of the file " 2006 Nov 24: 1.00 origin " " Dr. Thomas D. Schneider " National Institutes of Health " National Cancer Institute " Center for Cancer Research Nanobiology Program " Molecular Information Theory Group " Frederick, Maryland 21702-1201 " toms@ncifcrf.gov " permanent email: toms@alum.mit.edu (use only if first address fails) " http://www.ccrnp.ncifcrf.gov/~toms/ " Capture the current line in the file. " Method: " vim book page 321 " " "redirect messages to a file " :redir > filename " " capture the current line in variable j: " :let j=line('.') " " write out the value of j " :echo j " :redir END " " simpler: " " :redir > filename " :echo line('.') " :redir END " save in a file named .vimcurrentline " redir > .vimcurrentline " echo line('.') " redir END " Book page 353: % is current file name " save in a file named (currentfilename).vimcurrentline " redir > %.vimcurrentline " echo line('.') " redir END " Book page 355: echon no newline. function CurrentLine() " redir > %.vimcurrentline redir! > %.vimcurrentline echo line('.') redir END :endfunction " Vim version 6 does not recognize plugins. " Vim version 7 DOES - proof is to give this command: " :function " in Vim 7 on gets a response! The response is: " function CurrentLine() " which means it saw my plugin!! " The call is: " :call CurrentLine() " IT WORKED! With an error: " Error detected while processing function CurrentLine: " line 1: " E499: Empty file name for '%' or '#', only works with ":p:h": redir > %.vimcur " rentline " 2 " That happened because I had not defined a file name - I called " vim without a name. " Solution: just forget it for now. " THIS PLUGIN WORKS!! But only with Vim: " VIM - Vi IMproved 7.0 (2006 May 7, compiled Nov 24 2006 00:08:59)