[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.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("lsp", { clear = true }),
callback = function(args)
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = args.buf,
callback = function()
vim.lsp.buf.format { async = false, id = args.data.client_id }
end,
})
end
})
local nvim_lsp_omit_dir = os.getenv("NVIM_LSP_OMIT_DIR")
if not nvim_lsp_omit_dir then
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("lsp", { clear = true }),
callback = function(args)
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = args.buf,
callback = function()
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
fi
if [ -f .localrc ]; then
source .localrc
fi
if [ $# -gt 1 ]; then
if [ -f Makefile ]; then
make ${@:2}