Vim Tips Wiki
(Adjust previous/next navigation)
(Remove html character entities)
Line 17: Line 17:
   
 
<pre>
 
<pre>
map &lt;F1&gt; :write %&lt;CR&gt;:!ci -l %&lt;CR&gt;:edit!&lt;CR&gt;
+
map <F1> :write %<CR>:!ci -l %<CR>:edit!<CR>
map &lt;F2&gt; :!co -l %&lt;CR&gt;:edit!&lt;CR&gt;
+
map <F2> :!co -l %<CR>:edit!<CR>
 
</pre>
 
</pre>
   
Line 31: Line 31:
   
 
----
 
----
&gt; but I don't see an "if exists and is directory" function, right now.
+
> but I don't see an "if exists and is directory" function, right now.
   
 
How about isdirectory()?
 
How about isdirectory()?

Revision as of 05:40, 29 September 2008

Tip 366 Printable Monobook Previous Next

created November 8, 2002 · complexity basic · author Peter · version 6.0


I've looked all around and haven't found RCS functions built into vim (which surprises me, really), so I looked more and found some almost working RCS scripts for text-mode. Key there is almost. It's still a kludge, but it works without too much hassle.

I've chosen F1 and F2, because I never use those keys for what they are intended. I use :help for a command reference, not for a tutorial style thing. So, use some discretion. Also, the write command could just as easily have been a :write!, but I decided against that in the case of files that weren't checked out. You should check them out, first, and they should be writable.

map <F1> :write %<CR>:!ci -l %<CR>:edit!<CR>
map <F2> :!co -l %<CR>:edit!<CR>

New RCS files work just fine with the first mapping.

There would be some use to creating the RCS directory, if it's not already there, but I don't see an "if exists and is directory" function, right now.

There's a good menu-driven rcs client for graphical vim, but I hate menus and graphical interfaces.

Comments

If you are referring to rcs-menu.vim, even though it has a menu/graphical interface, it also creates mappings to do the same operations, which to me is more useful. So I guess you really get the best of both worlds that way.


> but I don't see an "if exists and is directory" function, right now.

How about isdirectory()?

if isdirectory("c:/vim/vimfiles/")
 "dir exists
endif

See script#360 rcsdiff.vim for visual rcsdiff. Integrates Vim's diffsplit with RCS.