红联Linux门户
Linux帮助

为什么用vi编辑器 修改文件 会变成这样

发布时间:2011-07-18 15:40:25来源:红联作者:fire312923253
每次都是这样
文章评论

共有 18 条评论

  1. qq9293000079 于 2011-07-22 18:02:53发表:

    学习下

  2. gogo11 于 2011-07-20 23:44:06发表:

    修改/etc/vimrc ,给set backup前边加一个"
    附上我的设置:[code]if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
    set fileencodings=utf-8,latin1
    endif

    set nocompatible " Use Vim defaults (much better!)
    set bs=indent,eol,start " allow backspacing over everything in insert mode
    "set ai " always set autoindenting on
    "set backup " keep a backup file
    set viminfo='20,\"50 " read/write a .viminfo file, don't store more
    " than 50 lines of registers
    set history=50 " keep 50 lines of command line history
    set ruler " show the cursor position all the time

    " Only do this part when compiled with support for autocommands
    if has("autocmd")
    augroup redhat
    " In text files, always limit the width of text to 78 characters
    autocmd BufRead *.txt set tw=78
    " When editing a file, always jump to the last cursor position
    autocmd BufReadPost *
    \ if line("'\"") > 0 && line ("'\"") <= line("$") |
    \ exe "normal! g'\"" |
    \ endif
    augroup END
    endif

    if has("cscope") && filereadable("/usr/bin/cscope")
    set csprg=/usr/bin/cscope
    set csto=0
    set cst
    set nocsverb
    " add any database in current directory
    if filereadable("cscope.out")
    cs add cscope.out
    " else add database pointed to by environment
    elseif $CSCOPE_DB != ""
    cs add $CSCOPE_DB
    endif
    set csverb
    endif

    " Switch syntax highlighting on, when the terminal has colors
    " Also switch on highlighting the last used search pattern.
    if &t_Co > 2 || has("gui_running")
    syntax on
    set hlsearch
    endif

    if &term=="xterm"
    set t_Co=8
    set t_Sb=[4%dm
    set t_Sf=[3%dm
    endif
    [/code]

  3. 天真花语 于 2011-07-20 19:40:59发表:

    你编辑后是怎么退出的啊。、、

  4. 年年年 于 2011-07-20 15:22:23发表:

    我用gedit写文件的时候也出现过类似的问题,带~文件出现之后,再次修改那个文件时候就提示错误。。不解

  5. siasleo 于 2011-07-20 14:58:14发表:

    我也很疑惑。。

  6. fire312923253 于 2011-07-20 14:27:46发表:

    的确是 备份文件

  7. qq9293000079 于 2011-07-20 12:07:22发表:

    嗯,10对

  8. 303563041 于 2011-07-20 10:02:23发表:

    那是隐藏的文件,你把ls 命令编辑下就OK

  9. hahalucky 于 2011-07-19 16:19:23发表:

    在$home的.vimrc里面添加:
    set nobackup
    set noswapfile
    之类的,查查相关资料吧,打开vi, 输入:help swap看看

  10. taffy5366 于 2011-07-19 16:13:36发表:

    vim不是直接编辑文件,先复制一份

  11. fire312923253 于 2011-07-19 08:10:00发表:

    如果是备份文件 如何用?怎样删除?

  12. snjxiaojing 于 2011-07-18 23:28:37发表:

    备份文件吧

  13. acrofox 于 2011-07-18 22:05:30发表:

    [code]alias ls='ls -B'[/code]这样ls就不会列出以 ~ 结尾的文件了。

  14. bon1314 于 2011-07-18 17:43:10发表:

    {:3_107:}

  15. gogo11 于 2011-07-18 17:22:35发表:

    在文件管理器里边是隐藏的,ls就出来了。

    同时,我也发现linux隐藏文件的一个招数,后边加~

  16. age 于 2011-07-18 16:33:31发表:

    那个自动生成的备份文件吧
    不过一般是隐藏的吧

  17. fire312923253 于 2011-07-18 16:29:26发表:

    只能自己顶了

  18. fire312923253 于 2011-07-18 16:23:38发表:

    编辑了一下就会多出 一个带"的 文件