Select predefined parameter strings for .ini Files
-
Hello everyone!
i am working in Software Development, where we just discussed about a ways to facilitate our usability for customers. We are extremely reliant on .ini Files, almost all of our settings are written down in .ini Files.
So i’d like to ask if something like an auto-selection for parameters in .ini Files is possible for Notepad++.
For example, you have an .ini file like this:
test.ini
parameter1=
parameter2=
parameter3=So, for parameter1, you can click behind the “=” mark, type “TAB”, there is a group of proposals for this parameter, let’s say the strings “None”, “Full”, “Periodic”. You can write down the possible strings associated to this parameter in an *xml file.
Is there any Notepad++ solution for this? Or maybe a plugin which can realize this?
All the best,
Dog Fish
-
Test the plugin
snippet
, I think it will suit you for these purposes -
if you meant, that you want to type the letters TAB, and you get an autocomplete list, where you select your parameter (your choice of being with or without double-quotes) and it will replace the letters TAB, once you double click on a proposed option:
yes, you can do that yourself with the built in user defined languages (udl) which produces the result you can see at the screenshot below.
you will have to create a new custom udl at
language > define your language > create new
, with the colours and keywords, etc of your choice.
in this example i named the udlINI (AutoComplete)
then save this xml code to
YourPathTo\Notepad++\autoCompletion\INI (AutoComplete).xml
.
note: the .xml file has to be given the exact name as your udl, plus the .xml file extension<?xml version="1.0" encoding="Windows-1252" ?> <!-- @title: INI (AutoComplete).xml @author: The Notepad++ Community - https://notepad-plus-plus.org/community/ @version: 19.3.8 --> <NotepadPlus> <AutoComplete> <KeyWord name='TAB None'/> <KeyWord name='TAB Full'/> <KeyWord name='TAB "Periodic"'/> </AutoComplete> </NotepadPlus>
feel free to play around with it.
it’s best if you try out some udl features and options for a while to get a basic grip of udl, as this will help you asking your next questions with more knowledge and maybe even more ideas that might come up while testing.also because if you don’t really need the letters
TAB
, and just use them to trigger the suggestions, it could be better to autocomplete the words None, Periodic and Full directly, e.g. typing an F to show Full as option, as well as anything else that starts with an F you might need.(unless you want to force-categorise, so the letters TAB will suggest all possible TAB options only, and another category, let’s name it POP, will show only options relevant for POP)
-
Thank you for this detailed answer! Sorry, i meant “press TAB” not “type TAB” , i think that was a bit confusing for you.
-
additional note:
if you don’t need any custom colouring or highlighting, and the default built in INI File highlighter suits your needs as it is, you can also save the autoCompletion code from above asini.xml
to your autoCompletion folder. -
Thank you for this detailed answer! Sorry, i meant “press TAB” not “type TAB” , i think that was a bit confusing for you.
yes it was, but who knows, we get all kinds of requests ;-)
in this case, i would suggest not to do it with a tab key, but with a complete line auto completion.
this is usually faster, as you just type the first few letters, e.g.para
, and it will give you your defined options for the whole line, as seen at the screenshot below:another reason is, because we can not use [tab] key as a trigger for the built in autocompletion suggestion list.
the new
INI (AutoComplete).xml
code template (orini.xml
code template, if you are satisfied with the built in ini highlighter) would be:<?xml version="1.0" encoding="Windows-1252" ?> <!-- @title: INI (AutoComplete).xml @author: The Notepad++ Community - https://notepad-plus-plus.org/community/ @version: 19.3.8b --> <NotepadPlus> <AutoComplete> <KeyWord name='parameter1="None"'/> <KeyWord name='parameter1="Periodic"'/> <KeyWord name='parameter1="Full"'/> <KeyWord name='parameter2="None"'/> <KeyWord name='parameter2="Periodic"'/> <KeyWord name='parameter2="Full"'/> </AutoComplete> </NotepadPlus>
as an alternative, you can try out the
Snippets
plugin, as suggested by @andrecool-68 .
it is available at the built inplugins > plugins admin
menu, if you are on notepad++ 7.6 to 7.6.4.
but configuring this plugin will be more work.
https://nppsnippets.readthedocs.io/en/latest/ -
@Meta-Chuh said:
if you meant, that you want to type the letters TAB
LOL. That interpretation is just INSANE. :)
-
type “TAB”
it would be less fun, if i’d stop treating requests completely literarily from time to time 😉
also it’s a nice playground, as the notepad++ autocompletion has this nice function to actually replace the typed place holder, as soon as a selection is made.
-
@Meta-Chuh said:
it would be less fun, if i’d stop treating requests completely literarily from time to time 😉
also it’s a nice playground, as the notepad++ autocompletion has this nice function to actually replace tHey, i just tried it out and i must say that it did unfortunately not work out. Here are the things i tried:
-Created a UDL named “AutoIni” and exported the language as an *.xml file in C:\Program Files (x86)\Notepad++\autoCompletion
-Settings --> Preferences --> Auto-Completion: Checked “Function completion”
-Selected the correct language in Notepad++Also, i tried some additional things like adapting the ending of a file to .AutoIni and copied the .xml File in the same directory as the .AutoIni file
Which Notepad++ Version / Windows Version did you use for your example? Mine is Windows10 Pro and Notepad++ Version 7.6.4
-
okay now i reinstalled x64 and it works, thank you issue is solved!