有很多可供程序员使用的文本编辑器,但大多数人经常选择Notepad++作为 Notepad 的替代品,因为(Notepad)它免费、用户友好且功能丰富。如果您不熟悉Windows PC的(Windows PC)Notepad++,您应该知道可以编写不同的语言,包括 .html、.css、.php、.asp、.bash、.js 等。以下是一些您可以用来入门的Notepad++ tips and tricks
Notepad++ 提示和技巧
1]自动执行(Perform)某些事情
Notepad++最节省时间的功能,因为它可以让您多次重复执行一项任务,而无需再次执行。您可以录制宏(Macro)并自动执行动作。让我们假设您要替换不同文件中的特定文本并将其保存为特定格式。您只需要记录整个过程并在以后想要执行该任务时播放。可以根据需要保存尽可能多的宏。要录制宏(Macro),只需转到Notepad++导航菜单(navigation menu)中的宏(Macro )部分。
2]在特定浏览器中启动代码(Launch code)
假设您已经用HTML 和 CSS(HTML and CSS)编写了几行代码。现在,您想检查该页面的外观而不将其应用于实时网站。你有两个选择。首先(First),您可以使用相应的扩展名(此处为 .html)保存该代码,然后在任何 Web 浏览器中打开该文件。或者,您可以直接在特定浏览器中启动代码,而无需执行任何操作。只需(Just)写下您的代码,Run > Launch in Firefox/IE/Chrome/Safari。现在,该页面将直接在您所需的网络浏览器(web browser)中打开。
3]更改偏好
如果您认为Notepad++的默认界面(default interface)很无聊,需要进行一些自定义,那么您当然可以在不使用任何第三方软件或插件(party software or plugin)的情况下做到这一点。可以更改主题、字体系列、字体大小、字体样式、字体粗细、字体颜色、背景颜色(background color)等。如果您安装了第三方来源的字体,您仍然可以将其用作Notepad++中的默认字体(default font)。要更改首选项,只需单击Settings > Style Configurator。您将看到一个屏幕,您可以在其中选择前面提到的所有内容。选择您的偏好和地点(preference and place)同一页面上复选框中的勾号。否则,更改将不会生效。
4]创建(Create)和设置自己的Notepad++ theme
如果您不喜欢Notepad++默认主题(default theme),您可以根据自己的意愿制作一个,并将其设置为您的默认主题(default theme)。主要要求是您必须以 .xml 扩展名保存主题文件(theme file),并将其放在以下文件夹中:
C:\Users\user_name\AppData\Roaming\Notepad++\themes
不要忘记将user_name替换为您的实际用户名。完成此操作后,转到Settings > Style Configurator。您将在“选择主题(Select Theme )”下拉菜单中看到该主题。
5]快速打开(Open)最近打开的文件并更改数字
假设(Suppose),你有一个文件夹,里面装满了你的代码,你需要打开一个特定的文件。如果您必须走很长的路,那肯定需要时间。在这种情况下,您只需单击文件(File )并检查您最近打开的文件。您最多可以在列表中使用实际路径获取 15 个文件。如果您认为此功能很有用,并且想增加“最近打开”文件的数量,这里有一个增加或减少数量的技巧。打开Settings > Preferences。在“最近的文件历史记录”(Recent Files History)下,您将获得更改数字的选项。
6]在树视图中打开文件
如果你正在开发一个主题,显然有不止一个文件。打开和关闭特定文件夹中的不同文件非常困难。为了解决这个问题,Notepad++有一个很棒的功能,叫做Folder as Workspace,它可以帮助用户在树形视图中查看所有文件和文件夹。您可以在左侧看到一个侧边栏,可让您打开特定的文件夹和文件(folder and file)。要打开文件夹,请单击File > Open Folder as Workspace,然后选择要在树视图中显示的文件夹。
7]一次打开(Open)文件夹中的所有文件
如果你想在Notepad++中一次打开一个文件夹中的所有文件,你可以做两件事。您可以简单地打开一个文件夹,选择所有文件并按Enter。或者您可以单击File > Open Containing Folder > Explorer,选择文件并按Enter。这两个动作将执行相同的任务。
8]在多个文件中查找单词或文本(Find word or text)
假设(Suppose),你在写一个特定的单词时犯了一个错误。例如,您写的是ABC而不是XYZ。要查找所有错误书写的单词,您不必一次打开一个文件并检查它们。相反,您可以使用上述指南一次打开所有文件。然后,按Ctrl + F并转到“查找”(Find )选项卡。现在,写下您要查找的内容,然后点击Find All in All Opened Documents按钮。您将在Notepad++ window底部获得结果。从这里,您可以转到该特定文件并找到错误。
9]替换多个文件中的单词或文本(Replace word or text)
如果您想用其他单词替换特定单词或文本,请在多个文件中打开(word or text)Notepad++中的所有文件。按Ctrl + H,键入要替换的单词,在给定字段中输入新单词,然后单击Replace All in All Opened Documents。要一次保存所有文件,请按Ctrl + Shift + S。
10]并排查找更改
让我们假设您对特定文件进行了一些更改,或者假设您想要创建单个文件的两个实例。为此,请打开或创建要并排放置的文件或创建另一个实例。然后,右键单击选项卡并选择(tab and select) Clone to Other View。
10]制作文件编辑证明
如果您经常错误地按下按钮,当您并排放置两个文件时,这里有一个解决方案可以帮助您编辑特定文件并使其他文件不可编辑。右键单击要只读的文件选项卡,然后选择只读(Read Only)。
Notepad++可从其主页(homepage)(homepage)下载。
额外提示(Bonus Tip):您还可以使用Notepad++FTP 服务器(FTP server)。
Hope you find these Notepad++ tips useful.
Best Notepad++ Tips and Tricks you should use
There are plenty of text editors available for programmers, but most of the peoрle оften choose Notepad++ as an alternative to Notepad since it is free, user-friendly and feature-rich. If you are not familiar with Notepad++ for Windows PC, you should know that it is possible to write different languages including .html, .css, .php, .asp, .bash, .js, and more. Here are a few Notepad++ tips and tricks that you may use to get started.
Notepad++ Tips and Tricks
1] Perform certain things automatically
This is probably the most time-saving feature that Notepad++ has, since it will let you do a repeat a task more than once without actually doing it again. You can record a Macro and perform an act automatically. Let’s assume that you want to replace a certain text in different files and save it in a particular format. You just need to record the whole process and play it later whenever you want to perform that task. It is possible to save as many macros as you want. To record a Macro, just head over to the Macro section in the navigation menu of Notepad++.
2] Launch code in a particular browser
Let’s assume that you have written a few lines of code in HTML and CSS. Now, you want to check the look of that page without applying it on a live website. You have two options. First, you can save that code with the respective extension (here it is .html), and open the file in any web browser. Or, you can just launch the code in a particular browser without doing any of this. Just write down your code, select Run > Launch in Firefox/IE/Chrome/Safari. Now, the page will open directly in your desired web browser.
3] Change preference
If you think that the default interface of Notepad++ is boring, and it needs some customization, you can certainly do that without using any third party software or plugin. It is possible to change the theme, font family, font size, font style, font weight, font color, background color, and more. If you have installed a font from third party sources, you can still use it as your default font in Notepad++. To change the preferences, just click on Settings > Style Configurator. You will see a screen, where you can choose everything mentioned earlier. Select your preference and place a tick-mark in the checkbox on the same page. Otherwise, the change will not be effected.
4] Create and set own Notepad++ theme
If you do not like the default themes of Notepad++, you can make one according to your wish and set it as your default theme. The primary requirement is that you have to save the theme file with a .xml extension, and place it inside the following folder:
C:\Users\user_name\AppData\Roaming\Notepad++\themes
Don’t forget to replace user_name with your actual username. Having done this, go to Settings > Style Configurator. You will see the theme inside the Select Theme drop-down menu.
5] Open recently opened files quickly and change the number
Suppose, you have a folder full of your codes, and you need to open a particular file. It will certainly take time if you have to navigate a long path. At such times, you can simply click on File and check your recently opened files. You can get up to 15 files in the list with the actual path. If you think that this feature is useful, and you want to increase the number of “Recently Opened” files, here is a trick to increase or decrease the number. Open Settings > Preferences. Under the Recent Files History, you will get the option to change the number.
6] Open file in the tree view
If you are developing a theme, obviously there are more than one files. It is quite difficult to open and close different files in a particular folder. To solve this problem, Notepad++ has an awesome feature called Folder as Workspace, which helps users to view all the files and folders in the tree view. You can see a sidebar on the left-hand side that will let you open a particular folder and file. To open a folder, click on File > Open Folder as Workspace, and choose the folder that you want to show in a tree view.
7] Open all files in a folder at once
If you want to open all the files in a folder at once in Notepad++, you can do two things. You can simply open a folder, select all the files and hit Enter. Or you can click on File > Open Containing Folder > Explorer, select the files and hit Enter. Both actions will perform the same task.
8] Find word or text in multiple files
Suppose, you have made a mistake in writing a particular word. For instance, you have written ABC instead of XYZ. To find all the wrongly written words, you do not have to open one file at a time and check them. Instead, you can just open all the files at once using the guide mentioned above. Then, press Ctrl + F and go to Find tab. Now, write down what you want to find and hit the Find All in All Opened Documents button. You will get the result in the bottom of your Notepad++ window. From here, you can go to that particular file and find the error.
9] Replace word or text in multiple files
If you want to replace a particular word or text with some other word, in multiple files, open all the files in Notepad++. Press Ctrl + H, type the word you want replaced, and the new word in the given fields and click on the Replace All in All Opened Documents. To save all the files at once, press Ctrl + Shift + S.
10] Find changes side by side
Let’s assume that you have made few changes in a particular file or say you want to make two instances of a single file. To do this, open or create the file that you want to place side by side or make another instance. Then, right-click on the tab and select Clone to Other View.
10] Make a file edit-proof
If you often press buttons by mistake, here is a solution that will help you to edit a particular file and make other files edit-proof when you have placed two files side by side. Right-click on the file’s tab that you want to Read Only and then, select Read Only.
Notepad++ is available for download from its homepage.
Bonus Tip: You can also access FTP server using Notepad++.
Hope you find these Notepad++ tips useful.