在 2016年3月10日星期四 UTC+8上午9:03:59,Tim Chase写道:
> On 2016-03-09 01:34, 童虎 wrote:
> > I have a file `a.txt`.
> > When I use root to edit this file `sudo vi a.txt`. Vim prompt:
>
> First, I'd use "sudoedit" which invokes $SUDO_EDITOR environment
> variable, falling back to $VISUAL, and then $EDITOR if needed.
>
> Since it runs vim as you rather than as root, this might solve your
> problem as well.
>
> As a side-benefit, you don't have the vulnerability that comes from
> launching an editor that can shell out to root-shells.
>
> > `E474: Invalid argument:
> > listchars=eol:¬,tab:>·,trail:~,extends:>,precedes:<,space:␣`
> >
> > But when I user `vi a.txt` without `sudo`. All things right.
>
> "space:" was added to 'listchars' in v7.4.710 on 2015-04-21 by Bram.
> My stock Debian install doesn't offer it so when I try your
> 'listchars' setting without using "space:␣" (or even "space:X" in
> case the character was causing the issue), it triggers the same
> message. When I try it with a recent build of vim, it works as
> expected.
>
> Are you sure that you're running the same vim binary when you run in
> each case?
>
> $ diff -u <(vim --version) <(sudo vim --version)
>
> or perhaps
>
> $ which vim
> $ sudo which vim
>
> -tim
I use vi as alias to vim.
And you are right. My vi is alias to vim, but my `sudo which vi` is "/usr/bin/vi".
Thanks again!
I remove space in .vimrc, and it goes right, maybe vi doesn't support space.
--
--
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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment