Autocomplete over multiple lines
-
Hey,
Let’s say we have a file with this :
$Test1 = strstr('my text to search in at First', 'e'); $Test2 = strstr('my text to search in If it is possible', 'e'); $Test3 = strstr('my text to search in', 'e');
I want to replace strstr by strpos, but i don’t want to use the simple search/replace, because I have other lines with the same function and i’ll have to keep them.
I can select “strstr” on these lines with [ALT]+[MAJ] then start to write “strp”.If I do, and press [CTRL]+[ENTER], nothing happens.
If I press [ENTER] only, it will create and go to next line.Would it be possible to get a shortcut doing it please ?
Like [CTRL]+[MAJ]+[V] for instance -
@romain-bocquiau said in Autocomplete over multiple lines:
I want to replace strstr by strpos, but i don’t want to use the simple search/replace, because I have other lines with the same function and i’ll have to keep them.
I can select “strstr” on these lines with [ALT]+[MAJ] then start to write “strp”.
If I do, and press [CTRL]+[ENTER], nothing happens.
If I press [ENTER] only, it will create and go to next line.
Would it be possible to get a shortcut doing it please ?This is possible, you just need to set SCI_AUTOCSETMULTI to
SC_MULTIAUTOC_EACH
. You can do this with the PythonScript plugin at startup:ed.autoCSetMulti(MULTIAUTOCOMPLETE.EACH)
or any other of your favorite scripting plugins.
Cheers.
-
Maybe more complete, for PythonScript?:
from Npp import * editor.autoCSetMulti(MULTIAUTOCOMPLETE.EACH)
-
In v8.2 and earlier, the auto-completion was always completed by typing either
ENTER
orTAB
, and there was no way to make either of those keys work as actual text input, so you had to typeTAB TAB
orENTER ENTER
if you wanted the next character to be inserted as a literalTAB
orENTER
(which I often wanted, so I have had to have auto-completion feature disabled for years, because I was more likely to want a literalTAB
orENTER
than to want the auto-completed text by the time I hitTAB
orENTER
)Ctrl+Enter
never was the auto-complete key, so I’m not sure why you (and others) have started saying that it should work.In v8.2.1 and v8.3, the new feature was added to disable
ENTER
and/orTAB
for the completion-selection key; this setting could be changed using Settings > Preferences > Auto-Completion☑ TAB
and☐ ENTER
, and was mentioned in the release notes (the change.log that opened when you installed or upgraded to v8.2.1). This change was necessary and good, because it allows users to pick which of the completion-keys will select the chosen auto-complete text (and allowed me to finally start using auto-completion, after years of not being able to).Unfortunately, by default it was set to
☑ TAB
(on) and☐ ENTER
(off), and users rebelled at the change in behavior. Due to the rebellion, the default was changed back to both being enabled by default on v8.3.1-RC1, but can still be changed in the GUI settings.But if you have v8.2.1 or v8.3 (or if you ever ran them, so they wrote the config file), the “default” will not override the saved setting (because the “default” has no way of knowing whether you intentionally set your
config.xml
to☑ TAB
(on) and☐ ENTER
(off), or whether that just happened to be the default that you don’t want). If you have installed one of those intermediate versions, you will have to go to Settings > Preferences > Auto-Completion and enable☑ ENTER
to get ENTER as the completion key. Or you can choose to learn to use TAB as the completion key, which is the more common completion key across Windows products (for example, it’s what’s used in MS Office products). (Please note that updating from v8.2.1 or from v8.3 to v8.3.1 will not change the configuration if you ever ran in v8.2.1 or v8.3 … you will have to change the setting yourself). -
Interesting. I interpreted your request as the auto-complete wasn’t working right. The others interpreted your request as wanting a way to multi-select the text so you can type it all.
Apparently, your phrasing can be interpreted in multiple ways.
If you wanted one or the other, hopefully our answers are good enough. If you really want both, please note that auto-completion will not work right with multi-select or column select (it will pop up, but the auto-completed text will only show up on one occurrence of the multi-or-column select). So if you’ve got multi-select or column-select, type the whole word rather than relying on auto-completion.
Good luck.
-
Hi, @romain-bocquiau, @peterjones, @michael-vincent, @alan-kilborn and All,
Peter, I think that the
BetterMultiSelection
plugin, of @dail, allows and keeps themulti
orcolumn selection
on several lines, together with theauto completion
feature ! Just tested !Best Regards,
guy038
-
Hi all,
@guy038 said in Autocomplete over multiple lines:
Hi, @romain-bocquiau, @peterjones, @michael-vincent, @alan-kilborn and All,
Peter, I think that the
BetterMultiSelection
plugin, of @dail, allows and keeps themulti
orcolumn selection
on several lines, together with theauto completion
feature ! Just tested !Best Regards,
guy038
It was exactly what i needed. thank you.