From 58bdfd856cc8de138d1b1ca71f124bc313217dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Doma=C5=84ski?= Date: Wed, 16 Oct 2024 16:55:16 +0200 Subject: [PATCH] [cd] eval .localrc [neovim] omit lsp autocmds when env set so --- .config/nvim/lua/config/autocmds.lua | 26 +++++++++++++++----------- .config/scriptrc/cd.sh | 4 ++++ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua index 5192fec..0e79c72 100644 --- a/.config/nvim/lua/config/autocmds.lua +++ b/.config/nvim/lua/config/autocmds.lua @@ -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 diff --git a/.config/scriptrc/cd.sh b/.config/scriptrc/cd.sh index 0a058ef..3ec4681 100644 --- a/.config/scriptrc/cd.sh +++ b/.config/scriptrc/cd.sh @@ -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}