aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim/lua/plugins/coding.lua
blob: fd636fa35dc522d5b77ba4c7a3420c2fa09dea56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
return {
    -- { "echasnovski/mini.move", config = true },
    { "echasnovski/mini.comment", config = true },
    { "max397574/better-escape.nvim", config = true },
    {
        "nvim-treesitter/nvim-treesitter",
        build = ":TSUpdate",
        config = function()
            local configs = require "nvim-treesitter.configs"
            configs.setup {
                ensure_installed = {
                    "lua",
                    "c",
                    "vim",
                    "vimdoc",
                    "query",
                    "rust",
                    "fish",
                    "json",
                    "javascript",
                    "latex",
                    "markdown",
                    "markdown_inline",
                    "zig",
                    "typescript",
                    "toml",
                    "svelte",
                    "comment",
                    "html",
                    "typst",
                    "ron"
                },
                highlight = { enable = true },
                indent = { enable = true },
            }
        end,
    },
    {
        "ggandor/leap.nvim",
        config = function()
            local leap = require "leap"
            leap.add_default_mappings()
            leap.opts.highlight_unlabeled_phase_one_targets = true
        end,
        dependencies = {
            "tpope/vim-repeat",
        },
    },
    {
        "hrsh7th/nvim-cmp",
        opts = function()
            vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
            local cmp = require "cmp"
            local defaults = require "cmp.config.default"()
            return {
                enabled = function()
                    local context = require "cmp.config.context"
                    if vim.api.nvim_get_mode().mode == "c" then
                        return true
                    else
                        return not context.in_treesitter_capture "comment" and not context.in_syntax_group "Comment"
                    end
                end,

                completion = {
                    completeopt = "menu,menuone,noinsert",
                },
                snippet = {
                    expand = function(args)
                        require("luasnip").lsp_expand(args.body)
                    end,
                },
                window = {
                    completion = cmp.config.window.bordered(),
                    documentation = cmp.config.window.bordered(),
                },
                mapping = cmp.mapping.preset.insert {
                    ["<C-j>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
                    ["<C-k>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
                    ["<C-b>"] = cmp.mapping.scroll_docs(-4),
                    ["<C-f>"] = cmp.mapping.scroll_docs(4),
                    ["<S-CR>"] = cmp.mapping.abort(),
                    ["<CR>"] = cmp.mapping.confirm { select = false },
                },
                sources = cmp.config.sources {
                    { name = "nvim_lsp" },
                    { name = "path" },
                },
                formatting = {
                    format = function(_, item)
                        local icons = require("icons").kinds
                        if icons[item.kind] then
                            item.kind = icons[item.kind] .. item.kind
                        end
                        return item
                    end,
                },
                experimental = {
                    ghost_text = {
                        hl_group = "CmpGhostText",
                    },
                },
                sorting = defaults.sorting,
            }
        end,
        dependencies = {
            { "L3MON4D3/LuaSnip", build = "make install_jsregexp" },
            "hrsh7th/cmp-path",
            "saadparwaiz1/cmp_luasnip",
        },
        disabled = true
    },
    {
        "NvChad/nvim-colorizer.lua",
        opts = {
            user_default_options = { RGB = true, RRGGBB = true, RRGGBBAA = true, always_update = true, names = false },
        },
    },
    {
        "echasnovski/mini.surround",
        version = false,
        opts = {
            mappings = {
                add = "\\a", -- Add surrounding in Normal and Visual modes
                delete = "\\d", -- Delete surrounding
                find = "\\f", -- Find surrounding (to the right)
                find_left = "\\F", -- Find surrounding (to the left)
                highlight = "\\h", -- Highlight surrounding
                replace = "\\r", -- Replace surrounding
                update_n_lines = "\\n", -- Update `n_lines`
            }
        }
    },
    {
        "color_converter",
        dev = true,
        dependencies = {
            { 'echasnovski/mini.colors', version = '*' },
            "MunifTanjim/nui.nvim",
        },
        -- lazy = false,
        cmd = "ColorConverter",
        config = true
    },
    -- {
    --     "m4xshen/hardtime.nvim",
    --     config = true,
    --     disabled = true
    -- }
}