summaryrefslogtreecommitdiff
path: root/lua/plugins/general.lua
blob: f1152476cec41ac619fb89db1d39a40e13a18220 (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
return {
    {
        "guess-indent.nvim",
        for_cat = "core.general",
        event = "DeferredUIEnter",
        after = function()
            require("guess-indent").setup({
                auto_cmd = true,
                override_editorconfig = true,
                filetype_exclude = {
                    "netrw",
                    "tutor",
                    "oil",
                    "gitcommit",
                },
                buftype_exclude = {
                    "help",
                    "nofile",
                    "terminal",
                    "prompt",
                },
                on_tab_options = {
                    ["expandtab"] = false,
                },
                on_space_options = {
                    ["expandtab"] = true,
                    ["tabstop"] = "detected",
                    ["softtabstop"] = "detected",
                    ["shiftwidth"] = "detected",
                },
            })
        end,
    },
    {
        "nvim-surround",
        for_cat = "core.general",
        event = { "BufReadPre", "BufNewFile" },
        after = function()
            require("nvim-surround").setup()
        end,
    },
    {
        "oil.nvim",
        keys = { { "<leader>o", "<CMD>Oil<CR>", desc = "Open oil" } },
        for_cat = "core.general",
        after = function()
            require("oil").setup({
                default_file_explorer = true,
                columns = { "icon", "permissions", "size" },
                keymaps = {
                    ["-"] = "actions.parent",
                    ["<CR>"] = "actions.select",
                    ["<C-v>"] = "actions.select_vsplit",
                    ["<C-s>"] = "actions.select_split",
                },
            })
        end,
    },
    {
        "undotree",
        for_cat = "core.general",
        cmd = { "UndotreeToggle", "UndotreeHide", "UndotreeShow", "UndotreeFocus", "UndotreePersistUndo" },
        keys = { { "<leader>U", "<cmd>UndotreeToggle<CR>", mode = { "n" }, desc = "Undo Tree" } },
        before = function(_)
            vim.g.undotree_WindowLayout = 1
            vim.g.undotree_SplitWidth = 40
            vim.g.undotree_WindowLayout = 3
        end,
    },
    {
        "lazydev.nvim",
        ft = "lua",
        after = function()
            require("lazydev").setup({
                library = {
                    { path = "${3rd}/luv/library", words = { "vim%.uv" } },
                },

                integrations = {
                    -- Fixes lspconfig's workspace management for LuaLS
                    -- Only create a new workspace if the buffer is not part
                    -- of an existing workspace or one of its libraries
                    lspconfig = true,
                    -- add the cmp source for completion of:
                    -- `require "modname"`
                    -- `---@module "modname"`
                    cmp = true,
                    -- same, but for Coq
                    coq = false,
                },
            })
        end,
    },
}