summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/extra
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-08-10 23:15:04 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-08-10 23:15:04 +0200
commit540268d618627079c9b958a955b586e1888b46a8 (patch)
tree1a22a5feb457135178b9d4fe8b6c1755f5ca66bc /.config/nvim/lua/extra
parente79bd3273f58ba38e8fcd716090b89326791afbb (diff)
Major refactor of nvim
Diffstat (limited to '.config/nvim/lua/extra')
-rw-r--r--.config/nvim/lua/extra/colorizer.lua22
-rw-r--r--.config/nvim/lua/extra/hop.lua15
-rw-r--r--.config/nvim/lua/extra/json_schemas.lua99
-rw-r--r--.config/nvim/lua/extra/lir.lua96
-rw-r--r--.config/nvim/lua/extra/lsp_signature.lua14
-rw-r--r--.config/nvim/lua/extra/neoscroll.lua25
-rw-r--r--.config/nvim/lua/extra/numb.lua17
-rw-r--r--.config/nvim/lua/extra/octo.lua139
-rw-r--r--.config/nvim/lua/extra/quickscope.lua3
-rw-r--r--.config/nvim/lua/extra/spectre.lua144
-rw-r--r--.config/nvim/lua/extra/twilight.lua30
-rw-r--r--.config/nvim/lua/extra/zen.lua48
12 files changed, 652 insertions, 0 deletions
diff --git a/.config/nvim/lua/extra/colorizer.lua b/.config/nvim/lua/extra/colorizer.lua
new file mode 100644
index 0000000..04b7367
--- /dev/null
+++ b/.config/nvim/lua/extra/colorizer.lua
@@ -0,0 +1,22 @@
+local M = {}
+local Log = require "core.log"
+
+M.config = function()
+ local status_ok, colorizer = pcall(require, "colorizer")
+ if not status_ok then
+ Log:get_default().error "Failed to load colorizer"
+ return
+ end
+
+ colorizer.setup({ "*" }, {
+ RGB = true, -- #RGB hex codes
+ RRGGBB = true, -- #RRGGBB hex codes
+ RRGGBBAA = true, -- #RRGGBBAA hex codes
+ rgb_fn = true, -- CSS rgb() and rgba() functions
+ hsl_fn = true, -- CSS hsl() and hsla() functions
+ css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
+ css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn
+ })
+end
+
+return M
diff --git a/.config/nvim/lua/extra/hop.lua b/.config/nvim/lua/extra/hop.lua
new file mode 100644
index 0000000..834f97a
--- /dev/null
+++ b/.config/nvim/lua/extra/hop.lua
@@ -0,0 +1,15 @@
+local M = {}
+local Log = require "core.log"
+
+M.config = function()
+ local status_ok, hop = pcall(require, "hop")
+ if not status_ok then
+ Log:get_default().error "Failed to load hop"
+ return
+ end
+ hop.setup()
+ vim.api.nvim_set_keymap("n", "s", ":HopChar2<cr>", { silent = true })
+ vim.api.nvim_set_keymap("n", "S", ":HopWord<cr>", { silent = true })
+end
+
+return M
diff --git a/.config/nvim/lua/extra/json_schemas.lua b/.config/nvim/lua/extra/json_schemas.lua
new file mode 100644
index 0000000..590547b
--- /dev/null
+++ b/.config/nvim/lua/extra/json_schemas.lua
@@ -0,0 +1,99 @@
+-- https://www.schemastore.org/json/
+local M = {}
+
+M.setup = function()
+ local schemas = {
+ {
+ description = "Package JSON file",
+ fileMatch = { "package.json" },
+ url = "https://json.schemastore.org/package.json",
+ },
+ {
+ description = "TypeScript compiler configuration file",
+ fileMatch = { "tsconfig.json", "tsconfig.*.json" },
+ url = "http://json.schemastore.org/tsconfig",
+ },
+ {
+ description = "Lerna config",
+ fileMatch = { "lerna.json" },
+ url = "http://json.schemastore.org/lerna",
+ },
+ {
+ description = "Babel configuration",
+ fileMatch = { ".babelrc.json", ".babelrc", "babel.config.json" },
+ url = "http://json.schemastore.org/lerna",
+ },
+ {
+ description = "ESLint config",
+ fileMatch = { ".eslintrc.json", ".eslintrc" },
+ url = "http://json.schemastore.org/eslintrc",
+ },
+ {
+ description = "Bucklescript config",
+ fileMatch = { "bsconfig.json" },
+ url = "https://bucklescript.github.io/bucklescript/docson/build-schema.json",
+ },
+ {
+ description = "Prettier config",
+ fileMatch = { ".prettierrc", ".prettierrc.json", "prettier.config.json" },
+ url = "http://json.schemastore.org/prettierrc",
+ },
+ {
+ description = "Vercel Now config",
+ fileMatch = { "now.json" },
+ url = "http://json.schemastore.org/now",
+ },
+ {
+ description = "Stylelint config",
+ fileMatch = { ".stylelintrc", ".stylelintrc.json", "stylelint.config.json" },
+ url = "http://json.schemastore.org/stylelintrc",
+ },
+ {
+ name = "Helm Chart.yaml",
+ description = "The Chart.lock file locks dependencies from Chart.yaml",
+ fileMatch = { "Chart.lock" },
+ url = "https://json.schemastore.org/chart-lock.json"
+ },
+ {
+ name = "CircleCI config.yml",
+ description = "Schema for CircleCI 2.0 config files",
+ fileMatch = { ".circleci/config.yml" },
+ url = "https://json.schemastore.org/circleciconfig.json"
+ },
+ {
+ name = "yamllint",
+ description = "yamllint uses a set of rules to check source files for problems",
+ fileMatch = { "**/.yamllint", "**/.yamllint.yaml", "**/.yamllint.yml" },
+ url = "https://json.schemastore.org/yamllint.json"
+ },
+ {
+ name = "Hadolint",
+ description = "A smarter Dockerfile linter that helps you build best practice Docker images.",
+ fileMatch = { ".hadolint.yaml", "hadolint.yaml", ".hadolint.yml", "hadolint.yml" },
+ url = "https://raw.githubusercontent.com/hadolint/hadolint/master/contrib/hadolint.json"
+ },
+ {
+ name = "kustomization.yaml",
+ description = "Kubernetes native configuration management",
+ fileMatch = { "kustomization.yaml", "kustomization.yml" },
+ url = "https://json.schemastore.org/kustomization.json"
+ },
+ }
+
+ local function extend(tab1, tab2)
+ for _, value in ipairs(tab2) do
+ table.insert(tab1, value)
+ end
+ return tab1
+ end
+
+ local extended_schemas = extend(schemas, require("nlspsettings.jsonls").get_default_schemas())
+
+ options.lang.json.lsp.setup.settings = {
+ json = {
+ schemas = extended_schemas,
+ },
+ }
+end
+
+return M
diff --git a/.config/nvim/lua/extra/lir.lua b/.config/nvim/lua/extra/lir.lua
new file mode 100644
index 0000000..271afb1
--- /dev/null
+++ b/.config/nvim/lua/extra/lir.lua
@@ -0,0 +1,96 @@
+local status_ok, lir = pcall(require, "lir")
+if not status_ok then
+ return
+end
+local actions = require "lir.actions"
+local mark_actions = require "lir.mark.actions"
+local clipboard_actions = require "lir.clipboard.actions"
+
+lir.setup {
+ show_hidden_files = false,
+ devicons_enable = true,
+ mappings = {
+ ["l"] = actions.edit,
+ ["<cr>"] = actions.edit,
+ ["<C-s>"] = actions.split,
+ ["v"] = actions.vsplit,
+ ["<C-t>"] = actions.tabedit,
+
+ ["h"] = actions.up,
+ ["q"] = actions.quit,
+
+ ["A"] = actions.mkdir,
+ ["a"] = actions.newfile,
+ ["r"] = actions.rename,
+ ["@"] = actions.cd,
+ ["Y"] = actions.yank_path,
+ ["."] = actions.toggle_show_hidden,
+ ["D"] = actions.delete,
+
+ ["J"] = function()
+ mark_actions.toggle_mark()
+ vim.cmd "normal! j"
+ end,
+ ["C"] = clipboard_actions.copy,
+ ["X"] = clipboard_actions.cut,
+ ["P"] = clipboard_actions.paste,
+ },
+ float = {
+ winblend = 0,
+
+ -- -- You can define a function that returns a table to be passed as the third
+ -- -- argument of nvim_open_win().
+ win_opts = function()
+ -- local width = math.floor(vim.o.columns * 0.8)
+ -- local height = math.floor(vim.o.lines * 0.8)
+ return {
+ border = "single",
+ -- border = require("lir.float.helper").make_border_opts({
+ -- "+",
+ -- "─",
+ -- "+",
+ -- "│",
+ -- "+",
+ -- "─",
+ -- "+",
+ -- "│",
+ -- }, "Normal"),
+ -- width = width,
+ -- height = height,
+ -- row = 1,
+ -- col = math.floor((vim.o.columns - width) / 2),
+ }
+ end,
+ },
+ hide_cursor = false,
+}
+
+-- custom folder icon
+require("nvim-web-devicons").setup {
+ override = {
+ lir_folder_icon = {
+ icon = "",
+ color = "#569CD6",
+ name = "LirFolderNode",
+ },
+ },
+}
+
+-- use visual mode
+function _G.LirSettings()
+ vim.api.nvim_buf_set_keymap(
+ 0,
+ "x",
+ "J",
+ ':<C-u>lua require"lir.mark.actions".toggle_mark("v")<CR>',
+ { noremap = true, silent = true }
+ )
+
+ -- echo cwd
+ vim.api.nvim_echo({ { vim.fn.expand "%:p", "Normal" } }, false, {})
+end
+
+vim.cmd [[augroup lir-settings]]
+vim.cmd [[ autocmd!]]
+vim.cmd [[ autocmd Filetype lir :lua LirSettings()]]
+vim.cmd [[augroup END]]
diff --git a/.config/nvim/lua/extra/lsp_signature.lua b/.config/nvim/lua/extra/lsp_signature.lua
new file mode 100644
index 0000000..7e67a4d
--- /dev/null
+++ b/.config/nvim/lua/extra/lsp_signature.lua
@@ -0,0 +1,14 @@
+local M = {}
+local Log = require "core.log"
+
+M.config = function()
+ local status_ok, lsp_signature = pcall(require, "lsp_signature")
+ if not status_ok then
+ Log:get_default().error "Failed to load lsp_signature"
+ return
+ end
+
+ lsp_signature.on_attach()
+end
+
+return M
diff --git a/.config/nvim/lua/extra/neoscroll.lua b/.config/nvim/lua/extra/neoscroll.lua
new file mode 100644
index 0000000..65f486b
--- /dev/null
+++ b/.config/nvim/lua/extra/neoscroll.lua
@@ -0,0 +1,25 @@
+local M = {}
+local Log = require "core.log"
+
+M.config = function()
+ local status_ok, neoscroll = pcall(require, "neoscroll")
+ if not status_ok then
+ Log:get_default().error "Failed to load hop"
+ return
+ end
+
+ neoscroll.setup {
+ -- All these keys will be mapped to their corresponding default scrolling animation
+ mappings = { "<C-u>", "<C-d>", "<C-b>", "<C-f>", "<C-y>", "<C-e>", "zt", "zz", "zb" },
+ hide_cursor = true, -- Hide cursor while scrolling
+ stop_eof = true, -- Stop at <EOF> when scrolling downwards
+ use_local_scrolloff = false, -- Use the local scope of scrolloff instead of the global scope
+ respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file
+ cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further
+ easing_function = nil, -- Default easing function
+ pre_hook = nil, -- Function to run before the scrolling animation starts
+ post_hook = nil, -- Function to run after the scrolling animation ends
+ }
+end
+
+return M
diff --git a/.config/nvim/lua/extra/numb.lua b/.config/nvim/lua/extra/numb.lua
new file mode 100644
index 0000000..17d9f6b
--- /dev/null
+++ b/.config/nvim/lua/extra/numb.lua
@@ -0,0 +1,17 @@
+local M = {}
+local Log = require "core.log"
+
+M.config = function()
+ local status_ok, numb = pcall(require, "numb")
+ if not status_ok then
+ Log:get_default().error "Failed to load numb"
+ return
+ end
+
+ numb.setup {
+ show_numbers = true, -- Enable 'number' for the window while peeking
+ show_cursorline = true, -- Enable 'cursorline' for the window while peeking
+ }
+end
+
+return M
diff --git a/.config/nvim/lua/extra/octo.lua b/.config/nvim/lua/extra/octo.lua
new file mode 100644
index 0000000..5a110df
--- /dev/null
+++ b/.config/nvim/lua/extra/octo.lua
@@ -0,0 +1,139 @@
+local M = {}
+
+local Log = require "core.log"
+
+M.config = function()
+ local status_ok, octo = pcall(require, "octo")
+ if not status_ok then
+ Log:get_default().error "Failed to load octo"
+ return
+ end
+
+ octo.setup {
+ default_remote = { "upstream", "origin" }, -- order to try remotes
+ reaction_viewer_hint_icon = "", -- marker for user reactions
+ user_icon = " ", -- user icon
+ timeline_marker = "", -- timeline marker
+ timeline_indent = "2", -- timeline indentation
+ right_bubble_delimiter = "", -- Bubble delimiter
+ left_bubble_delimiter = "", -- Bubble delimiter
+ github_hostname = "", -- GitHub Enterprise host
+ snippet_context_lines = 4, -- number or lines around commented lines
+ file_panel = {
+ size = 10, -- changed files panel rows
+ use_icons = true, -- use web-devicons in file panel
+ },
+ mappings = {
+ issue = {
+ close_issue = "<space>ic", -- close issue
+ reopen_issue = "<space>io", -- reopen issue
+ list_issues = "<space>il", -- list open issues on same repo
+ reload = "<C-r>", -- reload issue
+ open_in_browser = "<C-b>", -- open issue in browser
+ copy_url = "<C-y>", -- copy url to system clipboard
+ add_assignee = "<space>aa", -- add assignee
+ remove_assignee = "<space>ad", -- remove assignee
+ create_label = "<space>lc", -- create label
+ add_label = "<space>la", -- add label
+ remove_label = "<space>ld", -- remove label
+ goto_issue = "<space>gi", -- navigate to a local repo issue
+ add_comment = "<space>ca", -- add comment
+ delete_comment = "<space>cd", -- delete comment
+ next_comment = "]c", -- go to next comment
+ prev_comment = "[c", -- go to previous comment
+ react_hooray = "<space>rp", -- add/remove 🎉 reaction
+ react_heart = "<space>rh", -- add/remove ❤️ reaction
+ react_eyes = "<space>re", -- add/remove 👀 reaction
+ react_thumbs_up = "<space>r+", -- add/remove 👍 reaction
+ react_thumbs_down = "<space>r-", -- add/remove 👎 reaction
+ react_rocket = "<space>rr", -- add/remove 🚀 reaction
+ react_laugh = "<space>rl", -- add/remove 😄 reaction
+ react_confused = "<space>rc", -- add/remove 😕 reaction
+ },
+ pull_request = {
+ checkout_pr = "<space>po", -- checkout PR
+ merge_pr = "<space>pm", -- merge PR
+ list_commits = "<space>pc", -- list PR commits
+ list_changed_files = "<space>pf", -- list PR changed files
+ show_pr_diff = "<space>pd", -- show PR diff
+ add_reviewer = "<space>va", -- add reviewer
+ remove_reviewer = "<space>vd", -- remove reviewer request
+ close_issue = "<space>ic", -- close PR
+ reopen_issue = "<space>io", -- reopen PR
+ list_issues = "<space>il", -- list open issues on same repo
+ reload = "<C-r>", -- reload PR
+ open_in_browser = "<C-b>", -- open PR in browser
+ copy_url = "<C-y>", -- copy url to system clipboard
+ add_assignee = "<space>aa", -- add assignee
+ remove_assignee = "<space>ad", -- remove assignee
+ create_label = "<space>lc", -- create label
+ add_label = "<space>la", -- add label
+ remove_label = "<space>ld", -- remove label
+ goto_issue = "<space>gi", -- navigate to a local repo issue
+ add_comment = "<space>ca", -- add comment
+ delete_comment = "<space>cd", -- delete comment
+ next_comment = "]c", -- go to next comment
+ prev_comment = "[c", -- go to previous comment
+ react_hooray = "<space>rp", -- add/remove 🎉 reaction
+ react_heart = "<space>rh", -- add/remove ❤️ reaction
+ react_eyes = "<space>re", -- add/remove 👀 reaction
+ react_thumbs_up = "<space>r+", -- add/remove 👍 reaction
+ react_thumbs_down = "<space>r-", -- add/remove 👎 reaction
+ react_rocket = "<space>rr", -- add/remove 🚀 reaction
+ react_laugh = "<space>rl", -- add/remove 😄 reaction
+ react_confused = "<space>rc", -- add/remove 😕 reaction
+ },
+ review_thread = {
+ goto_issue = "<space>gi", -- navigate to a local repo issue
+ add_comment = "<space>ca", -- add comment
+ add_suggestion = "<space>sa", -- add suggestion
+ delete_comment = "<space>cd", -- delete comment
+ next_comment = "]c", -- go to next comment
+ prev_comment = "[c", -- go to previous comment
+ select_next_entry = "]q", -- move to previous changed file
+ select_prev_entry = "[q", -- move to next changed file
+ close_review_tab = "<C-c>", -- close review tab
+ react_hooray = "<space>rp", -- add/remove 🎉 reaction
+ react_heart = "<space>rh", -- add/remove ❤️ reaction
+ react_eyes = "<space>re", -- add/remove 👀 reaction
+ react_thumbs_up = "<space>r+", -- add/remove 👍 reaction
+ react_thumbs_down = "<space>r-", -- add/remove 👎 reaction
+ react_rocket = "<space>rr", -- add/remove 🚀 reaction
+ react_laugh = "<space>rl", -- add/remove 😄 reaction
+ react_confused = "<space>rc", -- add/remove 😕 reaction
+ },
+ submit_win = {
+ approve_review = "<C-a>", -- approve review
+ comment_review = "<C-m>", -- comment review
+ request_changes = "<C-r>", -- request changes review
+ close_review_tab = "<C-c>", -- close review tab
+ },
+ review_diff = {
+ add_review_comment = "<space>ca", -- add a new review comment
+ add_review_suggestion = "<space>sa", -- add a new review suggestion
+ focus_files = "<leader>e", -- move focus to changed file panel
+ toggle_files = "<leader>b", -- hide/show changed files panel
+ next_thread = "]t", -- move to next thread
+ prev_thread = "[t", -- move to previous thread
+ select_next_entry = "]q", -- move to previous changed file
+ select_prev_entry = "[q", -- move to next changed file
+ close_review_tab = "<C-c>", -- close review tab
+ toggle_viewed = "<leader><space>", -- toggle viewer viewed state
+ },
+ file_panel = {
+ next_entry = "j", -- move to next changed file
+ prev_entry = "k", -- move to previous changed file
+ select_entry = "<cr>", -- show selected changed file diffs
+ refresh_files = "R", -- refresh changed files panel
+ focus_files = "<leader>e", -- move focus to changed file panel
+ toggle_files = "<leader>b", -- hide/show changed files panel
+ select_next_entry = "]q", -- move to previous changed file
+ select_prev_entry = "[q", -- move to next changed file
+ close_review_tab = "<C-c>", -- close review tab
+ toggle_viewed = "<leader><space>", -- toggle viewer viewed state
+ },
+ },
+ }
+end
+
+return M
diff --git a/.config/nvim/lua/extra/quickscope.lua b/.config/nvim/lua/extra/quickscope.lua
new file mode 100644
index 0000000..99b4196
--- /dev/null
+++ b/.config/nvim/lua/extra/quickscope.lua
@@ -0,0 +1,3 @@
+vim.cmd [[
+ let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']
+ ]]
diff --git a/.config/nvim/lua/extra/spectre.lua b/.config/nvim/lua/extra/spectre.lua
new file mode 100644
index 0000000..12133d8
--- /dev/null
+++ b/.config/nvim/lua/extra/spectre.lua
@@ -0,0 +1,144 @@
+local M = {}
+local Log = require "core.log"
+
+M.config = function()
+ local status_ok, spectre = pcall(require, "spectre")
+ if not status_ok then
+ Log:get_default().error "Failed to load hop"
+ return
+ end
+
+ spectre.setup {
+
+ color_devicons = true,
+ highlight = {
+ ui = "String",
+ search = "DiffChange",
+ replace = "DiffDelete",
+ },
+ mapping = {
+ ["toggle_line"] = {
+ map = "t",
+ cmd = "<cmd>lua require('spectre').toggle_line()<CR>",
+ desc = "toggle current item",
+ },
+ ["enter_file"] = {
+ map = "<cr>",
+ cmd = "<cmd>lua require('spectre.actions').select_entry()<CR>",
+ desc = "goto current file",
+ },
+ ["send_to_qf"] = {
+ map = "Q",
+ cmd = "<cmd>lua require('spectre.actions').send_to_qf()<CR>",
+ desc = "send all item to quickfix",
+ },
+ ["replace_cmd"] = {
+ map = "c",
+ cmd = "<cmd>lua require('spectre.actions').replace_cmd()<CR>",
+ desc = "input replace vim command",
+ },
+ ["show_option_menu"] = {
+ map = "o",
+ cmd = "<cmd>lua require('spectre').show_options()<CR>",
+ desc = "show option",
+ },
+ ["run_replace"] = {
+ map = "R",
+ cmd = "<cmd>lua require('spectre.actions').run_replace()<CR>",
+ desc = "replace all",
+ },
+ ["change_view_mode"] = {
+ map = "m",
+ cmd = "<cmd>lua require('spectre').change_view()<CR>",
+ desc = "change result view mode",
+ },
+ ["toggle_ignore_case"] = {
+ map = "I",
+ cmd = "<cmd>lua require('spectre').change_options('ignore-case')<CR>",
+ desc = "toggle ignore case",
+ },
+ ["toggle_ignore_hidden"] = {
+ map = "H",
+ cmd = "<cmd>lua require('spectre').change_options('hidden')<CR>",
+ desc = "toggle search hidden",
+ },
+ -- you can put your mapping here it only use normal mode
+ },
+ find_engine = {
+ -- rg is map with finder_cmd
+ ["rg"] = {
+ cmd = "rg",
+ -- default args
+ args = {
+ "--color=never",
+ "--no-heading",
+ "--with-filename",
+ "--line-number",
+ "--column",
+ },
+ options = {
+ ["ignore-case"] = {
+ value = "--ignore-case",
+ icon = "[I]",
+ desc = "ignore case",
+ },
+ ["hidden"] = {
+ value = "--hidden",
+ desc = "hidden file",
+ icon = "[H]",
+ },
+ -- you can put any option you want here it can toggle with
+ -- show_option function
+ },
+ },
+ ["ag"] = {
+ cmd = "ag",
+ args = {
+ "--vimgrep",
+ "-s",
+ },
+ options = {
+ ["ignore-case"] = {
+ value = "-i",
+ icon = "[I]",
+ desc = "ignore case",
+ },
+ ["hidden"] = {
+ value = "--hidden",
+ desc = "hidden file",
+ icon = "[H]",
+ },
+ },
+ },
+ },
+ replace_engine = {
+ ["sed"] = {
+ cmd = "sed",
+ args = nil,
+ },
+ options = {
+ ["ignore-case"] = {
+ value = "--ignore-case",
+ icon = "[I]",
+ desc = "ignore case",
+ },
+ },
+ },
+ default = {
+ find = {
+ --pick one of item in find_engine
+ cmd = "rg",
+ options = { "ignore-case" },
+ },
+ replace = {
+ --pick one of item in replace_engine
+ cmd = "sed",
+ },
+ },
+ replace_vim_cmd = "cdo",
+ is_open_target_win = true, --open file on opener window
+ is_insert_mode = false, -- start open panel on is_insert_mode
+ }
+end
+
+return M
diff --git a/.config/nvim/lua/extra/twilight.lua b/.config/nvim/lua/extra/twilight.lua
new file mode 100644
index 0000000..b76563a
--- /dev/null
+++ b/.config/nvim/lua/extra/twilight.lua
@@ -0,0 +1,30 @@
+local M = {}
+local Log = require "core.log"
+
+M.config = function()
+ local status_ok, twilight = pcall(require, "twilight")
+ if not status_ok then
+ Log:get_default().error "Failed to load twilight"
+ return
+ end
+
+ twilight.setup {
+ dimming = {
+ alpha = 0.25, -- amount of dimming
+ -- we try to get the foreground from the highlight groups or fallback color
+ color = { "Normal", "#ffffff" },
+ },
+ context = 15, -- amount of lines we will try to show around the current line
+ -- treesitter is used to automatically expand the visible text,
+ -- but you can further control the types of nodes that should always be fully expanded
+ expand = {
+ "function",
+ "method",
+ "table",
+ "if_statement",
+ },
+ exclude = {}, -- exclude these filetypes
+ }
+end
+
+return M
diff --git a/.config/nvim/lua/extra/zen.lua b/.config/nvim/lua/extra/zen.lua
new file mode 100644
index 0000000..9bfaf1a
--- /dev/null
+++ b/.config/nvim/lua/extra/zen.lua
@@ -0,0 +1,48 @@
+local M = {}
+local Log = require "core.log"
+
+M.config = function()
+ local status_ok, zen_mode = pcall(require, "zen-mode")
+ if not status_ok then
+ Log:get_default().error "Failed to load zen-mode"
+ return
+ end
+
+ zen_mode.setup {
+ window = {
+ backdrop = 1,
+ height = 0.9, -- height of the Zen window
+ width = 0.65,
+ options = {
+ signcolumn = "no", -- disable signcolumn
+ number = false, -- disable number column
+ relativenumber = false, -- disable relative numbers
+ -- cursorline = false, -- disable cursorline
+ -- cursorcolumn = false, -- disable cursor column
+ -- foldcolumn = "0", -- disable fold column
+ -- list = false, -- disable whitespace characters
+ },
+ },
+ plugins = {
+ gitsigns = { enabled = false }, -- disables git signs
+ tmux = { enabled = true },
+ twilight = { enabled = true },
+ },
+ -- on_open = function()
+ -- vim.lsp.diagnostic.disable()
+ -- vim.cmd [[
+ -- set foldlevel=10
+ -- IndentBlanklineDisable
+ -- ]]
+ -- end,
+ -- on_close = function()
+ -- vim.lsp.diagnostic.enable()
+ -- vim.cmd [[
+ -- set foldlevel=5
+ -- IndentBlanklineEnable
+ -- ]]
+ -- end,
+ }
+end
+
+return M