J A G P R E E T wrote:
[...]
Furthermore I checked <C-left> shows the definition for the variable under
cursor.
[...]
Oh! I missed this.
The default action for Ctrl-Left is to go to the previous word in the file.
Maybe the mapping which "shows the definition for the variable" is defined
after the one in your vimrc (in a plugin maybe)?
That is easy to check in Vim 7 (but not so easy in Vim 6):
:verbose map <C-Left>
will (in Vim 7) tell you which script (if any) defined the mapping.
If the mapping is set in a plugin, the trick is to define your own mapping
after it.
For a global plugin,
autocmd VimEnter * map <C-Left> :tabprev<CR>
autocmd VimEnter * map <C-Right> :tabnext<CR>
(in your vimrc) will do the trick. For a filetype-plugin (let's assume
$VIMRUNTIME/ftplugin/c.vim for the sake of argument) you need to create an
after-plugin:
--- start ~/.vim/after/ftplugin/c.vim ---
map <buffer> <C-Left> :tabprev<CR>
map <buffer> <C-Right> :tabprev<CR>
--- end ~/.vim/after/ftplugin/c.vim ---
Your after-plugin should have the same name and be at the same location in a
directory tree later in 'runtimepath' than the culprit. (~/.vim/after is for
Unix; on Windows use ~/vimfiles/after instead.) Create the file and its
directory if they don't already exist. Note that a well-behaved
filetype-plugin should use "map <buffer>" and not just "map", "setlocal" and
not just "set" etc. to avoid interference with files of other filetypes which
could be edited in split windows.
Best regards,
Tony.