summaryrefslogtreecommitdiff
path: root/lua/bee/init.lua
blob: 265a0e3aa79288fad40ee7a724efe4886841fd8c (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
local MP = ...
do
    local ok
    ok, _G.nixInfo = pcall(require, vim.g.nix_info_plugin_name)
    if not ok then
        package.loaded[vim.g.nix_info_plugin_name] = setmetatable({}, {
            __call = function(_, default)
                return default
            end,
        })
        _G.nixInfo = require(vim.g.nix_info_plugin_name)
    end
    nixInfo.isNix = vim.g.nix_info_plugin_name ~= nil
    nixInfo.utils = require(MP:relpath("utils"))
    nixInfo.lze = setmetatable(require("lze"), getmetatable(require("lzextras")))
    function nixInfo.get_nix_plugin_path(name)
        return nixInfo(nil, "plugins", "lazy", name) or nixInfo(nil, "plugins", "start", name)
    end
end

nixInfo.lze.register_handlers({
    nixInfo.utils.auto_enable_handler,
    nixInfo.utils.for_cat_handler,
    nixInfo.lze.lsp,
})
nixInfo.lze.h.lsp.set_ft_fallback(nixInfo.utils.lsp_ft_fallback)
nixInfo.lze.load({
    { import = MP:relpath("plugins") },
    { import = MP:relpath("format") },
    { import = MP:relpath("lint") },
    { import = MP:relpath("LSPs") },
    {
        "vim-startuptime",
        auto_enable = true,
        cmd = { "StartupTime" },
        before = function(_)
            vim.g.startuptime_event_width = 0
            vim.g.startuptime_tries = 10
            vim.g.startuptime_exe_path = nixInfo(vim.v.progpath, "progpath")
        end,
    },
    {
        "nvim-surround",
        auto_enable = true,
        event = "DeferredUIEnter",
        before = function(_)
            vim.g.nvim_surround_no_mappings = true
        end,
        after = function(_)
            require("nvim-surround").setup({
                keymaps = false,
            })
            vim.keymap.set("i", "<C-g>s", "<Plug>(nvim-surround-insert)", {
                desc = "Add a surrounding pair around the cursor (insert mode)",
            })
            vim.keymap.set("i", "<C-g>S", "<Plug>(nvim-surround-insert-line)", {
                desc = "Add a surrounding pair around the cursor, on new lines (insert mode)",
            })
            vim.keymap.set("n", "sa", "<Plug>(nvim-surround-normal)", {
                desc = "Add a surrounding pair around a motion (normal mode)",
            })
            vim.keymap.set("n", "saa", "<Plug>(nvim-surround-normal-cur)", {
                desc = "Add a surrounding pair around the current line (normal mode)",
            })
            vim.keymap.set("n", "sA", "<Plug>(nvim-surround-normal-line)", {
                desc = "Add a surrounding pair around a motion, on new lines (normal mode)",
            })
            vim.keymap.set("n", "sAA", "<Plug>(nvim-surround-normal-cur-line)", {
                desc = "Add a surrounding pair around the current line, on new lines (normal mode)",
            })
            vim.keymap.set("x", "S", "<Plug>(nvim-surround-visual)", {
                desc = "Add a surrounding pair around a visual selection",
            })
            vim.keymap.set("x", "gS", "<Plug>(nvim-surround-visual-line)", {
                desc = "Add a surrounding pair around a visual selection, on new lines",
            })
            vim.keymap.set("n", "sd", "<Plug>(nvim-surround-delete)", {
                desc = "Delete a surrounding pair",
            })
            vim.keymap.set("n", "cs", "<Plug>(nvim-surround-change)", {
                desc = "Change a surrounding pair",
            })
            vim.keymap.set("n", "cS", "<Plug>(nvim-surround-change-line)", {
                desc = "Change a surrounding pair, putting replacements on new lines",
            })
        end,
    },
})

vim.cmd.colorscheme("base46-tokyonight")