diff --git a/init.lua b/init.lua index 4eae8e7d..6cf6a311 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.opt` @@ -616,7 +616,46 @@ 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 = { + { + 'clangd', + '--background-index', + '--clang-tidy', + '--header-insertion=iwyu', + '--completion-style=detailed', + '--function-arg-placeholders', + '--fallback-style=llvm', + }, + init_options = { + usePlaceholders = true, + completeUnimported = true, + clangdFileStatus = true, + }, + -- Configure clangd's capabilities + capabilities = { + offsetEncoding = { 'utf-16' }, + }, + -- Optional: Add custom on_attach function + on_attach = function(client, bufnr) + -- Enable completion triggered by + vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + + -- Key mappings + local bufopts = { noremap = true, silent = true, buffer = bufnr } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) + vim.keymap.set('n', '', vim.lsp.buf.signature_help, bufopts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) + vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) + + -- Set autoformat on save (optional) + vim.cmd [[autocmd BufWritePre lua vim.lsp.buf.format()]] + end, + }, -- gopls = {}, -- pyright = {}, -- rust_analyzer = {}, @@ -849,7 +888,7 @@ require('lazy').setup({ -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' + vim.cmd.colorscheme 'blue' -- You can configure highlights by doing something like: vim.cmd.hi 'Comment gui=none' @@ -942,7 +981,7 @@ require('lazy').setup({ -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! diff --git a/lua/custom/plugins/neo-tree.lua b/lua/custom/plugins/neo-tree.lua new file mode 100644 index 00000000..08d826c8 --- /dev/null +++ b/lua/custom/plugins/neo-tree.lua @@ -0,0 +1,45 @@ +return { + { + -- Add neo-tree + 'nvim-neo-tree/neo-tree.nvim', + branch = 'v3.x', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-tree/nvim-web-devicons', + 'MunifTanjim/nui.nvim', + }, + config = function() + require('neo-tree').setup { + close_if_last_window = true, + enable_git_status = true, + enable_diagnostics = true, + filesystem = { + follow_current_file = { + enabled = true, + }, + filtered_items = { + visible = false, + hide_dotfiles = false, + hide_gitignored = false, + }, + }, + window = { + width = 30, + mappings = { + [''] = { + 'toggle_node', + nowait = false, + }, + [''] = 'open', + ['P'] = { 'toggle_preview', config = { use_float = true } }, + ['l'] = 'focus_preview', + }, + }, + } + + -- Keymaps + vim.keymap.set('n', '', ':Neotree toggle', { silent = true }) + vim.keymap.set('n', 'o', ':Neotree focus', { silent = true }) + end, + }, +}