diff --git a/README.md b/README.md index ef119d21..ce72ebbf 100644 --- a/README.md +++ b/README.md @@ -11,37 +11,20 @@ A starting point for Neovim that is: This repo is meant to be used as by **YOU** to begin your Neovim journey; remove the things you don't use and add what you miss. -Kickstart.nvim targets *only* the latest ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. If you are experiencing issues, please make sure you have the latest versions. - Distribution Alternatives: - [LazyVim](https://www.lazyvim.org/): A delightful distribution maintained by @folke (the author of lazy.nvim, the package manager used here) ### Installation -* Backup your previous configuration (if any exists) +Kickstart.nvim targets *only* the latest ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. If you are experiencing issues, please make sure you have the latest versions. -### Archive Installation -* On the home/landing page for the project find the blue "<> CODE" button click it and select Local > Download ZIP. -* Extract the archive to: - `~/.config/nvim` (Linux) - `~/.config/nvim` (MacOS) - `%userprofile%\AppData\Local\nvim-data\` (Windows) -* Ensure your extraction method did not extract with a parent folder. For example in ~/.config/nvim you should have init.lua not another folder called kickstart.nvim. - -### GIT Clone Installation -* From a terminal cd/dir to: - `~/.config/nvim` (Linux) - `~/.config/nvim` (MacOS) - `%userprofile%\AppData\Local\nvim-data\` (Windows) - -* run: `git clone https://github.com/nvim-lua/kickstart.nvim.git ~/.config/nvim` OR: gh repo clone nvim-lua/kickstart.nvim -* Run neovim (from terminal or shortcut) and allow the kickstart process to download files and set up the basics. -* Once the setup is complete restart Neovim. -* **You're ready to go!** - -* (Recommended/Optional) Fork this repo (so that you have your own copy that you can modify). -* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `%userprofile%\AppData\Local\nvim-data\` (Windows) +* Backup your previous configuration +* (Recommended) Fork this repo (so that you have your own copy that you can modify). +* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `~/AppData/Local/nvim/` (Windows) * If you don't want to include it as a git repo, you can just clone it and then move the files to this location +* Start Neovim (`nvim`) and allow `lazy.nvim` to complete installation. +* Restart Neovim +* **You're ready to go!** Additional system requirements: - Make sure to review the readmes of the plugins if you are experiencing errors. In particular: @@ -98,7 +81,7 @@ return { } ``` -This will install the tree plugin and add the command `:Neotree` for you. You can explore the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) for more information. +This will install the tree plugin and add the command `:NeoTree` for you. You can explore the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) for more information. #### Example: Adding a file to change default options @@ -129,13 +112,13 @@ Each PR, especially those which increase the line count, should have a descripti * See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information * Are there any cool videos about this plugin? * Current iteration of kickstart (coming soon) - * Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s). Note the install via init.lua no longer works as specified. Please follow the install instructions in this file instead as they're up to date. + * Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s). ### Windows Installation Installation may require installing build tools, and updating the run command for `telescope-fzf-native` -See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) +See `telescope-fzf-native` documention for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) This requires: diff --git a/init.lua b/init.lua index 7fd9c54f..d665c935 100644 --- a/init.lua +++ b/init.lua @@ -79,7 +79,7 @@ require('lazy').setup({ 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs to stdpath for neovim - { 'williamboman/mason.nvim', config = true }, + 'williamboman/mason.nvim', 'williamboman/mason-lspconfig.nvim', -- Useful status updates for LSP @@ -93,7 +93,7 @@ require('lazy').setup({ { -- Autocompletion 'hrsh7th/nvim-cmp', - dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' }, + dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip', 'hrsh7th/cmp-nvim-lsp-signature-help' }, }, -- Useful plugin to show you pending keybinds. @@ -167,7 +167,9 @@ require('lazy').setup({ dependencies = { 'nvim-treesitter/nvim-treesitter-textobjects', }, - build = ":TSUpdate", + config = function() + pcall(require('nvim-treesitter.install').update { with_sync = true }) + end, }, -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart @@ -234,6 +236,11 @@ vim.o.termguicolors = true -- See `:help vim.keymap.set()` vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) +-- Maps for buffer movements +vim.keymap.set({ 'n', 'v', 'i' }, '', ':bp', { silent = true }) +vim.keymap.set({ 'n', 'v', 'i' }, '', ':bn', { silent = true }) +vim.keymap.set({ 'n', 'v', 'i' }, '', ':bd', { silent = true }) + -- Remap for dealing with word wrap vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) @@ -276,7 +283,6 @@ vim.keymap.set('n', '/', function() }) end, { desc = '[/] Fuzzily search in current buffer' }) -vim.keymap.set('n', 'gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) @@ -287,7 +293,7 @@ vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { de -- See `:help nvim-treesitter` require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' }, + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'help', 'vim' }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, @@ -406,12 +412,16 @@ end -- Add any additional override configuration in the following tables. They will be passed to -- the `settings` field of the server config. You must look up that documentation yourself. local servers = { - -- clangd = {}, - -- gopls = {}, + bashls = {}, + cssls = {}, + dockerls = {}, + html = {}, + jsonls = {}, + gopls = {}, + pylsp = {}, + ruff_lsp = {}, -- pyright = {}, - -- rust_analyzer = {}, - -- tsserver = {}, - + yamlls = {}, lua_ls = { Lua = { workspace = { checkThirdParty = false }, @@ -427,6 +437,9 @@ require('neodev').setup() local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) +-- Setup mason so it can manage external tooling +require('mason').setup() + -- Ensure the servers above are installed local mason_lspconfig = require 'mason-lspconfig' @@ -457,8 +470,6 @@ cmp.setup { end, }, mapping = cmp.mapping.preset.insert { - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.select_prev_item(), [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete {}, @@ -488,6 +499,7 @@ cmp.setup { sources = { { name = 'nvim_lsp' }, { name = 'luasnip' }, + { name = "nvim_lsp_signature_help" }, }, } diff --git a/lua/custom/plugins/autopairs.lua b/lua/custom/plugins/autopairs.lua new file mode 100644 index 00000000..4082bd88 --- /dev/null +++ b/lua/custom/plugins/autopairs.lua @@ -0,0 +1,6 @@ +return { + "windwp/nvim-autopairs", + config = function() + require("nvim-autopairs").setup {} + end, +} diff --git a/lua/custom/plugins/null-ls.lua b/lua/custom/plugins/null-ls.lua new file mode 100644 index 00000000..ea71af97 --- /dev/null +++ b/lua/custom/plugins/null-ls.lua @@ -0,0 +1,37 @@ +local M = { + "jose-elias-alvarez/null-ls.nvim", +} + +function M.setup(options) + local null_ls = require("null-ls") + null_ls.setup({ + debug = false, + sources = { + null_ls.builtins.code_actions.gitsigns, + null_ls.builtins.code_actions.gomodifytags, + null_ls.builtins.formatting.goimports, + null_ls.builtins.formatting.gofmt, + -- null_ls.builtins.diagnostics.cspell, + null_ls.builtins.formatting.prettier.with({ + extra_filetypes = { "toml" }, + extra_args = { "--no-semi" }, + }), + null_ls.builtins.formatting.black.with({ extra_args = { "--fast" } }), + null_ls.builtins.formatting.ruff, + null_ls.builtins.formatting.stylua.with({ + extra_args = { "--indent-type", "Spaces", "--indent-width", "2" }, + }), + }, + on_attach = options.on_attach, + root_dir = require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", ".git"), + }) +end + +function M.has_formatter(ft) + local sources = require("null-ls.sources") + local available = sources.get_available(ft, "NULL_LS_FORMATTING") + return #available > 0 +end + +return M + diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index deeda564..0b68c43b 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -9,6 +9,7 @@ return { -- NOTE: Yes, you can install new plugins here! 'mfussenegger/nvim-dap', + -- NOTE: And you can specify dependencies as well dependencies = { -- Creates a beautiful debugger UI @@ -21,6 +22,7 @@ return { -- Add your own debuggers here 'leoluz/nvim-dap-go', }, + config = function() local dap = require 'dap' local dapui = require 'dapui' @@ -30,10 +32,6 @@ return { -- reasonable debug configurations automatic_setup = true, - -- You can provide additional configuration to the handlers, - -- see mason-nvim-dap README for more information - handlers = {}, - -- You'll need to check that you have the required things installed -- online, please don't ask me how to install them :) ensure_installed = { @@ -42,6 +40,10 @@ return { }, } + -- You can provide additional configuration to the handlers, + -- see mason-nvim-dap README for more information + require('mason-nvim-dap').setup_handlers() + -- Basic debugging keymaps, feel free to change to your liking! vim.keymap.set('n', '', dap.continue) vim.keymap.set('n', '', dap.step_into) @@ -69,13 +71,10 @@ return { step_back = 'b', run_last = '▶▶', terminate = '⏹', - disconnect = "⏏", }, }, } - -- toggle to see last session result. Without this ,you can't see session output in case of unhandled exception. - vim.keymap.set("n", "", dapui.toggle) - + dap.listeners.after.event_initialized['dapui_config'] = dapui.open dap.listeners.before.event_terminated['dapui_config'] = dapui.close dap.listeners.before.event_exited['dapui_config'] = dapui.close