svn - Vim -- paste content of command line process referencing filename of current buffer into new buffer -
i'm trying create mapping can svn compare-with-base few keystrokes
i know how each step manually....
:newopen new buffer.:read !svn cat <filename>read base version of file new buffer.:diffthison new buffer , previous buffer diff files.
i'd love map series of events mapping -scb, not sure how grab filename (like :e %<cr>) , place read command. i'm not sure how can efficiently grab output of read command , put in new buffer if i'm using %.
as noted in comments, particular question has been asked , answered on superuser: https://superuser.com/questions/370125/getting-output-from-command-in-a-vim-buffer
for sake of general vim education, read on.
there @ least 3 ways access current file name. on command line,
:e! % will reload current file, although simpler use :e!. more useful example, using filename modifiers, edit foo.h if editing foo.c:
:sp %:r.h the second way use @% register, string variable name of current file (relative current directory).
:let myfile = @% :let mypath = fnamemodify(@%, ':p') the third way use expand():
:let myfile = expand("%") :let mypath = expand("%:p") there differences between fnamemodify() , expand().
:help cmdline-special :help @% :help @# :help fnamemodify() :help expand()
Comments
Post a Comment