自动换行-使用.vimrc进行光标换行



我似乎无法在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>

.vimrc中的以下行存在冲突。注释掉这一行可能会解决这个问题。

set nocompatible              " vim, not vi

对于自动换行,我建议您使用这个,并且使用更多的hl,而不是左侧的&右方向键:

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

问题是将set nocompatible放在vimrc的中间(我犯了同样的错误)。
实际上,nocompatible是在检测到vimrc时设置的,但set nocompatible有一个副作用,即将所有选项重置为默认值。

From :help nocompatible:

这是一种特殊的选项,因为当它被设置或重置时,其他选项也会作为副作用被改变。

注意:设置或重置此选项可能会有很多意想不到的effects:映射以另一种方式解释,undo行为不同,等等。如果您在vimrc文件中设置了这个选项,您就可以也许应该把它放在开头。

最新更新