autocomplete for complex svg tag
-
I tried to edit html.xml file within autoCompletion folder
I can add new tags like <KeyWord name=“rectNew” />
I want to write SVG tags faster including entire tag attributes that are often the same.
But I can’t add attributes to my tag.
I would expect that works like this:
<KeyWord name="rect x=‘0’ y=‘0’ " />
but it does not!
empty space works splitting the entire tags in different part of it. I can find x=0 in the option list but not autocompleted as wanted at once. -
Per the other thread you posted in minutes before this post, spaces in the autocomplete file haven’t worked since v6.5.3.
That other thread gave a workaround, which is to embed some other character, and then after auto-completion is done, replace that other character with the space.
For example, I added
<KeyWord name="rect nxa0x=0 nxa0y=0" />
to my
autoCompletion\html.xml
file, where 
is the numerical entity for the non-breaking space.When I reloaded and typed
rect
, the auto-complete popdown showsrect x=0 y=0
– but those space-like characters are really non-breaking spaces. Since the resulting SVG will not work with non-breaking spaces, you can then do a search/replace regex with Find=\xa0
(non-breaking space in regex character escape), Replace=\x20
(space in regex character escape) -
thx Peter
it sounds to me really dirty… other options? -
If that two-step process seems dirty to you, I am not sure I’d be able to recommend a process that would be “clean” in your opinion. But there are more ways to accomplish the same task, though not using the Auto-Completion feature of Notepad++ as it’s currently implemented
-
record a macro using the Macro menu: that macro would involve you typing the sequence, and saving it to a keystroke
- place the cursor where you want
- Macro > Start Recording
- type
rect x=0 y=0
- Macro > Stop Recording
- Macro > Save Current Recorded Macro, then give it a name and keyboard shortcut
- in the future, use that keyboard shortcut to insert the
rect x=0 y=0
-
Write your own plugin or PythonScript to help you automate frequent sequences that don’t work in auto-complete; for example, maybe have the Python script look for some special prefix (maybe
\|
) before at least 4 alphanumeric characters, and if it sees that, have it pop up your own auto-complete chooser based on those 4 characters: for example, maybe typing\|rect
would pop-up your chooser, then replace\|rect
withrect x=0 y=0
after you selected it from the dropdown. -
submit a feature request, per the feature-request/bug-report FAQ, which points to both the original thread and your duplicate thread here, and explains in clear words with examples what feature you want, and then be prepared to wait, and be willing to use a workaround in the mean time (because there is no guarantee of the feature being implemented, let alone being implemented in a quick turnaround time).
-
-
- A combo of my original search-and-replace suggestion and the first half of suggestion #2: use PythonScript to define a callback on the SAVE event, where PythonScript would then do a search-and-replace for all
\xa0
characters and replace them with\x20
(space) characters. That way, you could use the auto-complete as implemented, but have PythonScript “remember” to do the replace for you every time that you save.
I think #1 would be the easiest if you’re going to have just that one sequence with spaces. #4 will be easier if you have multiple space-containing sequences you want to autocomplete.
- A combo of my original search-and-replace suggestion and the first half of suggestion #2: use PythonScript to define a callback on the SAVE event, where PythonScript would then do a search-and-replace for all
-
Thanks a lot Peter, I tried Macro also and I found it simple and “clean enough”…