Giter Club home page Giter Club logo

cmdline-hl.nvim's People

Contributors

sam-programs avatar

Stargazers

 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

cmdline-hl.nvim's Issues

Something breaking with `ufo.nvim`

2024-03-15_12-10-45_ufo

Something about ufo.nvim is breaking the cmdline

:'<,'>s/\%V\v=/  

Error in decoration provider ufo.end:                                                         
Error executing lua: Keyboard interrupt                                                       
stack traceback:                                                                              
        [C]: in function 'foldClosed'                                                         
        ...no/.local/share/nvim/lazy/nvim-ufo/lua/ufo/decorator.lua:188: in function 'computeF
oldedPairs'                                                                                   
        ...no/.local/share/nvim/lazy/nvim-ufo/lua/ufo/decorator.lua:77: in function 'winCall' 
        ...no/.local/share/nvim/lazy/nvim-ufo/lua/ufo/decorator.lua:76: in function <...no/.lo
cal/share/nvim/lazy/nvim-ufo/lua/ufo/decorator.lua:66>                                        
:'<,'>s/\%V\v=/                                                                               
:'<,'>s/\%V\v=/                                                                               
:'<,'>s/\%V\v=/                                                                               
:'<,'>s/\%V\v=/                                                                               
:'<,'>s/\%V\v=/                                                                               
:'<,'>s/\%V\v=/                                                                               
:'<,'>s/\%V\v=/                                                                               
    {
        "kevinhwang91/nvim-ufo",
        lazy = true,
        event = "BufReadPost",
        enabled = true,
        dependencies = { "kevinhwang91/promise-async", {
            "luukvbaal/statuscol.nvim",
            config = function(_, opts)
                local builtin = require("statuscol.builtin")
                require("statuscol").setup(

                    {
                        relculright = true,
                        segments = {
                            {
                                sign = { name = { "Dap*" }, maxwidth = 1, colwidth = 2, auto = true, fillchars = "" },
                                click = "v:lua.ScSa",
                            },
                            {
                                sign = { name = { "Diagnostic" }, maxwidth = 2, auto = true },
                                click = "v:lua.ScSa"
                            },

                            {
                                sign = { namespace = { "gitsigns" }, colwidth = 1, wrap = true },
                                click = "v:lua.ScSa"
                            },
                            -- {text = { builtin.foldfunc }, click = "v:lua.ScFa"},
                            { text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" },
                        }

                    }
                )
            end

        } },
        config = function(_, opts)
            vim.o.foldcolumn = "1" -- '0' is not bad
            vim.o.foldlevel = 99   -- Using ufo provider need a large value, feel free to decrease the value
            vim.o.foldlevelstart = 99
            vim.o.foldenable = true
            vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]

            vim.keymap.set("n", "zR", require("ufo").openAllFolds)
            vim.keymap.set("n", "zM", require("ufo").closeAllFolds)

            local handler = function(virtText, lnum, endLnum, width, truncate)
                local newVirtText = {}
                local suffix = (' 󰦸 %d '):format(endLnum - lnum)
                local sufWidth = vim.fn.strdisplaywidth(suffix)
                local targetWidth = width - sufWidth
                local curWidth = 0
                for _, chunk in ipairs(virtText) do
                    local chunkText = chunk[1]
                    local chunkWidth = vim.fn.strdisplaywidth(chunkText)
                    if targetWidth > curWidth + chunkWidth then
                        table.insert(newVirtText, chunk)
                    else
                        chunkText = truncate(chunkText, targetWidth - curWidth)
                        local hlGroup = chunk[2]
                        table.insert(newVirtText, { chunkText, hlGroup })
                        chunkWidth = vim.fn.strdisplaywidth(chunkText)
                        -- str width returned from truncate() may less than 2nd argument, need padding
                        if curWidth + chunkWidth < targetWidth then
                            suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth)
                        end
                        break
                    end
                    curWidth = curWidth + chunkWidth
                end
                table.insert(newVirtText, { suffix, 'MoreMsg' })
                return newVirtText
            end

            -- global handler
            -- `handler` is the 2nd parameter of `setFoldVirtTextHandler`,
            -- check out `./lua/ufo.lua` and search `setFoldVirtTextHandler` for detail.
            require('ufo').setup({
                fold_virt_text_handler = handler
            })
        end
    },

    {
        'Sam-programs/cmdline-hl.nvim',
        event = 'UiEnter',
        dev = false,
        opts = {
            -- table used for prefixes
            type_signs = {
                [":"] = { ":", "FloatFooter" },
                ["/"] = { "/", "FloatFooter" },
                ["?"] = { "? ", "FloatFooter" },
                ["="] = { "=", "FloatFooter" },
            },
            custom_types = {
                -- ["command-name"] = {
                -- [icon],[icon_hl], default to `:` icon and highlight
                -- [lang], defaults to vim
                -- [showcmd], defaults to false
                -- [pat], defaults to "%w*%s*(.*)"
                -- [code], defaults to nil
                -- }
                -- lang is the treesitter language to use for the commands
                -- showcmd is true if the command should be displayed or to only show the icon
                -- pat is used to extract the part of the command that needs highlighting
                -- the part is matched against the raw command you don't need to worry about ranges
                -- e.g. in 's,>'s/foo/bar/
                -- pat is checked against s/foo/bar
                -- you could also use the 'code' function to extract the part that needs highlighting
                ["lua"] = { icon = "", icon_hl = "FloatFooter", lang = "lua" },
                ["="] = { icon = "", icon_hl = "FloatFooter", lang = "lua" },
                ["help"] = { icon = "? ", icon_hl = "FloatFooter" },
                ["substitute"] = { pat = "%w(.*)", lang = "regex", show_cmd = true },
            },
            input_hl = "FloatFooter",
            -- used to highlight the range in the command e.g. '<,>' in '<,>'s
            range_hl = "FloatBorder",
        },
        -- highlight used for vim.input
        input_hl = "FloatFooter",
    },

