Reputation: 840
When I'm in normal mode, the cursor works as I expected - consider the following situation:
If I press down 4 times, the cursor will move to this position:
However, when I do the same thing in insert mode, the cursor goes there:
The question is: is this behavior correct? If yes, what is the reason behind it and how can I change it (if possible)?
My short .vimrc:
set tabstop=4
set softtabstop=4
set shiftwidth=4
set smartindent
set mouse=a
set number
set ai
set nowrap
set viminfo='100,<5000,s1000
Upvotes: 4
Views: 326
Reputation: 840
This issue kept irritating me for a while now, and today I found this answered question on the same topic:
The answer is not exactly precise (following it precisely yielded errors in vim during runtime), however I managed to modify it to work correctly. Below is change I've done:
In file responsible for highlighting matching parentheses, /usr/share/vim/vim74/plugin/matchparen.vim
, at lines 90-100, there is the following piece of code:
let has_getcurpos = exists("*getcurpos")
if has_getcurpos
" getcurpos() is more efficient but doesn't exist before 7.4.313.
let save_cursor = getcurpos()
else
let save_cursor = winsaveview()
endif
The problem lies in getcurpos()
function - for some reason it doesn't seem to work correctly. Thus, I added override in after the first line of that code:
let has_getcurpos = 0
This works around the problem.
Upvotes: 2