diff --git a/doc/nano.texi b/doc/nano.texi
index 03c7afb8e06aa8478fa49a9536faf468fe26f682..0f92495991f1d74db603be4b72d4e5d59a03db7e 100644
--- a/doc/nano.texi
+++ b/doc/nano.texi
@@ -1359,6 +1359,9 @@ Toggles smooth scrolling (when moving around with the arrow keys).
 @item softwrap
 Toggles the displaying of overlong lines on multiple screen lines.
 
+@item linenumbers
+Toggles the display of line numbers in front of the text.
+
 @item whitespacedisplay
 Toggles the showing of whitespace.
 
diff --git a/doc/nanorc.5 b/doc/nanorc.5
index 6a931f9667188bca139e191ac276d16694a70319..e901db60f18b22ea58c7ca5166d5ce94ae98033e 100644
--- a/doc/nanorc.5
+++ b/doc/nanorc.5
@@ -715,6 +715,9 @@ Toggles smooth scrolling (when moving around with the arrow keys).
 .B softwrap
 Toggles the displaying of overlong lines on multiple screen lines.
 .TP
+.B linenumbers
+Toggles the display of line numbers in front of the text.
+.TP
 .B whitespacedisplay
 Toggles the showing of whitespace.
 .TP
diff --git a/src/global.c b/src/global.c
index 22495a6235e06b238934dee3f945e1883675cb1c..faae60b0b97b52750f2bfe91b29cabf2442da99c 100644
--- a/src/global.c
+++ b/src/global.c
@@ -1667,6 +1667,10 @@ sc *strtosc(const char *input)
 			s->toggle = SMOOTH_SCROLL;
 		else if (!strcasecmp(input, "softwrap"))
 			s->toggle = SOFTWRAP;
+#ifdef ENABLE_LINENUMBERS
+		else if (!strcasecmp(input, "linenumbers"))
+			s->toggle = LINE_NUMBERS;
+#endif
 		else if (!strcasecmp(input, "whitespacedisplay"))
 			s->toggle = WHITESPACE_DISPLAY;
 #ifdef ENABLE_COLOR