So here are my problems. Say I have a Python file and I type a very long line, for example, the last:
class SomeClass(object): def some_method(self): some_variable = SomeOtherClass.some_other_method(some_parameter=some_value)
When I type this in Vim, this happens:
class SomeClass(object): def some_method(self): some_variable = SomeOtherClass.some_other_method(some_parameter=some_value)
This is not just bad style, it breaks down PEP8. I would like to:
class SomeClass(object): def some_method(self): some_variable = SomeOtherClass.some_other_method( some_parameter=some_value)
This corresponds to PEP8 . (For the purpose of this discussion, I'm interested in the behavior of line breaking, not the indentation behavior.)
Edit: breakat only works with linebreak to control the display of lines. It does not work (apparently) in conjunction with textwidth to determine where hard line breaks are inserted. So my idea below will not work ...
Surprisingly, I did not find anything, indicating that others share this problem, which makes me think that I am doing something wrong. However, my idea was to add a character ( to the breakat setting (along with [ and { when I was on it).
I have tried this; here's the output :set breakat :
breakat= ^ I!@ *-+;:,./?([{
However, this is unsuccessful. No matter what I do, Vim insists on breaking after the "=" above. I have the same problem with long function names where it will break right after def .
Here is the full contents of my .vimrc:
set nobackup set nowritebackup set noswapfile set columns=80 set tabstop=4 set shiftwidth=4 set softtabstop=4 set autoindent set smarttab set smartindent set textwidth=80 set wrap set breakat=\ ^ I!@ *-+;:,./?\(\[\{ filetype indent on filetype on filetype plugin on
(I do not have plugins, etc. installed to figure this out.)
Does anyone know how I can get Vim to submit to adjusting my gap or any other thoughts on the best way to deal with this behavior?