dev: cleanup

This commit is contained in:
NotAShelf 2023-07-30 16:00:18 +03:00
parent c766e8cf27
commit 7f7926fbbb
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
2 changed files with 186 additions and 181 deletions

View file

@ -24,47 +24,9 @@ in {
]; ];
vim.luaConfigRC.nvimtreelua = nvim.dag.entryAnywhere '' vim.luaConfigRC.nvimtreelua = nvim.dag.entryAnywhere ''
${
lib.optionalString (cfg.openOnSetup) ''
-- Open on startup has been deprecated
-- see https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup
-- use a nix eval to dynamically insert the open on startup function
local function open_nvim_tree(data)
local IGNORED_FT = {
"markdown",
}
-- buffer is a real file on the disk
local real_file = vim.fn.filereadable(data.file) == 1
-- buffer is a [No Name]
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
-- &ft
local filetype = vim.bo[data.buf].ft
-- only files please
if not real_file and not no_name then
return
end
-- skip ignored filetypes
if vim.tbl_contains(IGNORED_FT, filetype) then
return
end
-- open the tree but don't focus it
require("nvim-tree.api").tree.toggle({ focus = false })
end
-- function to automatically open the tree on VimEnter
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
''
}
${ ${
lib.optionalString (cfg.disableNetrw) '' lib.optionalString (cfg.disableNetrw) ''
-- disable netrew completely
vim.g.loaded_netrw = 1 vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1 vim.g.loaded_netrwPlugin = 1
'' ''
@ -301,6 +263,46 @@ in {
}, },
}, },
}) })
-- autostart behaviour
${
lib.optionalString (cfg.openOnSetup) ''
-- Open on startup has been deprecated
-- see https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup
-- use a nix eval to dynamically insert the open on startup function
local function open_nvim_tree(data)
local IGNORED_FT = {
"markdown",
}
-- buffer is a real file on the disk
local real_file = vim.fn.filereadable(data.file) == 1
-- buffer is a [No Name]
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
-- &ft
local filetype = vim.bo[data.buf].ft
-- only files please
if not real_file and not no_name then
return
end
-- skip ignored filetypes
if vim.tbl_contains(IGNORED_FT, filetype) then
return
end
-- open the tree but don't focus it
require("nvim-tree.api").tree.toggle({ focus = false })
end
-- function to automatically open the tree on VimEnter
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
''
}
''; '';
}; };
} }

View file

@ -260,10 +260,12 @@ with builtins; {
severity = mkOption { severity = mkOption {
description = "Severity for which the diagnostics will be displayed. See `:help diagnostic-severity`"; description = "Severity for which the diagnostics will be displayed. See `:help diagnostic-severity`";
default = { default = {
min = "HINT"; min = "HINT";
max = "ERROR"; max = "ERROR";
}; };
type = types.submodule { type = types.submodule {
options = { options = {
min = mkOption { min = mkOption {
@ -306,7 +308,7 @@ with builtins; {
''; '';
}; };
timeOut = mkOption { timeout = mkOption {
type = types.int; type = types.int;
default = 400; default = 400;
description = '' description = ''
@ -472,6 +474,7 @@ with builtins; {
float = mkOption { float = mkOption {
description = "Configuration options for floating window."; description = "Configuration options for floating window.";
default = { default = {
enable = false; enable = false;
quitOnFocusLoss = true; quitOnFocusLoss = true;