Coder Social home page Coder Social logo

pocco81 / true-zen.nvim Goto Github PK

View Code? Open in Web Editor NEW
964.0 7.0 27.0 799 KB

🦝 Clean and elegant distraction-free writing for NeoVim

License: GNU General Public License v3.0

Lua 98.16% Makefile 1.84%
neovim-ui toggles nvim vi-mode lua neovim-plugin zen pretty neovim zenmode

true-zen.nvim's Introduction

🦝 true-zen.nvim

Clean and elegant distraction-free writing for NeoVim

Stars Issues Repo Size

Β 

true_zen_demo.mp4

Β 

πŸ“‹ Features

  • has 4 different modes to unclutter your screen:
    • Ataraxis: good ol' zen mode
    • Minimalist: disable ui components (e.g. numbers, tabline, statusline)
    • Narrow: narrow a text region for better focus
    • Focus: focus the current window
  • customizable lua callbacks for each mode
  • works out of the box
  • integratons:

Β 

πŸ“š Requirements

  • Neovim >= 0.5.0

Β 

πŸ“¦ Installation

Install the plugin with your favourite package manager:

Packer.nvim
use({
	"Pocco81/true-zen.nvim",
	config = function()
		 require("true-zen").setup {
			-- your config goes here
			-- or just leave it empty :)
		 }
	end,
})
vim-plug
Plug 'Pocco81/true-zen.nvim'
lua << EOF
	require("true-zen").setup {
		-- your config goes here
		-- or just leave it empty :)
	}
EOF

Β 

βš™οΈ Configuration

true-zen comes with the following defaults:

{
	modes = { -- configurations per mode
		ataraxis = {
			shade = "dark", -- if `dark` then dim the padding windows, otherwise if it's `light` it'll brighten said windows
			backdrop = 0, -- percentage by which padding windows should be dimmed/brightened. Must be a number between 0 and 1. Set to 0 to keep the same background color
			minimum_writing_area = { -- minimum size of main window
				width = 70,
				height = 44,
			},
			quit_untoggles = true, -- type :q or :qa to quit Ataraxis mode
			padding = { -- padding windows
				left = 52,
				right = 52,
				top = 0,
				bottom = 0,
			},
			callbacks = { -- run functions when opening/closing Ataraxis mode
				open_pre = nil,
				open_pos = nil,
				close_pre = nil,
				close_pos = nil
			},
		},
		minimalist = {
			ignored_buf_types = { "nofile" }, -- save current options from any window except ones displaying these kinds of buffers
			options = { -- options to be disabled when entering Minimalist mode
				number = false,
				relativenumber = false,
				showtabline = 0,
				signcolumn = "no",
				statusline = "",
				cmdheight = 1,
				laststatus = 0,
				showcmd = false,
				showmode = false,
				ruler = false,
				numberwidth = 1
			},
			callbacks = { -- run functions when opening/closing Minimalist mode
				open_pre = nil,
				open_pos = nil,
				close_pre = nil,
				close_pos = nil
			},
		},
		narrow = {
			--- change the style of the fold lines. Set it to:
			--- `informative`: to get nice pre-baked folds
			--- `invisible`: hide them
			--- function() end: pass a custom func with your fold lines. See :h foldtext
			folds_style = "informative",
			run_ataraxis = true, -- display narrowed text in a Ataraxis session
			callbacks = { -- run functions when opening/closing Narrow mode
				open_pre = nil,
				open_pos = nil,
				close_pre = nil,
				close_pos = nil
			},
		},
		focus = {
			callbacks = { -- run functions when opening/closing Focus mode
				open_pre = nil,
				open_pos = nil,
				close_pre = nil,
				close_pos = nil
			},
		}
	},
	integrations = {
		tmux = false, -- hide tmux status bar in (minimalist, ataraxis)
		kitty = { -- increment font size in Kitty. Note: you must set `allow_remote_control socket-only` and `listen_on unix:/tmp/kitty` in your personal config (ataraxis)
			enabled = false,
			font = "+3"
		},
		twilight = false, -- enable twilight (ataraxis)
		lualine = false -- hide nvim-lualine (ataraxis)
	},
}

🍀 Tweaks

Setting up Key Mappings

Additionally you may want to set up some key mappings for each true-zen mode:

