3 Newbie questions: cursor and folder margin disappeared and selective line editing in a file
-
-
My cursor has disappeared. How do I unhide it again?
-
In Notepad++ I have the fold margin that seems to arbitrarily appear or disappear depending on the file being edited and I’m only editing two file types: *.lua and *.bp (a lua file with a different file extension). Google search is frustrating. How do I permanently or globally display the fold margin so that it will always allow me to expand or contract curly brackets?
-
Is there a way to display or edit selected lines only in a file in Notepad++? For example in the Xedit editor (used in mainframe computers), the command ‘all /Health/’ will only display all lines with the word ‘Health’ only and only these lines can be edited or replaced. Is this available in Notepad++? What about a command which will delete all lines containing a specified string only?
Thank you.
-
-
@George-Jereza said in 3 Newbie questions: cursor and folder margin disappeared and selective line editing in a file:
- My cursor has disappeared. How do I unhide it again?
I’ve never seen the cursor disappears. Notepad++ doesn’t hide it. https://npp-user-manual.org/docs/preferences/#editing describes how to change the cursor width; that might make it more visible.
Or maybe a plugin is interfering; ?-menu Debug Info could tell us what plugins you have, and will tell us more about your setup.
- In Notepad++ I have the fold margin that seems to arbitrarily appear or disappear depending on the file being edited and I’m only editing two file types: *.lua and *.bp (a lua file with a different file extension). Google search is frustrating. How do I permanently or globally display the fold margin so that it will always allow me to expand or contract curly brackets?
That sounds like a plugin is interfering, or you’ve got a huge, hard-to-parse source file.
- Is there a way to display or edit selected lines only in a file in Notepad++? For example in the Xedit editor (used in mainframe computers), the command ‘all /Health/’ will only display all lines with the word ‘Health’ only and only these lines can be edited or replaced. Is this available in Notepad++?
Nope.
What about a command which will delete all lines containing a specified string only?
- Search > Replace
- Find What:
(?-s)^.*string.*\R
- Replace With: (leave empty)
- Search mode: regular expression
-
@PeterJones said in 3 Newbie questions: cursor and folder margin disappeared and selective line editing in a file:
@George-Jereza said in 3 Newbie questions: cursor and folder margin disappeared and selective line editing in a file:
- My cursor has disappeared. How do I unhide it again?
I’ve never seen the cursor disappears. Notepad++ doesn’t hide it. https://npp-user-manual.org/docs/preferences/#editing describes how to change the cursor width; that might make it more visible.
Or maybe a plugin is interfering; ?-menu Debug Info could tell us what plugins you have, and will tell us more about your setup.
- In Notepad++ I have the fold margin that seems to arbitrarily appear or disappear depending on the file being edited and I’m only editing two file types: *.lua and *.bp (a lua file with a different file extension). Google search is frustrating. How do I permanently or globally display the fold margin so that it will always allow me to expand or contract curly brackets?
That sounds like a plugin is interfering, or you’ve got a huge, hard-to-parse source file.
- Is there a way to display or edit selected lines only in a file in Notepad++? For example in the Xedit editor (used in mainframe computers), the command ‘all /Health/’ will only display all lines with the word ‘Health’ only and only these lines can be edited or replaced. Is this available in Notepad++?
Nope.
What about a command which will delete all lines containing a specified string only?
- Search > Replace
- Find What:
(?-s)^.*string.*\R
- Replace With: (leave empty)
- Search mode: regular expression
I’m a total newbie to Npp. I have no idea how or what plug-ins are installed in Npp. It looks like I have to rtfm.
Thanks for the cursor tip. It helped a lot. I’m hopeful for Npp and won’t give up yet. I’d like to start from scratch but would like to avoid re-installing Npp. Is there a switch in Npp that would return everything back to default settings? I’m not understanding why a button like that is not in the Preferences menu or somewhere given that there are so many preference choices available to screw up the Npp experience.
-
@George-Jereza said in 3 Newbie questions: cursor and folder margin disappeared and selective line editing in a file:
I have no idea how or what plug-ins are installed in Npp. It looks like I have to rtfm.
Or at least read my post. Where I said that “?-menu Debug Info could tell us”. Since you didn’t understand it, by that phrase, I was trying to tell you go to the ?-menu (which is the rightmost menu entry on the main menu bar), then click on the words Debug Info, which would pop up a dialog that gives lots of useful information including the plugins on a line that’s prefixed by “Plugins:”, plus some underlined text that says “Copy debug info into clipboard” which copies the debug info that you can see into your clipboard, which you could then paste into your reply:
Notepad++ v8.1.2 (64-bit) Build time : Jul 16 2021 - 01:59:50 Path : C:\usr\local\apps\npp\npp.8.1.2.portable.x64\notepad++.exe Command Line : Admin mode : OFF Local Conf mode : ON Cloud Config : OFF OS Name : Windows 10 Home (64-bit) OS Version : 2009 OS Build : 19043.1110 Current ANSI codepage : 1252 Plugins : mimeTools.dll NppConverter.dll NppExport.dll
Since you don’t know how to install plugins or find out what ones you have (rtfm: https://npp-user-manual.org/docs/plugins/), there’s a good chance you won’t have any (other than the three default plugins that come with Notepad++, as shown in my example Debug Info). But you should follow those instructions anyway, because it might tell us some other useful clue about what’s going wrong for you.
As far as your second problem, with folding margins disappearing, that doesn’t usually happen in one of the builtin languages like Lua. Do you have an example of a small Lua file that shows this problem? Is it small enough that you could paste it in your reply, highlight it, then click the
</>
on the toolbar that you see while typing your reply (this will put it in a black text box)I’d like to start from scratch but would like to avoid re-installing Npp. Is there a switch in Npp that would return everything back to default settings?
Close Notepad++; open Windows explorer; go to the
%AppData%
folder (🛈 usuallyc:\users\username\AppData\Roaming
) and delete or rename the Notepad++ folder, and start Notepad++ (which re-populates the%AppData%\Notepad++
with default settings) -
@PeterJones Thank you very much for the quick reply. I did read your post but the ‘?’ threw me off. I thought you were also asking me a question.
Deleting the folder helped, and will allow me to re-start and try to figure out what I apparently did wrong. I’m assuming it was operator error. I’ll see if I can replicate the problem and will follow up with questions as necessary.
-
@PeterJones Here is a short sample file called ‘temp.bp’. It’s a lua file with a .bp file extension. To set up in npp, I simply selected lua in the language setting, and in the Preferences/Delimiter settings I changed to curly brackets (ie. changed to the { } pair) and checked, ‘allow several lines’. Below is the debug info also.
I was hoping to see the fold margin on the left side of the screen but it’s not showing up. Thank you.
–snip, snip–
–snip, snip–
Notepad++ v8.1.2 (64-bit)
Build time : Jul 16 2021 - 01:59:50
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line :
Admin mode : ON
Local Conf mode : OFF
Cloud Config : OFF
OS Name : Windows 10 Pro (64-bit)
OS Version : 2009
OS Build : 19042.928
Current ANSI codepage : 1252
Plugins : LuaScript.dll mimeTools.dll NppConverter.dll NppExport.dll -
How do I make the Document Map fonts in npp bigger like they have it in Microsoft Word’s Navigation Map (see below)?
-
@George-Jereza
If you refer to this DocumentMap
then the meaning is different. You should simply get a “feel”
where you are in a large file. And you can use it to jump to distant lines very quickly.If you are referring to actual text, then the first thing you need to understand is,
that Npp is a pure text editor and NOT a word processor.
Highlighting and the use of different fonts are only available for text
based on semantic rules defined and checked by the lexers used by Npp. -
@George-Jereza ,
It would have been nice if you’d also copy/pasted the text and clicked the
</>
button, like I asked. But when I retyped that whole thing, I didn’t see what you were seeing.Then I realized: you don’t actually have the Lua syntax highlighter selected for that
.bp
file, because there isn’t even the column for the folding indicator, and your numbers have no color to them. That is, it looks like this screenshot:
Notice that the lower left corner, and the Language menu, both indicate Normal Text rather than Lua. If you set Language > L > Lua,
Then you can see “Lua source file” in the lower-left and Language > L > Lua is indicated as selected in the menu system; further, if you look now
… you can see thattrue
is blue, as a known constant; the number values are orange; and there are fold markers in the left column.The reason why the
.bp
file doesn’t default to Lua is because that’s not a standard Lua extension. If.bp
files should always be “Lua” for you, then you need to tell Notepad++ this: go to the Settings menu, click Style Configurator; in the “Language” box on the left, select “Lua”; in the “User ext. :” box at the bottom, typebp
(no dot); then click save-and-close.
From now on, when you open a.bp
file, it will recognize it as Lua and highlight appropriately; further, if you create a new file and Save Assomething.bp
, it will also start hightlighting as Lua after the save is complete.Plugins : LuaScript.dll mimeTools.dll NppConverter.dll NppExport.dll
Given that your Debug Info showed Lua Script plugin is installed, I think you do know how to install a plugin … or at least, someone explained it to you at one point, because you have an extra plugin installed.
like they have it in Microsoft Word’s Navigation Map
Like @Ekopalypse said , the Notepad++'s Document Map isn’t quite the same feature as MSWord’s Navigation Map. MSWord’s Navigation Map uses word-processor HEADER# format indicators to create a navigatable Table of Contents. Notepad++'s Document Map just takes the whole document and shrinks to the tiniest font it can render, and shows a highlighted section to let you know what’s on screen by giving you an unreadable “overview”, so you can see approximately where in your document you are. If you don’t find that useful, don’t use it.
Notepad++ does have a feature called “Function List” (View > Function List will toggle it) which shows you the functions (and classes) in your source code. But since your
.bp
files appear to be using Lua syntax for just storing data structures[1] (kind of a Lua-based[2] config language similar to “JSON” – but using Lua syntax instead of JavaScript syntax), rather than as a full-blown programming language, then you don’t have any functions (or classes). If you did, it would make it easy to navigate to each function (which is as close as source files come to having “headers” from word-processing nomenclature).[1: Looks like a video-game config file to me. We’ve seen some search-and-replace queries in video-game configs recently. I wonder if there’s been one or more more easily-moddable games released recently.]
[2: I say “Lua-based” loosely, because the Lua syntax highlighter was not highlighting the comments, which a quick google tells me are actually--
indicated, not#
. So now I’m wondering if it’s really not Lua-based, or if it would be better to pick some other language for syntax highlighting for your.bp
blueprint files.] -
@Ekopalypse said in 3 Newbie questions: cursor and folder margin disappeared and selective line editing in a file:
@George-Jereza
If you refer to this DocumentMap
then the meaning is different. You should simply get a “feel”
where you are in a large file. And you can use it to jump to distant lines very quickly.If you are referring to actual text, then the first thing you need to understand is,
that Npp is a pure text editor and NOT a word processor.
Highlighting and the use of different fonts are only available for text
based on semantic rules defined and checked by the lexers used by Npp.@Ekopalypse Thank you for the reply. Yes, I’m very aware about the differences between text editors and word processors. My first programming course was fortran on old style ‘text editors’ called ‘punch cards’ and my very, very first ‘text editor’ in PC’s was ‘edlin’ I guess.
You have an excellent point about having a ‘feel’. But’ it’s hard to get a feel for a specific language or a program as a person ‘new’ to both.
-
@PeterJones said in 3 Newbie questions: cursor and folder margin disappeared and selective line editing in a file:
@George-Jereza ,
It would have been nice if you’d also copy/pasted the text and clicked the
</>
button, like I asked. But when I retyped that whole thing, I didn’t see what you were seeing.Then I realized: you don’t actually have the Lua syntax highlighter selected for that
.bp
file, because there isn’t even the column for the folding indicator, and your numbers have no color to them. That is, it looks like this screenshot:
Notice that the lower left corner, and the Language menu, both indicate Normal Text rather than Lua. If you set Language > L > Lua,
Then you can see “Lua source file” in the lower-left and Language > L > Lua is indicated as selected in the menu system; further, if you look now
… you can see thattrue
is blue, as a known constant; the number values are orange; and there are fold markers in the left column.The reason why the
.bp
file doesn’t default to Lua is because that’s not a standard Lua extension. If.bp
files should always be “Lua” for you, then you need to tell Notepad++ this: go to the Settings menu, click Style Configurator; in the “Language” box on the left, select “Lua”; in the “User ext. :” box at the bottom, typebp
(no dot); then click save-and-close.
From now on, when you open a.bp
file, it will recognize it as Lua and highlight appropriately; further, if you create a new file and Save Assomething.bp
, it will also start hightlighting as Lua after the save is complete.Plugins : LuaScript.dll mimeTools.dll NppConverter.dll NppExport.dll
Given that your Debug Info showed Lua Script plugin is installed, I think you do know how to install a plugin … or at least, someone explained it to you at one point, because you have an extra plugin installed.
like they have it in Microsoft Word’s Navigation Map
Like @Ekopalypse said , the Notepad++'s Document Map isn’t quite the same feature as MSWord’s Navigation Map. MSWord’s Navigation Map uses word-processor HEADER# format indicators to create a navigatable Table of Contents. Notepad++'s Document Map just takes the whole document and shrinks to the tiniest font it can render, and shows a highlighted section to let you know what’s on screen by giving you an unreadable “overview”, so you can see approximately where in your document you are. If you don’t find that useful, don’t use it.
Notepad++ does have a feature called “Function List” (View > Function List will toggle it) which shows you the functions (and classes) in your source code. But since your
.bp
files appear to be using Lua syntax for just storing data structures[1] (kind of a Lua-based[2] config language similar to “JSON” – but using Lua syntax instead of JavaScript syntax), rather than as a full-blown programming language, then you don’t have any functions (or classes). If you did, it would make it easy to navigate to each function (which is as close as source files come to having “headers” from word-processing nomenclature).[1: Looks like a video-game config file to me. We’ve seen some search-and-replace queries in video-game configs recently. I wonder if there’s been one or more more easily-moddable games released recently.]
[2: I say “Lua-based” loosely, because the Lua syntax highlighter was not highlighting the comments, which a quick google tells me are actually--
indicated, not#
. So now I’m wondering if it’s really not Lua-based, or if it would be better to pick some other language for syntax highlighting for your.bp
blueprint files.]@PeterJones Sorry for not providing text to the sample but thank you very much for re-typing the whole thing!
Yes, the sample file I showed you is a gaming file. And yes it is a lua file. The game is decades old with a very active modding community (‘mods’ are like add-ons or plug-ins).
I became familiar with Npp plugins after you provided me the link to the Npp manual and after I quickly scanned the Npp owner’s guide. I thought that a text editor that mentions the word ‘sex’ in its cover page has really something to offer and therefore worth checking out. Lol.
The reason why I thought I had a problem was because I did change the language setting in the Configuration Style but nothing instantly changed on screen unlike other settings. It was not clear that I had to quit Npp before the change would reflect onscreen.
BP is an acronym for BluePrint. It is a lua file. The game modders just extended the lua syntax by adding ‘#’ for comments.
https://wiki.faforever.com/index.php?title=Modding
Btw, if you or anyone is stressed out, I found that this particular game, --having real physics in its ballistics (eg. nukes, artillery, etc.) and is very moddable might help take your mind off more serious stuff. In my opinion shared by lots of others, it’s the only real time strategy game that and still exists. There’s lots and lots of videos in YouTube on the game.
Thank you for your help and excellent reply.