Thursday, October 23, 2014

Re: How to set vim to not display filename info when saving

Here is what is happening: different users are actually running a program called myedit. So user are running say 'myedit file1'. The myedit program is actually running vim in it and editing a different file file2. People who run myedit edits the file using normal vi commands & thinking they are editing file1. They would be saving the normal :w, :wq or :x. I don't want the users to know that they actually ended up editing the file2 as that could be a security issue.
I am not clear on how I can implement what you suggested and meet the above need.

On Thursday, October 23, 2014 1:34:09 AM UTC-4, Christian Brabandt wrote:
> Am 2014-10-23 02:49, schrieb Romel Khan:
> > When I save a file using vim, it displays the filename, number of
> > lines and number of characters being saved. Eg: "temp" 4L, 228C
> > written
> > How can I setup vim so it doesn't display this?
>
>
> You can use the :silent modifier to suppresses it.
>
> Knowing this, you could define your own command:
>
> :com! -bang -range=% -complete=file -nargs=? W :sil
> <line1>,<line2>write<bang> <args>
>
> And using the cmdalias¹ plugin you could alias :W to :w
>
> Best,
> Christian
>
> ¹) There appear to be at least 2 different cmdalias plugins:
> http://www.vim.org/scripts/script.php?script_id=4250
> http://www.vim.org/scripts/script.php?script_id=746

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment