Last active
December 18, 2023 18:22
-
-
Save limitedeternity/9ecc79f2da9d80cfb1a1c152c2597f4d to your computer and use it in GitHub Desktop.
My Nano config (.nanorc)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enable built-in syntax highlighting | |
include "/usr/share/nano/*.nanorc" | |
include "/usr/share/nano/extra/*.nanorc" | |
# Make the Home key smarter. When Home is pressed anywhere but at the | |
# very beginning of non-whitespace characters on a line, the cursor | |
# will jump to that beginning (either forwards or backwards). If the | |
# cursor is already at that position, it will jump to the true | |
# beginning of the line. | |
set smarthome | |
# Make 'nextword' (Ctrl+Right) and 'chopwordright' (Ctrl+Delete) | |
# stop at word ends instead of at beginnings. | |
set afterends | |
# Spread overlong lines over multiple screen lines. | |
set softwrap | |
# When soft line wrapping is enabled, make it wrap lines at blanks | |
# (tabs and spaces) instead of always at the edge of the screen. | |
set atblanks | |
# Automatically indent a newly created line to the same number of | |
# tabs and/or spaces as the preceding line -- or as the next line | |
# if the preceding line is the beginning of a paragraph. | |
set autoindent | |
# Suppress the title bar and show the filename plus a cursor-position | |
# percentage in the space of the status bar. | |
set minibar | |
# Constantly display the cursor position in the status bar or minibar. | |
set constantshow | |
# Use cut-from-cursor-to-end-of-line by default. | |
set cutfromcursor | |
# Draw a vertical stripe at the given column, to help judge text width. | |
set guidestripe 80 | |
# Remember the cursor position in each file for the next editing session. | |
set positionlog | |
# Remember the used search/replace strings for the next session. | |
set historylog | |
# Display line numbers to the left (and any anchors in the margin). | |
set linenumbers | |
set numbercolor yellow,normal | |
# Enable vim-style lock-files. This is just to let a vim user know you | |
# are editing a file [s]he is trying to edit and vice versa. There are | |
# no plans to implement vim-style undo state in these files. | |
set locking | |
# Don't convert files from DOS/Mac format. | |
set noconvert | |
# Make status-bar messages disappear after 1 keystroke instead of after 20. | |
set quickblank | |
# Fix Backspace/Delete confusion problem. | |
set rebinddelete | |
# Do regular-expression searches by default. | |
# Regular expressions are of the extended type (ERE). | |
set regexp | |
# Use this tab size instead of the default; it must be greater than 0. | |
set tabsize 4 | |
# Convert each typed tab to the fitting number of spaces. | |
set tabstospaces | |
# Let an unmodified Backspace or Delete erase the marked region (instead | |
# of a single character, and without affecting the cutbuffer). | |
set zap | |
# Recognize _ as part of a word. | |
set wordchars "_" | |
##### Modern Nano Keybindings ##### | |
## M-U undo | |
## M-R redo | |
## ^-C copy | |
## ^-X cut | |
## ^-V paste | |
## ^-K delete line | |
## ^-bsp delete until word start (or M-bsp) | |
## ^-del delete until next word | |
## ^-L refresh and center cursor | |
## ^-S save file | |
## M-/ comment/uncomment | |
## M-V insert keystroke verbatim | |
## M-: record macro | |
## M-; play macro | |
## ^-Space autocomplete word | |
## M-C cursor position | |
## ^-W search forward (= M-W + prompt) | |
## ^-E seach backwards (= M-E + prompt) | |
## ^-R replace | |
## ^-up goto previous block | |
## ^-dn goto next block | |
## M-( goto block begin | |
## M-) goto block end | |
## ^_ goto line/coloumn number | |
## ^-G head of file (vim-like) | |
## M-G end of file | |
## M-up screen up one line | |
## M-dn screen down one line | |
## M-] goto matching bracket | |
## M-ins insert anchor | |
## M-pgup goto previous anchor | |
## ^-T terminal (eg. |xxd) | |
bind M-U undo main | |
bind M-R redo main | |
bind ^C copy main | |
bind ^X cut main | |
bind ^V paste main | |
bind ^K zap main | |
bind ^H chopwordleft all | |
bind F10 exit all | |
bind ^Z suspend main | |
bind M-/ comment main | |
bind ^Space complete main | |
bind M-C location main | |
bind ^E wherewas all | |
bind M-E findprevious all | |
bind ^R replace main | |
bind ^B pageup all # vim-like support | |
bind ^F pagedown all | |
bind ^G firstline all | |
bind M-G lastline all | |
# Fix Meta-Left/Meta-Right word skipping | |
# https://unix.stackexchange.com/a/392309 | |
unbind M-F all | |
unbind M-B all | |
bind M-F nextword all | |
bind M-B prevword all | |
bind M-1 help all # fix ^G been used | |
bind Sh-M-C constantshow main # fix M-C been used | |
bind Sh-M-F formatter main # fix M-F been used | |
bind Sh-M-B linter main # fix M-B been used |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment