diff --git a/init.lua b/init.lua index d5ae6dc9b2a..84172d4439f 100644 --- a/init.lua +++ b/init.lua @@ -356,6 +356,59 @@ require('lazy').setup({ { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, }, config = function() + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), + callback = function(event) + -- NOTE: Remember that Lua is a real programming language, and as such it is possible + -- to define small helper and utility functions so you don't have to repeat yourself. + -- In this case, we create a function that lets us more easily define mappings specific + -- for LSP related items. It sets the mode, buffer and description for us each time. + local map = function(keys, func, desc) + vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end + + -- Jump to the definition of the word under your cursor. + -- This is where a variable was first declared, or where a function is defined, etc. + -- To jump back, press . + map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + + -- Find references for the word under your cursor. + map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + + -- Jump to the implementation of the word under your cursor. + -- Useful when your language has ways of declaring types without an actual implementation. + map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + + -- Jump to the type of the word under your cursor. + -- Useful when you're not sure what type a variable is and you want to see + -- the definition of its *type*, not where it was *defined*. + map('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') + + -- Fuzzy find all the symbols in your current document. + -- Symbols are things like variables, functions, types, etc. + map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + + -- Fuzzy find all the symbols in your current workspace. + -- Similar to document symbols, except searches over your entire project. + map('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + + -- Rename the variable under your cursor. + -- Most Language Servers support renaming across files, etc. + map('lr', vim.lsp.buf.rename, '[R]e[n]ame') + + -- Execute a code action, usually your cursor needs to be on top of an error + -- or a suggestion from your LSP for this to activate. + map('la', vim.lsp.buf.code_action, '[C]ode [A]ction') + + -- Opens a popup that displays documentation about the word under your cursor + -- See `:help K` for why this keymap. + map('K', vim.lsp.buf.hover, 'Hover Documentation') + + -- WARN: This is not Goto Definition, this is Goto Declaration. + -- For example, in C this would take you to the header. + map('gt', vim.lsp.buf.declaration, '[G]oto [T]ype Declaration') + end, + }) -- Telescope is a fuzzy finder that comes with a lot of different things that -- it can fuzzy find! It's more than just a "file finder", it can search -- many different aspects of Neovim, your workspace, LSP, and more! @@ -674,7 +727,7 @@ require('lazy').setup({ -- Disable "format_on_save lsp_fallback" for languages that don't -- have a well standardized coding style. You can add additional -- languages here or re-enable it for the disabled ones. - local disable_filetypes = { c = true, cpp = true } + local disable_filetypes = { c = true, cpp = true, md = true } if disable_filetypes[vim.bo[bufnr].filetype] then return nil else @@ -871,11 +924,12 @@ require('lazy').setup({ -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- -- require 'kickstart.plugins.debug', - -- require 'kickstart.plugins.indent_line', - -- require 'kickstart.plugins.lint', - -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + require 'kickstart.plugins.indent_line', + require 'kickstart.plugins.lint', + require 'kickstart.plugins.autopairs', + require 'kickstart.plugins.neo-tree', + require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + require 'custom.plugins.init', -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. diff --git a/lua/custom/plugins/catppuccin.lua b/lua/custom/plugins/catppuccin.lua new file mode 100644 index 00000000000..589901a7a65 --- /dev/null +++ b/lua/custom/plugins/catppuccin.lua @@ -0,0 +1,25 @@ +return { + 'catppuccin/nvim', + name = 'catppuccin', + priority = 1000, + config = function() + require('catppuccin').setup { + flavour = 'mocha', + integrations = { + telescope = true, + treesitter = true, + cmp = true, + gitsigns = true, + }, + custom_highlights = function(colors) + return { + LineNr = { fg = colors.mauve }, + CursorLineNr = { fg = colors.lavender, bold = true }, + Visual = { bg = colors.surface1 }, + TelescopeSelection = { bg = colors.surface1 }, + } + end, + } + vim.cmd.colorscheme 'catppuccin' + end, +} diff --git a/lua/custom/plugins/firenvim.lua b/lua/custom/plugins/firenvim.lua new file mode 100644 index 00000000000..78d03e49636 --- /dev/null +++ b/lua/custom/plugins/firenvim.lua @@ -0,0 +1 @@ +return { 'glacambre/firenvim', build = ':call firenvim#install(0)' } diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8d7a..dd954b49bdf 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,4 +2,37 @@ -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information -return {} + +vim.opt.number = true + +vim.opt.relativenumber = true +vim.opt.wrap = false + +vim.keymap.set('n', '', '15k', { desc = 'Scroll up and center' }) +vim.keymap.set('n', '', '15j', { desc = 'Scroll down and center' }) +vim.keymap.set('n', '', 'ggVGy', { desc = 'Copy file' }) +vim.keymap.set('n', 'e', ':Neotree', { noremap = true, silent = true }) +-- vim.keymap.set('n', 'e', ':Explore', { desc = 'Open explorer' }) + +return { + { + 'NeogitOrg/neogit', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-telescope/telescope.nvim', + 'sindrets/diffview.nvim', + 'ibhagwan/fzf-lua', + }, + config = function() + local neogit = require 'neogit' + vim.keymap.set('n', 'gg', neogit.open, { desc = 'Open Neogit' }) + neogit.setup {} + end, + }, + { + 'github/copilot.vim', + cmd = 'Copilot', -- Load Copilot only when the 'Copilot' command is invoked + event = 'InsertEnter', -- Load Copilot when entering insert mode + config = true, -- Automatically run the default setup + }, +} diff --git a/lua/custom/plugins/lualline.lua b/lua/custom/plugins/lualline.lua new file mode 100644 index 00000000000..8b7f1f5376d --- /dev/null +++ b/lua/custom/plugins/lualline.lua @@ -0,0 +1,12 @@ +return { + -- Set lualine as statusline + 'nvim-lualine/lualine.nvim', + -- See `:help lualine.txt` + opts = { + options = { + icons_enabled = false, + component_separators = '|', + section_separators = '', + }, + }, +} diff --git a/lua/custom/plugins/nvim-tree.lua b/lua/custom/plugins/nvim-tree.lua new file mode 100644 index 00000000000..2e719982431 --- /dev/null +++ b/lua/custom/plugins/nvim-tree.lua @@ -0,0 +1,9 @@ +return { + 'nvim-tree/nvim-tree.lua', + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + config = function() + require('nvim-tree').setup {} + end, +}