fixing colorscheme WIP
This commit is contained in:
		
							parent
							
								
									a68ea2bf3d
								
							
						
					
					
						commit
						bf5ceef1f0
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1 +1,2 @@
 | 
			
		||||
config/spell
 | 
			
		||||
lazy-lock.json
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								init.lua
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								init.lua
									
									
									
									
									
								
							@ -1,5 +1,6 @@
 | 
			
		||||
-- load options
 | 
			
		||||
require("config.options")
 | 
			
		||||
require("config.keymap")
 | 
			
		||||
 | 
			
		||||
-- load lazy.nvim to bootstrap plugins
 | 
			
		||||
require("config.lazy")
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										199
									
								
								lua/colors/hybrid.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										199
									
								
								lua/colors/hybrid.lua
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,199 @@
 | 
			
		||||
-- [[
 | 
			
		||||
-- This file is largely based on work done by Andrew Wong (w0ng)
 | 
			
		||||
-- Find the original file and additional credits at: https://github.com/w0ng/vim-hybrid
 | 
			
		||||
--
 | 
			
		||||
-- ]] 
 | 
			
		||||
 | 
			
		||||
local M = {}
 | 
			
		||||
 | 
			
		||||
M.setup = function()
 | 
			
		||||
 | 
			
		||||
    -- Clear existing highlights
 | 
			
		||||
    vim.cmd("highlight clear")
 | 
			
		||||
 | 
			
		||||
    -- Reset syntax if it exists
 | 
			
		||||
    if vim.fn.exists("syntax_on") then
 | 
			
		||||
        vim.cmd("syntax reset")
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    vim.g.colors_name = "hybrid"
 | 
			
		||||
    vim.o.background = "dark"
 | 
			
		||||
    vim.o.termguicolors = true
 | 
			
		||||
 | 
			
		||||
    local colors = {
 | 
			
		||||
        -- Core colors with both GUI and cterm values
 | 
			
		||||
        background   = { gui = "#1d1f21", cterm = 234 },
 | 
			
		||||
        foreground   = { gui = "#c5c8c6", cterm = 250 },
 | 
			
		||||
        selection    = { gui = "#373b41", cterm = 237 },
 | 
			
		||||
        line         = { gui = "#282a2e", cterm = 235 },
 | 
			
		||||
        comment      = { gui = "#707880", cterm = 243 },
 | 
			
		||||
 | 
			
		||||
        -- Syntax colors
 | 
			
		||||
        red          = { gui = "#cc6666", cterm = 167 },
 | 
			
		||||
        orange       = { gui = "#de935f", cterm = 173 }, 
 | 
			
		||||
        yellow       = { gui = "#f0c674", cterm = 221 },
 | 
			
		||||
        green        = { gui = "#50c904", cterm = 143 },
 | 
			
		||||
        aqua         = { gui = "#8abeb7", cterm = 109 },
 | 
			
		||||
        -- aqua         = { gui = "#81a2be", cterm = 109 },
 | 
			
		||||
        blue         = { gui = "#87afd7", cterm = 110 },
 | 
			
		||||
        purple       = { gui = "#b294bb", cterm = 139 },
 | 
			
		||||
 | 
			
		||||
        -- UI colors
 | 
			
		||||
        window       = { gui = "#303030", cterm = 236 },
 | 
			
		||||
        darkcolumn   = { gui = "#1c1c1c", cterm = 234 },
 | 
			
		||||
 | 
			
		||||
        -- Git/diff colors
 | 
			
		||||
        add_bg       = { gui = "#5F875F", cterm = 65 },
 | 
			
		||||
        add_fg       = { gui = "#d7ffaf", cterm = 193 },
 | 
			
		||||
        change_bg    = { gui = "#5F5F87", cterm = 60 }, 
 | 
			
		||||
        change_fg    = { gui = "#d7d7ff", cterm = 189 },
 | 
			
		||||
        del_bg       = { gui = "#cc6666", cterm = 167 },
 | 
			
		||||
 | 
			
		||||
        -- Dark variants
 | 
			
		||||
        dark_red     = { gui = "#5f0000", cterm = 52 },
 | 
			
		||||
        dark_blue    = { gui = "#00005f", cterm = 17 },
 | 
			
		||||
        dark_cyan    = { gui = "#005f5f", cterm = 24 },
 | 
			
		||||
        dark_purple  = { gui = "#5f005f", cterm = 53 },
 | 
			
		||||
        dark_yellow  = { gui = "#b5bd68", cterm = 3 },
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    -- helper function to set highlights
 | 
			
		||||
    local function hi(group, opts)
 | 
			
		||||
        vim.api.nvim_set_hl(0, group, opts)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    -- Editor UI
 | 
			
		||||
    hi("Normal", { fg = colors.foreground.gui, bg = colors.background.gui, ctermfg = colors.foreground.cterm, ctermbg = colors.background.cterm })
 | 
			
		||||
    hi("ColorColumn", { bg = colors.line.gui, ctermbg = colors.line.cterm })
 | 
			
		||||
    hi("CursorColumn", { bg = colors.line.gui, ctermbg = colors.line.cterm })
 | 
			
		||||
    hi("CursorLine", {})
 | 
			
		||||
    hi("CursorLineNr", { fg = colors.yellow.gui, ctermfg = colors.yellow.cterm })
 | 
			
		||||
    hi("Directory", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
    hi("LineNr", { fg = colors.comment.gui, ctermfg = colors.comment.cterm })
 | 
			
		||||
    hi("VertSplit", { fg = colors.window.gui, ctermfg = colors.window.cterm })
 | 
			
		||||
    hi("Folded", { fg = colors.comment.gui, bg = colors.darkcolumn.gui, ctermfg = colors.comment.cterm, ctermbg = colors.darkcolumn.cterm })
 | 
			
		||||
    hi("FoldColumn", { bg = colors.darkcolumn.gui, ctermbg = colors.darkcolumn.cterm })
 | 
			
		||||
    hi("SignColumn", { bg = colors.darkcolumn.gui, ctermbg = colors.darkcolumn.cterm })
 | 
			
		||||
    hi("MatchParen", { fg = colors.background.gui, bg = colors.change_bg.gui, ctermfg = colors.background.cterm, ctermbg = colors.change_bg.cterm })
 | 
			
		||||
    hi("NonText", { fg = colors.selection.gui, ctermfg = colors.selection.cterm })
 | 
			
		||||
    hi("SpecialKey", { fg = colors.selection.gui, ctermfg = colors.selection.cterm })
 | 
			
		||||
    hi("Visual", { bg = colors.selection.gui, ctermbg = colors.selection.cterm })
 | 
			
		||||
    hi("Search", { fg = colors.background.gui, bg = colors.yellow.gui, ctermfg = colors.background.cterm, ctermbg = colors.yellow.cterm })
 | 
			
		||||
    hi("Title", { fg = colors.yellow.gui, ctermfg = colors.yellow.cterm })
 | 
			
		||||
 | 
			
		||||
    -- Messages
 | 
			
		||||
    hi("ModeMsg", { fg = colors.green.gui, ctermfg = colors.green.cterm })
 | 
			
		||||
    hi("MoreMsg", { fg = colors.green.gui, ctermfg = colors.green.cterm })
 | 
			
		||||
    hi("ErrorMsg", { fg = colors.background.gui, bg = colors.red.gui, ctermfg = colors.background.cterm, ctermbg = colors.red.cterm, standout = true })
 | 
			
		||||
    hi("WarningMsg", { fg = colors.red.gui, ctermfg = colors.red.cterm })
 | 
			
		||||
    hi("Question", { fg = colors.green.gui, ctermfg = colors.green.cterm })
 | 
			
		||||
 | 
			
		||||
    -- Popup menu
 | 
			
		||||
    hi("Pmenu", { fg = colors.foreground.gui, bg = colors.selection.gui, ctermfg = colors.foreground.cterm, ctermbg = colors.selection.cterm })
 | 
			
		||||
    hi("PmenuSel", { fg = colors.foreground.gui, bg = colors.selection.gui, ctermfg = colors.foreground.cterm, ctermbg = colors.selection.cterm, reverse = true })
 | 
			
		||||
 | 
			
		||||
    -- Status line
 | 
			
		||||
    hi("StatusLine", { fg = colors.comment.gui, bg = colors.background.gui, ctermfg = colors.comment.cterm, ctermbg = colors.background.cterm, reverse = true })
 | 
			
		||||
    hi("StatusLineNC", { fg = colors.window.gui, bg = colors.comment.gui, ctermfg = colors.window.cterm, ctermbg = colors.comment.cterm, reverse = true })
 | 
			
		||||
    hi("TabLine", { fg = colors.foreground.gui, bg = colors.darkcolumn.gui, ctermfg = colors.foreground.cterm, ctermbg = colors.darkcolumn.cterm, reverse = true })
 | 
			
		||||
 | 
			
		||||
    -- Diffs
 | 
			
		||||
    hi("DiffAdd", { fg = colors.add_fg.gui, bg = colors.add_bg.gui, ctermfg = colors.add_fg.cterm, ctermbg = colors.add_bg.cterm })
 | 
			
		||||
    hi("DiffChange", { fg = colors.change_fg.gui, bg = colors.change_bg.gui, ctermfg = colors.change_fg.cterm, ctermbg = colors.change_bg.cterm })
 | 
			
		||||
    hi("DiffDelete", { fg = colors.background.gui, bg = colors.del_bg.gui, ctermfg = colors.background.cterm, ctermbg = colors.del_bg.cterm })
 | 
			
		||||
    hi("DiffText", { fg = colors.background.gui, bg = colors.blue.gui, ctermfg = colors.background.cterm, ctermbg = colors.blue.cterm })
 | 
			
		||||
 | 
			
		||||
    -- Spelling
 | 
			
		||||
    hi("SpellCap", { sp = colors.blue.gui, ctermfg = colors.blue.cterm, undercurl = true })
 | 
			
		||||
    hi("SpellLocal", { sp = colors.aqua.gui, ctermfg = colors.aqua.cterm, undercurl = true })
 | 
			
		||||
    hi("SpellBad", { sp = colors.red.gui, ctermfg = colors.red.cterm, undercurl = true })
 | 
			
		||||
    hi("SpellRare", { fg = colors.purple.gui, bg = colors.dark_purple.gui, ctermfg = colors.purple.cterm, ctermbg = colors.dark_purple.cterm, underline = true })
 | 
			
		||||
 | 
			
		||||
    -- Syntax highlighting
 | 
			
		||||
    hi("Comment", { fg = colors.comment.gui, ctermfg = colors.comment.cterm })
 | 
			
		||||
 | 
			
		||||
    hi("Constant", { fg = colors.red.gui, ctermfg = colors.red.cterm })
 | 
			
		||||
    hi("String", { fg = colors.green.gui, ctermfg = colors.green.cterm })
 | 
			
		||||
 | 
			
		||||
    hi("Identifier", { fg = colors.purple.gui, ctermfg = colors.purple.cterm })
 | 
			
		||||
    hi("Function", { fg = colors.yellow.gui, ctermfg = colors.yellow.cterm })
 | 
			
		||||
 | 
			
		||||
    hi("Statement", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
    hi("Operator", { fg = colors.aqua.gui, ctermfg = colors.aqua.cterm })
 | 
			
		||||
 | 
			
		||||
    hi("PreProc", { fg = colors.aqua.gui, ctermfg = colors.aqua.cterm })
 | 
			
		||||
 | 
			
		||||
    hi("Type", { fg = colors.orange.gui, ctermfg = colors.orange.cterm })
 | 
			
		||||
    hi("Structure", { fg = colors.aqua.gui, ctermfg = colors.aqua.cterm })
 | 
			
		||||
 | 
			
		||||
    hi("Special", { fg = colors.green.gui, ctermfg = colors.green.cterm })
 | 
			
		||||
    hi("Underlined", { fg = colors.blue.gui, ctermfg = colors.blue.cterm, underline = true })
 | 
			
		||||
 | 
			
		||||
    hi("Error", { fg = colors.red.gui, bg = colors.dark_red.gui, ctermfg = colors.red.cterm, ctermbg = colors.dark_red.cterm, underline = true })
 | 
			
		||||
    hi("Todo", { fg = colors.add_fg.gui, ctermfg = colors.add_fg.cterm })
 | 
			
		||||
 | 
			
		||||
    -- Quickfix
 | 
			
		||||
    hi("qfLineNr", { fg = colors.yellow.gui, ctermfg = colors.yellow.cterm })
 | 
			
		||||
 | 
			
		||||
    -- Tree-sitter highlight groups
 | 
			
		||||
    hi("@variable", { fg = colors.foreground.gui, ctermfg = colors.foreground.cterm })
 | 
			
		||||
    hi("@variable.builtin", { fg = colors.purple.gui, ctermfg = colors.purple.cterm })
 | 
			
		||||
    hi("@variable.parameter", { fg = colors.foreground.gui, ctermfg = colors.foreground.cterm })
 | 
			
		||||
    hi("@variable.member", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
 | 
			
		||||
    hi("@constant", { fg = colors.yellow.gui, ctermfg = colors.yellow.cterm })
 | 
			
		||||
    hi("@constant.builtin", { fg = colors.yellow.gui, ctermfg = colors.yellow.cterm })
 | 
			
		||||
    hi("@constant.macro", { fg = colors.orange.gui, ctermfg = colors.orange.cterm })
 | 
			
		||||
 | 
			
		||||
    hi("@string", { fg = colors.dark_yellow.gui, ctermfg = colors.green.cterm })
 | 
			
		||||
    hi("@string.escape", { fg = colors.orange.gui, ctermfg = colors.orange.cterm })
 | 
			
		||||
    hi("@string.regexp", { fg = colors.orange.gui, ctermfg = colors.orange.cterm })
 | 
			
		||||
 | 
			
		||||
    hi("@character", { fg = colors.green.gui, ctermfg = colors.green.cterm })
 | 
			
		||||
    hi("@number", { fg = colors.orange.gui, ctermfg = colors.orange.cterm })
 | 
			
		||||
    hi("@boolean", { fg = colors.red.gui, ctermfg = colors.red.cterm })
 | 
			
		||||
    --hi("@float", { fg = colors.red.gui, ctermfg = colors.red.cterm })
 | 
			
		||||
 | 
			
		||||
    -- generally high priority
 | 
			
		||||
    hi("@function", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
    hi("@function.builtin", { fg = colors.purple.gui, ctermfg = colors.purple.cterm })
 | 
			
		||||
    hi("@function.call", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
    --hi("@function.macro", { fg = colors.purple.gui, ctermfg = colors.purple.cterm })
 | 
			
		||||
    --hi("@function.method", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
    hi("@method", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
    hi("@method.call", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
 | 
			
		||||
    hi("@constructor", { fg = colors.blue.gui, ctermfg = colors.blue.cterm, bold = true})
 | 
			
		||||
    hi("@operator", { fg = colors.red.gui, ctermfg = colors.red.cterm })
 | 
			
		||||
 | 
			
		||||
    hi("@keyword", { fg = colors.purple.gui, ctermfg = colors.purple.cterm })
 | 
			
		||||
    hi("@keyword.function", { fg = colors.purple.gui, ctermfg = colors.purple.cterm })
 | 
			
		||||
    hi("@keyword.operator", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
    hi("@keyword.return", { fg = colors.purple.gui, ctermfg = colors.purple.cterm })
 | 
			
		||||
    hi("@keyword.conditional", { fg = colors.purple.gui, ctermfg = colors.purple.cterm })
 | 
			
		||||
    hi("@keyword.repeat", { fg = colors.purple.gui, ctermfg = colors.purple.cterm })
 | 
			
		||||
    hi("@keyword.import", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
 | 
			
		||||
    hi("@type", { fg = colors.orange.gui, ctermfg = colors.orange.cterm })
 | 
			
		||||
    hi("@type.builtin", { fg = colors.orange.gui, ctermfg = colors.orange.cterm })
 | 
			
		||||
    hi("@type.qualifier", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
 | 
			
		||||
    hi("@property", { fg = colors.foreground.gui, ctermfg = colors.foreground.cterm })
 | 
			
		||||
    -- hi("@field", { fg = colors.red.gui, ctermfg = colors.red.cterm })
 | 
			
		||||
 | 
			
		||||
    hi("@punctuation.delimiter", { fg = colors.foreground.gui, ctermfg = colors.foreground.cterm })
 | 
			
		||||
    hi("@punctuation.bracket", { fg = colors.foreground.gui, ctermfg = colors.foreground.cterm })
 | 
			
		||||
    hi("@punctuation.special", { fg = colors.foreground.gui, ctermfg = colors.foreground.cterm })
 | 
			
		||||
 | 
			
		||||
    hi("@comment", { fg = colors.comment.gui, ctermfg = colors.comment.cterm })
 | 
			
		||||
    hi("@comment.documentation", { fg = colors.comment.gui, ctermfg = colors.comment.cterm })
 | 
			
		||||
 | 
			
		||||
    hi("@tag", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
    hi("@tag.attribute", { fg = colors.orange.gui, ctermfg = colors.orange.cterm })
 | 
			
		||||
    hi("@tag.delimiter", { fg = colors.foreground.gui, ctermfg = colors.foreground.cterm })
 | 
			
		||||
    -- Set up highlight links separately
 | 
			
		||||
    vim.api.nvim_set_hl(0, "diffRemoved", { link = "Constant" })
 | 
			
		||||
    vim.api.nvim_set_hl(0, "diffAdded", { link = "Special" })
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
return M
 | 
			
		||||
@ -1,5 +1,8 @@
 | 
			
		||||
vim.g.mapleader = " "
 | 
			
		||||
 | 
			
		||||
-- disable vim copying via windows cmd for system takeover
 | 
			
		||||
-- vim.keymap.set({"n","v","i"},"<C-c>",'<Nop>', { noremap = true })
 | 
			
		||||
 | 
			
		||||
-- allows for toggling of background
 | 
			
		||||
local function ToggleTransparent()
 | 
			
		||||
    Transparent = not Transparent
 | 
			
		||||
@ -44,7 +47,7 @@ vim.g.mkdp_browserfunc = 'OpenMarkdownPreview'
 | 
			
		||||
vim.keymap.set("n", "<leader>ga", ":Git add .<CR>")
 | 
			
		||||
vim.keymap.set("n", "<leader>gm", ":Git commit<CR>")
 | 
			
		||||
 | 
			
		||||
-q- -- fuzzy finder keybindings
 | 
			
		||||
-- -- fuzzy finder keybindings
 | 
			
		||||
-- local telescope = require('telescope.builtin')
 | 
			
		||||
-- vim.keymap.set('n','<leader>f', telescope.find_files, {})
 | 
			
		||||
-- vim.keymap.set('n','<leader>s', telescope.spell_suggest, {})
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,3 @@
 | 
			
		||||
-- grabs key mappings 
 | 
			
		||||
require("keymap")
 | 
			
		||||
 | 
			
		||||
-- prevent cursor override
 | 
			
		||||
vim.cmd('set guicursor=')
 | 
			
		||||
vim.cmd('let g:do_filetype_lua=1')
 | 
			
		||||
 | 
			
		||||
@ -1,199 +1,11 @@
 | 
			
		||||
-- [[
 | 
			
		||||
-- This file is largely based on work done by Andrew Wong (w0ng)
 | 
			
		||||
-- Find the original file and additional credits at: https://github.com/w0ng/vim-hybrid
 | 
			
		||||
--
 | 
			
		||||
-- ]] 
 | 
			
		||||
 | 
			
		||||
return {
 | 
			
		||||
 | 
			
		||||
    {
 | 
			
		||||
        "custom/hybrid",
 | 
			
		||||
        dir = vim.fn.stdpath("config") ..  "/lua/colors",
 | 
			
		||||
        name = "hybrid-colorscheme",
 | 
			
		||||
        lazy = "false",
 | 
			
		||||
        lazy = false,
 | 
			
		||||
        priority = 1000,
 | 
			
		||||
        config = function()
 | 
			
		||||
            -- Clear existing highlights
 | 
			
		||||
            vim.cmd("highlight clear")
 | 
			
		||||
 | 
			
		||||
            -- Reset syntax if it exists
 | 
			
		||||
            if vim.fn.exists("syntax_on") then
 | 
			
		||||
                vim.cmd("syntax reset")
 | 
			
		||||
            end
 | 
			
		||||
 | 
			
		||||
            vim.g.colors_name = "hybrid"
 | 
			
		||||
            vim.o.background = "dark"
 | 
			
		||||
            vim.o.termguicolors = true
 | 
			
		||||
 | 
			
		||||
            local colors = {
 | 
			
		||||
                -- Core colors with both GUI and cterm values
 | 
			
		||||
                background   = { gui = "#1d1f21", cterm = 234 },
 | 
			
		||||
                foreground   = { gui = "#c5c8c6", cterm = 250 },
 | 
			
		||||
                selection    = { gui = "#373b41", cterm = 237 },
 | 
			
		||||
                line         = { gui = "#282a2e", cterm = 235 },
 | 
			
		||||
                comment      = { gui = "#707880", cterm = 243 },
 | 
			
		||||
 | 
			
		||||
                -- Syntax colors
 | 
			
		||||
                red          = { gui = "#cc6666", cterm = 167 },
 | 
			
		||||
                orange       = { gui = "#de935f", cterm = 173 }, 
 | 
			
		||||
                yellow       = { gui = "#f0c674", cterm = 221 },
 | 
			
		||||
                green        = { gui = "#b5bd68", cterm = 143 },
 | 
			
		||||
                aqua         = { gui = "#8abeb7", cterm = 109 },
 | 
			
		||||
                blue         = { gui = "#81a2be", cterm = 110 },
 | 
			
		||||
                purple       = { gui = "#b294bb", cterm = 139 },
 | 
			
		||||
 | 
			
		||||
                -- UI colors
 | 
			
		||||
                window       = { gui = "#303030", cterm = 236 },
 | 
			
		||||
                darkcolumn   = { gui = "#1c1c1c", cterm = 234 },
 | 
			
		||||
 | 
			
		||||
                -- Git/diff colors
 | 
			
		||||
                add_bg       = { gui = "#5F875F", cterm = 65 },
 | 
			
		||||
                add_fg       = { gui = "#d7ffaf", cterm = 193 },
 | 
			
		||||
                change_bg    = { gui = "#5F5F87", cterm = 60 }, 
 | 
			
		||||
                change_fg    = { gui = "#d7d7ff", cterm = 189 },
 | 
			
		||||
                del_bg       = { gui = "#cc6666", cterm = 167 },
 | 
			
		||||
 | 
			
		||||
                -- Dark variants
 | 
			
		||||
                dark_red     = { gui = "#5f0000", cterm = 52 },
 | 
			
		||||
                dark_blue    = { gui = "#00005f", cterm = 17 },
 | 
			
		||||
                dark_cyan    = { gui = "#005f5f", cterm = 24 },
 | 
			
		||||
                dark_purple  = { gui = "#5f005f", cterm = 53 },
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            -- helper function to set highlights
 | 
			
		||||
            local function hi(group, opts)
 | 
			
		||||
                vim.api.nvim_set_hl(0, group, opts)
 | 
			
		||||
            end
 | 
			
		||||
 | 
			
		||||
            -- Editor UI
 | 
			
		||||
            hi("Normal", { fg = colors.foreground.gui, bg = colors.background.gui, ctermfg = colors.foreground.cterm, ctermbg = colors.background.cterm })
 | 
			
		||||
            hi("ColorColumn", { bg = colors.line.gui, ctermbg = colors.line.cterm })
 | 
			
		||||
            hi("CursorColumn", { bg = colors.line.gui, ctermbg = colors.line.cterm })
 | 
			
		||||
            hi("CursorLine", {})
 | 
			
		||||
            hi("CursorLineNr", { fg = colors.yellow.gui, ctermfg = colors.yellow.cterm })
 | 
			
		||||
            hi("Directory", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
            hi("LineNr", { fg = colors.comment.gui, ctermfg = colors.comment.cterm })
 | 
			
		||||
            hi("VertSplit", { fg = colors.window.gui, ctermfg = colors.window.cterm })
 | 
			
		||||
            hi("Folded", { fg = colors.comment.gui, bg = colors.darkcolumn.gui, ctermfg = colors.comment.cterm, ctermbg = colors.darkcolumn.cterm })
 | 
			
		||||
            hi("FoldColumn", { bg = colors.darkcolumn.gui, ctermbg = colors.darkcolumn.cterm })
 | 
			
		||||
            hi("SignColumn", { bg = colors.darkcolumn.gui, ctermbg = colors.darkcolumn.cterm })
 | 
			
		||||
            hi("MatchParen", { fg = colors.background.gui, bg = colors.change_bg.gui, ctermfg = colors.background.cterm, ctermbg = colors.change_bg.cterm })
 | 
			
		||||
            hi("NonText", { fg = colors.selection.gui, ctermfg = colors.selection.cterm })
 | 
			
		||||
            hi("SpecialKey", { fg = colors.selection.gui, ctermfg = colors.selection.cterm })
 | 
			
		||||
            hi("Visual", { bg = colors.selection.gui, ctermbg = colors.selection.cterm })
 | 
			
		||||
            hi("Search", { fg = colors.background.gui, bg = colors.yellow.gui, ctermfg = colors.background.cterm, ctermbg = colors.yellow.cterm })
 | 
			
		||||
            hi("Title", { fg = colors.yellow.gui, ctermfg = colors.yellow.cterm })
 | 
			
		||||
 | 
			
		||||
            -- Messages
 | 
			
		||||
            hi("ModeMsg", { fg = colors.green.gui, ctermfg = colors.green.cterm })
 | 
			
		||||
            hi("MoreMsg", { fg = colors.green.gui, ctermfg = colors.green.cterm })
 | 
			
		||||
            hi("ErrorMsg", { fg = colors.background.gui, bg = colors.red.gui, ctermfg = colors.background.cterm, ctermbg = colors.red.cterm, standout = true })
 | 
			
		||||
            hi("WarningMsg", { fg = colors.red.gui, ctermfg = colors.red.cterm })
 | 
			
		||||
            hi("Question", { fg = colors.green.gui, ctermfg = colors.green.cterm })
 | 
			
		||||
 | 
			
		||||
            -- Popup menu
 | 
			
		||||
            hi("Pmenu", { fg = colors.foreground.gui, bg = colors.selection.gui, ctermfg = colors.foreground.cterm, ctermbg = colors.selection.cterm })
 | 
			
		||||
            hi("PmenuSel", { fg = colors.foreground.gui, bg = colors.selection.gui, ctermfg = colors.foreground.cterm, ctermbg = colors.selection.cterm, reverse = true })
 | 
			
		||||
 | 
			
		||||
            -- Status line
 | 
			
		||||
            hi("StatusLine", { fg = colors.comment.gui, bg = colors.background.gui, ctermfg = colors.comment.cterm, ctermbg = colors.background.cterm, reverse = true })
 | 
			
		||||
            hi("StatusLineNC", { fg = colors.window.gui, bg = colors.comment.gui, ctermfg = colors.window.cterm, ctermbg = colors.comment.cterm, reverse = true })
 | 
			
		||||
            hi("TabLine", { fg = colors.foreground.gui, bg = colors.darkcolumn.gui, ctermfg = colors.foreground.cterm, ctermbg = colors.darkcolumn.cterm, reverse = true })
 | 
			
		||||
 | 
			
		||||
            -- Diffs
 | 
			
		||||
            hi("DiffAdd", { fg = colors.add_fg.gui, bg = colors.add_bg.gui, ctermfg = colors.add_fg.cterm, ctermbg = colors.add_bg.cterm })
 | 
			
		||||
            hi("DiffChange", { fg = colors.change_fg.gui, bg = colors.change_bg.gui, ctermfg = colors.change_fg.cterm, ctermbg = colors.change_bg.cterm })
 | 
			
		||||
            hi("DiffDelete", { fg = colors.background.gui, bg = colors.del_bg.gui, ctermfg = colors.background.cterm, ctermbg = colors.del_bg.cterm })
 | 
			
		||||
            hi("DiffText", { fg = colors.background.gui, bg = colors.blue.gui, ctermfg = colors.background.cterm, ctermbg = colors.blue.cterm })
 | 
			
		||||
 | 
			
		||||
            -- Spelling
 | 
			
		||||
            hi("SpellCap", { sp = colors.blue.gui, ctermfg = colors.blue.cterm, undercurl = true })
 | 
			
		||||
            hi("SpellLocal", { sp = colors.aqua.gui, ctermfg = colors.aqua.cterm, undercurl = true })
 | 
			
		||||
            hi("SpellBad", { sp = colors.red.gui, ctermfg = colors.red.cterm, undercurl = true })
 | 
			
		||||
            hi("SpellRare", { fg = colors.purple.gui, bg = colors.dark_purple.gui, ctermfg = colors.purple.cterm, ctermbg = colors.dark_purple.cterm, underline = true })
 | 
			
		||||
 | 
			
		||||
            -- Syntax highlighting
 | 
			
		||||
            hi("Comment", { fg = colors.comment.gui, ctermfg = colors.comment.cterm })
 | 
			
		||||
 | 
			
		||||
            hi("Constant", { fg = colors.red.gui, ctermfg = colors.red.cterm })
 | 
			
		||||
            hi("String", { fg = colors.green.gui, ctermfg = colors.green.cterm })
 | 
			
		||||
 | 
			
		||||
            hi("Identifier", { fg = colors.purple.gui, ctermfg = colors.purple.cterm })
 | 
			
		||||
            hi("Function", { fg = colors.yellow.gui, ctermfg = colors.yellow.cterm })
 | 
			
		||||
 | 
			
		||||
            hi("Statement", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
            hi("Operator", { fg = colors.aqua.gui, ctermfg = colors.aqua.cterm })
 | 
			
		||||
 | 
			
		||||
            hi("PreProc", { fg = colors.aqua.gui, ctermfg = colors.aqua.cterm })
 | 
			
		||||
 | 
			
		||||
            hi("Type", { fg = colors.orange.gui, ctermfg = colors.orange.cterm })
 | 
			
		||||
            hi("Structure", { fg = colors.aqua.gui, ctermfg = colors.aqua.cterm })
 | 
			
		||||
 | 
			
		||||
            hi("Special", { fg = colors.green.gui, ctermfg = colors.green.cterm })
 | 
			
		||||
            hi("Underlined", { fg = colors.blue.gui, ctermfg = colors.blue.cterm, underline = true })
 | 
			
		||||
 | 
			
		||||
            hi("Error", { fg = colors.red.gui, bg = colors.dark_red.gui, ctermfg = colors.red.cterm, ctermbg = colors.dark_red.cterm, underline = true })
 | 
			
		||||
            hi("Todo", { fg = colors.add_fg.gui, ctermfg = colors.add_fg.cterm })
 | 
			
		||||
 | 
			
		||||
            -- Quickfix
 | 
			
		||||
            hi("qfLineNr", { fg = colors.yellow.gui, ctermfg = colors.yellow.cterm })
 | 
			
		||||
 | 
			
		||||
            -- Tree-sitter highlight groups
 | 
			
		||||
            hi("@variable", { fg = colors.foreground.gui, ctermfg = colors.foreground.cterm })
 | 
			
		||||
            hi("@variable.builtin", { fg = colors.purple.gui, ctermfg = colors.purple.cterm })
 | 
			
		||||
            hi("@variable.parameter", { fg = colors.orange.gui, ctermfg = colors.orange.cterm })
 | 
			
		||||
            -- hi("@variable.member", { fg = colors.red.gui, ctermfg = colors.red.cterm })
 | 
			
		||||
 | 
			
		||||
            hi("@constant", { fg = colors.red.gui, ctermfg = colors.red.cterm })
 | 
			
		||||
            hi("@constant.builtin", { fg = colors.red.gui, ctermfg = colors.red.cterm })
 | 
			
		||||
            hi("@constant.macro", { fg = colors.aqua.gui, ctermfg = colors.aqua.cterm })
 | 
			
		||||
 | 
			
		||||
            hi("@string", { fg = colors.green.gui, ctermfg = colors.green.cterm })
 | 
			
		||||
            hi("@string.escape", { fg = colors.aqua.gui, ctermfg = colors.aqua.cterm })
 | 
			
		||||
            hi("@string.regexp", { fg = colors.aqua.gui, ctermfg = colors.aqua.cterm })
 | 
			
		||||
 | 
			
		||||
            hi("@character", { fg = colors.green.gui, ctermfg = colors.green.cterm })
 | 
			
		||||
            hi("@number", { fg = colors.red.gui, ctermfg = colors.red.cterm })
 | 
			
		||||
            hi("@boolean", { fg = colors.red.gui, ctermfg = colors.red.cterm })
 | 
			
		||||
            hi("@float", { fg = colors.red.gui, ctermfg = colors.red.cterm })
 | 
			
		||||
 | 
			
		||||
            hi("@function", { fg = colors.yellow.gui, ctermfg = colors.yellow.cterm })
 | 
			
		||||
            hi("@function.builtin", { fg = colors.yellow.gui, ctermfg = colors.yellow.cterm })
 | 
			
		||||
            hi("@function.call", { fg = colors.yellow.gui, ctermfg = colors.yellow.cterm })
 | 
			
		||||
            hi("@function.macro", { fg = colors.aqua.gui, ctermfg = colors.aqua.cterm })
 | 
			
		||||
            hi("@function.method", { fg = colors.yellow.gui, ctermfg = colors.yellow.cterm })
 | 
			
		||||
 | 
			
		||||
            hi("@constructor", { fg = colors.orange.gui, ctermfg = colors.orange.cterm })
 | 
			
		||||
            hi("@operator", { fg = colors.aqua.gui, ctermfg = colors.aqua.cterm })
 | 
			
		||||
 | 
			
		||||
            hi("@keyword", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
            hi("@keyword.function", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
            hi("@keyword.operator", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
            hi("@keyword.return", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
            hi("@keyword.conditional", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
            hi("@keyword.repeat", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
            hi("@keyword.import", { fg = colors.aqua.gui, ctermfg = colors.aqua.cterm })
 | 
			
		||||
 | 
			
		||||
            hi("@type", { fg = colors.orange.gui, ctermfg = colors.orange.cterm })
 | 
			
		||||
            hi("@type.builtin", { fg = colors.orange.gui, ctermfg = colors.orange.cterm })
 | 
			
		||||
            hi("@type.qualifier", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
 | 
			
		||||
            hi("@property", { fg = colors.red.gui, ctermfg = colors.red.cterm })
 | 
			
		||||
            hi("@field", { fg = colors.red.gui, ctermfg = colors.red.cterm })
 | 
			
		||||
 | 
			
		||||
            hi("@punctuation.delimiter", { fg = colors.foreground.gui, ctermfg = colors.foreground.cterm })
 | 
			
		||||
            hi("@punctuation.bracket", { fg = colors.foreground.gui, ctermfg = colors.foreground.cterm })
 | 
			
		||||
            hi("@punctuation.special", { fg = colors.aqua.gui, ctermfg = colors.aqua.cterm })
 | 
			
		||||
 | 
			
		||||
            hi("@comment", { fg = colors.comment.gui, ctermfg = colors.comment.cterm })
 | 
			
		||||
            hi("@comment.documentation", { fg = colors.comment.gui, ctermfg = colors.comment.cterm })
 | 
			
		||||
 | 
			
		||||
            hi("@tag", { fg = colors.blue.gui, ctermfg = colors.blue.cterm })
 | 
			
		||||
            hi("@tag.attribute", { fg = colors.orange.gui, ctermfg = colors.orange.cterm })
 | 
			
		||||
            hi("@tag.delimiter", { fg = colors.foreground.gui, ctermfg = colors.foreground.cterm })
 | 
			
		||||
            -- Set up highlight links separately
 | 
			
		||||
            vim.api.nvim_set_hl(0, "diffRemoved", { link = "Constant" })
 | 
			
		||||
            vim.api.nvim_set_hl(0, "diffAdded", { link = "Special" })
 | 
			
		||||
            require("colors.hybrid").setup()
 | 
			
		||||
        end,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    },
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,325 +0,0 @@
 | 
			
		||||
local M = {}
 | 
			
		||||
_VT_NS = vim.api.nvim_create_namespace("lsp_signature")
 | 
			
		||||
 | 
			
		||||
local prescript
 | 
			
		||||
local prescript_hi
 | 
			
		||||
local due_hi
 | 
			
		||||
local ft
 | 
			
		||||
local today
 | 
			
		||||
local today_hi
 | 
			
		||||
local overdue
 | 
			
		||||
local overdue_hi
 | 
			
		||||
local date_hi
 | 
			
		||||
local pattern_start
 | 
			
		||||
local pattern_end
 | 
			
		||||
 | 
			
		||||
local use_clock_time
 | 
			
		||||
local use_clock_today
 | 
			
		||||
local use_seconds
 | 
			
		||||
local default_due_time
 | 
			
		||||
 | 
			
		||||
local user_hour
 | 
			
		||||
local user_min
 | 
			
		||||
local user_sec
 | 
			
		||||
 | 
			
		||||
local date_pattern
 | 
			
		||||
local datetime_pattern
 | 
			
		||||
local datetime12_pattern
 | 
			
		||||
local fulldate_pattern
 | 
			
		||||
local fulldatetime_pattern
 | 
			
		||||
local fulldatetime12_pattern
 | 
			
		||||
 | 
			
		||||
local regex_hi
 | 
			
		||||
 | 
			
		||||
local update_rate
 | 
			
		||||
 | 
			
		||||
local function patternify(str)
 | 
			
		||||
  return str:gsub("[%(%)%.%%%+%-%*%?%[%^%$%]]", "%%%1")
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
local function regexify(str) return str:gsub("\\%^%$%.%*~%[%]&", "\\%1") end
 | 
			
		||||
 | 
			
		||||
local function make_pattern(pattern)
 | 
			
		||||
  return patternify(pattern_start) .. pattern:gsub('%(', ''):gsub('%)', '') ..
 | 
			
		||||
      patternify(pattern_end)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
local function make_pattern_match(pattern)
 | 
			
		||||
  return patternify(pattern_start) .. pattern .. patternify(pattern_end)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
local function parseDue(due)
 | 
			
		||||
  local year = 31556926
 | 
			
		||||
  local month = 2629743
 | 
			
		||||
  local week = 604800
 | 
			
		||||
  local day = 86400
 | 
			
		||||
  local hour = 3600
 | 
			
		||||
  local minute = 60
 | 
			
		||||
  local res = ''
 | 
			
		||||
  local is_today = due < day
 | 
			
		||||
 | 
			
		||||
  if due >= year then
 | 
			
		||||
    res = res .. math.floor(due / year) .. 'y '
 | 
			
		||||
    due = due % year
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  if due >= month then
 | 
			
		||||
    res = res .. math.floor(due / month) .. 'm '
 | 
			
		||||
    due = due % month
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  if due >= week then
 | 
			
		||||
    res = res .. math.floor(due / week) .. 'w '
 | 
			
		||||
    due = due % week
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  if use_clock_time or (is_today and use_clock_today) then
 | 
			
		||||
    if due >= day then
 | 
			
		||||
      res = res .. math.floor(due / day) .. 'd '
 | 
			
		||||
      due = due % day
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    if due >= hour then
 | 
			
		||||
      res = res .. math.floor(due / hour) .. 'h '
 | 
			
		||||
      due = due % hour
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    if due >= minute then
 | 
			
		||||
      res = res .. math.floor(due / minute) .. 'min '
 | 
			
		||||
      due = due % minute
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    if use_seconds then res = res .. math.floor(due / 1) + 1 .. 's ' end
 | 
			
		||||
 | 
			
		||||
  else
 | 
			
		||||
    res = res .. math.floor(due / day) + 1 .. 'd '
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  return res
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function M.setup(c)
 | 
			
		||||
  c = c or {}
 | 
			
		||||
  use_clock_time = c.use_clock_time or false
 | 
			
		||||
  use_clock_today = c.use_clock_time or false
 | 
			
		||||
  if type(c.use_seconds) == 'boolean' then
 | 
			
		||||
    use_seconds = c.use_seconds
 | 
			
		||||
  else
 | 
			
		||||
    use_seconds = c.use_clock_time or false
 | 
			
		||||
  end
 | 
			
		||||
  update_rate = c.update_rate or
 | 
			
		||||
      (use_clock_time and (use_seconds and 1000 or 60000) or 0)
 | 
			
		||||
  default_due_time = c.default_due_time or 'midnight'
 | 
			
		||||
  prescript = c.prescript or 'due: '
 | 
			
		||||
  prescript_hi = c.prescript_hi or 'Comment'
 | 
			
		||||
  due_hi = c.due_hi or 'String'
 | 
			
		||||
  ft = c.ft or '*.md'
 | 
			
		||||
  today = c.today or 'TODAY'
 | 
			
		||||
  today_hi = c.today_hi or 'Character'
 | 
			
		||||
  overdue = c.overdue or 'OVERDUE'
 | 
			
		||||
  overdue_hi = c.overdue_hi or 'Error'
 | 
			
		||||
  date_hi = c.date_hi or 'Conceal'
 | 
			
		||||
  week_hi = c.week_hi or 'Question'
 | 
			
		||||
  pattern_start = c.pattern_start or '<'
 | 
			
		||||
  pattern_end = c.pattern_end or '>'
 | 
			
		||||
  date_pattern = c.date_pattern or '(%d%d)%-(%d%d)'
 | 
			
		||||
  datetime_pattern = c.datetime_pattern or (date_pattern .. ' (%d+):(%d%d)')
 | 
			
		||||
  datetime12_pattern = c.datetime12_pattern or (datetime_pattern .. ' (%a%a)')
 | 
			
		||||
  fulldate_pattern = c.fulldate_pattern or ('(%d%d%d%d)%-' .. date_pattern)
 | 
			
		||||
  fulldatetime_pattern = c.fulldatetime_pattern or
 | 
			
		||||
      ('(%d%d%d%d)%-' .. datetime_pattern)
 | 
			
		||||
  fulldatetime12_pattern = c.fulldatetime12_pattern or
 | 
			
		||||
      (fulldatetime_pattern .. ' (%a%a)')
 | 
			
		||||
  regex_hi = c.regex_hi or
 | 
			
		||||
      "\\d*-*\\d\\+-\\d\\+\\( \\d*:\\d*\\( \\a\\a\\)\\?\\)\\?"
 | 
			
		||||
 | 
			
		||||
  if default_due_time == "midnight" then
 | 
			
		||||
    user_hour = 23
 | 
			
		||||
    user_min = 59
 | 
			
		||||
    user_sec = 59
 | 
			
		||||
  elseif default_due_time == "noon" then
 | 
			
		||||
    user_hour = 12
 | 
			
		||||
    user_min = 00
 | 
			
		||||
    user_sec = 00
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  local regex_start = regexify(pattern_start)
 | 
			
		||||
  local regex_end = regexify(pattern_end)
 | 
			
		||||
 | 
			
		||||
  local regex_hi_full = '/' .. regex_start .. regex_hi .. regex_end .. '/'
 | 
			
		||||
 | 
			
		||||
  vim.api.nvim_exec(string.format(
 | 
			
		||||
    [[
 | 
			
		||||
  augroup Due
 | 
			
		||||
    autocmd!
 | 
			
		||||
    autocmd BufEnter %s lua require("due_nvim").draw(0)
 | 
			
		||||
    autocmd BufEnter %s lua require("due_nvim").async_update(0)
 | 
			
		||||
    autocmd InsertLeave %s lua require("due_nvim").redraw(0)
 | 
			
		||||
    autocmd TextChanged %s lua require("due_nvim").redraw(0)
 | 
			
		||||
    autocmd TextChangedI %s lua require("due_nvim").redraw(0)
 | 
			
		||||
    autocmd BufEnter %s syn match DueDate %s display containedin=mkdNonListItemBlock,mkdListItemLine,mkdBlockquote conceal
 | 
			
		||||
    autocmd BufEnter %s hi def link DueDate %s
 | 
			
		||||
  augroup END
 | 
			
		||||
  ]] , ft, ft, ft, ft, ft, ft, regex_hi_full, ft, date_hi),
 | 
			
		||||
    false
 | 
			
		||||
  )
 | 
			
		||||
    -- old autcmd
 | 
			
		||||
    --autocmd BufEnter %s syn match DueDate %s display containedin=mkdNonListItemBlock,mkdListItemLine,mkdBlockquote contained conceal
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
local function draw_due(due, buf, key)
 | 
			
		||||
  local parsed
 | 
			
		||||
 | 
			
		||||
  if due > 0 then
 | 
			
		||||
    if not (use_clock_time or use_clock_today) and due < 86400 then
 | 
			
		||||
      parsed = { today, today_hi }
 | 
			
		||||
    elseif due < 86400 then
 | 
			
		||||
      parsed = { parseDue(due), today_hi }
 | 
			
		||||
    elseif due < 604800 then
 | 
			
		||||
      parsed = { parseDue(due), due_hi }
 | 
			
		||||
    else
 | 
			
		||||
      parsed = { parseDue(due), week_hi }
 | 
			
		||||
    end
 | 
			
		||||
  else
 | 
			
		||||
    parsed = { overdue, overdue_hi }
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  vim.api.nvim_buf_set_virtual_text(buf, _VT_NS, key - 1,
 | 
			
		||||
    { { prescript, prescript_hi }, parsed }, {})
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function M.draw(buf)
 | 
			
		||||
  -- get current time
 | 
			
		||||
  local now = os.time(os.date('*t'))
 | 
			
		||||
 | 
			
		||||
  -- find which date pattern is being passed in by user
 | 
			
		||||
  for key, value in pairs(vim.api.nvim_buf_get_lines(buf, 0, -1, {})) do
 | 
			
		||||
    local fulldatetime12 = value:match(make_pattern(fulldatetime12_pattern))
 | 
			
		||||
    if fulldatetime12 then
 | 
			
		||||
      local year, month, day, hour, min, period =
 | 
			
		||||
      fulldatetime12:match(make_pattern_match(fulldatetime12_pattern))
 | 
			
		||||
      hour = tonumber(hour)
 | 
			
		||||
      local is_pm = period:lower() == 'pm'
 | 
			
		||||
      if is_pm and hour < 12 or not is_pm and hour == 12 then
 | 
			
		||||
        hour = hour + 12
 | 
			
		||||
        if hour == 24 then
 | 
			
		||||
          hour = 0
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
      draw_due(os.time({
 | 
			
		||||
        year = year,
 | 
			
		||||
        month = month,
 | 
			
		||||
        day = day,
 | 
			
		||||
        hour = hour,
 | 
			
		||||
        min = min,
 | 
			
		||||
        sec = user_sec
 | 
			
		||||
      }) - now, buf, key)
 | 
			
		||||
      goto continue
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    local fulldatetime = value:match(make_pattern(fulldatetime_pattern))
 | 
			
		||||
    if fulldatetime then
 | 
			
		||||
      local year, month, day, hour, min =
 | 
			
		||||
      fulldatetime:match(make_pattern_match(fulldatetime_pattern))
 | 
			
		||||
      draw_due(os.time({
 | 
			
		||||
        year = year,
 | 
			
		||||
        month = month,
 | 
			
		||||
        day = day,
 | 
			
		||||
        hour = hour,
 | 
			
		||||
        min = min,
 | 
			
		||||
        sec = user_sec
 | 
			
		||||
      }) - now, buf, key)
 | 
			
		||||
      goto continue
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    local fulldate = value:match(make_pattern(fulldate_pattern))
 | 
			
		||||
    if fulldate then
 | 
			
		||||
      local year, month, day = fulldate:match(make_pattern_match(
 | 
			
		||||
        fulldate_pattern))
 | 
			
		||||
      draw_due(os.time({
 | 
			
		||||
        year = year,
 | 
			
		||||
        month = month,
 | 
			
		||||
        day = day,
 | 
			
		||||
        hour = user_hour,
 | 
			
		||||
        min = user_min,
 | 
			
		||||
        sec = user_sec
 | 
			
		||||
      }) - now, buf, key)
 | 
			
		||||
      goto continue
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    local datetime12 = value:match(make_pattern(datetime12_pattern))
 | 
			
		||||
    if datetime12 then
 | 
			
		||||
      local month, day, hour, min, period =
 | 
			
		||||
      datetime12:match(make_pattern_match(datetime12_pattern))
 | 
			
		||||
      local year = os.date("%Y")
 | 
			
		||||
      hour = tonumber(hour)
 | 
			
		||||
      local is_pm = period:lower() == 'pm'
 | 
			
		||||
      if is_pm and hour < 12 or not is_pm and hour == 12 then
 | 
			
		||||
        hour = hour + 12
 | 
			
		||||
        if hour == 24 then
 | 
			
		||||
          hour = 0
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
      draw_due(os.time({
 | 
			
		||||
        year = year,
 | 
			
		||||
        month = month,
 | 
			
		||||
        day = day,
 | 
			
		||||
        hour = hour,
 | 
			
		||||
        min = min,
 | 
			
		||||
        sec = user_sec
 | 
			
		||||
      }) - now, buf, key)
 | 
			
		||||
      goto continue
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    local datetime = value:match(make_pattern(datetime_pattern))
 | 
			
		||||
    if datetime then
 | 
			
		||||
      local month, day, hour, min = datetime:match(make_pattern_match(
 | 
			
		||||
        datetime_pattern))
 | 
			
		||||
      local year = os.date("%Y")
 | 
			
		||||
      draw_due(os.time({
 | 
			
		||||
        year = year,
 | 
			
		||||
        month = month,
 | 
			
		||||
        day = day,
 | 
			
		||||
        hour = hour,
 | 
			
		||||
        min = min,
 | 
			
		||||
        sec = user_sec
 | 
			
		||||
      }) - now, buf, key)
 | 
			
		||||
      goto continue
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    local date = value:match(make_pattern(date_pattern))
 | 
			
		||||
    if date then
 | 
			
		||||
      local month, day = date:match(make_pattern_match(date_pattern))
 | 
			
		||||
      local year = os.date("%Y")
 | 
			
		||||
 | 
			
		||||
      draw_due(os.time({
 | 
			
		||||
        year = year,
 | 
			
		||||
        month = month,
 | 
			
		||||
        day = day,
 | 
			
		||||
        hour = user_hour,
 | 
			
		||||
        min = user_min,
 | 
			
		||||
        sec = user_sec
 | 
			
		||||
      }) - now, buf, key)
 | 
			
		||||
      goto continue
 | 
			
		||||
    end
 | 
			
		||||
    ::continue::
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function M.clear(buf) vim.api.nvim_buf_clear_namespace(buf, _VT_NS, 0, -1) end
 | 
			
		||||
 | 
			
		||||
function M.redraw(buf)
 | 
			
		||||
  M.clear(buf)
 | 
			
		||||
  M.draw(buf)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function M.async_update(buf)
 | 
			
		||||
  if update_rate <= 0 then return end
 | 
			
		||||
  local timer = vim.loop.new_timer()
 | 
			
		||||
  timer:start(update_rate, 0, vim.schedule_wrap(function()
 | 
			
		||||
    M.redraw(buf)
 | 
			
		||||
    M.async_update(buf)
 | 
			
		||||
  end))
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
return M
 | 
			
		||||
@ -1,4 +1,3 @@
 | 
			
		||||
 | 
			
		||||
return {
 | 
			
		||||
    {
 | 
			
		||||
        "nvim-neo-tree/neo-tree.nvim",
 | 
			
		||||
@ -8,11 +7,8 @@ return {
 | 
			
		||||
            "MunifTanjim/nui.nvim",
 | 
			
		||||
            "nvim-tree/nvim-web-devicons",
 | 
			
		||||
        },
 | 
			
		||||
        opts = {
 | 
			
		||||
            
 | 
			
		||||
        }, 
 | 
			
		||||
        lazy = false, -- neo-tree lazy loads itself
 | 
			
		||||
    }
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        "nvim-telescope/telescope.nvim",
 | 
			
		||||
        branch = "0.1.x",
 | 
			
		||||
@ -29,5 +25,5 @@ return {
 | 
			
		||||
            { "<leader>f", "<cmd>Telescope find_files<cr>", desc = "Find files" },
 | 
			
		||||
            { "<leader>s", "<cmd>Telescope spell_suggest<cr>", desc = "Spelling suggestions" },
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -6,10 +6,8 @@ return {
 | 
			
		||||
        dependencies = {
 | 
			
		||||
        },
 | 
			
		||||
        config = function()
 | 
			
		||||
            local lspconfig = require("lspconfig")
 | 
			
		||||
 | 
			
		||||
            -- Go
 | 
			
		||||
            lspconfig.gopls.setup{
 | 
			
		||||
            vim.lsp.config["gopls"] = {
 | 
			
		||||
                cmd = {"gopls", "serve"},
 | 
			
		||||
                filetypes = {"go", "gomod"},
 | 
			
		||||
                settings = {
 | 
			
		||||
@ -22,13 +20,14 @@ return {
 | 
			
		||||
                },
 | 
			
		||||
            }
 | 
			
		||||
            -- C/C++
 | 
			
		||||
            lspconfig.clangd.setup{}
 | 
			
		||||
            vim.lsp.config["clangd"] = {}
 | 
			
		||||
 | 
			
		||||
            -- Arduino (C)
 | 
			
		||||
            lspconfig.arduino_language_server.setup{}
 | 
			
		||||
            vim.lsp.config["arduino_language_server"] = {}
 | 
			
		||||
 | 
			
		||||
            -- Lua
 | 
			
		||||
            lspconfig.lua_ls.setup{
 | 
			
		||||
            vim.lsp.config["lua_ls"] = {
 | 
			
		||||
                cmd = {"lua-language-server" },
 | 
			
		||||
                settings = {
 | 
			
		||||
                    Lua = {
 | 
			
		||||
                        diagnostics = {globals = {'vim', 'opts'}},
 | 
			
		||||
@ -40,13 +39,13 @@ return {
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            -- Rust
 | 
			
		||||
            lspconfig.rust_analyzer.setup{}
 | 
			
		||||
            vim.lsp.config["rust_analyzer"] = {}
 | 
			
		||||
 | 
			
		||||
            -- Python
 | 
			
		||||
            lspconfig.pylsp.setup{}
 | 
			
		||||
            vim.lsp.config["pylsp"] = {}
 | 
			
		||||
 | 
			
		||||
            -- TypeScript
 | 
			
		||||
            lspconfig.tsserver.setup{}
 | 
			
		||||
            vim.lsp.config["tsls"] = {}
 | 
			
		||||
 | 
			
		||||
            -- Fix virtual text going off screen
 | 
			
		||||
            vim.diagnostic.config({
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user