local map = vim.api.nvim_set_keymap vim.g.mapleader = " " require("config.lazy") require("lazy").setup({ spec = { -- import your plugins { import = "plugins" }, }, -- Configure any other settings here. See the documentation for more details. -- colorscheme that will be used when installing plugins. install = { colorscheme = { "habamax" } }, -- automatically check for plugin updates checker = { enabled = true }, }) require("core.options") options = { noremap = true } map('n', 'L', ':Lazy ', options) map('n', 'ff', ':Telescope find_files', options) map('n', 'fg', ':Telescope git_files', options) map('n', 'fc', ':Telescope git_commits', options) map('n', 'fC', ':Telescope git_bcommits', options) map('n', 'fl', ':Telescope live_grep', options) map('n', 'fh', ':Telescope help_tags', options) map('n', '', ':Telescope buffers', options) map('n', 'nv', ':Telescope find_files cwd=~/.config/nvim', options) map('n', 'nc', ':Telescope find_files cwd=~/.config', options) map('n', 'gd', ':Telescope lsp_definitions', options) map('n', 'gD', ':Telescope lsp_declaration', options) map('n', 'gr', ':Telescope lsp_references', options) map('n', 'gs', ':Telescope lsp_workspace_symbols', options) map('n', 'gS', ':Telescope lsp_dynamic_workspace_symbols', options) map('n', 'h', ':nohlsearch', options) -------------------------------------------------- -- Telescope -------------------------------------------------- require('telescope').setup{ defaults = { prompt_prefix = "> ", } } -------------------------------------------------- -- LSP -------------------------------------------------- -- Reserve a space in the gutter -- This will avoid an annoying layout shift in the screen vim.opt.signcolumn = 'yes' -- Add cmp_nvim_lsp capabilities settings to lspconfig -- This should be executed before you configure any language server local lspconfig_defaults = require('lspconfig').util.default_config lspconfig_defaults.capabilities = vim.tbl_deep_extend( 'force', lspconfig_defaults.capabilities, require('cmp_nvim_lsp').default_capabilities() ) -- This is where you enable features that only work -- if there is a language server active in the file vim.api.nvim_create_autocmd('LspAttach', { desc = 'LSP actions', callback = function(event) local opts = {buffer = event.buf} vim.keymap.set('n', 'K', 'lua vim.lsp.buf.hover()', opts) --vim.keymap.set('n', 'gd', 'lua vim.lsp.buf.definition()', opts) --vim.keymap.set('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) vim.keymap.set('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) vim.keymap.set('n', 'go', 'lua vim.lsp.buf.type_definition()', opts) --vim.keymap.set('n', 'gr', 'lua vim.lsp.buf.references()', opts) vim.keymap.set('n', 'gs', 'lua vim.lsp.buf.signature_help()', opts) vim.keymap.set('n', '', 'lua vim.lsp.buf.rename()', opts) vim.keymap.set({'n', 'x'}, '', 'lua vim.lsp.buf.format({async = true})', opts) vim.keymap.set('n', '', 'lua vim.lsp.buf.code_action()', opts) end, }) require('lspconfig').clangd.setup({}) local cmp = require('cmp') cmp.setup({ sources = { {name = 'nvim_lsp'}, }, completion = { autocomplete = false }, mapping = cmp.mapping.preset.insert({ -- Navigate between completion items [''] = cmp.mapping.select_prev_item({behavior = 'select'}), [''] = cmp.mapping.select_next_item({behavior = 'select'}), -- `Enter` key to confirm completion [''] = cmp.mapping.confirm({select = false}), -- Ctrl+Space to trigger completion menu [''] = cmp.mapping.complete(), -- Scroll up and down in the completion documentation [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), }), snippet = { expand = function(args) require('luasnip').lsp_expand(args.body) end, }, mapping = cmp.mapping.preset.insert({}), }) -------------------------------------------------- -- Aerial -------------------------------------------------- require("aerial").setup({ -- optionally use on_attach to set keymaps when aerial has attached to a buffer on_attach = function(bufnr) -- Jump forwards/backwards with '{' and '}' --vim.keymap.set("n", "{", "AerialPrev", { buffer = bufnr }) --vim.keymap.set("n", "}", "AerialNext", { buffer = bufnr }) end, }) -- You probably also want to set a keymap to toggle aerial vim.keymap.set("n", "a", "Telescope aerial")