From 6984aa64e80a7b1f11dd1e81fdcd71d3d9b78f68 Mon Sep 17 00:00:00 2001 From: Fabio Lenherr / DashieTM Date: Mon, 20 Feb 2023 22:30:37 +0100 Subject: [PATCH] chore: cleanup of nvim --- nvim/.luarc.json | 3 ++- nvim/lua/settings/dap.lua | 2 ++ nvim/lua/settings/lsp.lua | 9 +++++++-- nvim/lua/settings/nvim-tree.lua | 26 ++++++++++++++++++++++++-- nvim/lua/settings/options.lua | 2 +- nvim/lua/settings/treesitter.lua | 8 -------- 6 files changed, 36 insertions(+), 14 deletions(-) diff --git a/nvim/.luarc.json b/nvim/.luarc.json index 6789105..c609932 100644 --- a/nvim/.luarc.json +++ b/nvim/.luarc.json @@ -5,6 +5,7 @@ "global" ], "Lua.workspace.library": [ - "${3rd}/luassert/library" + "${3rd}/luassert/library", + "${3rd}/luv/library" ] } \ No newline at end of file diff --git a/nvim/lua/settings/dap.lua b/nvim/lua/settings/dap.lua index 27c65e1..5dc6292 100644 --- a/nvim/lua/settings/dap.lua +++ b/nvim/lua/settings/dap.lua @@ -110,6 +110,7 @@ require("dapui").setup({ max_value_lines = 100, -- Can be integer or nil. }, }) + require("mason-nvim-dap").setup({ ensure_installed = { "bash-debug-adapter", @@ -118,4 +119,5 @@ require("mason-nvim-dap").setup({ "node-debug2-adapter", }, }) + require("nvim-dap-virtual-text").setup() diff --git a/nvim/lua/settings/lsp.lua b/nvim/lua/settings/lsp.lua index c1641d1..377fd5e 100644 --- a/nvim/lua/settings/lsp.lua +++ b/nvim/lua/settings/lsp.lua @@ -18,7 +18,7 @@ require("mason-lspconfig").setup({ "cssls", -- css "html", -- html "clangd", -- cpp / c - "sumneko_lua", -- lua + "lua_ls", -- lua "pyright", -- python "cmake", -- cmake "bashls", -- shell @@ -28,7 +28,12 @@ require("mason-lspconfig").setup({ "tsserver", -- js and ts "ltex", -- latex "jdtls", -- jafuck - "gopls" -- yet another gargabe collector + "gopls", -- yet another gargabe collector + "sqls", -- sql + "taplo", -- toml + "lemminx", -- xml + "yamlls", -- yaml + "bashls", -- shell }, automatic_installation = true, }) diff --git a/nvim/lua/settings/nvim-tree.lua b/nvim/lua/settings/nvim-tree.lua index ed0ee53..d742712 100644 --- a/nvim/lua/settings/nvim-tree.lua +++ b/nvim/lua/settings/nvim-tree.lua @@ -19,11 +19,9 @@ nvim_tree.setup { -- BEGIN_DEFAULT_OPTS hijack_cursor = false, hijack_netrw = true, hijack_unnamed_buffer_when_opening = false, - ignore_buffer_on_setup = false, open_on_setup = false, open_on_setup_file = false, open_on_tab = false, - ignore_buf_on_tab_change = {}, sort_by = "name", root_dirs = {}, prefer_startup_root = false, @@ -241,3 +239,27 @@ vim.api.nvim_create_autocmd("BufEnter", { end end }) + +local function open_nvim_tree(data) + + -- buffer is a [No Name] + local no_name = data.file == "" and vim.bo[data.buf].buftype == "" + + -- buffer is a directory + local directory = vim.fn.isdirectory(data.file) == 1 + + if not no_name and not directory then + return + end + + -- change to the directory + if directory then + vim.cmd.cd(data.file) + end + + -- open the tree + require("nvim-tree.api").tree.open() +end + +vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree }) + diff --git a/nvim/lua/settings/options.lua b/nvim/lua/settings/options.lua index 8a66087..f588332 100644 --- a/nvim/lua/settings/options.lua +++ b/nvim/lua/settings/options.lua @@ -19,7 +19,7 @@ local options = { tabstop = 2, -- insert 2 spaces for a tab scrolloff = 8, sidescrolloff = 8, - spell = true, + spell = false, syntax = "off", spelllang = "en_us", mousemodel = "popup_setpos", diff --git a/nvim/lua/settings/treesitter.lua b/nvim/lua/settings/treesitter.lua index 4812874..5a5ccc5 100644 --- a/nvim/lua/settings/treesitter.lua +++ b/nvim/lua/settings/treesitter.lua @@ -4,17 +4,9 @@ if not status_ok then end require("nvim-treesitter.configs").setup({ - -- A list of parser names, or "all" ensure_installed = "all", highlight = { enable = true, additional_vim_regex_highlighting = false, }, }) - -local status_ok2, _ = pcall(require, "spellsitter") -if not status_ok2 then - return -end - -require("spellsitter").setup()