summaryrefslogtreecommitdiff
path: root/plugin/plugins/oil.lua
blob: edb3c50c5d305ba828a112b67466ef3032c4550f (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
require("oil").setup({
    default_file_explorer = true,
    columns = {
        "permissions",
        "size",
        -- "mtime",
    },
    buf_options = {
        buflisted = false,
        bufhidden = "hide",
    },
    win_options = {
        wrap = false,
        signcolumn = "no",
        cursorcolumn = false,
        foldcolumn = "0",
        spell = false,
        list = false,
        conceallevel = 3,
        concealcursor = "nvic",
    },
    delete_to_trash = false,
    skip_confirm_for_simple_edits = false,
    prompt_save_on_select_new_entry = true,
    cleanup_delay_ms = 2000,
    lsp_file_methods = {
        enabled = true,
        timeout_ms = 1000,
        autosave_changes = false,
    },
    constrain_cursor = "editable",
    watch_for_changes = false,
    keymaps = {
        ["g?"] = { "actions.show_help", mode = "n" },
        ["<CR>"] = "actions.select",
        ["<M-s>"] = { "actions.select", opts = { vertical = true } },
        ["<M-h>"] = { "actions.select", opts = { horizontal = true } },
        ["<M-t>"] = { "actions.select", opts = { tab = true } },
        ["<C-p>"] = false,
        ["<C-c>"] = { "actions.close", mode = "n" },
        ["<C-l>"] = "actions.refresh",
        ["-"] = { "actions.parent", mode = "n" },
        ["_"] = { "actions.open_cwd", mode = "n" },
        ["`"] = { "actions.cd", mode = "n" },
        ["g~"] = { "actions.cd", opts = { scope = "tab" }, mode = "n" },
        ["gs"] = false,
        ["gx"] = "actions.open_external",
        ["zh"] = { "actions.toggle_hidden", mode = "n" },
        ["gt"] = "actions.open_terminal",
        ["<Leader>Y"] = require("mo.oil-util").copy_to_clipboard,
        ["<Leader>y"] = function() require("mo.oil-util").copy_to_clipboard({ full_path = false }) end,
        ["<Leader>:"] = {
            "actions.open_cmdline",
            opts = { shorten_path = true, modify = ":h" },
        },
        ["<Leader>;"] = {
            "actions.open_cmdline",
            opts = { shorten_path = true },
        },
    },
    use_default_keymaps = false,
    view_options = {
        show_hidden = false,
        is_hidden_file = function(name, _bufnr)
            local m = name:match("^%.")
            return m ~= nil
        end,
        is_always_hidden = function(_name, _bufnr) return false end,
        natural_order = "fast",
        case_insensitive = false,
        sort = {
            { "type", "asc" },
            { "name", "asc" },
        },
    },
} --[[@as oil.SetupOpts]])