added oil.nvim

This commit is contained in:
2025-01-23 10:08:19 +11:00
parent a26b97c55f
commit cc7d2566fb
4 changed files with 34 additions and 15 deletions

View File

@@ -21,6 +21,7 @@ Plugins are managed using [lazy.nvim](https://github.com/folke/lazy.nvim)
- [Harpoon](#harpoon)
- [Markdown Preview](#markdown-preview)
- [NVIM Web Devicons](#nvim-web-devicons)
- [Oil](#oil)
- [SUDA](#suda)
- [Surround](#surround)
- [Telescope](#telescope)
@@ -116,6 +117,10 @@ Live preview of markdown files in browser, with synced scrolling
#### [NVIM Web Devicons](https://github.com/nvim-tree/nvim-web-devicons)
Provides Nerd font icons for other plugins to use
---
#### [Oil](https://github.com/nvim-tree/nvim-web-devicons)
Edit/view your filesystem like a normal NeoVim buffer
---
#### [SUDA](https://github.com/lambdalisue/vim-suda)
Write files using sudo inside NeoVim
@@ -271,7 +276,7 @@ LSP has been setup with the following dependencies:
| Keybind | Behaviour | Normal | Visual | Select |
|---------|-----------|--------|--------|--------|
| `<leader>pv` | View directory of current file | &check; | &cross; | &cross; |
| `-` | View parent directory (works in file and in Oil filetree viewer) | &check; | &cross; | &cross; |
| `J` | Move selection down and autoindent | &cross; | &check; | &check; |
| `K` | Move selection up and autoindent | &cross; | &check; | &check; |
| `J` | Moves line below current line into sameline | &check; | &cross; | &cross; |

View File

@@ -26,6 +26,7 @@
"nvim-surround": { "branch": "main", "commit": "ae298105122c87bbe0a36b1ad20b06d417c0433e" },
"nvim-treesitter": { "branch": "master", "commit": "0c94de7e9792cf89c14a865ab819ad5c6e6a7f77" },
"nvim-web-devicons": { "branch": "master", "commit": "aafa5c187a15701a7299a392b907ec15d9a7075f" },
"oil.nvim": { "branch": "master", "commit": "62c5683c2e4f968dce27048e11e72f662d6d90e5" },
"plenary": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" },
"plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" },
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },

12
lua/haelnorr/lazy/oil.lua Normal file
View File

@@ -0,0 +1,12 @@
return {
"stevearc/oil.nvim",
---@module 'oil'
---@type oil.SetupOpts
opts = {},
-- Optional dependencies
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("oil").setup()
vim.keymap.set("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" })
end,
}

View File

@@ -1,6 +1,7 @@
vim.g.mapleader = " "
-- directory viewer
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
-- has been replaced with Oil.nvim, keybind "-"
-- vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
-- move highlighted lines up and down
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
@@ -25,14 +26,14 @@ vim.keymap.set({ "n", "v" }, "<leader>d", [["_d]])
-- formats file using LSP
-- vim.keymap.set("n", "<leader>f", vim.lsp.buf.format)
vim.keymap.set("", "<leader>f", function()
require("conform").format({ async = true }, function(err)
if not err then
local mode = vim.api.nvim_get_mode().mode
if vim.startswith(string.lower(mode), "v") then
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Esc>", true, false, true), "n", true)
end
end
end)
require("conform").format({ async = true }, function(err)
if not err then
local mode = vim.api.nvim_get_mode().mode
if vim.startswith(string.lower(mode), "v") then
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Esc>", true, false, true), "n", true)
end
end
end)
end, { desc = "Format code" })
vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
@@ -46,9 +47,9 @@ vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
vim.keymap.set("n", "<leader>o", "o<Esc>k")
vim.keymap.set("n", "<C-Q>", function()
if vim.inspect(vim.opt.colorcolumn:get()) == "{}" then
vim.opt.colorcolumn = "80"
else
vim.opt.colorcolumn = ""
end
if vim.inspect(vim.opt.colorcolumn:get()) == "{}" then
vim.opt.colorcolumn = "80"
else
vim.opt.colorcolumn = ""
end
end)