William O'Higgins Witteman wrote:
On Wed, Aug 23, 2006 at 06:58:47PM +0200, A.J.Mechelynck wrote:
William O'Higgins Witteman wrote:
When coding in Python, I have a little mapping which helps me create
function declarations (and something similar for class definitions too).
It looks like this:
inoremap def def ():<cr><tab>""""""<up><left><left><left>
On Linux, it works perfectly - my ts = 2, and I get this when I type
"def ":
def |():
""""""
Where the pipe character is the cursor.
However, with Windows, and a nearly identical _vimrc, when I use the
above mapping I get 4 spaces (expandtab is set) before the quotation
marks, instead of two. Typing a tab still moves me two spaces, so ts=2
is still set, but I'm getting too big a tab in this mapping. All of the
places where I declare a <tab> generate the same behavior.
What does Vim answer to
:filetype
Interesting. On Linux it is detection and plugin on, and indent off
(even though "set autoindent") is in my RC file. On Windows all three
are on.
? Maybe the settings are different on both systems. Or if they are the
same, maybe you are using different versions of
$VIMRUNTIME/ftplugin/python.vim and/or $VIMRUNTIME/indent/python.vim --
check the "Last Change" date in a comment near the top of each script.
There are some differences. I am moving towards one vimrc that I can
use on any system, but I'm not there yet. What I find odd is that <tab>
takes up 4 spaces on Windows, when ts=2.
It might be a consequence of the fact that filetype-indenting is ON on
Windows. (That setting, when ON, takes precedence over 'autoindent'.) To
set it OFF, use
:filetype indent off
Best regards,
Tony.