On 03/01/09 03:36, Tim Johnson wrote:
> I'm using vim 7.10 on ubuntu 7.10 with python compiled in.
> I would like to be able to
>
> 1)select some text
> 2)write that text to a file in either 'w' mode or 'a' mode
> I.E. 'w' = original contents of file are removed (truncated)
> something like emacs write-region =>
> (Write current region into specified file)
> 'a' = select text is appended to original contents
> and do so as 'invisibly' as possible.
>
> I'd welcome comments on how to get started. I've mentioned the
> +python feature because I am a python programmer.
> thanks
> tim
What do you call "invisibly"?
See
:help :d
e.g. :1,$d to empty the editfile before adding
:help :put
e.g. :$put (append register "
at the end of the editfile)
:help :redir
with > or >> to a file.
Use :redir! > file to erase (replace) an existing file
:help :!
(and pass a > or >> redirection to the shell)
:help :w_f
to write part of the current buffer (linewise)
to an external file
see also what comes below it, about overwriting (with !)
and appending (with >>)
:help :function
:help :command
to write your own functions and ex-commands
None of the above requires python; but I recommend using at least a
Normal build of Vim (otherwise you won't have expression evaluation and
it makes script writing much harder -- no ifs, no whiles, no functions, etc.
Best regards,
Tony.
--
ARTHUR: Then who is your lord?
WOMAN: We don't have a lord.
ARTHUR: What?
DENNIS: I told you. We're an anarcho-syndicalist commune. We take it in
turns to act as a sort of executive officer for the week.
The Quest for the Holy Grail (Monty
Python)
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---