Search

Search IconIcon to open search

Zen Mode for Writing (Obsidian, Neovim)

Last updatedUpdated: by Simon Späti · CreatedCreated:

Zen mode is a plugin most writing apps provide. I created my own in Neovim by hidding tmux bars and center text.

# Examples

# Neovim

Zen mode in Neovim - I used wp.ssp.sh (nvim dots for Wordprocessor):

And Nvim without Zen:

# Obsidian

In Obsidian I’ve built the same, hiding the right size bar and tab bars - I used the same shortcut <leader>+z with the Vimrc Plugin.

Zen Mode:

And without Zen mode:

# Zen Configs

# Obsidian

Set Zen mode to hide tab and right side to have focus mode:

1
2
3
4
" Zen mode (hide tab bar) and right side
exmap toggle_tab obcommand obsidian-hider:toggle-tab-containers
exmap toggle_right obcommand app:toggle-right-sidebar
nmap <Space>z :toggle_tab<CR>:toggle_right<CR>

Check dotfiles at .obsidian/.vimrc.

# Neovim

I’m using zen-mode plugin with additinal tmux configs

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
return {
  "folke/zen-mode.nvim",
  lazy = false,
  priority = 1000,
  config = function()
    require("zen-mode").setup({
      on_open = function(_)
        vim.g.zen_mode_active = true
        vim.fn.system([[tmux set status off]])
        vim.fn.system(
           grep -q Z )
      end,
      on_close = function(_)
        vim.g.zen_mode_active = false
        vim.fn.system([[tmux set status on]])
        vim.fn.system(
           grep -q Z && tmux resize-pane -Z)
      end,
      window = {
        width = 120,
        options = {
          relativenumber = false,
          signcolumn = "no",
          number = false, -- disable number column
        },
      },
    })
  end,
}

See dotfiles at zen-mode.lua.

# Further Reads


Origin: Vimrc for Obsidian