![]() You also can modify the configuration file to specify whether to use automatic indenting ( set autoindent), whether to let the editor create automatic backups ( set backup), and many other things. This allows you to use the mouse to place the cursor, set the mark, and execute shortcuts. For example, if you want to enable the mouse in nano, uncomment the set mouse option. While you’re there, you might want to tweak other settings, too. ![]() To force this behavior globally (for all users), open the nanorc file for editing as root nano /etc/nanorcĪnd uncomment the following line: set speller "aspell -x -c" Alternatively, you can force nano to use the aspell program instead. By default, nano uses its own interactive spell checker that requires the spell program to be installed on your system. To view the current word count, press the Alt D. Then you can choose whether you want to replace only the first match found or all occurrences of the search string.Īlthough nano is not designed to replace a dedicated word processor, it has both word count and spell-checking features, which make it a perfect tool for drafting articles or taking notes (Figure 2). To perform the search and replaceĪction, press Ctrl \, specify a search string and its replacement, and press Enter. To find the same string again, press Ctrl W again and hit Enter. Performing a text search in nano is also easy: Hit Ctrl W, enter the search string, and press Enter. You can then paste the snippet using the Ctrl U shortcut. If you need to cut a single word or a text fragment, press Ctrl 6 or Alt A, select the text you want, then press Ctrl K to cut it. To move multiple lines, cut them using the Ctrl K shortcut, then paste them all together by pressing Ctrl U. To paste the line, place the cursor where you want to insert the line and press Ctrl U. Like any text editor worth its salt, nano supports cut and paste actions. Nano shows the name of the file you are currently editing at the top of the screen As an alternative, you can pass the filename to the command to open the file when the program launches: nano. To create a new file, you just launch the editor by typing nano at the command line. If you exit nano from a modified file, it will prompt you to save it first. You can periodically save the file during editing using the Ctrl O shortcut. Which key is defined as Meta depends on your system in most cases, it’s either the Esc, Alt, or Windows key (we use Alt in this HowTo). Some functions are accessible via the meta key (shown as M- in the onscreen Help). The circumflex (^) represents the Ctrl key – the shortcut Ctrl G displays Help, for example. Keyboard shortcuts are shown at the bottom of the screen. For more info about nanorc, type man nanorcįrom now on, if you open Nano all your setups will be taken into account.Figure 1: The nano editing program.(dot) before the name of the file, I do so to make the file hidden. Save the file by doing Ctrl X and hint Y (for yes). nanorc and add as many rules as you can following the example below: But you can also create one for your own in your home (run cd ~ if not in home) that will overwrite global configurations.įrom the CLI, run nano. There’s one global file located at /etc/nanorc. nanorc? It’s a file that contains configurations for… Nano. Permanently set customization rules with. Need to see other available options? Type man nano on the terminal.Īre you satisfied with these preview customizations? Now is the time to ![]() Some other options are: -i (autoindent), -l (display line numbers to the left of the text area). Note: mouse support is not available on a full command line system. By default, the mouse is not supported on the console. It means that mouse clicks can be used to place the cursor, set the mark (with a double click), and execute shortcuts. You just need to add option(s) when calling Nano on your terminal as this:Īs you can see in the image above, we will be opening the fizzbuzz.py file with the mouse support enabled on the command line. You need to try/preview the customization before setting it permanently. But, do you know that with a little effort you can have most of their features in Nano?įirst thing first. Truth be told, these editors have some really great features. Think about making your Nano more enjoyable? This is a step by step guide on how to do so.īy default, Nano looks ugly and most people fear or can’t use it at all and prefer to go for Vi/ Vim or Emacs.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |