Customize Nano Text Editor
Shafi
Posted on July 5, 2022
Nano is a great text editor that is available in every linux distros by default. Here's a few configs that would make your experience with nano even better!
To use the features listed below, you need to edit the .nanorc
file in your home directory.
You can open the terminal and write nano .nanorc
to access the configurations file.
Position Cursor With Mouse Click
Mouse clicks can be used to place the cursor, set the mark (with a double click), and execute shortcuts. Text can still be selected through dragging by holding down the Shift key.
set mouse
Set the Tab Size
Set the size (width) of a tab to number columns. The value of number must be greater than 0. The default value is 8.
set tabsize 2
Replace Tabs With Spaces
set tabstospaces
Keep Track of Cursor Location for Recently Closed Files
For the 200 most recent files, log the last position of the cursor, and place it at that position again upon reopening such a file.
set positionlog
Wrap Lines
Display over multiple screen rows line that exceed the screen's width. (You can make this soft-wrapping occur at whitespace instead of rudely at the screen's edge, by using atblanks
.
set softwrap
set atblanks
Auto Indentation
Automatically indent a newly created line to the same number of tabs and/or spaces as the previous line.
set autoindent
Display Line Numbers
Display line numbers to the left of the text area.
set linenumbers
Display Scrollbars
Display a "scrollbar" on the righthand side of the edit window. It shows the position of the viewport.
set indicator
Posted on July 5, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.