# Command/hotkey-toggle for Show line numbers

**URL:** <https://forum.obsidian.md/t/command-hotkey-toggle-for-show-line-numbers/13879>\
**Category:** Feature requests\
**Tags:** hotkeys\
**Created:** [March 1, 2021, 11:11pm UTC](https://forum.obsidian.md/t/command-hotkey-toggle-for-show-line-numbers/13879 "2021-03-01T23:11:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dantveita](https://forum.obsidian.md/user_avatar/forum.obsidian.md/dantveita/32/11026_2.png) [@dantveita](https://forum.obsidian.md/u/dantveita)\
**Post date:** [March 1, 2021, 11:11pm UTC](https://forum.obsidian.md/t/command-hotkey-toggle-for-show-line-numbers/13879/1 "2021-03-01T23:11:36Z")

</div>

I love the implementation of line-numbers, and use it to move around vim-style — but not always. Sometimes I want to go into “zen-mode” (metaphorically) and want as little clutter as possible; which Obsidian does very well.

So to be able to quickly turn of the line numbers when I don’t need them, would be great. As a command or even a hotkey.

For now I just leave it on, and turn it off through settings. Its works obviously, but it is a bit cumbersome.

---

<div class="post-metadata">

**Author:** ![sylph](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/s/258eb7/32.png) [@sylph](https://forum.obsidian.md/u/sylph)\
**Post date:** [August 18, 2022, 9:44am UTC](https://forum.obsidian.md/t/command-hotkey-toggle-for-show-line-numbers/13879/2 "2022-08-18T09:44:41Z")

</div>

Agreed. Hope it’ll be added to Obsidian. In my situation, If I’m using obsidian full screen, I want to keep the line number showing to navigate via vim mode; If I’m splitting windows and using obsidian half or less space, I’d rather turn off the line number for more content display. p.s., the vim command `set number` seems not working.

---

<div class="post-metadata">

**Author:** ![rogeriofonseca](https://forum.obsidian.md/user_avatar/forum.obsidian.md/rogeriofonseca/32/45673_2.png) [@rogeriofonseca](https://forum.obsidian.md/u/rogeriofonseca)\
**Post date:** [April 1, 2023, 3:22am UTC](https://forum.obsidian.md/t/command-hotkey-toggle-for-show-line-numbers/13879/3 "2023-04-01T03:22:25Z")

</div>

When I tried execute “:set number”  
It showed me “unknown option: number”

I can’t show the number of lines. ☹

---

<div class="post-metadata">

**Author:** ![Jopp](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/j/8e7dd6/32.png) [@Jopp](https://forum.obsidian.md/u/Jopp)\
**Post date:** [April 1, 2023, 8:04am UTC](https://forum.obsidian.md/t/command-hotkey-toggle-for-show-line-numbers/13879/4 "2023-04-01T08:04:02Z")

</div>

I wished, line numbers would be visible all times, but only for `code blocks`

---

<div class="post-metadata">

**Author:** ![rogeriofonseca](https://forum.obsidian.md/user_avatar/forum.obsidian.md/rogeriofonseca/32/45673_2.png) [@rogeriofonseca](https://forum.obsidian.md/u/rogeriofonseca)\
**Post date:** [April 5, 2023, 2:08am UTC](https://forum.obsidian.md/t/command-hotkey-toggle-for-show-line-numbers/13879/5 "2023-04-05T02:08:06Z")

</div>

I couldn’t get the numbers to show up at all.

---

<div class="post-metadata">

**Author:** ![rogeriofonseca](https://forum.obsidian.md/user_avatar/forum.obsidian.md/rogeriofonseca/32/45673_2.png) [@rogeriofonseca](https://forum.obsidian.md/u/rogeriofonseca)\
**Post date:** [October 19, 2024, 7:26pm UTC](https://forum.obsidian.md/t/command-hotkey-toggle-for-show-line-numbers/13879/6 "2024-10-19T19:26:56Z")

</div>

I had forgotten to enable “show line numbers” on “Settings \> Editor \> Show line numbers”

---

<div class="post-metadata">

**Author:** ![NWMoose](https://forum.obsidian.md/user_avatar/forum.obsidian.md/nwmoose/32/94856_2.png) [@NWMoose](https://forum.obsidian.md/u/NWMoose)\
**Post date:** [August 23, 2026, 10:42pm UTC](https://forum.obsidian.md/t/command-hotkey-toggle-for-show-line-numbers/13879/7 "2026-08-23T22:42:59Z")

</div>

Would like to bring this topic back up to the surface. Is there a way to toggle line numbers on and off? They are oh so necessary for certain files and oh so bothersome for other files.

---

<div class="post-metadata">

**Author:** ![NWMoose](https://forum.obsidian.md/user_avatar/forum.obsidian.md/nwmoose/32/94856_2.png) [@NWMoose](https://forum.obsidian.md/u/NWMoose)\
**Post date:** [August 23, 2026, 10:55pm UTC](https://forum.obsidian.md/t/command-hotkey-toggle-for-show-line-numbers/13879/8 "2026-08-23T22:55:08Z")

</div>

for a workaround, this approach was simple to configure and is working.  
Feels like a great snippet to add into the default package or an Obsidian PowerTools app.

> [@Toggle \*Settings \> Editor \> Show line numbers" via Command Palette](https://forum.obsidian.md/t/toggle-settings-editor-show-line-numbers-via-command-palette/86050/3):
>
> Thanks @blue_emperor! This was definitely an improvement on my Mac. And I already had Raycast installed :). I ended up finding a cross platform solution including optional hotkeys. I have a custom [CSS snippet](https://help.obsidian.md/snippets#Adding+a+snippet) and [snippet-commands-obsidian](https://publish.obsidian.md/hub/02+-+Community+Expansions/02.05+All+Community+Expansions/Plugins/snippet-commands-obsidian) installed, which exposes commands to toggle CSS snippets via the Command Palette. /\* snippet: hide-line-numbers \*/ .cm-gutters .cm-gutter.cm-lineNumbers { display: none !important; } Steps: Add CSS snippet to Obsidian Vault [CSS snippets \> Adding a sni…](https://help.obsidian.md/snippets#Adding+a+snippet)
