Sunday, August 15, 2010

Re: Python indenting of '#'

On 16/08/10 05:45, meino.cramer@gmx.de wrote:
> AK<andrei.avk@gmail.com> [10-08-16 05:40]:
>> On 08/15/2010 11:27 PM, meino.cramer@gmx.de wrote:
>>> Hi,
>>>
>>> after surfing the web for python related help for vim
>>> I found several sites with different versions of "the best
>>> way" to handle python files in vim.
>>>
>>> There is one thing (besides other others, which I
>>> have't figured out yet ;) ) which I want to fix:
>>>
>>> Regardless how deep the level of indentation is --
>>> as soon as I press '#' to comment something, the
>>> curor jumps to column 0 and forget all indentation
>>> levels which were valid just before entering the
>>> '#'.
>>>
>>> Since I use to comment my code....
>>>
>>> Is there any way to circumvent this problem ...
>>> may be to fix it for shell scripts in one
>>> turn too?
>>>
>>> Thanks a lot for any help in advance!
>>> Best regards,
>>> mcc
>>>
>>>
>>>
>>>
>>
>> I really recommend using NERDCommenter script instead. However
>> there is also a fix for manual commenting, add:
>>
>> inoremap # x^H#
>>
>> to .vimrc, where ^H is inserted by pressing ctrl-v and then backspace.
>>
>>
>> -ak
>>
>> --
>> Python plugins for vim: outliner, todo list, project manager,
>> calendar,
>> expenses tracker, sortable table, and more |
>> http://lightbird.net/pysuite/
>>
>> --
>> You received this message from the "vim_use" maillist.
>> Do not top-post! Type your reply below the text you are replying to.
>> For more information, visit http://www.vim.org/maillist.php
>>
>
> Hi Andrei,
> thanks for your reply! :)
>
> The ignoremap-command will fix the problem for shell scripts and
> python or for all files I will load into vim?
>
> Best regards,
> mcc
>
>

If it's a global mapping, then for all files.

If it's a buffer-local mapping (with <buffer> between inoremap and #)
defined in ~/.vim/after/python.vim (for Unix, and these directories and
file don't need to exist until or unless you have something to put in
them), then it applies only to Python sources.

And there's no g in inoremap, the i means "insert mode", see :help
map-overview


Best regards,
Tony.
--
Some people are born mediocre, some people achieve mediocrity, and some
people have mediocrity thrust upon them.
-- Joseph Heller, "Catch-22"

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: