vim在打开文件后按箭头键时显示垃圾字符
当我打开一个vim文件时,按下箭头键会得到垃圾字符 我还在我的vim在打开文件后按箭头键时显示垃圾字符,vim,putty,Vim,Putty,当我打开一个vim文件时,按下箭头键会得到垃圾字符 我还在我的~/.vimrc中定义了以下内容: set nocompatible 我使用putty登录。这是油灰问题吗 请帮忙 编辑:若我删除了我的~/.vimrc,那个么问题也会被删除。我使用了以下代码作为.vimrc文件,它解决了我的所有问题 " When started as "evim", evim.vim will already have done these settings. if v:progname =~? "evim"
~/.vimrc
中定义了以下内容:
set nocompatible
我使用putty登录。这是油灰问题吗
请帮忙
编辑:若我删除了我的~/.vimrc,那个么问题也会被删除。我使用了以下代码作为.vimrc文件,它解决了我的所有问题
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set backup " keep a backup file
endif
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")
" Don't use Ex mode, use Q for formatting
map Q gq
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>
" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
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
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
" Also don't do it when the mark is in the first line, that is the default
" position when opening a file.
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
”当以“evim”启动时,evim.vim将已经完成这些设置。
如果v:progname=~?“evim”
完成
恩迪夫
“使用Vim设置,而不是Vi设置(更好!)。
“这必须是第一步,因为它会作为副作用改变其他选项。
兼容模式
“允许在插入模式下对所有内容进行退格
设置退格=缩进、下线、开始
如果有(“虚拟机”)
set nobackup“不要保留备份文件,请改用版本
其他的
设置备份“保留备份文件
恩迪夫
设置历史记录=50“保留50行命令行历史记录
“设置标尺”始终显示光标位置
设置showcmd“显示不完整的命令
设置incsearch“执行增量搜索
对于Win32 GUI:从“GUI选项”中删除“t”标志:无tearoff菜单项
“let&guioptions=替换(&guioptions,“t”,“g”)
“不要使用Ex模式,请使用Q进行格式化
地图QGQ
“插入模式下的CTRL-U会删除很多内容。使用CTRL-G u键取消第一次中断,
“以便插入换行符后可以撤消CTRL-U。
inoremap u
“在许多终端模拟器中,鼠标工作正常,因此可以启用它。
如果有('鼠标')
设置鼠标=a
恩迪夫
当终端有颜色时,打开语法高亮显示
“同时打开高亮显示上次使用的搜索模式。
如果&t_Co>2||has(“gui_运行”)
语法高亮
高亮显示
恩迪夫
“仅当在支持自动命令的情况下编译时才执行此部分。
如果有(“自动MD”)
“启用文件类型检测。
使用默认的文件类型设置,使mail的“tw”设置为72,
“'cindent'在C文件等中处于打开状态。
同时加载缩进文件,以自动执行语言相关的缩进。
文件类型插件缩进
“将它们放在autocmd组中,以便我们可以轻松删除它们。
AugroupVimrcex
哎呀!
“对于所有文本文件,将“textwidth”设置为78个字符。
autocmd文件类型文本集本地文本宽度=78
编辑文件时,始终跳转到最后一个已知的光标位置。
“当位置无效或在事件处理程序中时,不要执行此操作
“(在gvim上删除文件时发生)。
“当标记位于第一行时也不要这样做,这是默认设置
“打开文件时的位置。
autocmd BufReadPost*
\如果行(“\”)>1&&line(“\”)否,则它是一个简单的文本文件。当您对您的\u文件进行cat操作时,您会看到什么?这会在不处于插入模式时阻止箭头键,因此不会插入垃圾字符。如果您能够识别解决问题的行,则可能会出现重复。此文件的大部分内容与当前问题无关。