latest commit errors on start cmdline

2024-03-16T20:48:39  ERROR cmdline-hl.nvim: Disabling cmdline highlighting please open an issue with this backtrace, you can copy it with lmouse:                                              
...vim/lazy/cmdline-hl.nvim/lua/cmdline-hl/highlighters.lua:65: attempt to call method 'parent' (a nil value)                                                                                   
stack traceback:                                                                                                                                                                                
        .../share/nvim/lazy/cmdline-hl.nvim/lua/cmdline-hl/init.lua:216: in function 'parent'                                                                                                   
        ...vim/lazy/cmdline-hl.nvim/lua/cmdline-hl/highlighters.lua:65: in function 'fn'                                                                                                        
        ...5/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:488: in function 'for_each_tree'                                                                                            
        ...vim/lazy/cmdline-hl.nvim/lua/cmdline-hl/highlighters.lua:54: in function 'ts'                                                                                                        
        ...vim/lazy/cmdline-hl.nvim/lua/cmdline-hl/highlighters.lua:37: in function 'cmdline'                                                                                                   
        .../share/nvim/lazy/cmdline-hl.nvim/lua/cmdline-hl/init.lua:30: in function 'draw_cmdline'                                                                                              
        .../share/nvim/lazy/cmdline-hl.nvim/lua/cmdline-hl/init.lua:197: in function <.../share/nvim/lazy/cmdline-hl.nvim/lua/cmdline-hl/init.lua:181>                                          
        [C]: in function 'xpcall'                                                                                                                                                               
        .../share/nvim/lazy/cmdline-hl.nvim/lua/cmdline-hl/init.lua:211: in function <.../share/nvim/lazy/cmdline-hl.nvim/lua/cmdline-hl/init.lua:209>     

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.