local api = vim.api

api.nvim_set_keymap("n", "<leader>zn", ":TZNarrow<CR>", {})
api.nvim_set_keymap("v", "<leader>zn", ":'<,'>TZNarrow<CR>", {})
api.nvim_set_keymap("n", "<leader>zf", ":TZFocus<CR>", {})
api.nvim_set_keymap("n", "<leader>zm", ":TZMinimalist<CR>", {})
api.nvim_set_keymap("n", "<leader>za", ":TZAtaraxis<CR>", {})

-- or
local truezen = require('true-zen')
local keymap = vim.keymap

keymap.set('n', '<leader>zn', function()
  local first = 0
  local last = vim.api.nvim_buf_line_count(0)
  truezen.narrow(first, last)
end, { noremap = true })
keymap.set('v', '<leader>zn', function()
  local first = vim.fn.line('v')
  local last = vim.fn.line('.')
  truezen.narrow(first, last)
end, { noremap = true })
keymap.set('n', '<leader>zf', truezen.focus, { noremap = true })
keymap.set('n', '<leader>zm', truezen.minimalist, { noremap = true })
keymap.set('n', '<leader>za', truezen.ataraxis, { noremap = true })

API

require("true-zen.ataraxis") --[[
	.toggle() - toggle on/off the mode
	.running - `true` if the mode is on / `false` if the mode is off
--]]

require("true-zen.minimalist") --[[
	.toggle() - toggle on/off the mode
	.running - `true` if the mode is on / `false` if the mode is off
--]]

require("true-zen.narrow") --[[
	.toggle(line1, line2) - toggle on/off the mode
	vim.b.tz_narrowed_buffer - `true` if the mode is on / `false` if the mode is off
--]]

require("true-zen.focus") --[[
	.toggle() - toggle on/off the mode
	.running - `true` if the mode is on / `false` if the mode is off
--]]

--[[
	Each one offers the following functions too:
		.on() - turn on the mode
		.off() - turn off the mode
--]]

Callbacks

Every mode has callbacks available in their conf:

callbacks = {
	open_pre = nil,
	open_pos = nil,
	close_pre = nil,
	close_pos = nil
},

If its needed to disable certain callbacks use:

vim.g.tz_disable_mode_status_when

Where:

  • mode: ataraxis, minimalist, narrow or focus
  • status: open or close
  • when: pre or pos

For example: Ataraxis mode uses Minimalist mode to hide some of NeoVim's UI components, so to stop Minimalist mode from running its open_pre callback this could be set within Ataraxis' config:

callbacks = {
	open_pre = function()
		-- do some stuff
		vim.g.tz_disable_minimalist_open_pre = true
	end,
},

Β 

πŸͺ΄ Usage

  • TZAtaraxis: toggle ataraxis mode
  • TZMinimalist: toggle minimalist mode
  • TZNarrow: toggle narrow mode
  • TZFocus: toggle focus mode

Β 

πŸ“œ License

Koy is released under the MIT license, which grants the following permissions:

  • Commercial use
  • Distribution
  • Modification
  • Private use

For more convoluted language, see the LICENSE.

Β 

true-zen.nvim's People

Contributors

ahmedkhalf avatar antonk52 avatar burnerwah avatar cesarguzmanlopez avatar geodimm avatar groctel avatar kdav5758 avatar loqusion avatar oncomouse avatar pocco81 avatar prncss-xyz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

true-zen.nvim's Issues

`misc` section of configuration not working

Hello, I've tried turning on on_off_commands and ui_elements_commands in the config but none of the commands appear (E.g. :TZAtaraxisOn, :TZBottomOn). cursor_by_mode has also stopped working but I don't know since when as I've only noticed it now.

Other areas work though. I can toggle options within the ui and modes sections.

I've also noticed that I can't access the general UI elements commands as well (E.g. :TZBottom), of which I don't know whether it's related to the above.

Read user settings before toggling.

Hello, I already commented on another issue, but I am opening an issue for visibility:

