diff options
Diffstat (limited to 'lua/init.lua')
-rw-r--r-- | lua/init.lua | 66 |
1 files changed, 61 insertions, 5 deletions
diff --git a/lua/init.lua b/lua/init.lua index aedac4f..f493729 100644 --- a/lua/init.lua +++ b/lua/init.lua @@ -1,7 +1,31 @@ +local function dump(o) + if type(o) == 'table' then + local s = '{ ' + for k,v in pairs(o) do + if type(k) ~= 'number' then k = '"'..k..'"' end + s = s .. '['..k..'] = ' .. dump(v) .. ',' + end + return s .. '} ' + else + return tostring(o) + end +end + -- Neotree local neotree = require("neo-tree") neotree.setup({ - close_if_last_window = true, + close_if_last_window = false, + icon = { + folder_closed = "", + folder_open = "", + folder_empty = "", + folder_empty_open = "", + -- The next two settings are only a fallback, + -- if you use nvim-web-devicons and configure default icons there + -- then these will never be used. + default = "*", + highlight = "NeoTreeFileIcon" + }, default_component_configs = { git_status = { symbols = { @@ -23,6 +47,13 @@ neotree.setup({ filtered_items = { hide_dotfiles = false, } + }, + event_handlers = { + event = "vim_buffer_changed", + handler = function(_) + vim.cmd('Git status') + end, + id = "AutoGitStatus", } }) @@ -50,7 +81,9 @@ cmp.setup({ ['<C-f>'] = cmp.mapping.scroll_docs(4), ['<C-Space>'] = cmp.mapping.complete(), ['<C-e>'] = cmp.mapping.abort(), - ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + -- Accept currently selected item. + -- Set `select` to `false` to only confirm explicitly selected items. + ['<CR>'] = cmp.mapping.confirm({ select = true }), }), sources = cmp.config.sources({ { name = 'nvim_lsp' }, @@ -58,16 +91,39 @@ cmp.setup({ }, { { name = 'buffer' }, }) + }) -local lsp_capabilibies = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) +local lsp_capabilibies = require('cmp_nvim_lsp').default_capabilities( + vim.lsp.protocol.make_client_capabilities() +) local servers = mason_lspconfig.get_installed_servers() +local configs_custom = { + lua_ls = { + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = {'vim'}, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + }, + } +} for _, server in ipairs(servers) do - lspconfig[server].setup({ + local config = { capabilities = lsp_capabilibies - }) + } + if configs_custom[server] then + for k, v in pairs(configs_custom[server]) do + config[k] = v + end + end + --print(server, ":") + --print(dump(config)) + lspconfig[server].setup(config) end require('lspconfig').gdscript.setup { |