diff --git a/init.lua b/init.lua index 11770d7d..4b6c5b4c 100644 --- a/init.lua +++ b/init.lua @@ -222,6 +222,13 @@ vim.api.nvim_create_autocmd('TextYankPost', { end, }) +vim.filetype.add { + extension = { + compute = 'hlsl', + hlsl = 'hlsl', + }, +} + -- [[ Install `lazy.nvim` plugin manager ]] -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' @@ -506,6 +513,8 @@ require('lazy').setup({ { 'mason-org/mason.nvim', opts = {} }, 'mason-org/mason-lspconfig.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim', + 'folke/trouble.nvim', + 'nvim-tree/nvim-web-devicons', -- Useful status updates for LSP. { 'j-hui/fidget.nvim', opts = {} }, @@ -593,8 +602,10 @@ require('lazy').setup({ -- the definition of its *type*, not where it was *defined*. map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') - -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) - ---@param client vim.lsp.Client + -- create a .cpp file for .hpp file automatically + map('gh', 'LspClangdSwitchSourceHeader', '[G]oto [H]ader/Source') + + -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) @param client vim.lsp.Client ---@param method vim.lsp.protocol.Method ---@param bufnr? integer some lsp support methods only in specific files ---@return boolean @@ -692,7 +703,7 @@ require('lazy').setup({ -- - settings (table): Override the default settings passed when initializing the server. -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { - -- clangd = {}, + clangd = {}, -- gopls = {}, -- pyright = {}, -- rust_analyzer = {}, @@ -856,7 +867,16 @@ require('lazy').setup({ -- : Toggle signature help -- -- See :h blink-cmp-config-keymap for defining your own keymap - preset = 'default', + preset = 'none', -- Disable the preset to avoid conflicts + [''] = { 'snippet_forward', 'fallback' }, + [''] = { 'snippet_backward', 'fallback' }, + [''] = { 'show', 'show_documentation', 'hide_documentation' }, + [''] = { 'hide' }, + [''] = { 'select_and_accept' }, + [''] = { 'select_prev', 'fallback' }, + [''] = { 'select_next', 'fallback' }, + [''] = { 'scroll_documentation_up', 'fallback' }, + [''] = { 'scroll_documentation_down', 'fallback' }, -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps @@ -897,6 +917,37 @@ require('lazy').setup({ }, }, + { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + -- Optional dependency to make it work with blink.cmp + dependencies = { 'saghen/blink.cmp' }, + config = function() + require('nvim-autopairs').setup {} + -- If you want it to automatically add brackets when accepting a function + -- in the completion menu, you can integrate it with your cmp: + end, + }, + + { + 'nvim-treesitter/nvim-treesitter-context', + opts = { + max_lines = 3, -- How many lines the window should span + min_window_height = 0, + line_numbers = true, + multiline_threshold = 20, -- Maximum number of lines to show for a single context + trim_scope = 'outer', -- Which context lines to discard if max_lines is exceeded + mode = 'cursor', -- Line used to calculate context. Can be 'cursor' or 'topline' + }, + }, + { + 'andymass/vim-matchup', + setup = function() + -- may set any options here + vim.g.matchup_matchparen_offscreen = { method = 'popup' } + end, + }, + { -- You can easily change to a different colorscheme. -- Change the name of the colorscheme plugin below, and then -- change the command in the config to whatever the name of that colorscheme is.