[cd] eval .localrc [neovim] omit lsp autocmds when env set so

This commit is contained in:
Piotr Domański 2024-10-16 16:55:16 +02:00
parent 424dd161c1
commit 58bdfd856c
2 changed files with 19 additions and 11 deletions

View file

@ -2,14 +2,18 @@ vim.o.updatetime = 250
vim.cmd [[autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]] vim.cmd [[autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]]
vim.api.nvim_create_autocmd("LspAttach", { local nvim_lsp_omit_dir = os.getenv("NVIM_LSP_OMIT_DIR")
group = vim.api.nvim_create_augroup("lsp", { clear = true }),
callback = function(args) if not nvim_lsp_omit_dir then
vim.api.nvim_create_autocmd("BufWritePre", { vim.api.nvim_create_autocmd("LspAttach", {
buffer = args.buf, group = vim.api.nvim_create_augroup("lsp", { clear = true }),
callback = function() callback = function(args)
vim.lsp.buf.format { async = false, id = args.data.client_id } vim.api.nvim_create_autocmd("BufWritePre", {
end, buffer = args.buf,
}) callback = function()
end vim.lsp.buf.format { async = false, id = args.data.client_id }
}) end,
})
end
})
end

View file

@ -20,6 +20,10 @@ function cd
source .venv/bin/activate source .venv/bin/activate
fi fi
if [ -f .localrc ]; then
source .localrc
fi
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then
if [ -f Makefile ]; then if [ -f Makefile ]; then
make ${@:2} make ${@:2}