diff options
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/config/diagnostic.lua | 58 | ||||
| -rw-r--r-- | lua/config/keymaps.lua | 28 | ||||
| -rw-r--r-- | lua/config/lazy.lua | 178 | ||||
| -rw-r--r-- | lua/pi/completition/init.lua | 74 | ||||
| -rw-r--r-- | lua/pi/dap/configs/rust.old (renamed from lua/pi/dap/configs/rust.lua) | 0 | ||||
| -rw-r--r-- | lua/pi/dap/init.lua | 8 | ||||
| -rw-r--r-- | lua/pi/lsp/default.lua | 2 | ||||
| -rw-r--r-- | lua/pi/lsp/servers/rust_analyzer.old (renamed from lua/pi/lsp/servers/rust_analyzer.lua) | 0 | ||||
| -rw-r--r-- | lua/plugins/completition.lua | 19 | ||||
| -rw-r--r-- | lua/plugins/elixir.lua | 3 | ||||
| -rw-r--r-- | lua/plugins/lualine.lua | 22 | ||||
| -rw-r--r-- | lua/plugins/neotest.lua | 3 | ||||
| -rw-r--r-- | lua/plugins/noice.lua | 2 | ||||
| -rw-r--r-- | lua/plugins/nvim-html-css.lua | 9 | ||||
| -rw-r--r-- | lua/plugins/oil.lua | 359 |
15 files changed, 458 insertions, 307 deletions
diff --git a/lua/config/diagnostic.lua b/lua/config/diagnostic.lua index 84d57b5..011d83a 100644 --- a/lua/config/diagnostic.lua +++ b/lua/config/diagnostic.lua @@ -1,28 +1,50 @@ - vim.diagnostic.config { virtual_text = false, signs = { text = { [vim.diagnostic.severity.ERROR] = '', [vim.diagnostic.severity.WARN] = '', - [vim.diagnostic.severity.INFO] = '', - [vim.diagnostic.severity.HINT] = '', - }, - linehl = { - [vim.diagnostic.severity.ERROR] = 'ErrorMsg', - }, - numhl = { - [vim.diagnostic.severity.WARN] = 'WarningMsg', + [vim.diagnostic.severity.INFO] = '', + [vim.diagnostic.severity.HINT] = '' }, + -- linehl = { + -- [vim.diagnostic.severity.ERROR] = 'ErrorMsg', + -- }, + -- numhl = { + -- [vim.diagnostic.severity.WARN] = 'WarningMsg', + -- }, + }, + update_in_insert = true, + underline = true, + severity_sort = true, + float = { + -- focusable = true, + -- style = "minimal", + border = "rounded", + source = "if_many", + -- header = "", + -- prefix = "", }, } --- vim.diagnostic.config { --- virtual_text = false, --- } --- --- local signs = { Error = "", Warn = "", Hint = "", Info = "" } --- for type, icon in pairs(signs) do --- local hl = "DiagnosticSign" .. type --- vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) --- end +-- vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { +-- border = "rounded", +-- -- width = 100, +-- -- height = 10, +-- position = "center", +-- header = "", +-- prefix = "", +-- source = "always", +-- style = "minimal", +-- focusable = true, +-- }) + +-- vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { +-- border = "rounded", +-- }) + +vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { + -- delay update diagnostics + update_in_insert = false, +}) + diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index 73478de..6002563 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -69,8 +69,6 @@ map( { desc = "Save the current file and source it for .vim and .lua files" } ) --- map("n", "<leader>vn", vim.diagnostic.goto_next, { desc = "Goes to next diagnostic error" }) --- map("n", "<leader>vp", vim.diagnostic.goto_prev, { desc = "Goes to prev diagnostic error" }) map( "n", "<leader>vn", @@ -129,24 +127,6 @@ map( function() require('nvim-python-repl').toggle_vertical() end, { desc = "Create REPL in vertical or horizontal split"} ) --- map( --- "n", --- "<leader>rl", --- function() require('rust-tools').inlay_hints.enable() end, --- {desc = "Enable inlay hints auto update and set them for all the buffers"} --- ) --- map( --- "n", --- "<leader>rdl", --- function() require('rust-tools').inlay_hints.disable() end, --- {desc = "Disable inlay hints auto update and unset them for all buffers"} --- ) --- map( --- "n", --- "<leader>rrn", --- function () require('rust-tools').runnables.runnables() end, --- {desc = "run rust"} --- ) map( "n", "-", @@ -167,3 +147,11 @@ vim.api.nvim_set_keymap( ':lua ToggleWrap()<CR>', { noremap = true, silent = true } ) +vim.keymap.set +( + "n", + "<leader>rrn", + ':RustLsp runnables<CR>', + {desc = "run rust"} +) + diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 81584d1..70aaec7 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -12,23 +12,160 @@ end vim.opt.rtp:prepend(lazypath) require("lazy").setup { - spec = { - { import = "plugins" }, + -- leave nil when passing the spec as the first argument to setup() + spec = { { import = "plugins" } }, + local_spec = true, -- load project specific .lazy.lua spec files. They will be added at the end of the spec. + defaults = { + -- Set this to `true` to have all your plugins lazy-loaded by default. + -- Only do this if you know what you are doing, as it can lead to unexpected behavior. + lazy = false, -- should plugins be lazy-loaded? + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = nil, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + -- default `cond` you can use to globally disable a lot of plugins + -- when running inside vscode for example + cond = nil, ---@type boolean|fun(self:LazyPlugin):boolean|nil }, - default = { - lazy = true, + lockfile = vim.fn.stdpath("config") .. "/lazy-lock.json", -- lockfile generated after running update. + ---@type number? limit the maximum amount of concurrent tasks + concurrency = jit.os:find("Windows") and (vim.uv.available_parallelism() * 2) or nil, + git = { + -- defaults for the `Lazy log` command + -- log = { "--since=3 days ago" }, -- show commits from the last 3 days + log = { "-8" }, -- show the last 8 commits + timeout = 120, -- kill processes that take more than 2 minutes + url_format = "https://github.com/%s.git", + -- lazy.nvim requires git >=2.19.0. If you really want to use lazy with an older version, + -- then set the below to false. This should work, but is NOT supported and will + -- increase downloads a lot. + filter = true, + }, + pkg = { + enabled = true, + cache = vim.fn.stdpath("state") .. "/lazy/pkg-cache.lua", + versions = true, -- Honor versions in pkg sources + -- the first package source that is found for a plugin will be used. + sources = { + "lazy", + "rockspec", + "packspec", + }, + }, + rocks = { + root = vim.fn.stdpath("data") .. "/lazy-rocks", + server = "https://nvim-neorocks.github.io/rocks-binaries/", }, - checker = { enabled = true, notify = false }, dev = { - path = "~/code/plugins", - fallback = true, - patterns = { "adalessa" }, + ---@type string | fun(plugin: LazyPlugin): string directory where you store your local plugin projects + path = "~/MIS-REPOS/neovim-plugins", + ---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub + patterns = {"elvis"}, -- For example {"folke"} + fallback = false, -- Fallback to git when local plugin doesn't exist + }, + install = { + -- install missing plugins on startup. This doesn't increase startup time. + missing = true, + -- try to load one of these colorschemes when starting an installation during startup + colorscheme = { "habamax" }, }, ui = { + -- a number <1 is a percentage., >1 is a fixed size + -- size = { width = 0.8, height = 0.8 }, + -- wrap = true, -- wrap the lines in the ui + -- The border to use for the UI window. Accepts same border values as |nvim_open_win()|. border = "rounded", + -- The backdrop opacity. 0 is fully opaque, 100 is fully transparent. + backdrop = 60, + title = nil, ---@type string only works when border is not "none" + title_pos = "center", ---@type "center" | "left" | "right" + -- Show pills on top of the Lazy window + pills = true, ---@type boolean + icons = { + cmd = " ", + config = "", + event = " ", + favorite = " ", + ft = " ", + init = " ", + import = " ", + keys = " ", + lazy = " ", + loaded = "●", + not_loaded = "○", + plugin = " ", + runtime = " ", + require = " ", + source = " ", + start = " ", + task = "✔ ", + list = { + "●", + "➜", + "★", + "‒", + }, + }, + -- leave nil, to automatically select a browser depending on your OS. + -- If you want to use a specific browser, you can define it here + browser = nil, ---@type string? + throttle = 20, -- how frequently should the ui process render events + custom_keys = { + -- You can define custom key maps here. If present, the description will + -- be shown in the help menu. + -- To disable one of the defaults, set it to false. + + ["<localleader>l"] = { + function(plugin) + require("lazy.util").float_term({ "lazygit", "log" }, { + cwd = plugin.dir, + }) + end, + desc = "Open lazygit log", + }, + + ["<localleader>t"] = { + function(plugin) + require("lazy.util").float_term(nil, { + cwd = plugin.dir, + }) + end, + desc = "Open terminal in plugin dir", + }, + }, + }, + diff = { + -- diff command <d> can be one of: + -- * browser: opens the github compare view. Note that this is always mapped to <K> as well, + -- so you can have a different command for diff <d> + -- * git: will run git diff and open a buffer with filetype git + -- * terminal_git: will open a pseudo terminal with git diff + -- * diffview.nvim: will open Diffview to show the diff + cmd = "git", + }, + checker = { + -- automatically check for plugin updates + enabled = true, + concurrency = nil, ---@type number? set to 1 to check for updates very slowly + notify = false, -- get a notification when new updates are found + frequency = 3600, -- check for updates every hour + check_pinned = false, -- check for pinned packages that can't be updated + }, + change_detection = { + -- automatically check for config file changes and reload the ui + enabled = true, + notify = true, -- get a notification when changes are found }, performance = { + cache = { + enabled = true, + }, + reset_packpath = true, -- reset the package path to improve startup time rtp = { + reset = true, -- reset the runtime path to $VIMRUNTIME and your config directory + ---@type string[] + paths = {}, -- add any custom paths here that you want to includes in the rtp + ---@type string[] list any plugins you want to disable here disabled_plugins = { "gzip", "matchit", @@ -41,4 +178,29 @@ require("lazy").setup { }, }, }, + -- lazy can generate helptags from the headings in markdown readme files, + -- so :help works even for plugins that don't have vim docs. + -- when the readme opens with :help it will be correctly displayed as markdown + readme = { + enabled = true, + root = vim.fn.stdpath("state") .. "/lazy/readme", + files = { "README.md", "lua/**/README.md" }, + -- only generate markdown helptags for plugins that dont have docs + skip_if_doc_exists = true, + }, + state = vim.fn.stdpath("state") .. "/lazy/state.json", -- state info for checker and other things + -- Enable profiling of lazy.nvim. This will add some overhead, + -- so only enable this when you are debugging lazy.nvim + profiling = { + -- Enables extra stats on the debug tab related to the loader cache. + -- Additionally gathers stats about all package.loaders + loader = false, + -- Track each new require in the Lazy profiling tab + require = false, + }, } + + + + + diff --git a/lua/pi/completition/init.lua b/lua/pi/completition/init.lua index 418c6d2..9ac1216 100644 --- a/lua/pi/completition/init.lua +++ b/lua/pi/completition/init.lua @@ -55,28 +55,30 @@ cmp.setup { ["<c-space>"] = cmp.mapping.complete(), }, sources = { - { name = "dictionary", keyword_length = 2}, + { name = "dictionary", keyword_length = 2 }, { name = "nvim_lua" }, { name = "nvim_lsp" }, { name = "path" }, { name = "luasnip" }, { name = "copilot" }, - {name = "codeium"}, + { name = "codeium" }, -- { name = 'cmp_ai' }, - { name = 'html-css', - option = { - max_count = {}, -- not ready yet - enable_on = { - "html", - "css" - }, -- set the file types you want the plugin to work on - file_extensions = { "css", "sass", "less" }, -- set the local filetypes from which you want to derive classes - style_sheets = { - -- example of remote styles, only css no js for now - "https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css", - "https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css", - } - } + { + name = "html-css", + option = { + spa = { + enable = false, -- SPA mode is disabled by default + entry_file = "index.html", -- if entry_file is omitted, it defaults to index.html in root dir + }, + max_count = {}, -- not ready yet + enable_on = { "html", "css" }, -- set the file types you want the plugin to work on + file_extensions = { "css", "sass", "less" }, -- set the local filetypes from which you want to derive classes + style_sheets = { + -- example of remote styles, only css no js for now + "https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css", + "https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css", + }, + }, }, { name = "buffer", @@ -104,12 +106,12 @@ cmp.setup { }, formatting = { - format = function (entry, vim_item) + format = function(entry, vim_item) if entry.source.name == "html-css" then - vim_item.menu = entry.completion_item.menu + source_mapping["html-css"] = "[" .. entry.completion_item.provider .. "]" or "[html-css]" end local KIND_ICONS = { - Tailwind = '', + Tailwind = "", Copilot = "", Ollama = "", Text = "", @@ -140,20 +142,20 @@ cmp.setup { TypeParameter = "", OpenAI = "", TinyLlama = "", - LlamaCPP = "" + LlamaCPP = "", } - if vim_item.kind == 'Color' and entry.completion_item.documentation then + if vim_item.kind == "Color" and entry.completion_item.documentation then local _, _, r, g, b = - ---@diagnostic disable-next-line: param-type-mismatch - string.find(entry.completion_item.documentation, '^rgb%((%d+), (%d+), (%d+)') + ---@diagnostic disable-next-line: param-type-mismatch + string.find(entry.completion_item.documentation, "^rgb%((%d+), (%d+), (%d+)") if r and g and b then - local color = string.format('%02x', r) .. string.format('%02x', g) .. string.format('%02x', b) - local group = 'Tw_' .. color + local color = string.format("%02x", r) .. string.format("%02x", g) .. string.format("%02x", b) + local group = "Tw_" .. color - if vim.api.nvim_call_function('hlID', { group }) < 1 then - vim.api.nvim_command('highlight' .. ' ' .. group .. ' ' .. 'guifg=#' .. color) + if vim.api.nvim_call_function("hlID", { group }) < 1 then + vim.api.nvim_command("highlight" .. " " .. group .. " " .. "guifg=#" .. color) end vim_item.kind = KIND_ICONS.Tailwind @@ -165,18 +167,16 @@ cmp.setup { vim_item.kind = KIND_ICONS[vim_item.kind] or vim_item.kind -- Add maxwidth and ellipsis_char in the middle - local maxwidth = 20 - local ellipsis_char = '...' + local maxwidth = 50 + local ellipsis_char = "..." if #vim_item.abbr > maxwidth then local half_width = math.floor((maxwidth - #ellipsis_char) / 2) - vim_item.abbr = string.sub( - vim_item.abbr, - 1, - half_width - ) .. ellipsis_char .. string.sub(vim_item.abbr, -half_width) + vim_item.abbr = string.sub(vim_item.abbr, 1, half_width) + .. ellipsis_char + .. string.sub(vim_item.abbr, -half_width) end return vim_item - end + end, }, sorting = { @@ -198,8 +198,8 @@ vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#3426C3" }) vim.api.nvim_set_hl(0, "CmpItemKindCodeium", { fg = "#2ACDBA" }) vim.api.nvim_set_hl(0, "CmpItemKindOllama", { fg = "#FDFEFF" }) vim.api.nvim_set_hl(0, "CmpItemKindOpenAI", { fg = "#080808" }) -vim.api.nvim_set_hl(0, "CmpItemKindTinyLlama", { fg = "#DF468C"}) -vim.api.nvim_set_hl(0, "CmpItemKindLlamaCPP", { fg = "#FF8235"}) +vim.api.nvim_set_hl(0, "CmpItemKindTinyLlama", { fg = "#DF468C" }) +vim.api.nvim_set_hl(0, "CmpItemKindLlamaCPP", { fg = "#FF8235" }) -- Set configuration for specific filetype. cmp.setup.filetype("gitcommit", { diff --git a/lua/pi/dap/configs/rust.lua b/lua/pi/dap/configs/rust.old index 9ca976f..9ca976f 100644 --- a/lua/pi/dap/configs/rust.lua +++ b/lua/pi/dap/configs/rust.old diff --git a/lua/pi/dap/init.lua b/lua/pi/dap/init.lua index 327dedf..97084fd 100644 --- a/lua/pi/dap/init.lua +++ b/lua/pi/dap/init.lua @@ -10,11 +10,11 @@ for _, ft_path in ipairs(vim.api.nvim_get_runtime_file("lua/pi/dap/configs/*.lua end -- Signs -vim.fn.sign_define("DapBreakpoint", { text = "🛑", texthl = "", linehl = "", numhl = "" }) +vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "", linehl = "", numhl = "" }) vim.fn.sign_define("DapStopped", { text = "▶", texthl = "", linehl = "", numhl = "" }) -vim.fn.sign_define("DapBreakpointRejected", { text = "🚫", texthl = "", linehl = "", numhl = "" }) -vim.fn.sign_define("DapBreakpointCondition", { text = "❓", texthl = "", linehl = "", numhl = "" }) -vim.fn.sign_define("DapLogPoint", { text = "💬", texthl = "", linehl = "", numhl = "" }) +vim.fn.sign_define("DapBreakpointRejected", { text = "", texthl = "", linehl = "", numhl = "" }) +vim.fn.sign_define("DapBreakpointCondition", { text = "", texthl = "", linehl = "", numhl = "" }) +vim.fn.sign_define("DapLogPoint", { text = "", texthl = "", linehl = "", numhl = "" }) -- UI structure dapui.setup { diff --git a/lua/pi/lsp/default.lua b/lua/pi/lsp/default.lua index b2be73e..b2020db 100644 --- a/lua/pi/lsp/default.lua +++ b/lua/pi/lsp/default.lua @@ -11,7 +11,7 @@ return { lua_ls = { enable = true, neodev = true }, -- nil_ls = { enable = true }, phpactor = {enable = true }, - rust_analyzer = { enable = true }, + -- rust_analyzer = { enable = true }, svelte = { enable = true }, tailwindcss = { enable = true, filetypes = {"blade", "html", "svelte"} }, ts_ls = { enable = true }, diff --git a/lua/pi/lsp/servers/rust_analyzer.lua b/lua/pi/lsp/servers/rust_analyzer.old index 8999ef8..8999ef8 100644 --- a/lua/pi/lsp/servers/rust_analyzer.lua +++ b/lua/pi/lsp/servers/rust_analyzer.old diff --git a/lua/plugins/completition.lua b/lua/plugins/completition.lua index 480da46..173cb54 100644 --- a/lua/plugins/completition.lua +++ b/lua/plugins/completition.lua @@ -17,28 +17,19 @@ return { "zbirenbaum/copilot.lua", cmd = { "Copilot" }, event = { "VeryLazy" }, - opts = { - suggestion = { enabled = false }, - panel = { enabled = false }, - }, + opts = { suggestion = { enabled = false }, panel = { enabled = false } }, }, config = true, }, { "uga-rosa/cmp-dictionary", config = function() - local dict_fl = { - ["*"] = { "/usr/share/dict/words" }, - ft = { - foo = { "./../../spell/dict_es.dict" }, - }, - } - local dict = require("cmp_dictionary") - - dict.setup({ paths = dict_fl["*"], exact_length = 3, first_case_insensitive = false }) + local dict_fl = { ["*"] = { "/usr/share/dict/words" }, ft = { foo = { "./../../spell/dict_es_en.dict" } } } + local dict = require "cmp_dictionary" + dict.setup { paths = dict_fl["*"], exact_length = 3, first_case_insensitive = false } end, }, - + { "Jezda1337/nvim-html-css" }, }, event = "VeryLazy", config = function() diff --git a/lua/plugins/elixir.lua b/lua/plugins/elixir.lua index 6aabb08..925c493 100644 --- a/lua/plugins/elixir.lua +++ b/lua/plugins/elixir.lua @@ -1,8 +1,7 @@ return { "elixir-tools/elixir-tools.nvim", version = "*", - event = { "BufReadPre", "BufNewFile" }, - filetypes = { "elixir" }, + ft = { "elixir" }, config = function() local elixir = require("elixir") local elixirls = require("elixir.elixirls") diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua index 88a0fec..5873598 100644 --- a/lua/plugins/lualine.lua +++ b/lua/plugins/lualine.lua @@ -91,10 +91,10 @@ return { }, sections = process_sections { lualine_a = { - { 'mode', - -- icons_enabled = true, + { 'mode', + icons_enabled = true, icon = { - " ", + " ", color = { fg = colors.base4, bg = colors.base03, gui = 'bold'} }, -- color = { fg = colors.base0, bg = colors.green300, gui = 'bold' }, @@ -131,11 +131,11 @@ return { }, lualine_c = { { - 'filename', - on_click = function() + 'filename', + on_click = function() require('telescope.builtin').find_files() - -- print('file name clicked') - end, + -- print('file name clicked') + end, icon = ' ', color = { fg = colors.yellow100, bg = colors.base03, gui = 'bold'}, path = 4, @@ -175,7 +175,7 @@ return { -- Lsp server name . function() local msg = 'No LSP' - local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') + local buf_ft = vim.api.nvim_get_option_value("filetype", { buf = 0 }) local clients = vim.lsp.get_clients() if next(clients) == nil then return msg @@ -208,13 +208,13 @@ return { } }, lualine_z = { - { - -- 'location', + { + -- 'location', -- function() -- return "Ln:%l Col:%c" -- end -- separator = { right = '' }, left_padding = 2 }, - } + } }, }, inactive_sections = { diff --git a/lua/plugins/neotest.lua b/lua/plugins/neotest.lua index 09e99b0..2afc490 100644 --- a/lua/plugins/neotest.lua +++ b/lua/plugins/neotest.lua @@ -7,7 +7,6 @@ return { "nvim-treesitter/nvim-treesitter", "antoinemadec/FixCursorHold.nvim", "nvim-neotest/neotest-go", - "rouge8/neotest-rust", "nvim-neotest/neotest-plenary", "nvim-neotest/neotest-vim-test", "anuvyklack/hydra.nvim", @@ -17,7 +16,7 @@ return { neotest.setup { adapters = { require "neotest-go", - require "neotest-rust", + require('rustaceanvim.neotest'), require "neotest-plenary", -- require "neotest-vim-test" { -- ignore_file_types = { "go", "lua", "rust", "php" }, diff --git a/lua/plugins/noice.lua b/lua/plugins/noice.lua index 7cd5593..b8942be 100644 --- a/lua/plugins/noice.lua +++ b/lua/plugins/noice.lua @@ -168,7 +168,7 @@ return { markdown = { hover = { ["|(%S-)|"] = vim.cmd.help, -- vim help links - ["%[.-%]%((%S-)%)"] = require("noice.util").open, -- markdown links + -- ["%[.-%]%((%S-)%)"] = require("noice.util").open, -- markdown links }, highlights = { ["|%S-|"] = "@text.reference", diff --git a/lua/plugins/nvim-html-css.lua b/lua/plugins/nvim-html-css.lua deleted file mode 100644 index d755f75..0000000 --- a/lua/plugins/nvim-html-css.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { "Jezda1337/nvim-html-css", - dependencies = { - "nvim-treesitter/nvim-treesitter", - "nvim-lua/plenary.nvim" - }, - config = function() - require("html-css"):setup() - end -} diff --git a/lua/plugins/oil.lua b/lua/plugins/oil.lua index 694fea9..b486c14 100644 --- a/lua/plugins/oil.lua +++ b/lua/plugins/oil.lua @@ -1,186 +1,185 @@ -return -{ - 'stevearc/oil.nvim', +return { + 'stevearc/oil.nvim', + ---@module 'oil' + ---@type oil.SetupOpts opts = {}, -- Optional dependencies dependencies = { - "nvim-tree/nvim-web-devicons", - {"ElvisClaros/oil-image-preview.nvim", lazy = false}, + { "echasnovski/mini.icons", opts = {} }, + { "ElvisClaros/oil-image-preview.nvim", lazy = false }, }, - config = function () - - local oip = require("oil-image-preview") - require('oil').setup({ - -- Oil will take over directory buffers (e.g. `vim .` or `:e src/`) - -- Set to false if you still want to use netrw. - default_file_explorer = true, - -- Id is automatically added at the beginning, and name at the end - -- See :help oil-columns - columns = { - "icon", - -- "permissions", - -- "size", - -- "mtime", - }, - -- Buffer-local options to use for oil buffers - buf_options = { - buflisted = false, - bufhidden = "hide", - }, - -- Window-local options to use for oil buffers - win_options = { - wrap = false, - signcolumn = "yes:3", - cursorcolumn = false, - foldcolumn = "0", - spell = false, - list = false, - conceallevel = 3, - concealcursor = "nvic", - }, - -- Send deleted files to the trash instead of permanently deleting them (:help oil-trash) - delete_to_trash = false, - -- Skip the confirmation popup for simple operations (:help oil.skip_confirm_for_simple_edits) - skip_confirm_for_simple_edits = false, - -- Selecting a new/moved/renamed file or directory will prompt you to save changes first - -- (:help prompt_save_on_select_new_entry) - prompt_save_on_select_new_entry = true, - -- Oil will automatically delete hidden buffers after this delay - -- You can set the delay to false to disable cleanup entirely - -- Note that the cleanup process only starts when none of the oil buffers are currently displayed - cleanup_delay_ms = 2000, - lsp_file_methods = { - -- Time to wait for LSP file operations to complete before skipping - timeout_ms = 1000, - -- Set to true to autosave buffers that are updated with LSP willRenameFiles - -- Set to "unmodified" to only save unmodified buffers - autosave_changes = false, - }, - -- Constrain the cursor to the editable parts of the oil buffer - -- Set to `false` to disable, or "name" to keep it on the file names - constrain_cursor = "editable", - -- Set to true to watch the filesystem for changes and reload oil - experimental_watch_for_changes = true, - -- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap - -- options with a `callback` (e.g. { callback = function() ... end, desc = "", mode = "n" }) - -- Additionally, if it is a string that matches "actions.<name>", - -- it will use the mapping at require("oil.actions").<name> - -- Set to `false` to remove a keymap - -- See :help oil-actions for a list of all available actions - keymaps = { - ["g?"] = "actions.show_help", - ["<CR>"] = "actions.select", - ["<C-s>"] = "actions.select_vsplit", - ["<C-h>"] = "actions.select_split", - ["<C-t>"] = "actions.select_tab", - ["<C-p>"] = "actions.preview", - ["<C-c>"] = "actions.close", - ["<C-l>"] = "actions.refresh", - ["-"] = "actions.parent", - ["_"] = "actions.open_cwd", - ["`"] = "actions.cd", - ["~"] = "actions.tcd", - ["gs"] = "actions.change_sort", - ["gx"] = "actions.open_external", - ["g."] = "actions.toggle_hidden", - ["g\\"] = "actions.toggle_trash", - ["g<leader>"] = oip.openWithQuickLook, - ["gp"] = oip.weztermPreview, - ["gdi"] = function() - require("oil").set_columns({ "icon", "", "", "" }) - end, - ["gdf"] = function() - require("oil").set_columns({ "icon", "permissions", "size", "mtime" }) - end, - ["g:"] = { - "actions.open_terminal", - desc = "Open terminal in current directory", - }, - - }, - -- Configuration for the floating keymaps help window - keymaps_help = { - border = "rounded", - }, - -- Set to false to disable all of the above keymaps - use_default_keymaps = true, - view_options = { - -- Show files and directories that start with "." - show_hidden = false, - -- This function defines what is considered a "hidden" file - is_hidden_file = function(name, bufnr) - return vim.startswith(name, ".") - end, - -- This function defines what will never be shown, even when `show_hidden` is set - is_always_hidden = function(name, bufnr) - return false - end, - sort = { - -- sort order can be "asc" or "desc" - -- see :help oil-columns to see which columns are sortable - { "type", "asc" }, - { "name", "asc" }, - }, - }, - -- Configuration for the floating window in oil.open_float - float = { - -- Padding around the floating window - padding = 2, - max_width = 0, - max_height = 0, - border = "rounded", - win_options = { - winblend = 0, - }, - -- This is the config that will be passed to nvim_open_win. - -- Change values here to customize the layout - override = function(conf) - return conf - end, - }, - -- Configuration for the actions floating preview window - preview = { - -- Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) - -- min_width and max_width can be a single value or a list of mixed integer/float types. - -- max_width = {100, 0.8} means "the lesser of 100 columns or 80% of total" - max_width = 0.9, - -- min_width = {40, 0.4} means "the greater of 40 columns or 40% of total" - min_width = { 40, 0.4 }, - -- optionally define an integer/float for the exact width of the preview window - width = nil, - -- Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) - -- min_height and max_height can be a single value or a list of mixed integer/float types. - -- max_height = {80, 0.9} means "the lesser of 80 columns or 90% of total" - max_height = 0.9, - -- min_height = {5, 0.1} means "the greater of 5 columns or 10% of total" - min_height = { 5, 0.1 }, - -- optionally define an integer/float for the exact height of the preview window - height = nil, - border = "rounded", - win_options = { - winblend = 0, - }, - -- Whether the preview window is automatically updated when the cursor is moved - update_on_cursor_moved = true, - }, - -- Configuration for the floating progress window - progress = { - max_width = 0.9, - min_width = { 40, 0.4 }, - width = nil, - max_height = { 10, 0.9 }, - min_height = { 5, 0.1 }, - height = nil, - border = "rounded", - minimized_border = "none", - win_options = { - winblend = 0, - }, - }, - -- Configuration for the floating SSH window - ssh = { - border = "rounded", - }, -}) + config = function() + local oip = require "oil-image-preview" + require("oil").setup { + -- Oil will take over directory buffers (e.g. `vim .` or `:e src/`) + -- Set to false if you still want to use netrw. + default_file_explorer = true, + -- Id is automatically added at the beginning, and name at the end + -- See :help oil-columns + columns = { + "icon", + -- "permissions", + -- "size", + -- "mtime", + }, + -- Buffer-local options to use for oil buffers + buf_options = { + buflisted = false, + bufhidden = "hide", + }, + -- Window-local options to use for oil buffers + win_options = { + wrap = false, + signcolumn = "yes:3", + cursorcolumn = false, + foldcolumn = "0", + spell = false, + list = false, + conceallevel = 3, + concealcursor = "nvic", + }, + -- Send deleted files to the trash instead of permanently deleting them (:help oil-trash) + delete_to_trash = false, + -- Skip the confirmation popup for simple operations (:help oil.skip_confirm_for_simple_edits) + skip_confirm_for_simple_edits = false, + -- Selecting a new/moved/renamed file or directory will prompt you to save changes first + -- (:help prompt_save_on_select_new_entry) + prompt_save_on_select_new_entry = true, + -- Oil will automatically delete hidden buffers after this delay + -- |