Why can't TrueZen.nvim just read my settings before toggling and store them. I want to have some peace of mind, because now if I want to hide sign columns in my neovim config i'l have to change it in two places... :(

Comment LInk

E86: Buffer does not exist

It appears that when I run TZAtaraxis I get the error stated above. The buffer changes every time.

I'm running Neovim 0.5
Alacritty
OSX

Screenshot 2021-04-20 at 15 56 23

Zen mode does not hide lualine

Hi, loving the plugin so far! I've noticed that my statusline is still present after entering zen mode:

image

Running :set laststatus=0 works outside of truezen, but fails with no output inside zen mode. I remember I had this issue earlier, and you mentioned a force statusline option. I no longer see this option after the recent update.

I'm using lualine, here are my zen mode settings:

local M = {}

M.config = function()
local true_zen = require("true-zen")
true_zen.setup({
	ui = {
		bottom = {
			laststatus = 0,
			ruler = false,
			showmode = false,
			showcmd = false,
			cmdheight = 1,
		},
		top = {
			showtabline = 0,
		},
		left = {
			number = false,
			relativenumber = false,
			signcolumn = "no",
		},
	},
	modes = {
		ataraxis = {
			left_padding = 32,
			right_padding = 32,
			top_padding = 1,
			bottom_padding = 1,
			ideal_writing_area_width = 0,
			just_do_it_for_me = true,
			keep_default_fold_fillchars = true,
			custome_bg = "",
			bg_configuration = true,
			affected_higroups = {NonText = {}, FoldColumn = {}, ColorColumn = {}, VertSplit = {}, StatusLine = {}, StatusLineNC = {}, SignColumn = {}}
		},
		focus = {
			margin_of_error = 5,
			focus_method = "experimental"
		},
	},
	integrations = {
		vim_gitgutter = false,
		galaxyline = false,
		tmux = false,
		gitsigns = false,
		nvim_bufferline = false,
		limelight = true,
		vim_airline = false,
		vim_powerline = false,
		vim_signify = false,
		express_line = false,
	},
	misc = {
		on_off_commands = false,
		ui_elements_commands = false,
		cursor_by_mode = false,
	}
})
end

[Feature Request] Goyo mode?

Hi. First of all I love your extension and the work you do on it!

By any chance could you implement a goyo mode as well? E.g. running :Goyo will also add padding to the top and bottom. I love using Ataraxis mode for programming but for writing pose goyo looks and feel a lot better, but I would rather have one extension over two

TZFocus stay in the same line

I've noticed that when TZFocus activate the cursor line not in the same place, is there any option to change that behaviour ?

exit while in ataraxis mode

I don't know if it's just me, but when I'm in ataraxis mode and try to quit neovim (:q or ZZ) it doesn't do that, actually have to repeat like 4 or 5 times more in order to quit in ataraxis mode even when the buffer hasn't been modified.

Edit: I forgot to mention that also when I successfully quit in atarixs mode my tmux statusline doesn't come back, I have to enter vim again and run TZAtaraxis twice to get it back

Minimalist mode does not close after activating Ataraxis from inside of it.

It seems like Minimalist mode gets stuck if you activate Ataraxis inside of it.

How to reproduce

  1. Activate Minimalist mode with :TZMinimalist.
  2. While in Minimalist mode, activate Ataraxis mode with TZAtaraxis.
  3. Deactivate Ataraxis mode with :TZAtaraxis. This brings Minimalist mode back.
  4. Try to deactivate Minimalist mode with :TZMinimalist

Expected behaviour vs Actual behaviour

I expected that, since I was in Minimalist mode in the last step, :TZMinimalist would deactivate it. However, it stays in Minimalist mode.

Doesn't respect user settings when toggling off

Hi, thanks for great plugin, I just tried it and when I toggle any mode off by executing the command again, I get number option set, but which I don't have set by default, so I get unexpected line numbers when back from zen mode.

`Vim(bufdo):E37: No write since last change (add ! to override)` when closing a mode.

How to reproduce

  1. Open a file.
  2. Activate a TrueZen mode (with a :TZ... command).
  3. Change the file.
  4. Try to exit the TrueZen mode (with the same :TZ... command).

It seems like you are currently obligated to save your changes if you want to exit a mode. It would be nice if you could exit the modes without having to save your changes to the file.

Note: The changes would still appear in the original buffer after you close the mode, of course.

Can't remove line numbers of nvim-toggleterm buffer

When using TrueZen.nvim alongside nvim-toggleterm, the ataraxis mode end up enforcing line numbers on the terminal buffer, example below:

2021-08-12-121827_958x972_scrot

Even though nvim-toggleterm documentation specify a hide_numbers property, setting it to true doesn't works, any clue of what might be happening?

Note: this problem started showing up after i began using TrueZen, when nvim-toggleterm was already installed

Add Option to Do a Real Quit

Howdy,

Could you add an option to make it so that hitting q or q! acts normally under TrueZen? Exiting the buffer, window, etc. instead of simply toggling TrueZen.

Galaxyline not hidden when TrueZen is at startup

First of all, thank you for the plugin!

I havean with galaxyline not disappearing. This is only when I use TZAtaraxis from the start with the autocmd VimEnter line. When I toggle it from within Neovim I do not have any issues.

This is my TrueZen configuration.

local true_zen = require("true-zen")

true_zen.setup({
	ui = {
		bottom = {
			laststatus = 0,
			ruler = false,
			showmode = false,
			showcmd = false,
			cmdheight = 1,
		},
		top = {
			showtabline = 0,
		},
		left = {
			number = false,
			relativenumber = false,
			signcolumn = "no",
		},
	},
	modes = {
		ataraxis = {
			left_padding = 32,
			right_padding = 32,
			top_padding = 0,
			bottom_padding = 0,
			ideal_writing_area_width = 90,
			just_do_it_for_me = false,
			keep_default_fold_fillchars = true,
			custome_bg = "",
			bg_configuration = true,
			affected_higroups = {NonText = {}, ColorColumn = {}, VertSplit = {}, StatusLine = {}, StatusLineNC = {}, SignColumn = {}, FoldColumn = {}}
		},
		focus = {
			margin_of_error = 5,
			focus_method = "experimental"
		},
	},
	integrations = {
		galaxyline = true,
	},
})

true_zen.before_mode_ataraxis_off = function ()
	vim.api.nvim_command('w')
end

vim.cmd("autocmd VimEnter * TZAtaraxis")

Completely remove bottom/top paddings

When setting top_padding=0 and bottom_padding=0, there's still two lines of padding on the top and bottom. It'd be nice if those were completely removed when the paddings were set to 0.

Here's a picture of the current way it displays:
Screenshot from 2021-08-06 06-35-10

Here's a picture of how I wish it would displayed, for reference (using zen-mode):
Screenshot from 2021-08-06 06-34-55

(don't mind the left and right paddings, the important difference is the bottom and top ones)

Doesn't works when not opening a file

Whenever i try to just run nvim without passing any files as arguments, i receive the following error:

Error detected while processing VimEnter Autocommands for "*":
E5108: Error executing lua ...im/lua/true-zen/services/modes/mode-ataraxis/service.lua:349: Vim(tabedit):E499: Empty fi
le name for '%' or '#', only works with ":p:h": tabe %

I'm running TZAtaraxis on my config from the autocommands.lua file:

require 'helpers.aliases'

-- enable zen mode on startup
cmd 'autocmd VimEnter * TZAtaraxis'

How to enable git-gutter (left side marks, near the line numbers)?

I want to enable git-gutter (left side marks, near the line numbers) when using minimalist mode. Here is what I have in my init.vim file:

"Truezen
autocmd VimEnter * TZMinimalist
autocmd VimEnter * TZTop
autocmd VimEnter * TZLeft

lua << EOF
local true_zen = require("true-zen")
true_zen.setup({
  minimalist = {
    store_and_restore_settings = false,
    show_vals_to_read = {}
  },
  integrations = {
    integration_gitgutter = true,
  }
})
EOF

Everything works, other than the git integration. Any suggestions?

Tmux integration in minimalist_mode.

It'd be great to have tmux integration in minimalist mode similar to ataraxis mode.

Also maybe a toggle to switch from transparent to solid background.

I'm using something like this as of now.

let t:transparent = 1
function! ZenToggle()
    if t:transparent == 0
        hi Normal guibg=NONE ctermbg=NONE
        hi NonText guibg=NONE ctermbg=NONE
        TZMinimalistT
        silent! !tmux set -g status on
        let t:transparent = 1
    else 
        hi Normal ctermfg=255 ctermbg=234 cterm=NONE guifg=#EEEEEE guibg=#1C1C1C gui=NONE
        hi NonText ctermfg=234 ctermbg=234 cterm=NONE guifg=#1C1C1C guibg=#1C1C1C gui=NONE
        TZMinimalistF
        silent! !tmux set -g status off
        let t:transparent = 0
    endif
endfunction

TZAtaraxis broken layout

Hi πŸ‘‹, I'm not sure why, but TZAtaraxis doesn't seem to work very well on my end.

I'm not sure how to debug this. Though it doesn't seem to be caused by a plugin.

Version:

NVIM v0.6.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -g -O2 -fdebug-prefix-map=/build/neovim-82h9vU/neovim-0.5.0+ubuntu2+git202107142015-19a2e59f7-d569569c9=. -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/build/neovim-82h9vU/neovim-0.5.0+ubuntu2+git202107142015-19a2e59f7-d569569c9/build/config -I/build/neovim-82h9vU/neovim-0.5.0+ubuntu2+git202107142015-19a2e59f7-d569569c9/src -I/build/neovim-82h9vU/neovim-0.5.0+ubuntu2+git202107142015-19a2e59f7-d569569c9/.deps/usr/include -I/usr/include -I/build/neovim-82h9vU/neovim-0.5.0+ubuntu2+git202107142015-19a2e59f7-d569569c9/build/src/nvim/auto -I/build/neovim-82h9vU/neovim-0.5.0+ubuntu2+git202107142015-19a2e59f7-d569569c9/build/include
Compiled by buildd@lgw01-amd64-021

NonText highlight group is reset when entering Ataraxis mode

This exact same issue is also present in Goyo. Basically the value of the NonText highlight group set by the colorscheme is reset when entering Ataraxis mode.

Using the onedark colorscheme, the output of :hi NonText before :TZAtaraxis is

:hi NonText
NonText        xxx ctermfg=238 guifg=#3B4048

and after

:hi NonText
NonText        xxx ctermfg=238 guifg=black

Set desired width instead of padding

Great job on this plugin, I'm enjoying it so far!

I think that the killer feature would be to be able to set a desired width rather than set the padding on left and right individually… to be able to restrict the "final" column to some width would be πŸ‘Œ.

I'll try hacking around to see if I can make a prototype, but I figured I'd let you know too.

Integrations not working and odd top bar

Hi, thanks for the wonderful plugin! I'm only facing two difficulties:

First, some integrations aren't working in Ataraxis mode.

use {
    'Pocco81/TrueZen.nvim',
    requires = {{'folke/twilight.nvim', opt = true}, {'lewis6991/gitsigns.nvim', opt = true}},
    config = function()
        require'true-zen'.setup {
            integrations = {
                gitsigns = true,
                twilight = true
            }
        }
    end
      }

twilight is doing fine but the gitsigns option is completely inert.

Second, the Ataraxis mode has an odd bar at the top.
image

What can I do to help diagnose the issues?

Integration not found

On entering Ataraxis mode I get the following error:

E5108: Error executing lua ...en/services/integrations/modules/integrations_loader.lua:30: module 'true-zen.services.integrations.luaine' not found

This happens with all the integrations I've tried and updating the plugin (with Paq) hasn't changed anything.

Is there a way to get these integrations?

[Feature Request] Padding delineation

Currently, the buffer has the same color as the paddings around it, which makes it a bit hard to differentiate between what's buffer and what's left/right padding.
Screenshot from 2021-07-23 16-56-38

I suggest an option to add some delineation to emphasize the buffer.

One way I see is to add lines on the sides the buffer, VsCode Zen style (although I don't know how feasible this is in terminal):
Screenshot from 2021-07-23 16-53-04

Another one, which I personally prefer, is to add a configurable darkening level, so the side paddings are slightly shaded, zen-mode style:
Screenshot from 2021-07-23 16-54-26

There may be more ways to implement this of course, these are just some examples of how it could be done.

Move lua code to lua/true_zen

Hi, thanks for this plugin, it looks cool. But a lot of files are directly in the lua/ directory, which pollutes the namespace of require and so require('config') resolves to the file in this plugin https://github.com/kdav5758/TrueZen.nvim/blob/main/lua/config.lua. Could you please move all the files to lua/true-zen/? Then require('true-zen') would load lua/true-zen/init.lua and the only "visible" namespace would be require('true-zen.*').

TrueZen eats tab and split on running :TZAtaraxis

While I was trying out TrueZen.nvim with the default settings in Neovim v0.5.0-dev+1318-g61aefaf29, I encountered a weird bug.

To reproduce it:

  1. Open file1.
  2. Create a new split (either horizontal or vertical).
  3. Open file2 on a new tab (:tabe file2).
  4. Switch back to the tab with the two splits.
  5. Run :TZAtaraxis. A message should come up that force_when_plus_one_window has to be set.
  6. Switch to the tab with file2.
  7. Run :TZAtaraxis again.

What happens is that Neovim shows only file1 with all the UI still displayed, and the other tab and split completely disappear. The following error appears as well:

E5108: Error executing lua ...Zen.nvim/lua/true-zen/services/mode-ataraxis/service.lua:331: attempt to compare number with nil

Possible inconsistencies with split windows

Lets say I have a horizontal split and run TZMinimalist in the top window, to remove line numbers etc. Now I want to remove them also in the lower window so I go down there and run the command again to remove them but they remain and instead that status bar appear again.

Perhaps this is the intended behaviour but just wondering how one easily toggles "zen-mode" in two split windows easily.

Cterm highlights being set unnecessarily

@kdav5758 I was looking through the code a little and trying to understand the reason for the E420 error, which you have a few settings to fix and it seems to be that whilst trying to hide the statusline this plugin specifically sets ctermbg=bg etc. https://github.com/kdav5758/TrueZen.nvim/blob/241a447913be439c1351ab0eadf805c4872622fc/lua/true-zen/services/mode-ataraxis/service.lua#L378

A lot of modern colour schemes only set gui values like guifg etc and no cterm values because really most modern editors can handle gui colors. A few lines below you seem to be checking a variable called gui and setting gui values only if termguicolors etc. is true. It seems to me you can do a similar check before trying to set cterm values

e.g.

if termguicolors then
 vim.cmd [[highlight Statusline guifg=fg guibg=bg]]
else
 vim.cmd [[highlight Statusline ctermfg=fg ctermbg=bg]]
end

Since if termguicolors is true then cterm is irrelevant so there's no point setting cterm values so it doesn't matter if a user has them or not

Automatically set default values for omitted options in configuration.

In the doc/true-zen.txt there's an example configuration. I expected those to be the default options, and using them or not to be optional, and if not manually set, they would just be set to those defaults.

So, I copied the configs and deleted the line for top_padding, as I like the default value. However, when running :TZAtaraxis, I received the error message "attempt to concatenate field 'top_padding' (a nil value)". It seems like if you don't set any value, it always defaults to nil.

At least in my experience, users usually don't change most of the settings, so allowing them to simply be omitted would trim down the size of their configurations by a lot (in my case, almost 5 fold). It would be nice if the values of the configurations would default to those sensible ones presented in doc/true-zen.txt when omitted.

Statusline is Not Hidden When in TrueZen

For some reason truezen is not hiding laststatus when I enter it, but rather moving it to the top of the buffer. I have checked my configuration, but can't seem to find any issues and when I use the default configuration I get the same issue.

My configuration is as follows

---------------
--- TrueZen ---
---------------
-- Variable declarations.
local true_zen = require 'true-zen'

true_zen.setup({
	ui = {
		bottom = {
			-- Do not show the status line in the last window.
			laststatus = 0,

			-- Do not show the line and culmn number of the cursor position.
			ruler = false,

			-- Do not show the current mode.
			showmode = false,

			-- Do not show partial command in the last line of the screen.
			showcmd = false,

			-- Use one screen line for the command-line.
			cmdheight = 1,
		},

		top = {
			-- Do not display the line with the tab page labels.
			showtabline = 0,
		},

		left = {
			-- Do not display line numbers.
			number = false,

			-- Do not display relative line numbers.
			relativenumber = false,

			-- Do not draw the signcolumn.
			signcolumn = 'no',
		},
	},

	modes = {
		ataraxis = {
			-- Padding for the left side of the screen.
			left_padding = 32,

			-- Padding for the right side of the screen.
			right_padding = 32,

			-- Padding for the top of the screen.
			top_padding = 1,

			-- Padding for the bottom of the screen.
			bottom_padding = 1,

			-- Ideal writing width area.
			ideal_writing_area_width = {0},

			-- Handle right and left padding for me.
			just_do_it_for_me = true,

			-- Keep the default fold fillchars.
			keep_default_fold_fillchars = true,

			-- Do not use a custome background.
			custome_bg = false,

			-- Close the current buffer on ':q'.
			quit = 'close',

			-- Allow TrueZen to interact with the background.
			bg_configuration = true,

			-- Highlight groups that TrueZen can affect.
			affected_higroups = { NonText = {}, FoldColumn = {}, VertSplit = {}, StatusLine = {},
                                  StatusLineNC = {}, SignColumn = {} }
		},

		focus = {
			-- Margin of error.
			margin_of_error = 5,

			-- Focus method.
			focus_method = 'experimental'
		},
	},

	integrations = {
		-- Enable integration for tmux.
		tmux = true,

		-- Enable integration for bufferline.
		nvim_bufferline = true,

		-- Enable integration for twilight.
		twilight = true,

		-- Disable integration for gitgutter.
		vim_gitgutter = false,

		-- Disable integration for galaxyline.
		galaxyline = false,

		-- Disable integration for gitsigns.
		gitsigns = false,

		-- Disable integration for limelight.
		limelight = false,

		-- Disable integration for airline.
		vim_airline = false,

		-- Disable integration for powerline.
		vim_powerline = false,

		-- Disable integration for signify.
		vim_signify = false,

		-- Disable integration for express_line.
		express_line = false,

		-- Do not integrate witg lualine.
		lualine = false,
	},

	misc = {
		-- Enable on/off commands.
		on_off_commands = true,

		-- Disable ui elements commands.
		ui_elements_commands = false,

		-- Enable cursor by mode.
		cursor_by_mode = true,
	}
})

Possibility to make `ideal_writing_area_width` a range?

Hello, I often switch my terminal between fullscreen mode and splitting with other applications on the screen. I have set my ideal_writing_area_width to 80 which is really nice when the terminal takes up only half the screen but insufficient (for me) when it's in fullscreen mode.

Would it be possible to have some kind of min/max ideal_writing_area_width? so when I turn off and on TZAtaraxis it will reset to a better size?

BG color unknown

Hi, I'm getting this error when doing :TZAtaraxis but it doesn't happens with :TZMinimalist

E5108: Error executing lua ...Zen.nvim/lua/true-zen/services/mode-ataraxis/service.lua:378: Vim(highlight):E420: BG color unknown

Also when the error happens, I have to press :q several times as it leaves some empty buffers πŸ˜•

Here I leave my config info, in case it's useful:

  • Neovim version: NVIM v0.5.0-dev+1280-gbb7d3790b
  • Colorscheme: doom-one (also happens when using transparent bg)

Error when going into Ataraxis mode with empty file

When I have a new file without a filename, and go into Atarxis mode, I get the following error:

E5108: Error executing lua ...im/lua/true-zen/services/modes/mode-ataraxis/service.lua:244: Vim(tabedit):E499: Empty file name for '%' or '#', only works with ":p:h": tabe %

When I enter into Atarxis mode with a file that is not empty, I do not encounter this error.

Automatically resize ataraxis mode on VimResize

Would it be interesting to implement a VimResize autocommand which adjusts the middle buffer dimensions whenever the window gets resized?

The actual behavior is whenever a window gets resized, the middle buffer isn't adjusted, it's needed to run :TZAtaraxis twice in order to toggle off and then on again for centering it accordingly to the current terminal window boundaries

:TZAtaraxis results in E5108: BG Color unknown

Running :TZAtaraxis rusults in the following output
Screen Shot 2021-04-26 at 5 23 51 PM

The screen looks somewhat fine except for two lines of ~~~

Screen Shot 2021-04-26 at 5 24 20 PM

Not sure what could be the issue. Using Latest Neovim and all plugins are updated. :TZMinimalist works fine

Close tabs bar after unfocus with TZFocus

Hello. When I use TZFocus with experimental mode and then toggle it again tabs bar still exist with one single tab. Could it disappear after unfocus?
image

Updated
I noticed similar strange issue with TZAtaraxis. When I toggle it to back to my normal mode I get set numbers but I didn't use it before and tabs bar as well.

Peek.2021-06-03.17-19.mp4

Commands on enter and leave

In Goyo I made use of the events GoyoEnter and GoyoLeave to trigger some additional things. Does TrueZen have something similar? This does not have to be events but could also be functions that could be passed to setup.

Maintaining cursor position when starting and exiting modes.

Currently, starting Ataraxis mode results in the cursor starting at the first line and first column of the file. Leaving Ataraxis results in the cursor returning to the position it was in the original buffer when the mode was first opened.

It would be nice if the cursor by default (or as an option) would maintain its position while going in and out of modes. That is, if you were in the position 330,20, starting Ataraxis would still leave you at 330,20. And, if while editing in that mode you ended up in 510,18, closing Ataraxis would drop you at 510,18.

`:TZAtaraxisOff` quits neovim

Hello, I don't know if this is intended but :TZAtaraxisOff quits neovim if TZAtaraxis mode isn't on.

Context for this issue: I want to create keybindings that easily switch between modes like these

vim.api.nvim_set_keymap('n', '<Leader>1', [[<Cmd>TZAtaraxisOff<CR><Cmd>TZMinimalistOff<CR><Cmd>TZFocusOff<CR><Cmd>TZAtaraxisOn<CR>]], { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<Leader>2', [[<Cmd>TZAtaraxisOff<CR><Cmd>TZMinimalistOff<CR><Cmd>TZFocusOff<CR><Cmd>TZMinimalistOn<CR>]], { noremap = true, silent = true })

Refactoring, Code style, Linting, etc.

I'm currently (as in editor open right now lol) working on a PR to fix the number of global variables this plugin has, and I noticed that this repo is kinda empty.

Also, a lot of the code looks weird to me (probably mostly because of editor settings).

I'm open to trying to refactor some parts of this plugin for simplicity, but I more importantly would like to ask about formatting & linting.

A code style would be useful for just automating formatting. The ones I'm most familiar with are StyLua (Which I recommend for avoiding future arguments over code style), and LuaFormatter (much more configurable than StyLua).
Also, a .editorconfig file would be useful for editor settings.

For linting, there's selene and luacheck. Both give a lot of errors & warnings right now (although a lot of that is related to globals, which I'm working on a fix for). I personally prefer selene.

Some of this stuff could also be integrated into automated checks, such as through github actions or git hooks. But that might be a bit much for now.


Is there a set of tools you'd prefer for this? I'm open to setting up anything, but there are already some formatting inconsistencies in the code that this could help with (ex. https://github.com/kdav5758/TrueZen.nvim/blob/main/lua/true-zen/services/bottom/integrations/integration_vim_airline.lua#L12-L16)

Error `attempt to index a nil value` when `custom_bg` is set to `darken` but no background is set

How to reproduce

  1. Set TrueZen Ataraxis' custom_bg option to darken (e.g. custom_bg = {"darken", 0.87})
  2. Start neovim without setting any background.
  3. Run :TZArataxis

Although it might not be possible, I suggest that TrueZen should fall back into darkening the terminal's background color. In case that's not viable, it would be nice to have a more graceful handling of the exception (e.g. issuing a warning when loading the setting, or ignoring the setting when there's no background, or showing an error message more informative than 'attempt to index a nil value').

Twilight.nvim integration

Hello once again, loving the plugin. Is there any chance you could provide integration with https://github.com/folke/twilight.nvim? I would love it as a Lua-based alternative to the limelight plugin, which already has an integration. It would be as simple as running :Twilight on opening/closing truezen

Ideal Writing Width Error

Whenever I attempt to use TrueZen with any configuration at all, even only changing one setting, I get these errors

Error detected while processing VimEnter Autocommands for "*":
E5108: Error executing lua /home/user/.config/nvim/lua/hook.lua:43: Vim(lua):E5108: Error executing lua ...im/lua
/true-zen/services/modes/mode-ataraxis/service.lua:145: attempt to index field 'ideal_writing_area_width' (a nil
value)

My configuration is here. I have tried removing all settings and it works, but even adding just one settings causes me this error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.