Closed galou closed 9 years ago
Hello
Lately I've tried to fix an issue when the pair of brackets inserted (plus the placeholder) was expanded after the column equal to &textwidth
.
Could it be that you are not typing just void foo
, but something quite long and that the column of the cursor is within 4 columns to the one specified by &textwidth
when you hit the (
key ? (In that case I can reproduce your problem)
I'm afraid not. void foo
was the only text present on the line. What can also be is an incompatibility with another plugin (I think of YouCompleteMe for example). My vim configuration is on http://github/galou/dotvim.git. I'll try to test without any other plugin.
You can try to instrument autoload/lh/brackets.vim line 360.
If I'm not mistaken, you enter this case. You can try to save the various local variables (line
, open
and close
in g:globalvariables
or to print them along with &tw
to see how lh-brackets interprets your context.
I tried without other plugins (except NeoBundle and lh-brackets dependencies). I had the same behavior. Interestingly, on my "minimal" installation, I had the line-insertion behavior also on Python files, whereas on my production configuration, no line break was inserted in the middle of the line on Python files.
I'd be glad to help with testing but I have no idea how to do what you suggest (saving in g:globalvariables
or printing).
I think I know what went wrong.
I suspect that textwidth is 0 in your configuration ; which is a valid setting, but one I did not think about.
If you type :set tw?
vim answers 0, does it?
It should be fixed now.
Bravo Luc !
Indeed, tw == 80 with Python and tw == 0 with C++, what explains the behavior.
Thank your your quick fix ! I just tested it positively.
Hi,
thank you for providing this plugin.
I wanted to try it with a C++ file and here is what happens:
void foo
(
, my line gets broken into two lines and I get(
|
represent the cursor position).How can I avoid this behavior and obtain
?
Thanks for your help!