使用.vimrc换行的Vim游标

yhived7q  于 2022-11-11  发布在  其他
关注(0)|答案(2)|浏览(217)

在Vim 7.3中,我似乎不能让光标换行工作。我试过其他地方的建议,包括以下建议,但都没有效果:

:set whichwrap+=<,>
  :set whichwrap+=>,l
  :set whichwrap+=<,h

有什么建议吗?我已经包括了我的.vimrc以防有冲突...

syntax on

":set whichwrap+=<,h
set whichwrap+=<,>,[,]

colorscheme koehler
noremap <tab> i
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk

nnoremap ; :
nnoremap : ;

set more                      " use more prompt
set autoread                  " watch for file changes
set number                    " line numbers
set noautowrite               " don't automagically write on :next
set lazyredraw                " don't redraw when don't have to
set showmode
set showcmd
set nocompatible              " vim, not vi
set autoindent smartindent    " auto/smart indent
set smarttab                  " tab and backspace are smart
set tabstop=4                 " 6 spaces
set shiftwidth=2
set scrolloff=5               " keep at least 5 lines above/below
set sidescrolloff=5           " keep at least 5 lines left/right
set history=200
set backspace=indent,eol,start
set linebreak
set cmdheight=2               " command line two lines high
set undolevels=1000           " 1000 undos
set updatecount=100           " switch every 100 chars
set complete=.,w,b,u,U,t,i,d  " do lots of scanning on tab completion
set noerrorbells              " No error bells please
set visualbell t_vb=            " and don't make faces
filetype on                   " Enable filetype detection
filetype indent on            " Enable filetype-specific indenting
filetype plugin on            " Enable filetype-specific plugins
set wildmode=longest:full
set wildmenu                  " menu has tab completion
set laststatus=2

set incsearch                 " incremental search
set ignorecase                " search ignoring case
set hlsearch                  " highlight the search
set showmatch                 " show matching bracket
set diffopt=filler,iwhite     " ignore all whitespace and sync

  if v:version >= 700
    " Enable spell check for text files
      autocmd BufNewFile,BufRead *.txt setlocal spell spelllang=en
      endif

      " mappings
      " toggle list mode
      nmap <LocalLeader>tl :set list!<cr>
      " toggle paste mode
     nmap <LocalLeader>pp :set paste!<cr>
nimxete2

nimxete21#

您的.vimrc中的下列行发生恩怨。将该行注解掉可能会修正这个问题。

set nocompatible              " vim, not vi

而对于自动换行,我建议你使用这一个,并使用更多的hl比左箭头和右箭头键:

set whichwrap+=<,>,h,l,[,]
fhg3lkii

fhg3lkii2#

问题是把set nocompatible放在vimrc的中间(我也犯了同样的错误)。
实际上是nocompatible is set when a vimrc is detected,但set nocompatible有一个副作用,即将所有选项重置为默认值。
:help nocompatible开始:
这是一种特殊的选项,因为当它被设置或重置时,其他选项也会作为副作用而更改。
注意:设置或重置此选项可能会产生许多意外的影响:Map会以另一种方式解释,撤消的行为也会有所不同,等等。如果在vimrc文件中设置了此选项,则可能应该将其放在最开始。

相关问题