mirror of
https://github.com/pnx/dotfiles
synced 2026-06-16 03:14:55 +02:00
more nvim
This commit is contained in:
parent
48ddc29db1
commit
fc6be19a2d
10 changed files with 337 additions and 273 deletions
|
|
@ -15,3 +15,4 @@ autocmd('TextYankPost', {
|
|||
autocmd('BufWritePre', {
|
||||
command = [[:exe 'norm m`' | %s/\s\+$//eg | norm ``]]
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,7 @@ return function()
|
|||
local windowstyle = {
|
||||
border = vim.g.float_border or "none",
|
||||
winhighlight = "Normal:Pmenu,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None",
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
preselect = false,
|
||||
|
|
@ -21,12 +20,12 @@ return function()
|
|||
},
|
||||
view = {
|
||||
entries = { name = "custom", selection_order = "near_cursor" },
|
||||
},
|
||||
},
|
||||
window = {
|
||||
documentation = windowstyle,
|
||||
completion = vim.tbl_deep_extend("force", windowstyle, {
|
||||
scrolloff = 4,
|
||||
}),
|
||||
scrolloff = 4,
|
||||
}),
|
||||
},
|
||||
mapping = {
|
||||
["<Up>"] = selectPrev,
|
||||
|
|
@ -52,8 +51,8 @@ return function()
|
|||
}),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "nvim_lsp" },
|
||||
-- { name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
{
|
||||
|
|
|
|||
|
|
@ -113,9 +113,18 @@ return {
|
|||
{ '<leader>ff', "<cmd>Format<cr>", desc = 'Format file' },
|
||||
{ '<leader>ff', "<cmd>Format<cr>", mode = 'x', desc = 'Format selection' },
|
||||
},
|
||||
fugitive = {
|
||||
{ '<leader>gB', '<cmd>Git blame<cr>', desc = 'Git blame' },
|
||||
{ '<leader>gs', '<cmd>Git status<cr>', desc = 'Git status' },
|
||||
{ '<leader>gl', '<cmd>Git log<cr>', desc = 'Git log' },
|
||||
{ '<leader>gL', '<cmd>Git log %<cr>', desc = 'Git log current file' },
|
||||
},
|
||||
gitsigns = {
|
||||
{ '<leader>gp', '<cmd>Gitsigns preview_hunk<cr>', desc = 'Git preview diff' },
|
||||
{ '<leader>gb', '<cmd>Gitsigns blame_line<cr>', desc = 'Git blame' }
|
||||
{ '<leader>gb', '<cmd>Gitsigns blame_line<cr>', desc = 'Git blame line' }
|
||||
},
|
||||
trouble = {
|
||||
{ '<leader>dt', '<cmd>Trouble diagnostics toggle<cr>', desc = 'Trouble diagnostics' },
|
||||
},
|
||||
-- Keybinds for buffers with an LSP client attached
|
||||
lsp = {
|
||||
|
|
|
|||
|
|
@ -1,69 +1,81 @@
|
|||
vim.g.lsp_zero_ui_float_border = vim.g.float_border or 'none'
|
||||
vim.g.lsp_zero_ui_float_border = vim.g.float_border or "none"
|
||||
|
||||
return {
|
||||
document_highlight = true,
|
||||
nonels = function()
|
||||
local null_ls = require("null-ls")
|
||||
return {
|
||||
--null_ls.builtins.completion.luasnip,
|
||||
null_ls.builtins.code_actions.impl,
|
||||
null_ls.builtins.code_actions.gitsigns,
|
||||
null_ls.builtins.diagnostics.phpstan,
|
||||
}
|
||||
end,
|
||||
servers = {
|
||||
-- Bash
|
||||
bashls = {},
|
||||
-- PHP
|
||||
-- intelephense = {},
|
||||
phpactor = {
|
||||
settings = {
|
||||
init_options = {
|
||||
["language_server_phpstan.enabled"] = true,
|
||||
["language_server_psalm.enabled"] = false,
|
||||
}
|
||||
}
|
||||
},
|
||||
--
|
||||
--
|
||||
-- JS,TS,VUE
|
||||
volar = {
|
||||
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue', 'json' }
|
||||
},
|
||||
-- TailwindCSS
|
||||
tailwindcss = {},
|
||||
-- GO
|
||||
gopls = {
|
||||
on_save = function()
|
||||
local params = vim.lsp.util.make_range_params()
|
||||
params.context = { only = { "source.organizeImports" } }
|
||||
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 1000)
|
||||
for cid, res in pairs(result or {}) do
|
||||
for _, r in pairs(res.result or {}) do
|
||||
if r.edit then
|
||||
local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or "utf-16"
|
||||
vim.lsp.util.apply_workspace_edit(r.edit, enc)
|
||||
end
|
||||
end
|
||||
end
|
||||
vim.lsp.buf.format({ async = false })
|
||||
end,
|
||||
settings = {
|
||||
gopls = {
|
||||
analyses = {
|
||||
unusedvariable = true,
|
||||
unusedwrite = true,
|
||||
useany = true
|
||||
},
|
||||
gofumpt = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- Lua
|
||||
lua_ls = {
|
||||
cmd = {"/opt/luals/bin/lua-language-server", "--logpath=~/.local/luals/logs"},
|
||||
settings = {
|
||||
Lua = {
|
||||
document_highlight = true,
|
||||
nonels = function()
|
||||
local null_ls = require("null-ls")
|
||||
return {
|
||||
--null_ls.builtins.completion.luasnip,
|
||||
null_ls.builtins.code_actions.impl,
|
||||
null_ls.builtins.code_actions.gitsigns,
|
||||
null_ls.builtins.diagnostics.phpstan,
|
||||
}
|
||||
end,
|
||||
servers = {
|
||||
-- Bash
|
||||
bashls = {},
|
||||
-- PHP
|
||||
-- intelephense = {},
|
||||
phpactor = {
|
||||
settings = {
|
||||
init_options = {
|
||||
["language_server_phpstan.enabled"] = true,
|
||||
["language_server_psalm.enabled"] = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- JS,TS,VUE
|
||||
tsserver = {
|
||||
document_highlight = false,
|
||||
settings = {
|
||||
tsserver_plugins = {
|
||||
"@vue/typescript-plugin",
|
||||
},
|
||||
},
|
||||
filetypes = { "javascript", "typescript", "vue" },
|
||||
},
|
||||
volar = {
|
||||
init_options = {
|
||||
vue = {
|
||||
hybridMode = false,
|
||||
},
|
||||
},
|
||||
filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue", "json" },
|
||||
},
|
||||
-- TailwindCSS
|
||||
tailwindcss = {},
|
||||
-- GO
|
||||
gopls = {
|
||||
on_save = function()
|
||||
local params = vim.lsp.util.make_range_params()
|
||||
params.context = { only = { "source.organizeImports" } }
|
||||
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 1000)
|
||||
for cid, res in pairs(result or {}) do
|
||||
for _, r in pairs(res.result or {}) do
|
||||
if r.edit then
|
||||
local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or "utf-16"
|
||||
vim.lsp.util.apply_workspace_edit(r.edit, enc)
|
||||
end
|
||||
end
|
||||
end
|
||||
vim.lsp.buf.format({ async = false })
|
||||
end,
|
||||
settings = {
|
||||
gopls = {
|
||||
analyses = {
|
||||
unusedvariable = true,
|
||||
unusedwrite = true,
|
||||
useany = true,
|
||||
},
|
||||
gofumpt = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- Lua
|
||||
lua_ls = {
|
||||
cmd = { "/opt/luals/bin/lua-language-server", "--logpath=~/.local/luals/logs" },
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
version = 'LuaJIT'
|
||||
},
|
||||
|
|
@ -73,8 +85,8 @@ return {
|
|||
vim.env.VIMRUNTIME
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ return {
|
|||
"xml",
|
||||
"glsl",
|
||||
"hlsl",
|
||||
"markdown"
|
||||
"markdown",
|
||||
"markdown_inline"
|
||||
},
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
|
|
|
|||
|
|
@ -1,183 +1,199 @@
|
|||
local keys = require('config.keymaps')
|
||||
local keys = require("config.keymaps")
|
||||
|
||||
return {
|
||||
-- colorscheme
|
||||
{
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require("catppuccin").setup(require('config.colorscheme'))
|
||||
vim.cmd.colorscheme("catppuccin")
|
||||
end
|
||||
},
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end,
|
||||
opts = function() return {
|
||||
defaults = keys.whichkey
|
||||
} end,
|
||||
config = function(_, opts)
|
||||
local wk = require("which-key")
|
||||
wk.setup(opts)
|
||||
wk.register(opts.defaults or {})
|
||||
end
|
||||
},
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = function()
|
||||
require('nvim-treesitter.install').update({ with_sync = true })
|
||||
end,
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
'nvim-treesitter/playground'
|
||||
},
|
||||
opts = require('config.treesitter'),
|
||||
config = function(_, opts)
|
||||
local parser_config = require('nvim-treesitter.parsers').get_parser_configs()
|
||||
-- colorscheme
|
||||
{
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require("catppuccin").setup(require("config.colorscheme"))
|
||||
vim.cmd.colorscheme("catppuccin")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end,
|
||||
opts = function()
|
||||
return {
|
||||
defaults = keys.whichkey,
|
||||
}
|
||||
end,
|
||||
config = function(_, opts)
|
||||
local wk = require("which-key")
|
||||
wk.setup(opts)
|
||||
wk.register(opts.defaults or {})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = function()
|
||||
require("nvim-treesitter.install").update({ with_sync = true })
|
||||
end,
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
"nvim-treesitter/playground",
|
||||
},
|
||||
opts = require("config.treesitter"),
|
||||
config = function(_, opts)
|
||||
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
|
||||
|
||||
parser_config.blade = {
|
||||
install_info = {
|
||||
url = 'https://github.com/EmranMR/tree-sitter-blade',
|
||||
branch = "main",
|
||||
files = { 'src/parser.c' },
|
||||
generate_requires_npm = true,
|
||||
requires_generate_from_grammar = true,
|
||||
},
|
||||
filetype = 'blade',
|
||||
}
|
||||
parser_config.blade = {
|
||||
install_info = {
|
||||
url = "https://github.com/EmranMR/tree-sitter-blade",
|
||||
branch = "main",
|
||||
files = { "src/parser.c" },
|
||||
generate_requires_npm = true,
|
||||
requires_generate_from_grammar = true,
|
||||
},
|
||||
filetype = "blade",
|
||||
}
|
||||
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
end,
|
||||
},
|
||||
{
|
||||
'windwp/nvim-autopairs',
|
||||
event = "InsertEnter",
|
||||
config = true
|
||||
},
|
||||
{
|
||||
"windwp/nvim-ts-autotag",
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter'
|
||||
},
|
||||
opts = require('config.autotag')
|
||||
},
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
main = "ibl",
|
||||
opts = {
|
||||
debounce = 10,
|
||||
indent = {
|
||||
char = '▏',
|
||||
},
|
||||
scope = {
|
||||
enabled = true,
|
||||
show_start = false,
|
||||
show_end = false
|
||||
},
|
||||
exclude = {
|
||||
filetypes = {
|
||||
'help',
|
||||
'dashboard'
|
||||
}
|
||||
}
|
||||
},
|
||||
config = function(_, opts)
|
||||
require 'ibl'.setup(opts)
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
config = true,
|
||||
},
|
||||
{
|
||||
"windwp/nvim-ts-autotag",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
opts = require("config.autotag"),
|
||||
},
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
main = "ibl",
|
||||
opts = {
|
||||
debounce = 10,
|
||||
indent = {
|
||||
char = "▏",
|
||||
},
|
||||
scope = {
|
||||
enabled = true,
|
||||
show_start = false,
|
||||
show_end = false,
|
||||
},
|
||||
exclude = {
|
||||
filetypes = {
|
||||
"help",
|
||||
"dashboard",
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("ibl").setup(opts)
|
||||
|
||||
local hooks = require 'ibl.hooks'
|
||||
hooks.register(hooks.type.WHITESPACE, hooks.builtin.hide_first_tab_indent_level)
|
||||
hooks.register(hooks.type.WHITESPACE, hooks.builtin.hide_first_space_indent_level)
|
||||
end
|
||||
},
|
||||
-- Git stuff
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
dependencies = {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
defaults = {
|
||||
["<leader>g"] = { name = "+git" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
lazy = false,
|
||||
keys = keys.gitsigns or {},
|
||||
opts = require('config.gitsigns')
|
||||
local hooks = require("ibl.hooks")
|
||||
hooks.register(hooks.type.WHITESPACE, hooks.builtin.hide_first_tab_indent_level)
|
||||
hooks.register(hooks.type.WHITESPACE, hooks.builtin.hide_first_space_indent_level)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"echasnovski/mini.nvim",
|
||||
version = false,
|
||||
},
|
||||
-- Git stuff
|
||||
{
|
||||
"tpope/vim-fugitive",
|
||||
keys = keys.fugitive,
|
||||
},
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
dependencies = {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
defaults = {
|
||||
["<leader>g"] = { name = "+git" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
lazy = false,
|
||||
keys = keys.gitsigns or {},
|
||||
opts = require("config.gitsigns"),
|
||||
},
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"arkav/lualine-lsp-progress",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
opts = require("config.lualine"),
|
||||
},
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"sharkdp/fd",
|
||||
"nvim-telescope/telescope-ui-select.nvim",
|
||||
},
|
||||
keys = keys.telescope,
|
||||
opts = require("config.telescope"),
|
||||
config = function(_, opts)
|
||||
local telescope = require("telescope")
|
||||
|
||||
},
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
'arkav/lualine-lsp-progress',
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
opts = require("config.lualine")
|
||||
},
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
'sharkdp/fd',
|
||||
'nvim-telescope/telescope-ui-select.nvim',
|
||||
},
|
||||
keys = keys.telescope,
|
||||
opts = require('config.telescope'),
|
||||
config = function (_, opts)
|
||||
local telescope = require("telescope")
|
||||
telescope.setup(opts)
|
||||
for name, _ in pairs(opts.extensions or {}) do
|
||||
telescope.load_extension(name)
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
keys = keys.conform or {},
|
||||
opts = require("config.conform"),
|
||||
config = function(_, opts)
|
||||
vim.api.nvim_create_user_command("Format", function(args)
|
||||
local range = nil
|
||||
if args.count ~= -1 then
|
||||
local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1]
|
||||
range = {
|
||||
start = { args.line1, 0 },
|
||||
["end"] = { args.line2, end_line:len() },
|
||||
}
|
||||
end
|
||||
require("conform").format({ async = true, lsp_fallback = true, range = range })
|
||||
end, { range = true })
|
||||
|
||||
telescope.setup(opts)
|
||||
for name, _ in pairs(opts.extensions or {}) do
|
||||
telescope.load_extension(name)
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
'stevearc/conform.nvim',
|
||||
keys = keys.conform or {},
|
||||
opts = require('config.conform'),
|
||||
config = function(_, opts)
|
||||
vim.api.nvim_create_user_command("Format", function(args)
|
||||
local range = nil
|
||||
if args.count ~= -1 then
|
||||
local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1]
|
||||
range = {
|
||||
start = { args.line1, 0 },
|
||||
["end"] = { args.line2, end_line:len() },
|
||||
}
|
||||
end
|
||||
require("conform").format({ async = true, lsp_fallback = true, range = range })
|
||||
end, { range = true })
|
||||
require("conform").setup(opts)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"stevearc/oil.nvim",
|
||||
keys = keys.oil or {},
|
||||
opts = require("config.oil"),
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function(_, opts)
|
||||
require('oil').setup(opts)
|
||||
|
||||
require('conform').setup(opts)
|
||||
end,
|
||||
},
|
||||
{
|
||||
'stevearc/oil.nvim',
|
||||
keys = keys.oil or {},
|
||||
opts = require('config.oil'),
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
},
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
-- Don't touch my CWD!
|
||||
require('utils.oil').RegisterCWDHackHook()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
keys = keys.trouble or {},
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
'L3MON4D3/LuaSnip',
|
||||
opts = {},
|
||||
config = function (_, opts)
|
||||
require("luasnip.loaders.from_lua").load({paths = "~/.config/nvim/snippets"})
|
||||
require("luasnip").setup(opts)
|
||||
end
|
||||
},
|
||||
},
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
opts = {},
|
||||
config = function(_, opts)
|
||||
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets" })
|
||||
require("luasnip").setup(opts)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ return {
|
|||
"neovim/nvim-lspconfig",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
{
|
||||
"nvimtools/none-ls.nvim",
|
||||
"nvimtools/none-ls.nvim",
|
||||
opts = require("config.lsp").nonels,
|
||||
config = function(_, opts)
|
||||
require("null-ls").setup({sources = opts})
|
||||
|
|
@ -20,8 +20,8 @@ return {
|
|||
"hrsh7th/cmp-buffer", -- autocomplete from buffer
|
||||
"hrsh7th/cmp-path", -- autocomplete from filesystem
|
||||
"hrsh7th/cmp-nvim-lsp", -- autocomplete from lsp
|
||||
"saadparwaiz1/cmp_luasnip", -- autocomplete from snippet engine
|
||||
"L3MON4D3/LuaSnip", -- snippet engine
|
||||
-- "saadparwaiz1/cmp_luasnip", -- autocomplete from snippet engine
|
||||
-- "L3MON4D3/LuaSnip", -- snippet engine
|
||||
"onsails/lspkind-nvim", -- icons for kind
|
||||
},
|
||||
opts = require("config.cmp"),
|
||||
|
|
@ -48,6 +48,7 @@ return {
|
|||
end)
|
||||
|
||||
for name, server_opt in pairs(opts.servers) do
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
|
||||
|
|
@ -59,7 +60,7 @@ return {
|
|||
})
|
||||
end
|
||||
|
||||
if (opts.document_highlight or false) and client.supports_method('textDocument/documentHighlight')then
|
||||
if (opts.document_hightlight or server_opt.document_highlight or false) and client.supports_method('textDocument/documentHighlight')then
|
||||
require("utils.lsp").document_highlight(bufnr)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
17
nvim/lua/utils/oil.lua
Normal file
17
nvim/lua/utils/oil.lua
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
local M = {}
|
||||
|
||||
-- Hack for making oil.nvim return to
|
||||
-- the initial cwd on save.
|
||||
function M.RegisterCWDHackHook()
|
||||
local cwd = vim.fn.getcwd()
|
||||
local group = vim.api.nvim_create_augroup("OilCWDHack", {})
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
group = group,
|
||||
pattern = "oil:///*",
|
||||
callback = function() vim.cmd("cd " .. cwd) end,
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
Loading…
Add table
Add a link
Reference in a new issue