add oil.nvim
This commit is contained in:
parent
d65c4083ba
commit
09aa20cf59
4 changed files with 71 additions and 1 deletions
2
init.lua
2
init.lua
|
|
@ -16,7 +16,7 @@ vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
vim.keymap.set("n", "<leader>gr", vim.lsp.buf.references, opts)
|
vim.keymap.set("n", "<leader>gr", vim.lsp.buf.references, opts)
|
||||||
vim.keymap.set("n", "<leader>r", vim.lsp.buf.rename, opts)
|
vim.keymap.set("n", "<leader>r", vim.lsp.buf.rename, opts)
|
||||||
vim.keymap.set("n", "<leader>a", vim.lsp.buf.code_action, opts)
|
vim.keymap.set("n", "<leader>a", vim.lsp.buf.code_action, opts)
|
||||||
vim.keymap.set("n", "<leader>for", function()
|
vim.keymap.set("n", "<leader>lf", function()
|
||||||
vim.lsp.buf.format({ async = true })
|
vim.lsp.buf.format({ async = true })
|
||||||
end, opts)
|
end, opts)
|
||||||
vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, opts)
|
vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, opts)
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
"nvim-treesitter-endwise": { "branch": "master", "commit": "8fe8a95630f4f2c72a87ba1927af649e0bfaa244" },
|
"nvim-treesitter-endwise": { "branch": "master", "commit": "8fe8a95630f4f2c72a87ba1927af649e0bfaa244" },
|
||||||
"nvim-ts-autotag": { "branch": "main", "commit": "8e1c0a389f20bf7f5b0dd0e00306c1247bda2595" },
|
"nvim-ts-autotag": { "branch": "main", "commit": "8e1c0a389f20bf7f5b0dd0e00306c1247bda2595" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "d7462543c9e366c0d196c7f67a945eaaf5d99414" },
|
"nvim-web-devicons": { "branch": "master", "commit": "d7462543c9e366c0d196c7f67a945eaaf5d99414" },
|
||||||
|
"oil.nvim": { "branch": "master", "commit": "0fcc83805ad11cf714a949c98c605ed717e0b83e" },
|
||||||
"rustaceanvim": { "branch": "master", "commit": "f2f0c1231a5b019dbc1fd6dafac1751c878925a3" },
|
"rustaceanvim": { "branch": "master", "commit": "f2f0c1231a5b019dbc1fd6dafac1751c878925a3" },
|
||||||
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }
|
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
65
lua/plugins/oil.lua
Normal file
65
lua/plugins/oil.lua
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
return {
|
||||||
|
'stevearc/oil.nvim',
|
||||||
|
lazy = false,
|
||||||
|
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||||
|
|
||||||
|
---@module 'oil'
|
||||||
|
---@type oil.SetupOpts
|
||||||
|
opts = {
|
||||||
|
-- Substitutes netrw as the default browser
|
||||||
|
default_file_explorer = true,
|
||||||
|
|
||||||
|
-- Visible buffer columns
|
||||||
|
columns = {
|
||||||
|
'icon',
|
||||||
|
-- 'permissions',
|
||||||
|
-- 'size',
|
||||||
|
-- 'mtime',
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Oil buffer options
|
||||||
|
buf_options = {
|
||||||
|
buflisted = false,
|
||||||
|
bufhidden = 'hide',
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Floating window
|
||||||
|
float = {
|
||||||
|
padding = 2,
|
||||||
|
max_width = 80,
|
||||||
|
max_height = 30,
|
||||||
|
border = 'rounded',
|
||||||
|
win_options = {
|
||||||
|
winblend = 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
view_options = {
|
||||||
|
show_hidden = true, -- show hidden files/dirs
|
||||||
|
is_always_hidden = function(name, _)
|
||||||
|
-- always hide the .git dir
|
||||||
|
return name == '.git'
|
||||||
|
end
|
||||||
|
},
|
||||||
|
|
||||||
|
keymaps = {
|
||||||
|
['g?'] = 'actions.show_help',
|
||||||
|
['<CR>'] = 'actions.select',
|
||||||
|
['<C-v>'] = 'actions.select_vsplit',
|
||||||
|
['<C-s>'] = 'actions.select_split',
|
||||||
|
['<C-t>'] = 'actions.select_tab',
|
||||||
|
['<C-p>'] = 'actions.preview',
|
||||||
|
['<C-c>'] = 'actions.close',
|
||||||
|
['<C-r>'] = 'actions.refresh',
|
||||||
|
['-'] = 'actions.parent',
|
||||||
|
['_'] = 'actions.open_cwd',
|
||||||
|
['g.'] = 'actions.toggle_hidden',
|
||||||
|
},
|
||||||
|
use_default_keymaps = false,
|
||||||
|
},
|
||||||
|
|
||||||
|
keys = {
|
||||||
|
{ '-', '<cmd>Oil<cr>', desc = 'Open parent directory' },
|
||||||
|
{ '<leader>-', function() require('oil').open_float() end, desc = 'Open parent directory (float)' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -31,6 +31,10 @@ vim.opt.hlsearch = false -- do not keep matches highlighted
|
||||||
vim.opt.splitbelow = true -- horizontal splits open below
|
vim.opt.splitbelow = true -- horizontal splits open below
|
||||||
vim.opt.splitright = true -- vertical splits open to the right
|
vim.opt.splitright = true -- vertical splits open to the right
|
||||||
|
|
||||||
|
-- Misc
|
||||||
|
vim.opt.undofile = true -- persist between sessions
|
||||||
|
vim.opt.updatetime = 250 -- lower the update delay
|
||||||
|
|
||||||
-- Diagnostics
|
-- Diagnostics
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
virtual_text = true, -- use virtual text for diagnostics
|
virtual_text = true, -- use virtual text for diagnostics
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue