diff options
-rw-r--r-- | lua/plugins/auto-session.lua | 34 | ||||
-rw-r--r-- | lua/plugins/lspconfig.lua | 10 | ||||
-rw-r--r-- | lua/plugins/treesitter.lua | 2 |
3 files changed, 37 insertions, 9 deletions
diff --git a/lua/plugins/auto-session.lua b/lua/plugins/auto-session.lua index 5737e3a..974d32d 100644 --- a/lua/plugins/auto-session.lua +++ b/lua/plugins/auto-session.lua @@ -1,19 +1,39 @@ +local function close_plugins() + -- dirty way of handling neotree not being loaded yet (lazy load on <leader>nt) + local _ = pcall(vim.cmd, 'Neotree close') + -- same thing for trouble + local _ = pcall(vim.cmd, 'TroubleClose') +end + +-- from https://github.com/rmagatti/auto-session/pull/230 +local function close_unsupported() + local tabpages = vim.api.nvim_list_tabpages() + for _, tabpage in ipairs(tabpages) do + local windows = vim.api.nvim_tabpage_list_wins(tabpage) + for _, window in ipairs(windows) do + local buffer = vim.api.nvim_win_get_buf(window) + local file_name = vim.api.nvim_buf_get_name(buffer) + -- local is_readable = vim.fn.exists(file_name) + local is_readable = vim.fn.filereadable(file_name) + if not is_readable then + vim.api.nvim_win_close(window, true) + end + end + end +end + return { 'rmagatti/auto-session', opts = { log_level = 'error', auto_session_enabled = true, auto_session_create_enabled = false, - auto_save_enabled = false, -- i only want to save some sessions + auto_save_enabled = false, -- i only want to save some sessions auto_restore_enabled = true, -- always restore if session exists -- handle closing the neotree window/buffer as it results in errors when loading the session pre_save_cmds = { - function() - -- dirty way of handling neotree not being loaded yet (lazy load on <leader>nt) - local _ = pcall(vim.cmd, 'Neotree close') - -- same thing for trouble - local _ = pcall(vim.cmd, 'TroubleClose') - end, + close_plugins, + close_unsupported, }, }, config = function(_, opts) diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua index 2171416..bd6f4c5 100644 --- a/lua/plugins/lspconfig.lua +++ b/lua/plugins/lspconfig.lua @@ -169,7 +169,15 @@ return { -- setup_server('clangd') lspconfig['clangd'].setup({ capabilities = capabilities, - on_attach = on_attach, + on_attach = function(client, bufnr) + -- Really only required if NvChad is used: + -- https://www.youtube.com/watch?v=lsFoZIg-oDs + client.server_capabilities.signatureHelpProvider = false + -- Fixes syntax highlighting: + -- https://www.reddit.com/r/neovim/comments/16hgnjv/comment/k0dx9x8/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button + client.server_capabilities.semanticTokensProvider = nil + on_attach(client, bufnr) + end, settings = servers['clangd'], cmd = { 'clangd', diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 190dad4..df93a7c 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -28,7 +28,7 @@ return { 'godot_resource', 'rust', }, - auto_install = false, + auto_install = true, highlight = { enable = true }, indent = { enable = true, |