Question

I can't seem to get cursor wrapping to work in vim 7.3. I've tried suggestions found elsewhere, including the following, which have no effect:

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

Any suggestions? I've included my .vimrc in case there is a conflict...

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>
Was it helpful?

Solution

The following line in your .vimrc is a conflict. Commenting out that line will probably fix the issue.

set nocompatible              " vim, not vi

And for automatic wrap, I suggest you use this one and use more of h and l than the left & right arrow keys:

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

OTHER TIPS

The issue is putting set nocompatible in the middle of your vimrc (I made the same mistake).
Actually nocompatible is set when a vimrc is detected, but set nocompatible has a side effect of resetting all options to default.

From :help nocompatible:

This is a special kind of option, because when it's set or reset, other options are also changed as a side effect.

NOTE: Setting or resetting this option can have a lot of unexpected effects: Mappings are interpreted in another way, undo behaves differently, etc. If you set this option in your vimrc file, you should probably put it at the very start.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top