From 4c4096cf30acace7bf3cf5a0a4b6c5346a0d5a59 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Thu, 23 Jun 2022 23:35:53 -0400 Subject: [PATCH 001/137] init: kickstart.nvim --- .gitignore | 1 + .stylua.toml | 6 + Dockerfile | 34 +++++ LICENSE.md | 21 +++ README.md | 30 ++++ init.lua | 383 +++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 475 insertions(+) create mode 100644 .gitignore create mode 100644 .stylua.toml create mode 100644 Dockerfile create mode 100644 LICENSE.md create mode 100644 README.md create mode 100644 init.lua diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..6e92f57d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +tags diff --git a/.stylua.toml b/.stylua.toml new file mode 100644 index 00000000..5d12dbdf --- /dev/null +++ b/.stylua.toml @@ -0,0 +1,6 @@ +column_width = 160 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferSingle" +no_call_parentheses = true diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..5c303b48 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +# Build neovim separately in the first stage +FROM alpine:latest AS base + +RUN apk --no-cache add \ + autoconf \ + automake \ + build-base \ + cmake \ + ninja \ + coreutils \ + curl \ + gettext-tiny-dev \ + git \ + libtool \ + pkgconf \ + unzip + +# Build neovim (and use it as an example codebase +RUN git clone https://github.com/neovim/neovim.git + +ARG VERSION=master +RUN cd neovim && git checkout ${VERSION} && make CMAKE_BUILD_TYPE=RelWithDebInfo install + +# To support kickstart.nvim +RUN apk --no-cache add \ + fd \ + ctags \ + ripgrep \ + git + +# Copy the kickstart.nvim init.lua +COPY ./init.lua /root/.config/nvim/init.lua + +WORKDIR /neovim diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..6c88c9ab --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Michael Lingelbach + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..a9807ccb --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +### Introduction + +A starting point for neovim that is: + +* Small (~325 lines) +* Single-file +* Documented +* Modular + +Kickstart targets *only* the latest stable neovim release (0.7) and the nightly. + +This repo is meant to be used as a starting point for a user's own configuration; remove the things you don't use and add what you miss. This configuration serves as the reference configuration for the [lspconfig wiki](https://github.com/neovim/nvim-lspconfig/wiki). + +See the [wiki](https://github.com/nvim-lua/kickstart.nvim/wiki) for additional tips, tricks, and recommended plugins. + +### Installation +* Backup your previous configuration +* Copy and paste the kickstart.nvim `init.lua` into `$HOME/.config/nvim/init.lua` +* start neovim (`nvim`) and run `:PackerInstall`, ignore any error message about missing plugins, `:PackerInstall` will fix that shortly. +* restart neovim + +### Contribution + +Pull-requests are welcome. The goal of this repo is not to create a neovim configuration framework, but to offer a starting template that shows, by example, available features in neovim. Some things that will not be included: + +* Custom language server configuration (null-ls templates) +* Theming beyond a default colorscheme necessary for LSP highlight groups +* Lazy-loading. Kickstart.nvim should start within 40 ms on modern hardware. Please profile and contribute to upstream plugins to optimize startup time instead. + +Each PR, especially those which increase the line count, should have a description as to why the PR is necessary. diff --git a/init.lua b/init.lua new file mode 100644 index 00000000..98bd81d4 --- /dev/null +++ b/init.lua @@ -0,0 +1,383 @@ +-- Install packer +local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim' +local is_bootstrap = false +if vim.fn.empty(vim.fn.glob(install_path)) > 0 then + is_bootstrap = true + vim.fn.execute('!git clone https://github.com/wbthomason/packer.nvim ' .. install_path) + vim.cmd [[packadd packer.nvim]] +end + +-- stylua: ignore start +require('packer').startup(function(use) + use 'wbthomason/packer.nvim' -- Package manager + use 'tpope/vim-fugitive' -- Git commands in nvim + use 'tpope/vim-rhubarb' -- Fugitive-companion to interact with github + use { 'lewis6991/gitsigns.nvim', requires = { 'nvim-lua/plenary.nvim' } } -- Add git related info in the signs columns and popups + use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines + use 'nvim-treesitter/nvim-treesitter' -- Highlight, edit, and navigate code + use 'nvim-treesitter/nvim-treesitter-textobjects' -- Additional textobjects for treesitter + use 'neovim/nvim-lspconfig' -- Collection of configurations for built-in LSP client + use 'williamboman/nvim-lsp-installer' -- Automatically install language servers to stdpath + use { 'hrsh7th/nvim-cmp', requires = { 'hrsh7th/cmp-nvim-lsp' } } -- Autocompletion + use { 'L3MON4D3/LuaSnip', requires = { 'saadparwaiz1/cmp_luasnip' } } -- Snippet Engine and Snippet Expansion + use 'mjlbach/onedark.nvim' -- Theme inspired by Atom + use 'nvim-lualine/lualine.nvim' -- Fancier statusline + use 'lukas-reineke/indent-blankline.nvim' -- Add indentation guides even on blank lines + use 'tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically + use { 'nvim-telescope/telescope.nvim', requires = { 'nvim-lua/plenary.nvim' } } -- Fuzzy Finder (files, lsp, etc) + + -- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available + use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable "make" == 1 } + + if is_bootstrap then + require('packer').sync() + end +end) +-- stylua: ignore end + +-- When we are bootstrapping a configuration, it doesn't +-- make sense to execute the rest of the init.lua. +-- +-- You'll need to restart nvim, and then it will work. +if is_bootstrap then + print '==================================' + print ' Plugins are being installed' + print ' Wait until Packer completes,' + print ' then restart nvim' + print '==================================' + return +end + +-- Automatically source and re-compile packer whenever you save this init.lua +local packer_group = vim.api.nvim_create_augroup('Packer', { clear = true }) +vim.api.nvim_create_autocmd('BufWritePost', { + command = 'source | PackerCompile', + group = packer_group, + pattern = vim.fn.expand '$MYVIMRC', +}) + +-- [[ Setting options ]] +-- See `:help vim.o` + +-- Set highlight on search +vim.o.hlsearch = false + +-- Make line numbers default +vim.wo.number = true + +-- Enable mouse mode +vim.o.mouse = 'a' + +-- Enable break indent +vim.o.breakindent = true + +-- Save undo history +vim.o.undofile = true + +-- Case insensitive searching UNLESS /C or capital in search +vim.o.ignorecase = true +vim.o.smartcase = true + +-- Decrease update time +vim.o.updatetime = 250 +vim.wo.signcolumn = 'yes' + +-- Set colorscheme +vim.o.termguicolors = true +vim.cmd [[colorscheme onedark]] + +-- Set completeopt to have a better completion experience +vim.o.completeopt = 'menuone,noselect' + +-- [[ Basic Keymaps ]] +-- Set as the leader key +-- See `:help mapleader` +-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +-- Keymaps for better default experience +-- See `:help vim.keymap.set()` +vim.keymap.set({ 'n', 'v' }, '', '', { 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 }) + +-- [[ Highlight on yank ]] +-- See `:help vim.highlight.on_yank()` +local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) +vim.api.nvim_create_autocmd('TextYankPost', { + callback = function() + vim.highlight.on_yank() + end, + group = highlight_group, + pattern = '*', +}) + +-- Set lualine as statusline +-- See `:help lualine.txt` +require('lualine').setup { + options = { + icons_enabled = false, + theme = 'onedark', + component_separators = '|', + section_separators = '', + }, +} + +-- Enable Comment.nvim +require('Comment').setup() + +-- Enable `lukas-reineke/indent-blankline.nvim` +-- See `:help indent_blankline.txt` +require('indent_blankline').setup { + char = '┊', + show_trailing_blankline_indent = false, +} + +-- Gitsigns +-- See `:help gitsigns.txt` +require('gitsigns').setup { + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, +} + +-- [[ Configure Telescope ]] +-- See `:help telesceope` and `:help telescope.setup()` +require('telescope').setup { + defaults = { + mappings = { + i = { + [''] = false, + [''] = false, + }, + }, + }, +} + +-- Enable telescope fzf native, if installed +pcall(require('telescope').load_extension, 'fzf') + +-- See `:help telescope.builtin` +vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) +vim.keymap.set('n', '', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) +vim.keymap.set('n', '/', function() + -- You can pass additional configuration to telescope to change theme, layout, etc. + require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = false, + }) +end, { desc = '[/] Fuzzily search in current buffer]' }) + +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' }) +vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) +vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) + +-- [[ Configure Treesitter ]] +-- See `:help nvim-treesitter` +require('nvim-treesitter.configs').setup { + -- Add languages to be installed here that you want installed for treesitter + ensure_installed = { 'lua', 'typescript', 'rust', 'go', 'python' }, + + highlight = { enable = true }, + indent = { enable = true }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = '', + node_incremental = '', + -- TODO: I'm not sure for this one. + scope_incremental = '', + node_decremental = '', + }, + }, + textobjects = { + select = { + enable = true, + lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + }, + }, + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + [']m'] = '@function.outer', + [']]'] = '@class.outer', + }, + goto_next_end = { + [']M'] = '@function.outer', + [']['] = '@class.outer', + }, + goto_previous_start = { + ['[m'] = '@function.outer', + ['[['] = '@class.outer', + }, + goto_previous_end = { + ['[M'] = '@function.outer', + ['[]'] = '@class.outer', + }, + }, + swap = { + enable = true, + swap_next = { + ['a'] = '@parameter.inner', + }, + swap_previous = { + ['A'] = '@parameter.inner', + }, + }, + }, +} + +-- Diagnostic keymaps +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next) +vim.keymap.set('n', 'e', vim.diagnostic.open_float) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist) + +-- LSP settings. +-- This function gets run when an LSP connects to a particular buffer. +local on_attach = function(_, bufnr) + -- 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 + -- many times. + -- + -- 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 nmap = function(keys, func, desc) + if desc then + desc = 'LSP: ' .. desc + end + + vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) + end + + nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') + nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]tion') + + nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') + nmap('gi', vim.lsp.buf.implementation, '[G]oto [I]mplementation') + nmap('gr', require('telescope.builtin').lsp_references) + nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + + -- See `:help K` for why this keymap + nmap('K', vim.lsp.buf.hover, 'Hover Documentation') + nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') + + -- Lesser used LSP functionality + nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + nmap('D', vim.lsp.buf.type_definition, 'Type Definition') + nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') + nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') + nmap('wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, '[W]orkspace [L]ist Folders') + + -- Create a command `:Format` local to the LSP buffer + vim.api.nvim_buf_create_user_command(bufnr, 'Format', vim.lsp.buf.format or vim.lsp.buf.formatting, { desc = 'Format current buffer with LSP' }) +end + +-- nvim-cmp supports additional completion capabilities +local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) + +-- Enable the following language servers +local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua' } + +-- Ensure the servers above are installed +require('nvim-lsp-installer').setup { + ensure_installed = servers, +} + +for _, lsp in ipairs(servers) do + require('lspconfig')[lsp].setup { + on_attach = on_attach, + capabilities = capabilities, + } +end + +-- Example custom configuration for lua +-- +-- Make runtime files discoverable to the server +local runtime_path = vim.split(package.path, ';') +table.insert(runtime_path, 'lua/?.lua') +table.insert(runtime_path, 'lua/?/init.lua') + +require('lspconfig').sumneko_lua.setup { + on_attach = on_attach, + capabilities = capabilities, + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT) + version = 'LuaJIT', + -- Setup your lua path + path = runtime_path, + }, + diagnostics = { + globals = { 'vim' }, + }, + workspace = { library = vim.api.nvim_get_runtime_file('', true) }, + }, + }, +} + +-- nvim-cmp setup +local cmp = require 'cmp' +local luasnip = require 'luasnip' + +cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert { + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + }, + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + }, +} + +-- The line beneath this is called `modeline`. See `:help modeline` +-- vim: ts=2 sts=2 sw=2 et From 5788a41cb82e3598fccbe99f4661e8372ff59854 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Sat, 25 Jun 2022 21:51:44 -0400 Subject: [PATCH 002/137] license --- LICENSE.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 6c88c9ab..9cf10627 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,7 +1,5 @@ MIT License -Copyright (c) 2021 Michael Lingelbach - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights From fa3faeede208cf06007d3836a3c1381c620bb354 Mon Sep 17 00:00:00 2001 From: Ash Date: Fri, 24 Jun 2022 17:19:15 +0100 Subject: [PATCH 003/137] Fixed spelling error and missing marker --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 98bd81d4..cc3cd0fd 100644 --- a/init.lua +++ b/init.lua @@ -267,7 +267,7 @@ local on_attach = function(_, bufnr) end nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') - nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]tion') + nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') nmap('gi', vim.lsp.buf.implementation, '[G]oto [I]mplementation') @@ -281,7 +281,7 @@ local on_attach = function(_, bufnr) -- Lesser used LSP functionality nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - nmap('D', vim.lsp.buf.type_definition, 'Type Definition') + nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') nmap('wl', function() From d85fb8a998620c4a66f1fd7bf0b6e6f0f4fd9778 Mon Sep 17 00:00:00 2001 From: Peter Piekarczyk Date: Sat, 9 Jul 2022 00:13:53 -0500 Subject: [PATCH 004/137] Removes extra space between "- Annotation" -> "-Annotation" --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index cc3cd0fd..d15e4792 100644 --- a/init.lua +++ b/init.lua @@ -15,7 +15,7 @@ require('packer').startup(function(use) use { 'lewis6991/gitsigns.nvim', requires = { 'nvim-lua/plenary.nvim' } } -- Add git related info in the signs columns and popups use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines use 'nvim-treesitter/nvim-treesitter' -- Highlight, edit, and navigate code - use 'nvim-treesitter/nvim-treesitter-textobjects' -- Additional textobjects for treesitter + use 'nvim-treesitter/nvim-treesitter-textobjects' -- Additional textobjects for treesitter use 'neovim/nvim-lspconfig' -- Collection of configurations for built-in LSP client use 'williamboman/nvim-lsp-installer' -- Automatically install language servers to stdpath use { 'hrsh7th/nvim-cmp', requires = { 'hrsh7th/cmp-nvim-lsp' } } -- Autocompletion From aec3137ca3fc0c7566f9b9760b12f7b70a48a791 Mon Sep 17 00:00:00 2001 From: Stephen Lewis Date: Tue, 28 Jun 2022 20:45:51 +0000 Subject: [PATCH 005/137] Fix typo in help reference --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index d15e4792..65d76012 100644 --- a/init.lua +++ b/init.lua @@ -149,7 +149,7 @@ require('gitsigns').setup { } -- [[ Configure Telescope ]] --- See `:help telesceope` and `:help telescope.setup()` +-- See `:help telescope` and `:help telescope.setup()` require('telescope').setup { defaults = { mappings = { From 07ba51d789f1be14b104826ce1c0fbaca55e3338 Mon Sep 17 00:00:00 2001 From: skovati Date: Sat, 25 Jun 2022 15:43:06 -0700 Subject: [PATCH 006/137] Disable telemetry for sumneko lua lsp --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index 65d76012..20f35d73 100644 --- a/init.lua +++ b/init.lua @@ -332,6 +332,8 @@ require('lspconfig').sumneko_lua.setup { globals = { 'vim' }, }, workspace = { library = vim.api.nvim_get_runtime_file('', true) }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { enable = false, }, }, }, } From f2dedf6e3eafb8c702dc10c4c3418e2e2786a7c7 Mon Sep 17 00:00:00 2001 From: Heath Nail Date: Mon, 11 Jul 2022 10:40:22 -0400 Subject: [PATCH 007/137] Remove reference to wiki that doesn't exist Closes #3 --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index a9807ccb..c523139a 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,6 @@ Kickstart targets *only* the latest stable neovim release (0.7) and the nightly. This repo is meant to be used as a starting point for a user's own configuration; remove the things you don't use and add what you miss. This configuration serves as the reference configuration for the [lspconfig wiki](https://github.com/neovim/nvim-lspconfig/wiki). -See the [wiki](https://github.com/nvim-lua/kickstart.nvim/wiki) for additional tips, tricks, and recommended plugins. - ### Installation * Backup your previous configuration * Copy and paste the kickstart.nvim `init.lua` into `$HOME/.config/nvim/init.lua` From 32f090182a72aa7b6e2009b612f1f2b1aabbd8b5 Mon Sep 17 00:00:00 2001 From: Vzaa Date: Wed, 24 Aug 2022 11:17:50 +0300 Subject: [PATCH 008/137] Don't pass args to vim.lsp.buf.format/formatting Args passed by nvim_buf_create_user_command to the callback creates errors with rust-analyzer on nvim 0.7.x and vim.lsp.buf.formatting. --- init.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 20f35d73..47a0abc2 100644 --- a/init.lua +++ b/init.lua @@ -289,7 +289,13 @@ local on_attach = function(_, bufnr) end, '[W]orkspace [L]ist Folders') -- Create a command `:Format` local to the LSP buffer - vim.api.nvim_buf_create_user_command(bufnr, 'Format', vim.lsp.buf.format or vim.lsp.buf.formatting, { desc = 'Format current buffer with LSP' }) + vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) + if vim.lsp.buf.format then + vim.lsp.buf.format() + elseif vim.lsp.buf.formatting then + vim.lsp.buf.formatting() + end + end, { desc = 'Format current buffer with LSP' }) end -- nvim-cmp supports additional completion capabilities From 5a1a819d34364e9c6458c53191eeb8c3567437b7 Mon Sep 17 00:00:00 2001 From: Vzaa Date: Wed, 24 Aug 2022 11:48:08 +0300 Subject: [PATCH 009/137] Move Telescope from master to 0.1.x branch Follow Telescope's README suggestion and use 0.1.x branch instead of master --- init.lua | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/init.lua b/init.lua index 47a0abc2..2cbb4749 100644 --- a/init.lua +++ b/init.lua @@ -9,22 +9,24 @@ end -- stylua: ignore start require('packer').startup(function(use) - use 'wbthomason/packer.nvim' -- Package manager - use 'tpope/vim-fugitive' -- Git commands in nvim - use 'tpope/vim-rhubarb' -- Fugitive-companion to interact with github - use { 'lewis6991/gitsigns.nvim', requires = { 'nvim-lua/plenary.nvim' } } -- Add git related info in the signs columns and popups - use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines - use 'nvim-treesitter/nvim-treesitter' -- Highlight, edit, and navigate code - use 'nvim-treesitter/nvim-treesitter-textobjects' -- Additional textobjects for treesitter - use 'neovim/nvim-lspconfig' -- Collection of configurations for built-in LSP client - use 'williamboman/nvim-lsp-installer' -- Automatically install language servers to stdpath - use { 'hrsh7th/nvim-cmp', requires = { 'hrsh7th/cmp-nvim-lsp' } } -- Autocompletion - use { 'L3MON4D3/LuaSnip', requires = { 'saadparwaiz1/cmp_luasnip' } } -- Snippet Engine and Snippet Expansion - use 'mjlbach/onedark.nvim' -- Theme inspired by Atom - use 'nvim-lualine/lualine.nvim' -- Fancier statusline - use 'lukas-reineke/indent-blankline.nvim' -- Add indentation guides even on blank lines - use 'tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically - use { 'nvim-telescope/telescope.nvim', requires = { 'nvim-lua/plenary.nvim' } } -- Fuzzy Finder (files, lsp, etc) + use 'wbthomason/packer.nvim' -- Package manager + use 'tpope/vim-fugitive' -- Git commands in nvim + use 'tpope/vim-rhubarb' -- Fugitive-companion to interact with github + use { 'lewis6991/gitsigns.nvim', requires = { 'nvim-lua/plenary.nvim' } } -- Add git related info in the signs columns and popups + use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines + use 'nvim-treesitter/nvim-treesitter' -- Highlight, edit, and navigate code + use 'nvim-treesitter/nvim-treesitter-textobjects' -- Additional textobjects for treesitter + use 'neovim/nvim-lspconfig' -- Collection of configurations for built-in LSP client + use 'williamboman/nvim-lsp-installer' -- Automatically install language servers to stdpath + use { 'hrsh7th/nvim-cmp', requires = { 'hrsh7th/cmp-nvim-lsp' } } -- Autocompletion + use { 'L3MON4D3/LuaSnip', requires = { 'saadparwaiz1/cmp_luasnip' } } -- Snippet Engine and Snippet Expansion + use 'mjlbach/onedark.nvim' -- Theme inspired by Atom + use 'nvim-lualine/lualine.nvim' -- Fancier statusline + use 'lukas-reineke/indent-blankline.nvim' -- Add indentation guides even on blank lines + use 'tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically + + -- Fuzzy Finder (files, lsp, etc) + use { 'nvim-telescope/telescope.nvim', branch = '0.1.x', requires = { 'nvim-lua/plenary.nvim' } } -- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable "make" == 1 } From 510ca59a6c2307283ecf27699cc3a3cdadf50260 Mon Sep 17 00:00:00 2001 From: Ash Date: Thu, 1 Sep 2022 17:38:11 +0100 Subject: [PATCH 010/137] Added cpp to treesitter and ordered TS imports --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 2cbb4749..85aafad8 100644 --- a/init.lua +++ b/init.lua @@ -187,7 +187,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 = { 'lua', 'typescript', 'rust', 'go', 'python' }, + ensure_installed = {'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript'}, highlight = { enable = true }, indent = { enable = true }, From 34ed3f0d0c69fe21b8c618f2663353aaf2e42f1d Mon Sep 17 00:00:00 2001 From: Sebastian Olsen Date: Sun, 7 Aug 2022 12:56:33 +0200 Subject: [PATCH 011/137] Replace nvim-lsp-installer with mason.nvim --- init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 85aafad8..0cf3b453 100644 --- a/init.lua +++ b/init.lua @@ -17,7 +17,8 @@ require('packer').startup(function(use) use 'nvim-treesitter/nvim-treesitter' -- Highlight, edit, and navigate code use 'nvim-treesitter/nvim-treesitter-textobjects' -- Additional textobjects for treesitter use 'neovim/nvim-lspconfig' -- Collection of configurations for built-in LSP client - use 'williamboman/nvim-lsp-installer' -- Automatically install language servers to stdpath + use 'williamboman/mason.nvim' -- Manage external editor tooling i.e LSP servers + use 'williamboman/mason-lspconfig.nvim' -- Automatically install language servers to stdpath use { 'hrsh7th/nvim-cmp', requires = { 'hrsh7th/cmp-nvim-lsp' } } -- Autocompletion use { 'L3MON4D3/LuaSnip', requires = { 'saadparwaiz1/cmp_luasnip' } } -- Snippet Engine and Snippet Expansion use 'mjlbach/onedark.nvim' -- Theme inspired by Atom @@ -303,11 +304,14 @@ end -- nvim-cmp supports additional completion capabilities local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) +-- Setup mason so it can manage external tooling +require('mason').setup() + -- Enable the following language servers local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua' } -- Ensure the servers above are installed -require('nvim-lsp-installer').setup { +require('mason-lspconfig').setup { ensure_installed = servers, } From c8a140577832ed4f958f4964400b2591abea3825 Mon Sep 17 00:00:00 2001 From: Sebastian Olsen Date: Sat, 24 Sep 2022 13:22:45 +0200 Subject: [PATCH 012/137] fix nvim-treesitter-textobjects install warning --- init.lua | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/init.lua b/init.lua index 0cf3b453..856a4fbd 100644 --- a/init.lua +++ b/init.lua @@ -9,22 +9,22 @@ end -- stylua: ignore start require('packer').startup(function(use) - use 'wbthomason/packer.nvim' -- Package manager - use 'tpope/vim-fugitive' -- Git commands in nvim - use 'tpope/vim-rhubarb' -- Fugitive-companion to interact with github - use { 'lewis6991/gitsigns.nvim', requires = { 'nvim-lua/plenary.nvim' } } -- Add git related info in the signs columns and popups - use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines - use 'nvim-treesitter/nvim-treesitter' -- Highlight, edit, and navigate code - use 'nvim-treesitter/nvim-treesitter-textobjects' -- Additional textobjects for treesitter - use 'neovim/nvim-lspconfig' -- Collection of configurations for built-in LSP client - use 'williamboman/mason.nvim' -- Manage external editor tooling i.e LSP servers - use 'williamboman/mason-lspconfig.nvim' -- Automatically install language servers to stdpath - use { 'hrsh7th/nvim-cmp', requires = { 'hrsh7th/cmp-nvim-lsp' } } -- Autocompletion - use { 'L3MON4D3/LuaSnip', requires = { 'saadparwaiz1/cmp_luasnip' } } -- Snippet Engine and Snippet Expansion - use 'mjlbach/onedark.nvim' -- Theme inspired by Atom - use 'nvim-lualine/lualine.nvim' -- Fancier statusline - use 'lukas-reineke/indent-blankline.nvim' -- Add indentation guides even on blank lines - use 'tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically + use 'wbthomason/packer.nvim' -- Package manager + use 'tpope/vim-fugitive' -- Git commands in nvim + use 'tpope/vim-rhubarb' -- Fugitive-companion to interact with github + use { 'lewis6991/gitsigns.nvim', requires = { 'nvim-lua/plenary.nvim' } } -- Add git related info in the signs columns and popups + use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines + use 'nvim-treesitter/nvim-treesitter' -- Highlight, edit, and navigate code + use { 'nvim-treesitter/nvim-treesitter-textobjects', after = { 'nvim-treesitter' } } -- Additional textobjects for treesitter + use 'neovim/nvim-lspconfig' -- Collection of configurations for built-in LSP client + use 'williamboman/mason.nvim' -- Manage external editor tooling i.e LSP servers + use 'williamboman/mason-lspconfig.nvim' -- Automatically install language servers to stdpath + use { 'hrsh7th/nvim-cmp', requires = { 'hrsh7th/cmp-nvim-lsp' } } -- Autocompletion + use { 'L3MON4D3/LuaSnip', requires = { 'saadparwaiz1/cmp_luasnip' } } -- Snippet Engine and Snippet Expansion + use 'mjlbach/onedark.nvim' -- Theme inspired by Atom + use 'nvim-lualine/lualine.nvim' -- Fancier statusline + use 'lukas-reineke/indent-blankline.nvim' -- Add indentation guides even on blank lines + use 'tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically -- Fuzzy Finder (files, lsp, etc) use { 'nvim-telescope/telescope.nvim', branch = '0.1.x', requires = { 'nvim-lua/plenary.nvim' } } @@ -188,7 +188,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', 'typescript'}, + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript' }, highlight = { enable = true }, indent = { enable = true }, @@ -345,7 +345,7 @@ require('lspconfig').sumneko_lua.setup { }, workspace = { library = vim.api.nvim_get_runtime_file('', true) }, -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { enable = false, }, + telemetry = { enable = false }, }, }, } From ce463f704bd0c3499acf1f2db49ba2cace37be5a Mon Sep 17 00:00:00 2001 From: "C.D. MacEachern" Date: Wed, 9 Nov 2022 10:27:08 -0500 Subject: [PATCH 013/137] Update README.md Use links to tagged releases rather than hardcoding 0.x and having to change it every few months. Fix markdownlint errors and some spelling, like using the official 'Neovim', not 'neovim'. --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c523139a..61b559a1 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,26 @@ ### Introduction -A starting point for neovim that is: +A starting point for Neovim that is: * Small (~325 lines) * Single-file * Documented * Modular -Kickstart targets *only* the latest stable neovim release (0.7) and the nightly. +Kickstart.nvim targets *only* the Neovim releases tagged ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly). This repo is meant to be used as a starting point for a user's own configuration; remove the things you don't use and add what you miss. This configuration serves as the reference configuration for the [lspconfig wiki](https://github.com/neovim/nvim-lspconfig/wiki). ### Installation + * Backup your previous configuration * Copy and paste the kickstart.nvim `init.lua` into `$HOME/.config/nvim/init.lua` -* start neovim (`nvim`) and run `:PackerInstall`, ignore any error message about missing plugins, `:PackerInstall` will fix that shortly. -* restart neovim +* Start Neovim (`nvim`) and run `:PackerInstall` - ignore any error message about missing plugins, `:PackerInstall` will fix that shortly +* Restart Neovim ### Contribution -Pull-requests are welcome. The goal of this repo is not to create a neovim configuration framework, but to offer a starting template that shows, by example, available features in neovim. Some things that will not be included: +Pull-requests are welcome. The goal of this repo is not to create a Neovim configuration framework, but to offer a starting template that shows, by example, available features in Neovim. Some things that will not be included: * Custom language server configuration (null-ls templates) * Theming beyond a default colorscheme necessary for LSP highlight groups From 489b56d0c49050afeb3ed41f4d851eeac7919c3d Mon Sep 17 00:00:00 2001 From: Nikolas Bertrand Date: Thu, 17 Nov 2022 20:37:26 +0100 Subject: [PATCH 014/137] lsp.update_ is deprecated --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 856a4fbd..346427f5 100644 --- a/init.lua +++ b/init.lua @@ -302,7 +302,7 @@ local on_attach = function(_, bufnr) end -- nvim-cmp supports additional completion capabilities -local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) +local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) -- Setup mason so it can manage external tooling require('mason').setup() From 801ec6e108c001e6dbaf5dd059c2a0205b26b2d5 Mon Sep 17 00:00:00 2001 From: zirbest Date: Wed, 19 Oct 2022 19:42:21 +0100 Subject: [PATCH 015/137] fix: syntax highlights tree-sitter - `navarasu/onedark.nvim` support both API TS* and the new one @* - `mjlbach/onedark.nvim` is archived and not support new syntax --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 346427f5..9b085bff 100644 --- a/init.lua +++ b/init.lua @@ -21,7 +21,7 @@ require('packer').startup(function(use) use 'williamboman/mason-lspconfig.nvim' -- Automatically install language servers to stdpath use { 'hrsh7th/nvim-cmp', requires = { 'hrsh7th/cmp-nvim-lsp' } } -- Autocompletion use { 'L3MON4D3/LuaSnip', requires = { 'saadparwaiz1/cmp_luasnip' } } -- Snippet Engine and Snippet Expansion - use 'mjlbach/onedark.nvim' -- Theme inspired by Atom + use 'navarasu/onedark.nvim' -- Theme inspired by Atom use 'nvim-lualine/lualine.nvim' -- Fancier statusline use 'lukas-reineke/indent-blankline.nvim' -- Add indentation guides even on blank lines use 'tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically From e311d48c97f00d526b266c9d67c4a120eba622f7 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Fri, 18 Nov 2022 21:04:04 -0500 Subject: [PATCH 016/137] reformat to reduce merge conflicts and add fidget --- .gitignore | 1 + init.lua | 78 +++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 54 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index 6e92f57d..712f217f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ tags +test.sh diff --git a/init.lua b/init.lua index 9b085bff..5ed766c4 100644 --- a/init.lua +++ b/init.lua @@ -7,36 +7,60 @@ if vim.fn.empty(vim.fn.glob(install_path)) > 0 then vim.cmd [[packadd packer.nvim]] end --- stylua: ignore start require('packer').startup(function(use) - use 'wbthomason/packer.nvim' -- Package manager - use 'tpope/vim-fugitive' -- Git commands in nvim - use 'tpope/vim-rhubarb' -- Fugitive-companion to interact with github - use { 'lewis6991/gitsigns.nvim', requires = { 'nvim-lua/plenary.nvim' } } -- Add git related info in the signs columns and popups - use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines - use 'nvim-treesitter/nvim-treesitter' -- Highlight, edit, and navigate code - use { 'nvim-treesitter/nvim-treesitter-textobjects', after = { 'nvim-treesitter' } } -- Additional textobjects for treesitter - use 'neovim/nvim-lspconfig' -- Collection of configurations for built-in LSP client - use 'williamboman/mason.nvim' -- Manage external editor tooling i.e LSP servers - use 'williamboman/mason-lspconfig.nvim' -- Automatically install language servers to stdpath - use { 'hrsh7th/nvim-cmp', requires = { 'hrsh7th/cmp-nvim-lsp' } } -- Autocompletion - use { 'L3MON4D3/LuaSnip', requires = { 'saadparwaiz1/cmp_luasnip' } } -- Snippet Engine and Snippet Expansion - use 'navarasu/onedark.nvim' -- Theme inspired by Atom - use 'nvim-lualine/lualine.nvim' -- Fancier statusline - use 'lukas-reineke/indent-blankline.nvim' -- Add indentation guides even on blank lines - use 'tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically + -- Package manager + use 'wbthomason/packer.nvim' + + use { -- LSP Configuration & Plugins + 'neovim/nvim-lspconfig', + requires = { + -- Automatically install LSPs to stdpath for neovim + 'williamboman/mason.nvim', + 'williamboman/mason-lspconfig.nvim', + + -- Useful status updates for LSP + 'j-hui/fidget.nvim', + }, + } + + use { -- Autocompletion + 'hrsh7th/nvim-cmp', + requires = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' }, + } + + use { -- Highlight, edit, and navigate code + 'nvim-treesitter/nvim-treesitter', + run = function() + pcall(require('nvim-treesitter.install').update { with_sync = true }) + end, + } + + use { -- Additional text objects via treesitter + 'nvim-treesitter/nvim-treesitter-textobjects', + after = 'nvim-treesitter', + } + + -- Git related plugins + use 'tpope/vim-fugitive' + use 'tpope/vim-rhubarb' + use 'lewis6991/gitsigns.nvim' + + use 'navarasu/onedark.nvim' -- Theme inspired by Atom + use 'nvim-lualine/lualine.nvim' -- Fancier statusline + use 'lukas-reineke/indent-blankline.nvim' -- Add indentation guides even on blank lines + use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines + use 'tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically -- Fuzzy Finder (files, lsp, etc) use { 'nvim-telescope/telescope.nvim', branch = '0.1.x', requires = { 'nvim-lua/plenary.nvim' } } -- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available - use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable "make" == 1 } + use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable 'make' == 1 } if is_bootstrap then require('packer').sync() end end) --- stylua: ignore end -- When we are bootstrapping a configuration, it doesn't -- make sense to execute the rest of the init.lua. @@ -197,7 +221,6 @@ require('nvim-treesitter.configs').setup { keymaps = { init_selection = '', node_incremental = '', - -- TODO: I'm not sure for this one. scope_incremental = '', node_decremental = '', }, @@ -274,7 +297,7 @@ local on_attach = function(_, bufnr) nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') nmap('gi', vim.lsp.buf.implementation, '[G]oto [I]mplementation') - nmap('gr', require('telescope.builtin').lsp_references) + nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') @@ -301,20 +324,22 @@ local on_attach = function(_, bufnr) end, { desc = 'Format current buffer with LSP' }) end --- nvim-cmp supports additional completion capabilities -local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) - -- Setup mason so it can manage external tooling require('mason').setup() -- Enable the following language servers -local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua' } +-- Feel free to add/remove any LSPs that you want here. They will automatically be installed +local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua', 'gopls' } -- Ensure the servers above are installed require('mason-lspconfig').setup { ensure_installed = servers, } +-- nvim-cmp supports additional completion capabilities +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) + for _, lsp in ipairs(servers) do require('lspconfig')[lsp].setup { on_attach = on_attach, @@ -322,6 +347,9 @@ for _, lsp in ipairs(servers) do } end +-- Turn on status information +require('fidget').setup() + -- Example custom configuration for lua -- -- Make runtime files discoverable to the server From e80aa6667166334119d567567e7d1e1eed3ae2fb Mon Sep 17 00:00:00 2001 From: Elijah Manor Date: Mon, 21 Nov 2022 06:47:24 -0600 Subject: [PATCH 017/137] Add optional packer plugins hook (#20) * Add optional packer plugins hook * Provide help in README and simplify module * Fix spelling and tweak verbiage about after/plugin --- README.md | 31 +++++++++++++++++++++++++++++++ init.lua | 4 ++++ 2 files changed, 35 insertions(+) diff --git a/README.md b/README.md index 61b559a1..e5f80752 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,37 @@ This repo is meant to be used as a starting point for a user's own configuration * Start Neovim (`nvim`) and run `:PackerInstall` - ignore any error message about missing plugins, `:PackerInstall` will fix that shortly * Restart Neovim +### Configuration + +You could directly modify the `init.lua` file with your personal customizations. This option is the most straightforward, but if you update your config from this repo, you may need to reapply your changes. + +An alternative approach is to create a separate `custom.plugins` module to register your own plugins. In addition, you can handle further customizations in the `/after/plugin/` directory (see `:help load-plugins`). See the following examples for more information. Leveraging this technique should make upgrading to a newer version of this repo easier. + +#### Example `plugins.lua` + +The following is an example of a `plugins.lua` module (located at `$HOME/.config/nvim/lua/custom/plugins.lua`) where you can register your own plugins. + +```lua +return function(use) + use({ + "folke/which-key.nvim", + config = function() + require("which-key").setup({}) + end + }) +end +``` + +#### Example `defaults.lua` + +For further customizations, you can add a file in the `/after/plugin/` folder (see `:help load-plugins`) to include your own options, keymaps, autogroups, and more. The following is an example `defaults.lua` file (located at `$HOME/.config/nvim/after/plugin/defaults.lua`). + +```lua +vim.opt.relativenumber = true + +vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) +``` + ### Contribution Pull-requests are welcome. The goal of this repo is not to create a Neovim configuration framework, but to offer a starting template that shows, by example, available features in Neovim. Some things that will not be included: diff --git a/init.lua b/init.lua index 5ed766c4..88c3857b 100644 --- a/init.lua +++ b/init.lua @@ -57,6 +57,10 @@ require('packer').startup(function(use) -- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable 'make' == 1 } + -- Add custom plugins to packer from /nvim/lua/custom/plugins.lua + local has_plugins, plugins = pcall(require, "custom.plugins") + if has_plugins then plugins(use) end + if is_bootstrap then require('packer').sync() end From 6afec7b35de1ce5bf9a7a117ac2dd89771b4f363 Mon Sep 17 00:00:00 2001 From: Fabio <81859+fgrehm@users.noreply.github.com> Date: Fri, 25 Nov 2022 15:16:27 -0300 Subject: [PATCH 018/137] Update the amount of SLOC in README (#35) Looks like the project has grown a tad bit :sweat --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e5f80752..e3a1b879 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A starting point for Neovim that is: -* Small (~325 lines) +* Small (~370 lines) * Single-file * Documented * Modular From edad895bf43a737284f97503aa9fcf5f4188317f Mon Sep 17 00:00:00 2001 From: Carlo Teubner <435950+c4rlo@users.noreply.github.com> Date: Fri, 25 Nov 2022 18:18:01 +0000 Subject: [PATCH 019/137] Enable parameter text objects (#36) This seems like a natural addition. In classic Vim, I used to use https://github.com/b4winckler/vim-angry for this. --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index 88c3857b..6800ace3 100644 --- a/init.lua +++ b/init.lua @@ -235,6 +235,8 @@ require('nvim-treesitter.configs').setup { lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim keymaps = { -- You can use the capture groups defined in textobjects.scm + ['aa'] = '@parameter.outer', + ['ia'] = '@parameter.inner', ['af'] = '@function.outer', ['if'] = '@function.inner', ['ac'] = '@class.outer', From d5bbf7cef2ad43a9f279399ec508777141e568c4 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Fri, 25 Nov 2022 13:23:30 -0500 Subject: [PATCH 020/137] add more explicit note about latest versions of nvim --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e3a1b879..931348dd 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ A starting point for Neovim that is: * Documented * Modular -Kickstart.nvim targets *only* the Neovim releases tagged ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly). +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. This repo is meant to be used as a starting point for a user's own configuration; remove the things you don't use and add what you miss. This configuration serves as the reference configuration for the [lspconfig wiki](https://github.com/neovim/nvim-lspconfig/wiki). From ad0fa7daf009f10e23964c25fdffc8245a75ed9d Mon Sep 17 00:00:00 2001 From: Maximiliano Greco Date: Wed, 7 Dec 2022 03:11:15 +0100 Subject: [PATCH 021/137] enh(treesitter): add help into ensure_installed (#39) closes https://github.com/nvim-lua/kickstart.nvim/issues/38 --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 6800ace3..651a2126 100644 --- a/init.lua +++ b/init.lua @@ -216,7 +216,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', 'typescript' }, + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript', 'help' }, highlight = { enable = true }, indent = { enable = true }, From e3b768619c912ea8f22a054a5ebba8c0bb664b06 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Tue, 6 Dec 2022 21:18:43 -0500 Subject: [PATCH 022/137] fixup: add gitignore and style --- .gitignore | 2 ++ init.lua | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 712f217f..d699e1d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ tags test.sh +.luarc.json +nvim diff --git a/init.lua b/init.lua index 651a2126..b9c89ad3 100644 --- a/init.lua +++ b/init.lua @@ -58,8 +58,10 @@ require('packer').startup(function(use) use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable 'make' == 1 } -- Add custom plugins to packer from /nvim/lua/custom/plugins.lua - local has_plugins, plugins = pcall(require, "custom.plugins") - if has_plugins then plugins(use) end + local has_plugins, plugins = pcall(require, 'custom.plugins') + if has_plugins then + plugins(use) + end if is_bootstrap then require('packer').sync() From 760823f1e3cda01d9b8a7c52c7a7e2db63285d5b Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Tue, 13 Dec 2022 11:21:34 -0500 Subject: [PATCH 023/137] small changes to default mappings (#41) --- init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index b9c89ad3..d35ebf7c 100644 --- a/init.lua +++ b/init.lua @@ -304,8 +304,9 @@ local on_attach = function(_, bufnr) nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') - nmap('gi', vim.lsp.buf.implementation, '[G]oto [I]mplementation') nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation') + nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') @@ -315,7 +316,6 @@ local on_attach = function(_, bufnr) -- Lesser used LSP functionality nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') nmap('wl', function() @@ -355,7 +355,7 @@ for _, lsp in ipairs(servers) do } end --- Turn on status information +-- Turn on lsp status information require('fidget').setup() -- Example custom configuration for lua From c73aefcb210125677aea9e62366c24beb0211b79 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Sat, 17 Dec 2022 21:40:20 -0500 Subject: [PATCH 024/137] Closes #46 --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index d35ebf7c..52a0b98c 100644 --- a/init.lua +++ b/init.lua @@ -57,7 +57,7 @@ require('packer').startup(function(use) -- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable 'make' == 1 } - -- Add custom plugins to packer from /nvim/lua/custom/plugins.lua + -- Add custom plugins to packer from ~/.config/nvim/lua/custom/plugins.lua local has_plugins, plugins = pcall(require, 'custom.plugins') if has_plugins then plugins(use) From f218bcd6fe9c1e4aeb209dd4035a4d9341aac161 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Mon, 19 Dec 2022 17:56:21 -0500 Subject: [PATCH 025/137] note: tell people to remove languages they arent going to use --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 931348dd..c7e8b2cb 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ This repo is meant to be used as a starting point for a user's own configuration * Start Neovim (`nvim`) and run `:PackerInstall` - ignore any error message about missing plugins, `:PackerInstall` will fix that shortly * Restart Neovim +If there are languages that you don't want to use, remove their configuration and notes from your `init.lua` after copy and pasting (for example, in the mason configuration). + ### Configuration You could directly modify the `init.lua` file with your personal customizations. This option is the most straightforward, but if you update your config from this repo, you may need to reapply your changes. From 99df0d8f66ac499e949109883792ddb22ddba025 Mon Sep 17 00:00:00 2001 From: Debashis Biswas <37234687+debashisbiswas@users.noreply.github.com> Date: Mon, 19 Dec 2022 15:57:28 -0700 Subject: [PATCH 026/137] Fix error on Windows when space in install path (#64) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 52a0b98c..961eb784 100644 --- a/init.lua +++ b/init.lua @@ -3,7 +3,7 @@ local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nv local is_bootstrap = false if vim.fn.empty(vim.fn.glob(install_path)) > 0 then is_bootstrap = true - vim.fn.execute('!git clone https://github.com/wbthomason/packer.nvim ' .. install_path) + vim.fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) vim.cmd [[packadd packer.nvim]] end From d37a3a946288c97e52e3d82e8a710c099eb6bd90 Mon Sep 17 00:00:00 2001 From: Nicolas Gryman Date: Tue, 20 Dec 2022 00:01:33 +0100 Subject: [PATCH 027/137] fix: don't check third party for Lua LSP (#57) * fix: don't check third party for Lua LSP Co-authored-by: Sean <44933921+seantwie03@users.noreply.github.com> Co-authored-by: TJ DeVries Co-authored-by: Sean <44933921+seantwie03@users.noreply.github.com> --- init.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 961eb784..167114ca 100644 --- a/init.lua +++ b/init.lua @@ -379,7 +379,10 @@ require('lspconfig').sumneko_lua.setup { diagnostics = { globals = { 'vim' }, }, - workspace = { library = vim.api.nvim_get_runtime_file('', true) }, + workspace = { + library = vim.api.nvim_get_runtime_file('', true), + checkThirdParty = false, + }, -- Do not send telemetry data containing a randomized but unique identifier telemetry = { enable = false }, }, From 6dccf03fd23e708549139204bfe3cbfc5bf0ea7d Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Mon, 19 Dec 2022 21:29:52 -0500 Subject: [PATCH 028/137] Update issue templates (#72) --- .github/ISSUE_TEMPLATE/bug_report.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..6999d51e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,26 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. ... + +**Desktop (please complete the following information):** +- OS: +- Terminal: + +** Neovim Version ** + - Output of running `:version` from inside of neovim: + +``` +``` From bec74101277a56b2b890f0020c29037fd7d045a7 Mon Sep 17 00:00:00 2001 From: Matthias Debernardini <32387851+matthiasdebernardini@users.noreply.github.com> Date: Tue, 20 Dec 2022 19:27:01 +0100 Subject: [PATCH 029/137] Update intstructions for existing nvim setups (#65) * Update intstructions for existing nvim setups If you already had a nvim setup, then this makes it so that the kickstarter can work without a problem. Having that file exist and loaded with plugins gives the script many issues. Also better to have it be a shell command rather than have the script delete a bunch of files on your computer. --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index c7e8b2cb..f7a6b764 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ This repo is meant to be used as a starting point for a user's own configuration * Start Neovim (`nvim`) and run `:PackerInstall` - ignore any error message about missing plugins, `:PackerInstall` will fix that shortly * Restart Neovim + If there are languages that you don't want to use, remove their configuration and notes from your `init.lua` after copy and pasting (for example, in the mason configuration). ### Configuration @@ -60,3 +61,9 @@ Pull-requests are welcome. The goal of this repo is not to create a Neovim confi * Lazy-loading. Kickstart.nvim should start within 40 ms on modern hardware. Please profile and contribute to upstream plugins to optimize startup time instead. Each PR, especially those which increase the line count, should have a description as to why the PR is necessary. + +### FAQ + + * What should I do if I already have a pre-existing neovim configuration? + * You should back it up, then delete all files associated with it. This includes your existing init.lua and the neovim files in .local which can be deleted with `rm -rf ~/.local/share/nvim/` + From aa660e64cea945e7ee4b0ede2475e1ac49e1f592 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Tue, 20 Dec 2022 16:03:05 -0500 Subject: [PATCH 030/137] remove python indent: closes #78 --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 167114ca..fb7c0972 100644 --- a/init.lua +++ b/init.lua @@ -3,7 +3,7 @@ local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nv local is_bootstrap = false if vim.fn.empty(vim.fn.glob(install_path)) > 0 then is_bootstrap = true - vim.fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) + vim.fn.system { 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path } vim.cmd [[packadd packer.nvim]] end @@ -221,7 +221,7 @@ require('nvim-treesitter.configs').setup { ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript', 'help' }, highlight = { enable = true }, - indent = { enable = true }, + indent = { enable = true, disable = { 'python' } }, incremental_selection = { enable = true, keymaps = { From 521940693e10eee57f4e67dce960d2229c1441d3 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Tue, 20 Dec 2022 22:12:39 -0500 Subject: [PATCH 031/137] move server config to easy to extend style (#71) Move servers to new configuration style. I will probably cover this in a new shorter video, or maybe in combination with something else. This should hopefully remove getting so many people making issues about LSPs that they don't want to. I can update documentation if what is happening is not clear. --- .gitignore | 1 + README.md | 5 +-- init.lua | 98 +++++++++++++++++++++++++----------------------------- 3 files changed, 49 insertions(+), 55 deletions(-) diff --git a/.gitignore b/.gitignore index d699e1d6..1b83131b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ tags test.sh .luarc.json nvim +plugin/packer_compiled.lua diff --git a/README.md b/README.md index f7a6b764..b4240858 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ A starting point for Neovim that is: 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. -This repo is meant to be used as a starting point for a user's own configuration; remove the things you don't use and add what you miss. This configuration serves as the reference configuration for the [lspconfig wiki](https://github.com/neovim/nvim-lspconfig/wiki). +This repo is meant to be used as a starting point for a user's own configuration; remove the things you don't use and add what you miss. Please refrain from leaving comments about enabling / disabling particular languages out of the box. ### Installation @@ -65,5 +65,6 @@ Each PR, especially those which increase the line count, should have a descripti ### FAQ * What should I do if I already have a pre-existing neovim configuration? - * You should back it up, then delete all files associated with it. This includes your existing init.lua and the neovim files in .local which can be deleted with `rm -rf ~/.local/share/nvim/` + * You should back it up, then delete all files associated with it. + * This includes your existing init.lua and the neovim files in `.local` which can be deleted with `rm -rf ~/.local/share/nvim/` diff --git a/init.lua b/init.lua index fb7c0972..636d86af 100644 --- a/init.lua +++ b/init.lua @@ -20,6 +20,9 @@ require('packer').startup(function(use) -- Useful status updates for LSP 'j-hui/fidget.nvim', + + -- Additional lua configuration, makes nvim stuff amazing + 'folke/neodev.nvim', }, } @@ -324,71 +327,60 @@ local on_attach = function(_, bufnr) -- Create a command `:Format` local to the LSP buffer vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) - if vim.lsp.buf.format then - vim.lsp.buf.format() - elseif vim.lsp.buf.formatting then - vim.lsp.buf.formatting() - end + vim.lsp.buf.format() end, { desc = 'Format current buffer with LSP' }) end --- Setup mason so it can manage external tooling -require('mason').setup() - -- Enable the following language servers --- Feel free to add/remove any LSPs that you want here. They will automatically be installed -local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua', 'gopls' } - --- Ensure the servers above are installed -require('mason-lspconfig').setup { - ensure_installed = servers, -} - --- nvim-cmp supports additional completion capabilities -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) - -for _, lsp in ipairs(servers) do - require('lspconfig')[lsp].setup { - on_attach = on_attach, - capabilities = capabilities, - } -end - --- Turn on lsp status information -require('fidget').setup() - --- Example custom configuration for lua +-- Feel free to add/remove any LSPs that you want here. They will automatically be installed. -- --- Make runtime files discoverable to the server -local runtime_path = vim.split(package.path, ';') -table.insert(runtime_path, 'lua/?.lua') -table.insert(runtime_path, 'lua/?/init.lua') +-- 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 = {}, + -- pyright = {}, + -- rust_analyzer = {}, + -- tsserver = {}, -require('lspconfig').sumneko_lua.setup { - on_attach = on_attach, - capabilities = capabilities, - settings = { + sumneko_lua = { Lua = { - runtime = { - -- Tell the language server which version of Lua you're using (most likely LuaJIT) - version = 'LuaJIT', - -- Setup your lua path - path = runtime_path, - }, - diagnostics = { - globals = { 'vim' }, - }, - workspace = { - library = vim.api.nvim_get_runtime_file('', true), - checkThirdParty = false, - }, - -- Do not send telemetry data containing a randomized but unique identifier + workspace = { checkThirdParty = false }, telemetry = { enable = false }, }, }, } +-- Setup neovim lua configuration +require('neodev').setup() +-- +-- nvim-cmp supports additional completion capabilities, so broadcast that to servers +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' + +mason_lspconfig.setup { + ensure_installed = vim.tbl_keys(servers), +} + +mason_lspconfig.setup_handlers { + function(server_name) + require('lspconfig')[server_name].setup { + capabilities = capabilities, + on_attach = on_attach, + settings = servers[server_name], + } + end, +} + +-- Turn on lsp status information +require('fidget').setup() + -- nvim-cmp setup local cmp = require 'cmp' local luasnip = require 'luasnip' From 39a941c3851fbadf08731601b9958785e50bee73 Mon Sep 17 00:00:00 2001 From: kazenix Date: Thu, 22 Dec 2022 04:45:20 -0800 Subject: [PATCH 032/137] Adding cmake documentation to README.md (#85) --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index b4240858..e29f426a 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,20 @@ This repo is meant to be used as a starting point for a user's own configuration If there are languages that you don't want to use, remove their configuration and notes from your `init.lua` after copy and pasting (for example, in the mason configuration). +### Windows Installation + +Installation may require installing build tools, and updating the run command for `telescope-fzf-native` + +See `telescope-fzf-native` documention for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) + +This requires: + +- Install CMake, and the Microsoft C++ Build Tools on Windows + +```lua +use {'nvim-telescope/telescope-fzf-native.nvim', run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } +``` + ### Configuration You could directly modify the `init.lua` file with your personal customizations. This option is the most straightforward, but if you update your config from this repo, you may need to reapply your changes. From c4d7212de3d309a20435333f42a0473cee81e29a Mon Sep 17 00:00:00 2001 From: amalgame21 <93383215+amalgame21@users.noreply.github.com> Date: Wed, 28 Dec 2022 06:33:44 +0000 Subject: [PATCH 033/137] Prevent multiple language servers from being spawned after every file save of init.lua (#96) * Prevent multiple language servers from being spawned Prevent multiple language servers from being spawned after every save of init.lua, which eventually leads to high RAM usage and system freeze. * Supress error messages add `silent!` in case of error message when nvim-lspconfig is not installed --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 636d86af..c8f18d59 100644 --- a/init.lua +++ b/init.lua @@ -87,7 +87,7 @@ end -- Automatically source and re-compile packer whenever you save this init.lua local packer_group = vim.api.nvim_create_augroup('Packer', { clear = true }) vim.api.nvim_create_autocmd('BufWritePost', { - command = 'source | PackerCompile', + command = 'source | silent! LspStop | silent! LspStart | PackerCompile', group = packer_group, pattern = vim.fn.expand '$MYVIMRC', }) From 4916072854d01d0503821b7f3061daeb381f0441 Mon Sep 17 00:00:00 2001 From: willsmanic <57890520+nesper8@users.noreply.github.com> Date: Mon, 2 Jan 2023 07:48:13 +0530 Subject: [PATCH 034/137] added vim to tree-sitter's ensured installed list (#110) please refer to https://github.com/nvim-treesitter/nvim-treesitter/issues/3092 --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index c8f18d59..ac291dad 100644 --- a/init.lua +++ b/init.lua @@ -221,7 +221,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', 'typescript', 'help' }, + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript', 'help', 'vim' }, highlight = { enable = true }, indent = { enable = true, disable = { 'python' } }, From 32744c3f66ac9e66e4ac5cc9d181db50254c44b3 Mon Sep 17 00:00:00 2001 From: Sean <44933921+seantwie03@users.noreply.github.com> Date: Wed, 11 Jan 2023 15:49:00 -0600 Subject: [PATCH 035/137] Add windows init lua location (#121) * feat: add init.lua location fir Windows * feat: more specific number of lines --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e29f426a..4cc00b1b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A starting point for Neovim that is: -* Small (~370 lines) +* Small (<500 lines) * Single-file * Documented * Modular @@ -14,7 +14,7 @@ This repo is meant to be used as a starting point for a user's own configuration ### Installation * Backup your previous configuration -* Copy and paste the kickstart.nvim `init.lua` into `$HOME/.config/nvim/init.lua` +* Copy and paste the kickstart.nvim `init.lua` into `$HOME/.config/nvim/init.lua` (Linux) or `~/AppData/Local/nvim/init.lua` (Windows) * Start Neovim (`nvim`) and run `:PackerInstall` - ignore any error message about missing plugins, `:PackerInstall` will fix that shortly * Restart Neovim From 3526fbeec9299dad5f7b14894765c34c83cf8324 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Fri, 17 Feb 2023 16:31:57 -0500 Subject: [PATCH 036/137] feat: move to lazy.nvim package manager and add first plugins (#178) Closes #175 Closes #177 Closes #173 Closes #169 Closes #161 Closes #144 Closes #138 Fixes #136 Closes #137 Closes #131 Closes #117 Closes #130 Closes #115 Closes #86 Closes #105 Closes #70 Fixes #176 Fixes #174 Fixes #160 Fixes #158 --- .gitignore | 2 +- Dockerfile | 34 --- README.md | 154 +++++++++----- doc/kickstart.txt | 24 +++ doc/tags | 3 + init.lua | 304 ++++++++++++++++----------- lua/custom/plugins/init.lua | 5 + lua/kickstart/plugins/autoformat.lua | 74 +++++++ lua/kickstart/plugins/debug.lua | 85 ++++++++ 9 files changed, 476 insertions(+), 209 deletions(-) delete mode 100644 Dockerfile create mode 100644 doc/kickstart.txt create mode 100644 doc/tags create mode 100644 lua/custom/plugins/init.lua create mode 100644 lua/kickstart/plugins/autoformat.lua create mode 100644 lua/kickstart/plugins/debug.lua diff --git a/.gitignore b/.gitignore index 1b83131b..ea93edad 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ tags test.sh .luarc.json nvim -plugin/packer_compiled.lua +lazy-lock.json diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 5c303b48..00000000 --- a/Dockerfile +++ /dev/null @@ -1,34 +0,0 @@ -# Build neovim separately in the first stage -FROM alpine:latest AS base - -RUN apk --no-cache add \ - autoconf \ - automake \ - build-base \ - cmake \ - ninja \ - coreutils \ - curl \ - gettext-tiny-dev \ - git \ - libtool \ - pkgconf \ - unzip - -# Build neovim (and use it as an example codebase -RUN git clone https://github.com/neovim/neovim.git - -ARG VERSION=master -RUN cd neovim && git checkout ${VERSION} && make CMAKE_BUILD_TYPE=RelWithDebInfo install - -# To support kickstart.nvim -RUN apk --no-cache add \ - fd \ - ctags \ - ripgrep \ - git - -# Copy the kickstart.nvim init.lua -COPY ./init.lua /root/.config/nvim/init.lua - -WORKDIR /neovim diff --git a/README.md b/README.md index 4cc00b1b..32f58dfb 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,118 @@ +# kickstart.nvim + ### Introduction A starting point for Neovim that is: -* Small (<500 lines) -* Single-file +* Small +* Single-file (with examples of moving to multi-file) * Documented * Modular -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. +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. -This repo is meant to be used as a starting point for a user's own configuration; remove the things you don't use and add what you miss. Please refrain from leaving comments about enabling / disabling particular languages out of the box. +Distribution Alternatives: +- [LazyVim](https://www.lazyvim.org/): A delightful distribution maintained by @folke (the author of lazy.nvim, the package manager used here) ### Installation +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. + * Backup your previous configuration -* Copy and paste the kickstart.nvim `init.lua` into `$HOME/.config/nvim/init.lua` (Linux) or `~/AppData/Local/nvim/init.lua` (Windows) -* Start Neovim (`nvim`) and run `:PackerInstall` - ignore any error message about missing plugins, `:PackerInstall` will fix that shortly +* (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: + - [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers. +- See as well [Windows Installation](#Windows-Installation) + +### Configuration And Extension + +* Inside of your fork, feel free to modify any file you like! It's your fork! +* Then there are two primary configuration options available: + * Include the `lua/kickstart/plugins/*` files in your configuration. + * Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` + * NOTE: To enable this, you need to uncomment `{ import = 'custom.plugins' }` in your `init.lua` + +You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration + +#### Example: Adding an autopairs plugin + +In the file: `lua/custom/plugins/autopairs.lua`, add: + +```lua +-- File: lua/custom/plugins/autopairs.lua + +return { + "windwp/nvim-autopairs", + config = function() + require("nvim-autopairs").setup {} + end, +} +``` -If there are languages that you don't want to use, remove their configuration and notes from your `init.lua` after copy and pasting (for example, in the mason configuration). +This will automatically install `nvim-autopairs` and enable it on startup. For more information, see documentation for [lazy.nvim](https://github.com/folke/lazy.nvim). + +#### Example: Adding a file tree plugin + +In the file: `lua/custom/plugins/filetree.lua`, add: + +```lua +return { + "nvim-neo-tree/neo-tree.nvim", + version = "*", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + }, + config = function () + -- Unless you are still migrating, remove the deprecated commands from v1.x + vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) + + require('neo-tree').setup {} + end, +} +``` + +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 + +To change default options, you can add a file in the `/after/plugin/` folder (see `:help load-plugins`) to include your own options, keymaps, autogroups, and more. The following is an example `defaults.lua` file (located at `$HOME/.config/nvim/after/plugin/defaults.lua`). + +```lua +vim.opt.relativenumber = true + +vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) +``` + +### Contribution + +Pull-requests are welcome. The goal of this repo is not to create a Neovim configuration framework, but to offer a starting template that shows, by example, available features in Neovim. Some things that will not be included: + +* Custom language server configuration (null-ls templates) +* Theming beyond a default colorscheme necessary for LSP highlight groups + +Each PR, especially those which increase the line count, should have a description as to why the PR is necessary. + +### FAQ + +* What should I do if I already have a pre-existing neovim configuration? + * You should back it up, then delete all files associated with it. + * This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/` + * You may also want to look at the [migration guide for lazy.nvim](https://github.com/folke/lazy.nvim#-migration-guide) +* What if I want to "uninstall" this configuration: + * 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). ### Windows Installation @@ -35,50 +128,3 @@ This requires: use {'nvim-telescope/telescope-fzf-native.nvim', run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } ``` -### Configuration - -You could directly modify the `init.lua` file with your personal customizations. This option is the most straightforward, but if you update your config from this repo, you may need to reapply your changes. - -An alternative approach is to create a separate `custom.plugins` module to register your own plugins. In addition, you can handle further customizations in the `/after/plugin/` directory (see `:help load-plugins`). See the following examples for more information. Leveraging this technique should make upgrading to a newer version of this repo easier. - -#### Example `plugins.lua` - -The following is an example of a `plugins.lua` module (located at `$HOME/.config/nvim/lua/custom/plugins.lua`) where you can register your own plugins. - -```lua -return function(use) - use({ - "folke/which-key.nvim", - config = function() - require("which-key").setup({}) - end - }) -end -``` - -#### Example `defaults.lua` - -For further customizations, you can add a file in the `/after/plugin/` folder (see `:help load-plugins`) to include your own options, keymaps, autogroups, and more. The following is an example `defaults.lua` file (located at `$HOME/.config/nvim/after/plugin/defaults.lua`). - -```lua -vim.opt.relativenumber = true - -vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) -``` - -### Contribution - -Pull-requests are welcome. The goal of this repo is not to create a Neovim configuration framework, but to offer a starting template that shows, by example, available features in Neovim. Some things that will not be included: - -* Custom language server configuration (null-ls templates) -* Theming beyond a default colorscheme necessary for LSP highlight groups -* Lazy-loading. Kickstart.nvim should start within 40 ms on modern hardware. Please profile and contribute to upstream plugins to optimize startup time instead. - -Each PR, especially those which increase the line count, should have a description as to why the PR is necessary. - -### FAQ - - * What should I do if I already have a pre-existing neovim configuration? - * You should back it up, then delete all files associated with it. - * This includes your existing init.lua and the neovim files in `.local` which can be deleted with `rm -rf ~/.local/share/nvim/` - diff --git a/doc/kickstart.txt b/doc/kickstart.txt new file mode 100644 index 00000000..cb87ac3f --- /dev/null +++ b/doc/kickstart.txt @@ -0,0 +1,24 @@ +================================================================================ +INTRODUCTION *kickstart.nvim* + +Kickstart.nvim is a project to help you get started on your neovim journey. + + *kickstart-is-not* +It is not: +- Complete framework for every plugin under the sun +- Place to add every plugin that could ever be useful + + *kickstart-is* +It is: +- Somewhere that has a good start for the most common "IDE" type features: + - autocompletion + - goto-definition + - find references + - fuzzy finding + - and hinting at what more can be done :) +- A place to _kickstart_ your journey. + - You should fork this project and use/modify it so that it matches your + style and preferences. If you don't want to do that, there are probably + other projects that would fit much better for you (and that's great!)! + + vim:tw=78:ts=8:ft=help:norl: diff --git a/doc/tags b/doc/tags new file mode 100644 index 00000000..687ae772 --- /dev/null +++ b/doc/tags @@ -0,0 +1,3 @@ +kickstart-is kickstart.txt /*kickstart-is* +kickstart-is-not kickstart.txt /*kickstart-is-not* +kickstart.nvim kickstart.txt /*kickstart.nvim* diff --git a/init.lua b/init.lua index ac291dad..13db1393 100644 --- a/init.lua +++ b/init.lua @@ -1,96 +1,193 @@ --- Install packer -local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim' -local is_bootstrap = false -if vim.fn.empty(vim.fn.glob(install_path)) > 0 then - is_bootstrap = true - vim.fn.system { 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path } - vim.cmd [[packadd packer.nvim]] +--[[ + +===================================================================== +==================== READ THIS BEFORE CONTINUING ==================== +===================================================================== + +Kickstart.nvim is *not* a distribution. + +Kickstart.nvim is a template for your own configuration. + The goal is that you can read every line of code, top-to-bottom, and understand + what your configuration is doing. + + Once you've done that, you should start exploring, configuring and tinkering to + explore Neovim! + + If you don't know anything about Lua, I recommend taking some time to read through + a guide. One possible example: + - https://learnxinyminutes.com/docs/lua/ + + And then you can explore or search through `:help lua-guide` + + +Kickstart Guide: + +I have left several `:help X` comments throughout the init.lua +You should run that command and read that help section for more information. + +In addition, I have some `NOTE:` items throughout the file. +These are for you, the reader to help understand what is happening. Feel free to delete +them once you know what you're doing, but they should serve as a guide for when you +are first encountering a few different constructs in your nvim config. + +I hope you enjoy your Neovim journey, +- TJ + +P.S. You can delete this when you're done too. It's your config now :) +--]] + +-- Set as the leader key +-- See `:help mapleader` +-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +-- Install package manager +-- https://github.com/folke/lazy.nvim +-- `:help lazy.nvim.txt` for more info +local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' +if not vim.loop.fs_stat(lazypath) then + vim.fn.system { + 'git', + 'clone', + '--filter=blob:none', + 'https://github.com/folke/lazy.nvim.git', + '--branch=stable', -- latest stable release + lazypath, + } end +vim.opt.rtp:prepend(lazypath) -require('packer').startup(function(use) - -- Package manager - use 'wbthomason/packer.nvim' +-- NOTE: Here is where you install your plugins. +-- You can configure plugins using the `config` key. +-- +-- You can also configure plugins after the setup call, +-- as they will be available in your neovim runtime. +require('lazy').setup({ + -- NOTE: First, some plugins that don't require any configuration - use { -- LSP Configuration & Plugins + -- Git related plugins + 'tpope/vim-fugitive', + 'tpope/vim-rhubarb', + + -- Detect tabstop and shiftwidth automatically + 'tpope/vim-sleuth', + + -- NOTE: This is where your plugins related to LSP can be installed. + -- The configuration is done below. Search for lspconfig to find it below. + { -- LSP Configuration & Plugins 'neovim/nvim-lspconfig', - requires = { + dependencies = { -- Automatically install LSPs to stdpath for neovim 'williamboman/mason.nvim', 'williamboman/mason-lspconfig.nvim', -- Useful status updates for LSP - 'j-hui/fidget.nvim', + -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` + { 'j-hui/fidget.nvim', opts = {} }, - -- Additional lua configuration, makes nvim stuff amazing + -- Additional lua configuration, makes nvim stuff amazing! 'folke/neodev.nvim', }, - } + }, - use { -- Autocompletion + { -- Autocompletion 'hrsh7th/nvim-cmp', - requires = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' }, - } + dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' }, + }, - use { -- Highlight, edit, and navigate code - 'nvim-treesitter/nvim-treesitter', - run = function() - pcall(require('nvim-treesitter.install').update { with_sync = true }) + -- Useful plugin to show you pending keybinds. + { 'folke/which-key.nvim', opts = {} }, + { -- Adds git releated signs to the gutter, as well as utilities for managing changes + 'lewis6991/gitsigns.nvim', + opts = { + -- See `:help gitsigns.txt` + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + }, + }, + + { -- Theme inspired by Atom + 'navarasu/onedark.nvim', + priority = 1000, + config = function() + vim.cmd.colorscheme 'onedark' end, - } + }, - use { -- Additional text objects via treesitter - 'nvim-treesitter/nvim-treesitter-textobjects', - after = 'nvim-treesitter', - } + { -- Set lualine as statusline + 'nvim-lualine/lualine.nvim', + -- See `:help lualine.txt` + opts = { + options = { + icons_enabled = false, + theme = 'onedark', + component_separators = '|', + section_separators = '', + }, + }, + }, - -- Git related plugins - use 'tpope/vim-fugitive' - use 'tpope/vim-rhubarb' - use 'lewis6991/gitsigns.nvim' + { -- Add indentation guides even on blank lines + 'lukas-reineke/indent-blankline.nvim', + -- Enable `lukas-reineke/indent-blankline.nvim` + -- See `:help indent_blankline.txt` + opts = { + char = '┊', + show_trailing_blankline_indent = false, + }, + }, - use 'navarasu/onedark.nvim' -- Theme inspired by Atom - use 'nvim-lualine/lualine.nvim' -- Fancier statusline - use 'lukas-reineke/indent-blankline.nvim' -- Add indentation guides even on blank lines - use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines - use 'tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically + -- "gc" to comment visual regions/lines + { 'numToStr/Comment.nvim', opts = {} }, -- Fuzzy Finder (files, lsp, etc) - use { 'nvim-telescope/telescope.nvim', branch = '0.1.x', requires = { 'nvim-lua/plenary.nvim' } } + { 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim' } }, - -- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available - use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable 'make' == 1 } + -- Fuzzy Finder Algorithm which requires local dependencies to be built. + -- Only load if `make` is available. Make sure you have the system + -- requirements installed. + { + 'nvim-telescope/telescope-fzf-native.nvim', + -- NOTE: If you are having trouble with this installation, + -- refer to the README for telescope-fzf-native for more instructions. + build = 'make', + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, - -- Add custom plugins to packer from ~/.config/nvim/lua/custom/plugins.lua - local has_plugins, plugins = pcall(require, 'custom.plugins') - if has_plugins then - plugins(use) - end + { -- Highlight, edit, and navigate code + 'nvim-treesitter/nvim-treesitter', + dependencies = { + 'nvim-treesitter/nvim-treesitter-textobjects', + }, + config = function() + pcall(require('nvim-treesitter.install').update { with_sync = true }) + end, + }, - if is_bootstrap then - require('packer').sync() - end -end) + -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart + -- These are some example plugins that I've included in the kickstart repository. + -- Uncomment any of the lines below to enable them. + -- require 'kickstart.plugins.autoformat', + -- require 'kickstart.plugins.debug', --- When we are bootstrapping a configuration, it doesn't --- make sense to execute the rest of the init.lua. --- --- You'll need to restart nvim, and then it will work. -if is_bootstrap then - print '==================================' - print ' Plugins are being installed' - print ' Wait until Packer completes,' - print ' then restart nvim' - print '==================================' - return -end - --- Automatically source and re-compile packer whenever you save this init.lua -local packer_group = vim.api.nvim_create_augroup('Packer', { clear = true }) -vim.api.nvim_create_autocmd('BufWritePost', { - command = 'source | silent! LspStop | silent! LspStart | PackerCompile', - group = packer_group, - pattern = vim.fn.expand '$MYVIMRC', -}) + -- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua` + -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping + -- up-to-date with whatever is in the kickstart repo. + -- + -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins + -- + -- An additional note is that if you only copied in the `init.lua`, you can just comment this line + -- to get rid of the warning telling you that there are not plugins in `lua/custom/plugins/`. + { import = 'custom.plugins' }, +}, {}) -- [[ Setting options ]] -- See `:help vim.o` @@ -114,23 +211,21 @@ vim.o.undofile = true vim.o.ignorecase = true vim.o.smartcase = true --- Decrease update time -vim.o.updatetime = 250 +-- Keep signcolumn on by default vim.wo.signcolumn = 'yes' --- Set colorscheme -vim.o.termguicolors = true -vim.cmd [[colorscheme onedark]] +-- Decrease update time +vim.o.updatetime = 250 +vim.o.timeout = true +vim.o.timeoutlen = 300 -- Set completeopt to have a better completion experience vim.o.completeopt = 'menuone,noselect' +-- NOTE: You should make sure your terminal supports this +vim.o.termguicolors = true + -- [[ Basic Keymaps ]] --- Set as the leader key --- See `:help mapleader` --- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' -- Keymaps for better default experience -- See `:help vim.keymap.set()` @@ -151,39 +246,6 @@ vim.api.nvim_create_autocmd('TextYankPost', { pattern = '*', }) --- Set lualine as statusline --- See `:help lualine.txt` -require('lualine').setup { - options = { - icons_enabled = false, - theme = 'onedark', - component_separators = '|', - section_separators = '', - }, -} - --- Enable Comment.nvim -require('Comment').setup() - --- Enable `lukas-reineke/indent-blankline.nvim` --- See `:help indent_blankline.txt` -require('indent_blankline').setup { - char = '┊', - show_trailing_blankline_indent = false, -} - --- Gitsigns --- See `:help gitsigns.txt` -require('gitsigns').setup { - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, -} - -- [[ Configure Telescope ]] -- See `:help telescope` and `:help telescope.setup()` require('telescope').setup { @@ -209,7 +271,7 @@ vim.keymap.set('n', '/', function() winblend = 10, previewer = false, }) -end, { desc = '[/] Fuzzily search in current buffer]' }) +end, { desc = '[/] Fuzzily search in current buffer' }) 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' }) @@ -221,7 +283,10 @@ 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', 'typescript', 'help', '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, highlight = { enable = true }, indent = { enable = true, disable = { 'python' } }, @@ -231,7 +296,7 @@ require('nvim-treesitter.configs').setup { init_selection = '', node_incremental = '', scope_incremental = '', - node_decremental = '', + node_decremental = '', }, }, textobjects = { @@ -343,7 +408,7 @@ local servers = { -- rust_analyzer = {}, -- tsserver = {}, - sumneko_lua = { + lua_ls = { Lua = { workspace = { checkThirdParty = false }, telemetry = { enable = false }, @@ -353,7 +418,7 @@ local servers = { -- Setup neovim lua configuration require('neodev').setup() --- + -- nvim-cmp supports additional completion capabilities, so broadcast that to servers local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) @@ -378,13 +443,12 @@ mason_lspconfig.setup_handlers { end, } --- Turn on lsp status information -require('fidget').setup() - -- nvim-cmp setup local cmp = require 'cmp' local luasnip = require 'luasnip' +luasnip.config.setup {} + cmp.setup { snippet = { expand = function(args) @@ -394,7 +458,7 @@ cmp.setup { mapping = cmp.mapping.preset.insert { [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), + [''] = cmp.mapping.complete {}, [''] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = true, diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua new file mode 100644 index 00000000..be0eb9d8 --- /dev/null +++ b/lua/custom/plugins/init.lua @@ -0,0 +1,5 @@ +-- You can add your own plugins here or in other files in this directory! +-- I promise not to create any merge conflicts in this directory :) +-- +-- See the kickstart.nvim README for more information +return {} diff --git a/lua/kickstart/plugins/autoformat.lua b/lua/kickstart/plugins/autoformat.lua new file mode 100644 index 00000000..bc56b15b --- /dev/null +++ b/lua/kickstart/plugins/autoformat.lua @@ -0,0 +1,74 @@ +-- autoformat.lua +-- +-- Use your language server to automatically format your code on save. +-- Adds additional commands as well to manage the behavior + +return { + 'neovim/nvim-lspconfig', + config = function() + -- Switch for controlling whether you want autoformatting. + -- Use :KickstartFormatToggle to toggle autoformatting on or off + local format_is_enabled = true + vim.api.nvim_create_user_command('KickstartFormatToggle', function() + format_is_enabled = not format_is_enabled + print('Setting autoformatting to: ' .. tostring(format_is_enabled)) + end, {}) + + -- Create an augroup that is used for managing our formatting autocmds. + -- We need one augroup per client to make sure that multiple clients + -- can attach to the same buffer without interfering with each other. + local _augroups = {} + local get_augroup = function(client) + if not _augroups[client.id] then + local group_name = 'kickstart-lsp-format-' .. client.name + local id = vim.api.nvim_create_augroup(group_name, { clear = true }) + _augroups[client.id] = id + end + + return _augroups[client.id] + end + + -- Whenever an LSP attaches to a buffer, we will run this function. + -- + -- See `:help LspAttach` for more information about this autocmd event. + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }), + -- This is where we attach the autoformatting for reasonable clients + callback = function(args) + local client_id = args.data.client_id + local client = vim.lsp.get_client_by_id(client_id) + local bufnr = args.buf + + -- Only attach to clients that support document formatting + if not client.server_capabilities.documentFormattingProvider then + return + end + + -- Tsserver usually works poorly. Sorry you work with bad languages + -- You can remove this line if you know what you're doing :) + if client.name == 'tsserver' then + return + end + + -- Create an autocmd that will run *before* we save the buffer. + -- Run the formatting command for the LSP that has just attached. + vim.api.nvim_create_autocmd('BufWritePre', { + group = get_augroup(client), + buffer = bufnr, + callback = function() + if not format_is_enabled then + return + end + + vim.lsp.buf.format { + async = false, + filter = function(c) + return c.id == client.id + end, + } + end, + }) + end, + }) + end, +} diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua new file mode 100644 index 00000000..0b68c43b --- /dev/null +++ b/lua/kickstart/plugins/debug.lua @@ -0,0 +1,85 @@ +-- debug.lua +-- +-- Shows how to use the DAP plugin to debug your code. +-- +-- Primarily focused on configuring the debugger for Go, but can +-- be extended to other languages as well. That's why it's called +-- kickstart.nvim and not kitchen-sink.nvim ;) + +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 + 'rcarriga/nvim-dap-ui', + + -- Installs the debug adapters for you + 'williamboman/mason.nvim', + 'jay-babu/mason-nvim-dap.nvim', + + -- Add your own debuggers here + 'leoluz/nvim-dap-go', + }, + + config = function() + local dap = require 'dap' + local dapui = require 'dapui' + + require('mason-nvim-dap').setup { + -- Makes a best effort to setup the various debuggers with + -- reasonable debug configurations + automatic_setup = true, + + -- You'll need to check that you have the required things installed + -- online, please don't ask me how to install them :) + ensure_installed = { + -- Update this to ensure that you have the debuggers for the langs you want + 'delve', + }, + } + + -- 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) + vim.keymap.set('n', '', dap.step_over) + vim.keymap.set('n', '', dap.step_out) + vim.keymap.set('n', 'b', dap.toggle_breakpoint) + vim.keymap.set('n', 'B', function() + dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') + end) + + -- Dap UI setup + -- For more information, see |:help nvim-dap-ui| + dapui.setup { + -- Set icons to characters that are more likely to work in every terminal. + -- Feel free to remove or use ones that you like more! :) + -- Don't feel like these are good choices. + icons = { expanded = '▾', collapsed = '▸', current_frame = '*' }, + controls = { + icons = { + pause = '⏸', + play = '▶', + step_into = '⏎', + step_over = '⏭', + step_out = '⏮', + step_back = 'b', + run_last = '▶▶', + terminate = '⏹', + }, + }, + } + + 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 + + -- Install golang specific config + require('dap-go').setup() + end, +} From 9f384d76f4ecb3d12b9315767df3b327a3c9191b Mon Sep 17 00:00:00 2001 From: Tudor <59114560+tudorjnu@users.noreply.github.com> Date: Fri, 17 Feb 2023 21:37:36 +0000 Subject: [PATCH 037/137] feat: Add clipboard sync by default (#166) --- init.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/init.lua b/init.lua index 13db1393..aeca6d28 100644 --- a/init.lua +++ b/init.lua @@ -201,6 +201,11 @@ vim.wo.number = true -- Enable mouse mode vim.o.mouse = 'a' +-- Sync clipboard between OS and Neovim. +-- Remove this option if you want your OS clipboard to remain independent. +-- See `:help 'clipboard'` +vim.o.clipboard = 'unnamedplus' + -- Enable break indent vim.o.breakindent = true From 72364ad9acb35bb44d7e0af64f977f2a4b3c59db Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 19 Feb 2023 21:32:15 +0100 Subject: [PATCH 038/137] docs: change telescope fzf native to lazy syntax (#185) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 32f58dfb..75c24d84 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,6 @@ This requires: - Install CMake, and the Microsoft C++ Build Tools on Windows ```lua -use {'nvim-telescope/telescope-fzf-native.nvim', run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } +{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } ``` From 187bebcbf93a82c29f12d946136b8d35ab695c64 Mon Sep 17 00:00:00 2001 From: Luiz Antonio Calliari Filho Date: Sun, 26 Feb 2023 23:03:34 -0300 Subject: [PATCH 039/137] Adding [+c and ]+c to move to diffs and leader+ph to show a pop up with the preview diff value. --- init.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/init.lua b/init.lua index aeca6d28..427af75e 100644 --- a/init.lua +++ b/init.lua @@ -109,6 +109,19 @@ require('lazy').setup({ topdelete = { text = '‾' }, changedelete = { text = '~' }, }, + on_attach = function(bufnr) + local function map(mode, lhs, rhs, opts) + opts = vim.tbl_extend('force', {noremap = true, silent = true}, opts or {}) + vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts) + end + + -- Navigation + map('n', ']c', "&diff ? ']c' : 'Gitsigns next_hunk'", {expr=true}) + map('n', '[c', "&diff ? '[c' : 'Gitsigns prev_hunk'", {expr=true}) + + -- Actions + map('n', 'ph', 'Gitsigns preview_hunk') + end }, }, From 933ddee7d9583e97dc17100b6128fa664f6ee7cf Mon Sep 17 00:00:00 2001 From: Lucian Boaca Date: Mon, 27 Feb 2023 21:36:59 +0000 Subject: [PATCH 040/137] Update instructions for neo-tree set up (#200) For me, setting this variable in the config function didn't work. Putting it outside the return block did the trick. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 75c24d84..ce72ebbf 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,9 @@ This will automatically install `nvim-autopairs` and enable it on startup. For m In the file: `lua/custom/plugins/filetree.lua`, add: ```lua +-- Unless you are still migrating, remove the deprecated commands from v1.x +vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) + return { "nvim-neo-tree/neo-tree.nvim", version = "*", @@ -73,9 +76,6 @@ return { "MunifTanjim/nui.nvim", }, config = function () - -- Unless you are still migrating, remove the deprecated commands from v1.x - vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) - require('neo-tree').setup {} end, } From 4a37a0a9b1d53fd355637256ac975c619226fb6d Mon Sep 17 00:00:00 2001 From: Philipp Szechenyi <45265588+szechp@users.noreply.github.com> Date: Mon, 27 Feb 2023 22:37:28 +0100 Subject: [PATCH 041/137] added descriptions to Diagnostic keymaps (#191) * Update init.lua * Update init.lua --- init.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index aeca6d28..72890326 100644 --- a/init.lua +++ b/init.lua @@ -351,10 +351,10 @@ require('nvim-treesitter.configs').setup { } -- Diagnostic keymaps -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next) -vim.keymap.set('n', 'e', vim.diagnostic.open_float) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist) +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" }) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" }) +vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" }) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" }) -- LSP settings. -- This function gets run when an LSP connects to a particular buffer. From 66dc5b896d47ed58e9821b8b39588ce431bfd83a Mon Sep 17 00:00:00 2001 From: Luiz Antonio Calliari Filho Date: Mon, 6 Mar 2023 23:26:20 -0300 Subject: [PATCH 042/137] Feat: Simplifying code --- init.lua | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/init.lua b/init.lua index 427af75e..9ce29c65 100644 --- a/init.lua +++ b/init.lua @@ -110,17 +110,9 @@ require('lazy').setup({ changedelete = { text = '~' }, }, on_attach = function(bufnr) - local function map(mode, lhs, rhs, opts) - opts = vim.tbl_extend('force', {noremap = true, silent = true}, opts or {}) - vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts) - end - - -- Navigation - map('n', ']c', "&diff ? ']c' : 'Gitsigns next_hunk'", {expr=true}) - map('n', '[c', "&diff ? '[c' : 'Gitsigns prev_hunk'", {expr=true}) - - -- Actions - map('n', 'ph', 'Gitsigns preview_hunk') + vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to [P]revious [H]unk' }) + vim.keymap.set('n', ']c', require('gitsigns').next_hunk, { buffer = bufnr, desc = 'Go to [N]ext [H]unk' }) + vim.keymap.set('n', 'ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) end }, }, From 986aa82cd63a104e0930c17f747518d6449ac11a Mon Sep 17 00:00:00 2001 From: Luiz Antonio Calliari Filho Date: Sun, 12 Mar 2023 20:45:26 -0300 Subject: [PATCH 043/137] FIX: Updating command description. --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index e3ddbd29..b4a7881d 100644 --- a/init.lua +++ b/init.lua @@ -110,8 +110,8 @@ require('lazy').setup({ changedelete = { text = '~' }, }, on_attach = function(bufnr) - vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to [P]revious [H]unk' }) - vim.keymap.set('n', ']c', require('gitsigns').next_hunk, { buffer = bufnr, desc = 'Go to [N]ext [H]unk' }) + vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to Previous Hunk' }) + vim.keymap.set('n', ']c', require('gitsigns').next_hunk, { buffer = bufnr, desc = 'Go to Next Hunk' }) vim.keymap.set('n', 'ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) end }, From 7cecf4fcb1d8ecf577f6ba7422fdec091adbc38e Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Fri, 7 Apr 2023 13:11:33 -0400 Subject: [PATCH 044/137] help treesitter module has been renamed to vimdoc in master (#248) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 72890326..1296085e 100644 --- a/init.lua +++ b/init.lua @@ -288,7 +288,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', 'help', 'vim' }, + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, From 9451e1db7171cf8992c448cdccb9da3a5fb7167b Mon Sep 17 00:00:00 2001 From: Sebastian Lyng Johansen Date: Wed, 12 Apr 2023 19:42:40 +0200 Subject: [PATCH 045/137] fix: use :TSInstall on build with nvim-treesitter (#261) --- init.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 1296085e..56975a67 100644 --- a/init.lua +++ b/init.lua @@ -167,9 +167,7 @@ require('lazy').setup({ dependencies = { 'nvim-treesitter/nvim-treesitter-textobjects', }, - config = function() - pcall(require('nvim-treesitter.install').update { with_sync = true }) - end, + build = ":TSUpdate", }, -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart From c19fe7af24611c7863e4d218ec1c18ffb813673a Mon Sep 17 00:00:00 2001 From: Kai Windle Date: Wed, 12 Apr 2023 18:43:08 +0100 Subject: [PATCH 046/137] mason nvim dap 2.0 removed setup_handlers() (#258) --- lua/kickstart/plugins/debug.lua | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 0b68c43b..000bcb8f 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -9,7 +9,6 @@ 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 @@ -22,7 +21,6 @@ return { -- Add your own debuggers here 'leoluz/nvim-dap-go', }, - config = function() local dap = require 'dap' local dapui = require 'dapui' @@ -32,6 +30,10 @@ 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 = { @@ -40,10 +42,6 @@ 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) From 0278862ea142c37eec827b61a189f1649f3ea939 Mon Sep 17 00:00:00 2001 From: Antoine Stevan <44101798+amtoine@users.noreply.github.com> Date: Thu, 13 Apr 2023 15:22:59 +0200 Subject: [PATCH 047/137] minor modifications on the issue template (#244) * use real markdown headers for section titles * add a newline after the initial comment for readability * make hint indications comments --- .github/ISSUE_TEMPLATE/bug_report.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 6999d51e..2ad4d31d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -8,19 +8,21 @@ assignees: '' --- -**Describe the bug** -A clear and concise description of what the bug is. -**To Reproduce** -Steps to reproduce the behavior: +## Describe the bug + + +## To Reproduce + 1. ... -**Desktop (please complete the following information):** +## Desktop + - OS: - Terminal: -** Neovim Version ** - - Output of running `:version` from inside of neovim: +## Neovim Version + ``` ``` From 06192307f3302b75a6d9d2ac5ba382cafccf9c3f Mon Sep 17 00:00:00 2001 From: Jon Earnshaw <1021321+jpearnshaw@users.noreply.github.com> Date: Thu, 13 Apr 2023 14:28:44 +0100 Subject: [PATCH 048/137] Correct command for neo-tree (#216) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ce72ebbf..f6c0ac57 100644 --- a/README.md +++ b/README.md @@ -81,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 From 8d8fbd15bfefde43303ffa41b4c0d9047c0dae5a Mon Sep 17 00:00:00 2001 From: KudoLayton Date: Thu, 13 Apr 2023 22:34:06 +0900 Subject: [PATCH 049/137] fix: move the Mason setup time forward from before (#210) This commit fix the Mason [#1045](https://github.com/williamboman/mason.nvim/issues/1045) issue. Quickly set up Mason to avoid DAP-related startup error messages. --- init.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 56975a67..1cfa228b 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', + { 'williamboman/mason.nvim', config = true }, 'williamboman/mason-lspconfig.nvim', -- Useful status updates for LSP @@ -426,9 +426,6 @@ 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' From 9924f7e0a0fbc2caea91007a5d66cb9aa74827db Mon Sep 17 00:00:00 2001 From: Tsanko Tsanev Date: Thu, 13 Apr 2023 16:34:27 +0300 Subject: [PATCH 050/137] Fix typo "documention" into "documentation" (#209) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f6c0ac57..21fcab3d 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ Each PR, especially those which increase the line count, should have a descripti Installation may require installing build tools, and updating the run command for `telescope-fzf-native` -See `telescope-fzf-native` documention for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) +See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) This requires: From 9004013a8da9abac30dc17ff71d6b5fee137076a Mon Sep 17 00:00:00 2001 From: SamPosh Date: Mon, 24 Apr 2023 16:40:07 +0530 Subject: [PATCH 051/137] Dapui.toggle is added --- lua/kickstart/plugins/debug.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 000bcb8f..14f422fa 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -72,7 +72,9 @@ return { }, }, } - + -- 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 From 0dfc1592862c145f72a0844521542d1522f33607 Mon Sep 17 00:00:00 2001 From: liepieshov Date: Mon, 24 Apr 2023 17:57:47 +0100 Subject: [PATCH 052/137] setup a standard binding for searching git files using telescope --- init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/init.lua b/init.lua index 1cfa228b..22d90cd4 100644 --- a/init.lua +++ b/init.lua @@ -276,6 +276,7 @@ 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' }) From 2eff982e1ef7b7c1e7a052c5338a4a09bec396cd Mon Sep 17 00:00:00 2001 From: nPHYN1T3 <38122105+nPHYN1T3@users.noreply.github.com> Date: Mon, 24 Apr 2023 15:21:53 -0600 Subject: [PATCH 053/137] Update README.md --- README.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 21fcab3d..52a62fc9 100644 --- a/README.md +++ b/README.md @@ -11,14 +11,27 @@ 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 -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. +* Backup your previous configuration (if any exists) + +### 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) + ??? (MacOS) + ??? (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. +* Run nvim and allow the kickstart process to download files and set up the basics. + +### GIT Clone Installation + -* 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 From b5c0b25398409465006732f1f29aafff73ee42af Mon Sep 17 00:00:00 2001 From: nPHYN1T3 <38122105+nPHYN1T3@users.noreply.github.com> Date: Mon, 24 Apr 2023 15:28:27 -0600 Subject: [PATCH 054/137] Update README.md --- README.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 52a62fc9..29df719b 100644 --- a/README.md +++ b/README.md @@ -23,21 +23,25 @@ Distribution Alternatives: ### 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) - ??? (MacOS) - ??? (Windows) + `~/.config/nvim` (Linux) + `~/.config/nvim` (MacOS) + `~/AppData/Local/nvim/` (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. -* Run nvim and allow the kickstart process to download files and set up the basics. ### GIT Clone Installation +* From a terminal cd/dir to: + `~/.config/nvim` (Linux) + `~/.config/nvim` (MacOS) + `~/AppData/Local/nvim/` (Windows) +* run: git clone https://github.com/nvim-lua/kickstart.nvim.git 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) Fork this repo (so that you have your own copy that you can modify). +* (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 `~/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: From f3ad4bb518949e5945f0034c6aa5611b602e53c7 Mon Sep 17 00:00:00 2001 From: nPHYN1T3 <38122105+nPHYN1T3@users.noreply.github.com> Date: Mon, 24 Apr 2023 15:29:58 -0600 Subject: [PATCH 055/137] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 29df719b..dd4f70c9 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ 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). + * 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. ### Windows Installation From ad6351a650685b9c4e856a2a832a379551aebc86 Mon Sep 17 00:00:00 2001 From: nPHYN1T3 <38122105+nPHYN1T3@users.noreply.github.com> Date: Tue, 25 Apr 2023 10:21:31 -0600 Subject: [PATCH 056/137] Should fix the win paths I fear adding bits like "Your paths may differ, these are just for reference." but the core behind the kickstart is getting "noobs" past big hurdles fast. This however means things need to be super spoon fed or basic things like not understanding relative paths and such might end up right where things started...ambiguous to some user instructions because they don't understand they need to know certain things because this is supposed to help them bypass knowing that for now...and the snake eats its tail. :) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dd4f70c9..81a9e0aa 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Distribution Alternatives: * Extract the archive to: `~/.config/nvim` (Linux) `~/.config/nvim` (MacOS) - `~/AppData/Local/nvim/` (Windows) + `C:\User\YourName\AppData\Local\nvim\` (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 @@ -40,7 +40,7 @@ Distribution Alternatives: * **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 `~/AppData/Local/nvim/` (Windows) +* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `C:\User\YourName\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 Additional system requirements: From 545577b9a13feb21cf0270084a5d20692f3af26a Mon Sep 17 00:00:00 2001 From: nPHYN1T3 <38122105+nPHYN1T3@users.noreply.github.com> Date: Tue, 25 Apr 2023 10:43:15 -0600 Subject: [PATCH 057/137] Fixed Windows style path for home --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 81a9e0aa..0b617b13 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Distribution Alternatives: * Extract the archive to: `~/.config/nvim` (Linux) `~/.config/nvim` (MacOS) - `C:\User\YourName\AppData\Local\nvim\` (Windows) + `%userprofile%\User\YourName\AppData\Local\nvim\` (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 @@ -40,7 +40,7 @@ Distribution Alternatives: * **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 `C:\User\YourName\AppData\Local\nvim\` (Windows) +* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `%userprofile%\User\YourName\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 Additional system requirements: From 604e92ef74f099dedcf232f27bf6640bd4282d13 Mon Sep 17 00:00:00 2001 From: nPHYN1T3 <38122105+nPHYN1T3@users.noreply.github.com> Date: Tue, 25 Apr 2023 13:14:17 -0600 Subject: [PATCH 058/137] Hmmm Tested on a win10VM for location and such because I remembered %appdata% should be a thing but it's the wrong location and the win MSI creates nvim-data rather than just nvim. Then I noticed my previous changes weren't all saved...so here I go again heh. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0b617b13..96d3a0fd 100644 --- a/README.md +++ b/README.md @@ -25,14 +25,14 @@ Distribution Alternatives: * Extract the archive to: `~/.config/nvim` (Linux) `~/.config/nvim` (MacOS) - `%userprofile%\User\YourName\AppData\Local\nvim\` (Windows) + `%userprofile%\User\YourName\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) - `~/AppData/Local/nvim/` (Windows) + `%userprofile%\AppData\Local\nvim-data\` (Windows) * run: git clone https://github.com/nvim-lua/kickstart.nvim.git 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. @@ -40,7 +40,7 @@ Distribution Alternatives: * **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%\User\YourName\AppData\Local\nvim\` (Windows) +* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `%userprofile%\AppData\Local\nvim-data\` (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 Additional system requirements: From 821ad95565a293d6d52ef2f07941472ab75ef00f Mon Sep 17 00:00:00 2001 From: nPHYN1T3 <38122105+nPHYN1T3@users.noreply.github.com> Date: Tue, 25 Apr 2023 13:15:10 -0600 Subject: [PATCH 059/137] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 96d3a0fd..0b878ebe 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Distribution Alternatives: * Extract the archive to: `~/.config/nvim` (Linux) `~/.config/nvim` (MacOS) - `%userprofile%\User\YourName\AppData\Local\nvim-data\` (Windows) + `%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 df10841febe952c3482da7ce54233eea6cf02905 Mon Sep 17 00:00:00 2001 From: nPHYN1T3 <38122105+nPHYN1T3@users.noreply.github.com> Date: Tue, 25 Apr 2023 13:21:31 -0600 Subject: [PATCH 060/137] ARG! My browser should not be caching yet github seems to fight some changes. I'm also still unable to see why the formatting (line height) differs between the Archive Install section and the Git Clone Install section. Hopefully this will at least save the correct changes to the Win stuff. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0b878ebe..02df1b89 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,8 @@ Distribution Alternatives: `~/.config/nvim` (Linux) `~/.config/nvim` (MacOS) `%userprofile%\AppData\Local\nvim-data\` (Windows) -* run: git clone https://github.com/nvim-lua/kickstart.nvim.git OR: gh repo clone nvim-lua/kickstart.nvim +* run: git clone https://github.com/nvim-lua/kickstart.nvim.git 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!** From e78ad01dd284273b19dd6295a2be53b1f7e2c6d2 Mon Sep 17 00:00:00 2001 From: Keiwan Jamaly <33158209+keiwanjamaly@users.noreply.github.com> Date: Wed, 26 Apr 2023 17:37:48 +0200 Subject: [PATCH 061/137] Added disconnect emoji for nvim-dap-ui --- lua/kickstart/plugins/debug.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 14f422fa..deeda564 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -69,6 +69,7 @@ return { step_back = 'b', run_last = '▶▶', terminate = '⏹', + disconnect = "⏏", }, }, } From 5b74a016b39a26aaea061aa3637411160472250a Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Wed, 26 Apr 2023 12:24:52 -0400 Subject: [PATCH 062/137] Update README.md Tiny wording changes I requested from https://github.com/nvim-lua/kickstart.nvim/pull/283 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 02df1b89..ad3d7db7 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ 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. + * 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. ### Windows Installation From 7e39ab77c6fa3497a3f362915381870721be9582 Mon Sep 17 00:00:00 2001 From: Sumanth Lingappa <42572246+sumanth-lingappa@users.noreply.github.com> Date: Wed, 26 Apr 2023 23:49:32 +0530 Subject: [PATCH 063/137] corrected git clone command --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ad3d7db7..ef119d21 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Distribution Alternatives: `~/.config/nvim` (MacOS) `%userprofile%\AppData\Local\nvim-data\` (Windows) -* run: git clone https://github.com/nvim-lua/kickstart.nvim.git OR: gh repo clone nvim-lua/kickstart.nvim +* 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!** From efdfd6ed82c5d3c069f9b9240407375669f71e25 Mon Sep 17 00:00:00 2001 From: Victor Wallsten <94681407+victorwallsten@users.noreply.github.com> Date: Thu, 27 Apr 2023 09:33:10 +0200 Subject: [PATCH 064/137] Add , mappings to nvim-cmp setup --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index 22d90cd4..7fd9c54f 100644 --- a/init.lua +++ b/init.lua @@ -457,6 +457,8 @@ 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 {}, From 55c52ce45bea8395e79d43dc6e5490c23b06a95b Mon Sep 17 00:00:00 2001 From: SamPosh Date: Tue, 2 May 2023 16:01:46 +0530 Subject: [PATCH 065/137] Added friendly snippet support --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 7fd9c54f..2d377d28 100644 --- a/init.lua +++ b/init.lua @@ -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',"rafamadriz/friendly-snippets", }, }, -- Useful plugin to show you pending keybinds. @@ -447,7 +447,7 @@ mason_lspconfig.setup_handlers { -- nvim-cmp setup local cmp = require 'cmp' local luasnip = require 'luasnip' - +require("luasnip.loaders.from_vscode").lazy_load() luasnip.config.setup {} cmp.setup { From 1c02cec98b9192d8c7e990b8243e3ae007325bad Mon Sep 17 00:00:00 2001 From: Gaurav Bhatnagar <11798509+mech-a@users.noreply.github.com> Date: Sun, 7 May 2023 16:28:13 -0700 Subject: [PATCH 066/137] change luasnip tab jumping to locally jumpable --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 7fd9c54f..f4d8d0f4 100644 --- a/init.lua +++ b/init.lua @@ -469,7 +469,7 @@ cmp.setup { [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then + elseif luasnip.expand_or_locally_jumpable() then luasnip.expand_or_jump() else fallback() From 2844f61d968501b531758e8a301a53a77b2fb69e Mon Sep 17 00:00:00 2001 From: Gaurav Bhatnagar <11798509+mech-a@users.noreply.github.com> Date: Sun, 7 May 2023 16:38:44 -0700 Subject: [PATCH 067/137] add local jumping to shift tab --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index f4d8d0f4..1496d240 100644 --- a/init.lua +++ b/init.lua @@ -478,7 +478,7 @@ cmp.setup { [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() - elseif luasnip.jumpable(-1) then + elseif luasnip.locally_jumpable(-1) then luasnip.jump(-1) else fallback() From fa4bf9c378a7ae17264abc42782f0628e3a3acf3 Mon Sep 17 00:00:00 2001 From: dec Date: Mon, 8 May 2023 11:02:37 +0100 Subject: [PATCH 068/137] Udated tree sitter to use latest release branch --- init.lua | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/init.lua b/init.lua index 7fd9c54f..f9c86079 100644 --- a/init.lua +++ b/init.lua @@ -35,7 +35,6 @@ I hope you enjoy your Neovim journey, P.S. You can delete this when you're done too. It's your config now :) --]] - -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) @@ -75,7 +74,8 @@ require('lazy').setup({ -- NOTE: This is where your plugins related to LSP can be installed. -- The configuration is done below. Search for lspconfig to find it below. - { -- LSP Configuration & Plugins + { + -- LSP Configuration & Plugins 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs to stdpath for neovim @@ -84,21 +84,23 @@ require('lazy').setup({ -- Useful status updates for LSP -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', opts = {} }, + { 'j-hui/fidget.nvim', opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! 'folke/neodev.nvim', }, }, - { -- Autocompletion + { + -- Autocompletion 'hrsh7th/nvim-cmp', dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' }, }, -- Useful plugin to show you pending keybinds. - { 'folke/which-key.nvim', opts = {} }, - { -- Adds git releated signs to the gutter, as well as utilities for managing changes + { 'folke/which-key.nvim', opts = {} }, + { + -- Adds git releated signs to the gutter, as well as utilities for managing changes 'lewis6991/gitsigns.nvim', opts = { -- See `:help gitsigns.txt` @@ -112,7 +114,8 @@ require('lazy').setup({ }, }, - { -- Theme inspired by Atom + { + -- Theme inspired by Atom 'navarasu/onedark.nvim', priority = 1000, config = function() @@ -120,7 +123,8 @@ require('lazy').setup({ end, }, - { -- Set lualine as statusline + { + -- Set lualine as statusline 'nvim-lualine/lualine.nvim', -- See `:help lualine.txt` opts = { @@ -133,7 +137,8 @@ require('lazy').setup({ }, }, - { -- Add indentation guides even on blank lines + { + -- Add indentation guides even on blank lines 'lukas-reineke/indent-blankline.nvim', -- Enable `lukas-reineke/indent-blankline.nvim` -- See `:help indent_blankline.txt` @@ -144,10 +149,10 @@ require('lazy').setup({ }, -- "gc" to comment visual regions/lines - { 'numToStr/Comment.nvim', opts = {} }, + { 'numToStr/Comment.nvim', opts = {} }, -- Fuzzy Finder (files, lsp, etc) - { 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim' } }, + { 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } }, -- Fuzzy Finder Algorithm which requires local dependencies to be built. -- Only load if `make` is available. Make sure you have the system @@ -162,7 +167,8 @@ require('lazy').setup({ end, }, - { -- Highlight, edit, and navigate code + { + -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', dependencies = { 'nvim-treesitter/nvim-treesitter-textobjects', From 455691bd8d15064531d2db31a77b54f83ce2898d Mon Sep 17 00:00:00 2001 From: Gaurav Bhatnagar Date: Tue, 16 May 2023 12:38:56 -0700 Subject: [PATCH 069/137] refact: stylua --- init.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/init.lua b/init.lua index 71e1ae5a..c77ff26c 100644 --- a/init.lua +++ b/init.lua @@ -84,7 +84,7 @@ require('lazy').setup({ -- Useful status updates for LSP -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', opts = {} }, + { 'j-hui/fidget.nvim', opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! 'folke/neodev.nvim', @@ -94,11 +94,11 @@ require('lazy').setup({ { -- Autocompletion 'hrsh7th/nvim-cmp', - dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip',"rafamadriz/friendly-snippets", }, + dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip', 'rafamadriz/friendly-snippets' }, }, -- Useful plugin to show you pending keybinds. - { 'folke/which-key.nvim', opts = {} }, + { 'folke/which-key.nvim', opts = {} }, { -- Adds git releated signs to the gutter, as well as utilities for managing changes 'lewis6991/gitsigns.nvim', @@ -115,7 +115,7 @@ require('lazy').setup({ vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to Previous Hunk' }) vim.keymap.set('n', ']c', require('gitsigns').next_hunk, { buffer = bufnr, desc = 'Go to Next Hunk' }) vim.keymap.set('n', 'ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) - end + end, }, }, @@ -154,10 +154,10 @@ require('lazy').setup({ }, -- "gc" to comment visual regions/lines - { 'numToStr/Comment.nvim', opts = {} }, + { 'numToStr/Comment.nvim', opts = {} }, -- Fuzzy Finder (files, lsp, etc) - { 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } }, + { 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } }, -- Fuzzy Finder Algorithm which requires local dependencies to be built. -- Only load if `make` is available. Make sure you have the system @@ -178,7 +178,7 @@ require('lazy').setup({ dependencies = { 'nvim-treesitter/nvim-treesitter-textobjects', }, - build = ":TSUpdate", + build = ':TSUpdate', }, -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart @@ -361,10 +361,10 @@ require('nvim-treesitter.configs').setup { } -- Diagnostic keymaps -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" }) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" }) -vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" }) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" }) +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) +vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) -- LSP settings. -- This function gets run when an LSP connects to a particular buffer. @@ -458,7 +458,7 @@ mason_lspconfig.setup_handlers { -- nvim-cmp setup local cmp = require 'cmp' local luasnip = require 'luasnip' -require("luasnip.loaders.from_vscode").lazy_load() +require('luasnip.loaders.from_vscode').lazy_load() luasnip.config.setup {} cmp.setup { From 8a647f4384eb7d38259474db042b9e5291b6f6b5 Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Sun, 21 May 2023 22:13:02 -0400 Subject: [PATCH 070/137] Update README.md Fix for #314 - there's no -data at the end of the nvim dir. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ef119d21..9bab48d4 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Distribution Alternatives: * From a terminal cd/dir to: `~/.config/nvim` (Linux) `~/.config/nvim` (MacOS) - `%userprofile%\AppData\Local\nvim-data\` (Windows) + `%userprofile%\AppData\Local\nvim\` (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. From 8e8ba26a96a4b2306b90dbaadf86eb7cb43f56d8 Mon Sep 17 00:00:00 2001 From: Gaurav Bhatnagar Date: Sun, 21 May 2023 23:46:09 -0700 Subject: [PATCH 071/137] refact: add cmp comments, other --- init.lua | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index c77ff26c..bc60ef85 100644 --- a/init.lua +++ b/init.lua @@ -94,7 +94,17 @@ require('lazy').setup({ { -- Autocompletion 'hrsh7th/nvim-cmp', - dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip', 'rafamadriz/friendly-snippets' }, + dependencies = { + -- Snippet Engine & its associated nvim-cmp source + 'L3MON4D3/LuaSnip', + 'saadparwaiz1/cmp_luasnip', + + -- Adds LSP completion capabilities + 'hrsh7th/cmp-nvim-lsp', + + -- Adds a number of user-friendly snippets + 'rafamadriz/friendly-snippets', + }, }, -- Useful plugin to show you pending keybinds. @@ -366,7 +376,7 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnos vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) --- LSP settings. +-- [[ Configure LSP ]] -- This function gets run when an LSP connects to a particular buffer. local on_attach = function(_, bufnr) -- NOTE: Remember that lua is a real programming language, and as such it is possible @@ -455,7 +465,8 @@ mason_lspconfig.setup_handlers { end, } --- nvim-cmp setup +-- [[ Configure nvim-cmp ]] +-- See `:help cmp` local cmp = require 'cmp' local luasnip = require 'luasnip' require('luasnip.loaders.from_vscode').lazy_load() From 8d97b11dd8fb7bda1857ab30bb45b067947da797 Mon Sep 17 00:00:00 2001 From: Gaurav Bhatnagar Date: Mon, 22 May 2023 11:29:42 -0700 Subject: [PATCH 072/137] refact: remove after/ reference in readme, other clean-up items --- README.md | 42 +++++++++++++++++++++--------------------- init.lua | 8 +++----- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 9bab48d4..265c2be3 100644 --- a/README.md +++ b/README.md @@ -28,15 +28,15 @@ Distribution Alternatives: `%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 +### Git Clone Installation * From a terminal cd/dir to: `~/.config/nvim` (Linux) `~/.config/nvim` (MacOS) `%userprofile%\AppData\Local\nvim\` (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. +* 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 lazy.nvim 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). @@ -46,17 +46,18 @@ Distribution Alternatives: Additional system requirements: - Make sure to review the readmes of the plugins if you are experiencing errors. In particular: - [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers. -- See as well [Windows Installation](#Windows-Installation) +- See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native` ### Configuration And Extension -* Inside of your fork, feel free to modify any file you like! It's your fork! -* Then there are two primary configuration options available: - * Include the `lua/kickstart/plugins/*` files in your configuration. +* Inside of your copy, feel free to modify any file you like! It's your copy! +* Feel free to change any of the default options in `init.lua` to better suit your needs. +* For adding plugins, there are 3 primary options: * Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` - * NOTE: To enable this, you need to uncomment `{ import = 'custom.plugins' }` in your `init.lua` + * Modify `init.lua` with additional plugins. + * Include the `lua/kickstart/plugins/*` files in your configuration. -You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration +You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration. #### Example: Adding an autopairs plugin @@ -67,14 +68,23 @@ In the file: `lua/custom/plugins/autopairs.lua`, add: return { "windwp/nvim-autopairs", + -- Optional dependency + dependencies = { 'hrsh7th/nvim-cmp' }, config = function() require("nvim-autopairs").setup {} + -- If you want to automatically add `(` after selecting a function or method + local cmp_autopairs = require('nvim-autopairs.completion.cmp') + local cmp = require('cmp') + cmp.event:on( + 'confirm_done', + cmp_autopairs.on_confirm_done() + ) end, } ``` -This will automatically install `nvim-autopairs` and enable it on startup. For more information, see documentation for [lazy.nvim](https://github.com/folke/lazy.nvim). +This will automatically install [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs) and enable it on startup. For more information, see documentation for [lazy.nvim](https://github.com/folke/lazy.nvim). #### Example: Adding a file tree plugin @@ -100,16 +110,6 @@ 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. -#### Example: Adding a file to change default options - -To change default options, you can add a file in the `/after/plugin/` folder (see `:help load-plugins`) to include your own options, keymaps, autogroups, and more. The following is an example `defaults.lua` file (located at `$HOME/.config/nvim/after/plugin/defaults.lua`). - -```lua -vim.opt.relativenumber = true - -vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) -``` - ### Contribution Pull-requests are welcome. The goal of this repo is not to create a Neovim configuration framework, but to offer a starting template that shows, by example, available features in Neovim. Some things that will not be included: diff --git a/init.lua b/init.lua index c77ff26c..4719912e 100644 --- a/init.lua +++ b/init.lua @@ -7,8 +7,8 @@ Kickstart.nvim is *not* a distribution. Kickstart.nvim is a template for your own configuration. - The goal is that you can read every line of code, top-to-bottom, and understand - what your configuration is doing. + The goal is that you can read every line of code, top-to-bottom, understand + what your configuration is doing, and modify it to suit your needs. Once you've done that, you should start exploring, configuring and tinkering to explore Neovim! @@ -192,14 +192,12 @@ require('lazy').setup({ -- up-to-date with whatever is in the kickstart repo. -- -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - -- - -- An additional note is that if you only copied in the `init.lua`, you can just comment this line - -- to get rid of the warning telling you that there are not plugins in `lua/custom/plugins/`. { import = 'custom.plugins' }, }, {}) -- [[ Setting options ]] -- See `:help vim.o` +-- NOTE: You can change these options as you wish! -- Set highlight on search vim.o.hlsearch = false From 83b65a1c7d4a5ae9454426e88be823c203d14a73 Mon Sep 17 00:00:00 2001 From: Luiz Antonio Calliari Filho Date: Thu, 25 May 2023 22:09:34 -0300 Subject: [PATCH 073/137] FIX: Conflict with vimdiff keybinding --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index fb0252cc..ca2da6e1 100644 --- a/init.lua +++ b/init.lua @@ -122,8 +122,8 @@ require('lazy').setup({ changedelete = { text = '~' }, }, on_attach = function(bufnr) - vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to Previous Hunk' }) - vim.keymap.set('n', ']c', require('gitsigns').next_hunk, { buffer = bufnr, desc = 'Go to Next Hunk' }) + vim.keymap.set('n', 'gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' }) + vim.keymap.set('n', 'gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' }) vim.keymap.set('n', 'ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) end, }, From f2b09aaac7cd6e93f857f4faf33329a095da4797 Mon Sep 17 00:00:00 2001 From: Pavel 'PK' Kaminsky Date: Mon, 29 May 2023 23:35:45 +0300 Subject: [PATCH 074/137] fix(docs): update windows path to a correct folder --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 265c2be3..e4a841ec 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Distribution Alternatives: * **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) +* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `%userprofile%\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 Additional system requirements: From 1d52d1e68b8aa7e399b218bf2faf363e5c093254 Mon Sep 17 00:00:00 2001 From: Pavel 'PK' Kaminsky Date: Tue, 30 May 2023 11:04:01 +0300 Subject: [PATCH 075/137] Update README.md fix(docs): whoops missed another instance of `nvim-data` --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e4a841ec..64f386c6 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Distribution Alternatives: * Extract the archive to: `~/.config/nvim` (Linux) `~/.config/nvim` (MacOS) - `%userprofile%\AppData\Local\nvim-data\` (Windows) + `%userprofile%\AppData\Local\nvim\` (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 cdaa750c86cfc0c8f2fc1c8638b7296c327bf5a9 Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Sat, 3 Jun 2023 10:11:10 -0400 Subject: [PATCH 076/137] Refactor theme and status line into their own file --- init.lua | 29 ++++++---------------------- lua/kickstart/plugins/autoformat.lua | 14 +++----------- lua/kickstart/plugins/statusline.lua | 14 ++++++++++++++ lua/kickstart/plugins/theme.lua | 10 ++++++++++ 4 files changed, 33 insertions(+), 34 deletions(-) create mode 100644 lua/kickstart/plugins/statusline.lua create mode 100644 lua/kickstart/plugins/theme.lua diff --git a/init.lua b/init.lua index ca2da6e1..5e9e5679 100644 --- a/init.lua +++ b/init.lua @@ -122,35 +122,18 @@ require('lazy').setup({ changedelete = { text = '~' }, }, on_attach = function(bufnr) - vim.keymap.set('n', 'gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' }) - vim.keymap.set('n', 'gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' }) + vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to Previous Hunk' }) + vim.keymap.set('n', ']c', require('gitsigns').next_hunk, { buffer = bufnr, desc = 'Go to Next Hunk' }) vim.keymap.set('n', 'ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) end, }, }, - { - -- Theme inspired by Atom - 'navarasu/onedark.nvim', - priority = 1000, - config = function() - vim.cmd.colorscheme 'onedark' - end, - }, + -- Theme related configs go here + require 'kickstart.plugins.theme', - { - -- Set lualine as statusline - 'nvim-lualine/lualine.nvim', - -- See `:help lualine.txt` - opts = { - options = { - icons_enabled = false, - theme = 'onedark', - component_separators = '|', - section_separators = '', - }, - }, - }, + -- Status line related configs go here + require 'kickstart.plugins.statusline', { -- Add indentation guides even on blank lines diff --git a/lua/kickstart/plugins/autoformat.lua b/lua/kickstart/plugins/autoformat.lua index bc56b15b..855f350f 100644 --- a/lua/kickstart/plugins/autoformat.lua +++ b/lua/kickstart/plugins/autoformat.lua @@ -5,6 +5,7 @@ return { 'neovim/nvim-lspconfig', + config = function() -- Switch for controlling whether you want autoformatting. -- Use :KickstartFormatToggle to toggle autoformatting on or off @@ -28,11 +29,9 @@ return { return _augroups[client.id] end - -- Whenever an LSP attaches to a buffer, we will run this function. - -- - -- See `:help LspAttach` for more information about this autocmd event. vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }), + -- This is where we attach the autoformatting for reasonable clients callback = function(args) local client_id = args.data.client_id @@ -50,8 +49,6 @@ return { return end - -- Create an autocmd that will run *before* we save the buffer. - -- Run the formatting command for the LSP that has just attached. vim.api.nvim_create_autocmd('BufWritePre', { group = get_augroup(client), buffer = bufnr, @@ -60,12 +57,7 @@ return { return end - vim.lsp.buf.format { - async = false, - filter = function(c) - return c.id == client.id - end, - } + vim.lsp.buf.format { async = false } end, }) end, diff --git a/lua/kickstart/plugins/statusline.lua b/lua/kickstart/plugins/statusline.lua new file mode 100644 index 00000000..f54393fa --- /dev/null +++ b/lua/kickstart/plugins/statusline.lua @@ -0,0 +1,14 @@ +return { + -- Set lualine as statusline + 'nvim-lualine/lualine.nvim', + -- See `:help lualine.txt` + opts = { + options = { + icons_enabled = false, + theme = 'tokyonight', + component_separators = '|', + section_separators = '', + }, + }, +} + diff --git a/lua/kickstart/plugins/theme.lua b/lua/kickstart/plugins/theme.lua new file mode 100644 index 00000000..794aa4d2 --- /dev/null +++ b/lua/kickstart/plugins/theme.lua @@ -0,0 +1,10 @@ +return { + "folke/tokyonight.nvim", + lazy = false, + priority = 1000, + opts = {}, + config = function() + vim.cmd.colorscheme 'tokyonight-storm' + end, +} + From 5e4d24cb2faf37d341bc906affcc2cac21919c51 Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Sun, 4 Jun 2023 16:10:59 +0000 Subject: [PATCH 077/137] Revert "Refactor theme and status line into their own file" This reverts commit cdaa750c86cfc0c8f2fc1c8638b7296c327bf5a9. --- init.lua | 29 ++++++++++++++++++++++------ lua/kickstart/plugins/autoformat.lua | 14 +++++++++++--- lua/kickstart/plugins/statusline.lua | 14 -------------- lua/kickstart/plugins/theme.lua | 10 ---------- 4 files changed, 34 insertions(+), 33 deletions(-) delete mode 100644 lua/kickstart/plugins/statusline.lua delete mode 100644 lua/kickstart/plugins/theme.lua diff --git a/init.lua b/init.lua index 5e9e5679..ca2da6e1 100644 --- a/init.lua +++ b/init.lua @@ -122,18 +122,35 @@ require('lazy').setup({ changedelete = { text = '~' }, }, on_attach = function(bufnr) - vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to Previous Hunk' }) - vim.keymap.set('n', ']c', require('gitsigns').next_hunk, { buffer = bufnr, desc = 'Go to Next Hunk' }) + vim.keymap.set('n', 'gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' }) + vim.keymap.set('n', 'gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' }) vim.keymap.set('n', 'ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) end, }, }, - -- Theme related configs go here - require 'kickstart.plugins.theme', + { + -- Theme inspired by Atom + 'navarasu/onedark.nvim', + priority = 1000, + config = function() + vim.cmd.colorscheme 'onedark' + end, + }, - -- Status line related configs go here - require 'kickstart.plugins.statusline', + { + -- Set lualine as statusline + 'nvim-lualine/lualine.nvim', + -- See `:help lualine.txt` + opts = { + options = { + icons_enabled = false, + theme = 'onedark', + component_separators = '|', + section_separators = '', + }, + }, + }, { -- Add indentation guides even on blank lines diff --git a/lua/kickstart/plugins/autoformat.lua b/lua/kickstart/plugins/autoformat.lua index 855f350f..bc56b15b 100644 --- a/lua/kickstart/plugins/autoformat.lua +++ b/lua/kickstart/plugins/autoformat.lua @@ -5,7 +5,6 @@ return { 'neovim/nvim-lspconfig', - config = function() -- Switch for controlling whether you want autoformatting. -- Use :KickstartFormatToggle to toggle autoformatting on or off @@ -29,9 +28,11 @@ return { return _augroups[client.id] end + -- Whenever an LSP attaches to a buffer, we will run this function. + -- + -- See `:help LspAttach` for more information about this autocmd event. vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }), - -- This is where we attach the autoformatting for reasonable clients callback = function(args) local client_id = args.data.client_id @@ -49,6 +50,8 @@ return { return end + -- Create an autocmd that will run *before* we save the buffer. + -- Run the formatting command for the LSP that has just attached. vim.api.nvim_create_autocmd('BufWritePre', { group = get_augroup(client), buffer = bufnr, @@ -57,7 +60,12 @@ return { return end - vim.lsp.buf.format { async = false } + vim.lsp.buf.format { + async = false, + filter = function(c) + return c.id == client.id + end, + } end, }) end, diff --git a/lua/kickstart/plugins/statusline.lua b/lua/kickstart/plugins/statusline.lua deleted file mode 100644 index f54393fa..00000000 --- a/lua/kickstart/plugins/statusline.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - -- Set lualine as statusline - 'nvim-lualine/lualine.nvim', - -- See `:help lualine.txt` - opts = { - options = { - icons_enabled = false, - theme = 'tokyonight', - component_separators = '|', - section_separators = '', - }, - }, -} - diff --git a/lua/kickstart/plugins/theme.lua b/lua/kickstart/plugins/theme.lua deleted file mode 100644 index 794aa4d2..00000000 --- a/lua/kickstart/plugins/theme.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - "folke/tokyonight.nvim", - lazy = false, - priority = 1000, - opts = {}, - config = function() - vim.cmd.colorscheme 'tokyonight-storm' - end, -} - From e6cb90b2b33127dafdee351cc84a1d4ae06ce71f Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Wed, 7 Jun 2023 20:41:30 -0400 Subject: [PATCH 078/137] Fixes #336 - Enabale treesitter indent for Python Tested in my local configuratoin. Indenting works great. --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 5e9e5679..200bfe7c 100644 --- a/init.lua +++ b/init.lua @@ -295,7 +295,7 @@ require('nvim-treesitter.configs').setup { auto_install = false, highlight = { enable = true }, - indent = { enable = true, disable = { 'python' } }, + indent = { enable = true }, incremental_selection = { enable = true, keymaps = { From ac07c5c59cb57688f0c63fa74a28bcc3d7795ecd Mon Sep 17 00:00:00 2001 From: Gavin Date: Wed, 14 Jun 2023 17:21:15 -0400 Subject: [PATCH 079/137] Add legacy tag to fidget to avoid deprecation warning --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 57c9af42..c6217451 100644 --- a/init.lua +++ b/init.lua @@ -84,7 +84,7 @@ require('lazy').setup({ -- Useful status updates for LSP -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', opts = {} }, + { 'j-hui/fidget.nvim', tag = 'legacy', opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! 'folke/neodev.nvim', From be90f025de58b08871d866eab8e4d3baeb9f4f97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maria=20Jos=C3=A9=20Solano?= Date: Fri, 16 Jun 2023 21:12:11 -0700 Subject: [PATCH 080/137] Use call_parentheses --- .stylua.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stylua.toml b/.stylua.toml index 5d12dbdf..139e9397 100644 --- a/.stylua.toml +++ b/.stylua.toml @@ -3,4 +3,4 @@ line_endings = "Unix" indent_type = "Spaces" indent_width = 2 quote_style = "AutoPreferSingle" -no_call_parentheses = true +call_parentheses = "None" From c45b17ebab9da4913baa09f37c393a1a6962119b Mon Sep 17 00:00:00 2001 From: Juan Giordana Date: Sun, 18 Jun 2023 00:10:49 -0300 Subject: [PATCH 081/137] Add descriptions for debugging keybindings. Add descriptions for debugging key bindings. Improve formatting by changing double quotes to single quotes in order to keep compatibility with the rest of the kickstart.nvim project. --- lua/kickstart/plugins/debug.lua | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index deeda564..7fc783fa 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -43,14 +43,14 @@ return { } -- Basic debugging keymaps, feel free to change to your liking! - vim.keymap.set('n', '', dap.continue) - vim.keymap.set('n', '', dap.step_into) - vim.keymap.set('n', '', dap.step_over) - vim.keymap.set('n', '', dap.step_out) - vim.keymap.set('n', 'b', dap.toggle_breakpoint) + vim.keymap.set('n', '', dap.continue, { desc = 'Debug: Start/Continue' }) + vim.keymap.set('n', '', dap.step_into, { desc = 'Debug: Step Into' }) + vim.keymap.set('n', '', dap.step_over, { desc = 'Debug: Step Over' }) + vim.keymap.set('n', '', dap.step_out, { desc = 'Debug: Step Out' }) + vim.keymap.set('n', 'b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' }) vim.keymap.set('n', 'B', function() dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') - end) + end, { desc = 'Debug: Set Breakpoint' }) -- Dap UI setup -- For more information, see |:help nvim-dap-ui| @@ -69,13 +69,14 @@ return { step_back = 'b', run_last = '▶▶', terminate = '⏹', - disconnect = "⏏", + 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) - + + -- 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, { desc = 'Debug: See last session result.' }) + 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 From d8b3b774bb642a9bdb2930f2ef0dd09e29a2f00c Mon Sep 17 00:00:00 2001 From: ilian Date: Sun, 18 Jun 2023 16:20:34 +0200 Subject: [PATCH 082/137] Fix typo in ignorecase comment In order to perform a case-sensitive search with ignorecase, the pattern should contain `\C` instead of `/C`. --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index c6217451..fd36919c 100644 --- a/init.lua +++ b/init.lua @@ -229,7 +229,7 @@ vim.o.breakindent = true -- Save undo history vim.o.undofile = true --- Case insensitive searching UNLESS /C or capital in search +-- Case-insensitive searching UNLESS \C or capital in search vim.o.ignorecase = true vim.o.smartcase = true From 957655ddb8be837a37c8e1fd0dd7f5c49705986e Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Sat, 1 Jul 2023 12:34:20 -0400 Subject: [PATCH 083/137] Make init.lua copy-paste friendly --- init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index fd36919c..f8d9383f 100644 --- a/init.lua +++ b/init.lua @@ -197,12 +197,13 @@ require('lazy').setup({ -- require 'kickstart.plugins.autoformat', -- require 'kickstart.plugins.debug', - -- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua` + -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping -- up-to-date with whatever is in the kickstart repo. + -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - { import = 'custom.plugins' }, + -- { import = 'custom.plugins' }, }, {}) -- [[ Setting options ]] From a73b2e5f57059aeff4f6a4cc5ea15f9b012ec9b8 Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Sat, 1 Jul 2023 11:21:10 -0400 Subject: [PATCH 084/137] =?UTF-8?q?docs:=20Update=20README.md=20?= =?UTF-8?q?=F0=9F=93=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 64f386c6..99914cf1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # kickstart.nvim +https://github.com/kdheepak/kickstart.nvim/assets/1813121/f3ff9a2b-c31f-44df-a4fa-8a0d7b17cf7b + ### Introduction A starting point for Neovim that is: From 93ef2e8078900d2a19936beb8cd37706cdb7dbdb Mon Sep 17 00:00:00 2001 From: Andres Lowrie Date: Fri, 7 Jul 2023 08:37:12 -0500 Subject: [PATCH 085/137] correct typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hey y'all 👋 I think there may have been a typo? --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 64f386c6..e0b0470a 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ A starting point for Neovim that is: * Documented * Modular -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. +This repo is meant to be used 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. From 31f867a69947f96f7b3ae1a9d49d2a12a3220a8f Mon Sep 17 00:00:00 2001 From: Andrew Stewart Date: Mon, 17 Jul 2023 10:21:44 -0400 Subject: [PATCH 086/137] Remove timeout --- init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/init.lua b/init.lua index f8d9383f..859d9d2a 100644 --- a/init.lua +++ b/init.lua @@ -239,7 +239,6 @@ vim.wo.signcolumn = 'yes' -- Decrease update time vim.o.updatetime = 250 -vim.o.timeout = true vim.o.timeoutlen = 300 -- Set completeopt to have a better completion experience From 78ab7ee09411676d01138faafc03a3e638d5f560 Mon Sep 17 00:00:00 2001 From: Dennis-Rall <56480601+Dennis-Rall@users.noreply.github.com> Date: Thu, 20 Jul 2023 10:56:15 +0200 Subject: [PATCH 087/137] Add hint to uncomment line to autodetect plugins --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4a128bcf..b38867dd 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Additional system requirements: * Inside of your copy, feel free to modify any file you like! It's your copy! * Feel free to change any of the default options in `init.lua` to better suit your needs. * For adding plugins, there are 3 primary options: - * Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` + * Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` (uncomment line 206 in init.lua therefore) * Modify `init.lua` with additional plugins. * Include the `lua/kickstart/plugins/*` files in your configuration. From c151235551781459fdb60af17c8d5c5f3ee94170 Mon Sep 17 00:00:00 2001 From: Dennis-Rall <56480601+Dennis-Rall@users.noreply.github.com> Date: Thu, 20 Jul 2023 16:42:46 +0200 Subject: [PATCH 088/137] Remove fixed line number and describe line --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b38867dd..ef597600 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Additional system requirements: * Inside of your copy, feel free to modify any file you like! It's your copy! * Feel free to change any of the default options in `init.lua` to better suit your needs. * For adding plugins, there are 3 primary options: - * Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` (uncomment line 206 in init.lua therefore) + * Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` (uncomment the line importing the `custom/plugins` directory in the `init.lua` file to enable this) * Modify `init.lua` with additional plugins. * Include the `lua/kickstart/plugins/*` files in your configuration. From 29aa5bf42df01c6983c5ea7b464e0535de46f628 Mon Sep 17 00:00:00 2001 From: Numkil Date: Mon, 24 Jul 2023 20:41:14 +0200 Subject: [PATCH 089/137] setup more language servers i use + allow customizing filetypes --- init.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 859d9d2a..e5cbed98 100644 --- a/init.lua +++ b/init.lua @@ -424,12 +424,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. +-- +-- If you want to override the default filetypes that your language server will attach to you can +-- define the property 'filetypes' to the map in question. local servers = { -- clangd = {}, -- gopls = {}, -- pyright = {}, -- rust_analyzer = {}, -- tsserver = {}, + -- html = { filetypes = { 'html', 'twig', 'hbs'} }, lua_ls = { Lua = { @@ -459,8 +463,9 @@ mason_lspconfig.setup_handlers { capabilities = capabilities, on_attach = on_attach, settings = servers[server_name], + filetypes = servers[server_name].filetypes, } - end, + end } -- [[ Configure nvim-cmp ]] From 734cc4e94aec64c8cb3504711978c51b092f2542 Mon Sep 17 00:00:00 2001 From: Merel Jossart Date: Tue, 25 Jul 2023 17:06:04 +0200 Subject: [PATCH 090/137] Fix bug when server not explicitely defined in configuration but installed --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index e5cbed98..c6e7a981 100644 --- a/init.lua +++ b/init.lua @@ -463,7 +463,7 @@ mason_lspconfig.setup_handlers { capabilities = capabilities, on_attach = on_attach, settings = servers[server_name], - filetypes = servers[server_name].filetypes, + filetypes = (servers[server_name] or {}).filetypes, } end } From c2fb482ec14041f4537d2269b554818894de7f8e Mon Sep 17 00:00:00 2001 From: Ikko Eltociear Ashimine Date: Mon, 31 Jul 2023 02:46:27 +0900 Subject: [PATCH 091/137] Fix typo in init.lua releated -> related --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index c6e7a981..160d9400 100644 --- a/init.lua +++ b/init.lua @@ -110,7 +110,7 @@ require('lazy').setup({ -- Useful plugin to show you pending keybinds. { 'folke/which-key.nvim', opts = {} }, { - -- Adds git releated signs to the gutter, as well as utilities for managing changes + -- Adds git related signs to the gutter, as well as utilities for managing changes 'lewis6991/gitsigns.nvim', opts = { -- See `:help gitsigns.txt` From b06980a8da1a02f8c123197668998e279c313a5d Mon Sep 17 00:00:00 2001 From: Peter Benjamin Date: Sat, 5 Aug 2023 17:28:18 -0700 Subject: [PATCH 092/137] fix(init): turn telescope-fzf-native into a dependecy --- init.lua | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/init.lua b/init.lua index 160d9400..933f5f16 100644 --- a/init.lua +++ b/init.lua @@ -167,19 +167,24 @@ require('lazy').setup({ { 'numToStr/Comment.nvim', opts = {} }, -- Fuzzy Finder (files, lsp, etc) - { 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } }, - - -- Fuzzy Finder Algorithm which requires local dependencies to be built. - -- Only load if `make` is available. Make sure you have the system - -- requirements installed. { - 'nvim-telescope/telescope-fzf-native.nvim', - -- NOTE: If you are having trouble with this installation, - -- refer to the README for telescope-fzf-native for more instructions. - build = 'make', - cond = function() - return vim.fn.executable 'make' == 1 - end, + 'nvim-telescope/telescope.nvim', + branch = '0.1.x', + dependencies = { + 'nvim-lua/plenary.nvim' + } + -- Fuzzy Finder Algorithm which requires local dependencies to be built. + -- Only load if `make` is available. Make sure you have the system + -- requirements installed. + { + 'nvim-telescope/telescope-fzf-native.nvim', + -- NOTE: If you are having trouble with this installation, + -- refer to the README for telescope-fzf-native for more instructions. + build = 'make', + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, }, { From 8ee4d24b36334bbf92ae6553baac435687c99969 Mon Sep 17 00:00:00 2001 From: Peter Benjamin Date: Sat, 5 Aug 2023 17:31:01 -0700 Subject: [PATCH 093/137] fix: fix brackets --- init.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/init.lua b/init.lua index 933f5f16..f5389e47 100644 --- a/init.lua +++ b/init.lua @@ -172,18 +172,18 @@ require('lazy').setup({ branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' - } - -- Fuzzy Finder Algorithm which requires local dependencies to be built. - -- Only load if `make` is available. Make sure you have the system - -- requirements installed. - { - 'nvim-telescope/telescope-fzf-native.nvim', - -- NOTE: If you are having trouble with this installation, - -- refer to the README for telescope-fzf-native for more instructions. - build = 'make', - cond = function() - return vim.fn.executable 'make' == 1 - end, + -- Fuzzy Finder Algorithm which requires local dependencies to be built. + -- Only load if `make` is available. Make sure you have the system + -- requirements installed. + { + 'nvim-telescope/telescope-fzf-native.nvim', + -- NOTE: If you are having trouble with this installation, + -- refer to the README for telescope-fzf-native for more instructions. + build = 'make', + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, }, }, From a4ec83a43328232175f5a68bdd188ad4ba8e8981 Mon Sep 17 00:00:00 2001 From: daan Date: Sun, 6 Aug 2023 16:27:05 +0100 Subject: [PATCH 094/137] fix: missing comma --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index f5389e47..1192c463 100644 --- a/init.lua +++ b/init.lua @@ -171,7 +171,7 @@ require('lazy').setup({ 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { - 'nvim-lua/plenary.nvim' + 'nvim-lua/plenary.nvim', -- Fuzzy Finder Algorithm which requires local dependencies to be built. -- Only load if `make` is available. Make sure you have the system -- requirements installed. From d0b47ce9581499785aab8ed6772128ad67c95a4b Mon Sep 17 00:00:00 2001 From: Smig <89040888+smiggiddy@users.noreply.github.com> Date: Thu, 10 Aug 2023 15:00:15 -0400 Subject: [PATCH 095/137] Update init.lua added a URL to the lua-guide may help others who miss the :help lua-guide --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index 1192c463..1332c3b9 100644 --- a/init.lua +++ b/init.lua @@ -17,7 +17,9 @@ Kickstart.nvim is a template for your own configuration. a guide. One possible example: - https://learnxinyminutes.com/docs/lua/ + And then you can explore or search through `:help lua-guide` + - https://neovim.io/doc/user/lua-guide.html Kickstart Guide: From 555dd8ed27890ffa29b30921b46614e5cbf21a09 Mon Sep 17 00:00:00 2001 From: Erik Date: Sat, 19 Aug 2023 13:38:31 +0200 Subject: [PATCH 096/137] Fix typo in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ef597600..4a312bc9 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Distribution Alternatives: `~/.config/nvim` (MacOS) `%userprofile%\AppData\Local\nvim\` (Windows) -* run: `git clone https://github.com/nvim-lua/kickstart.nvim.git ~/.config/nvim` OR: `gh repo clone nvim-lua/kickstart.nvim` +* 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 lazy.nvim to download files and set up the basics. * Once the setup is complete, restart Neovim. * **You're ready to go!** From f00ff6f6ab6a94e3d49b2e8efa94eed855bc6623 Mon Sep 17 00:00:00 2001 From: "E. Aakash" <09e.aakash@gmail.com> Date: Sun, 20 Aug 2023 14:43:34 +0530 Subject: [PATCH 097/137] Use telescope for goto implementation --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 1332c3b9..7eb1d231 100644 --- a/init.lua +++ b/init.lua @@ -403,7 +403,7 @@ local on_attach = function(_, bufnr) nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation') + nmap('gI', require('telescope.builtin').lsp_implementaitons, '[G]oto [I]mplementation') nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') From 1283a0bbe7424b44a38dc983f1ba0fbe33e80978 Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Mon, 21 Aug 2023 17:19:13 -0400 Subject: [PATCH 098/137] Update init.lua Fix typo in original. Co-authored-by: Luis G Estrades --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 7eb1d231..d9967930 100644 --- a/init.lua +++ b/init.lua @@ -403,7 +403,7 @@ local on_attach = function(_, bufnr) nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - nmap('gI', require('telescope.builtin').lsp_implementaitons, '[G]oto [I]mplementation') + nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') From 38a0f0323196c406e6e81d52052b2ac213bfe709 Mon Sep 17 00:00:00 2001 From: George Angelopoulos Date: Tue, 22 Aug 2023 07:17:15 +0300 Subject: [PATCH 099/137] Revert gitsigns keymaps but fix vimdiff and fugitive conflict Originally, the keymaps for jumping to next and previous git hunks were ]c and [c. This was changed in #323 (83b65a1) because they overwrote the built-in vimdiff keymaps. However, the more traditional solution is to have ]c and [c *extend* the built-in keymap. This is what fugitive and gitgutter have been doing for years. Gitsigns doesn't do this by itself, but it has a recommended keymap configuration on which the present patch is based: https://github.com/lewis6991/gitsigns.nvim#keymaps The only thing I've added is to have the keymaps work in visual mode as well, which is the same behavior as the built in vimdiff keymaps. --- init.lua | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 1332c3b9..8c213667 100644 --- a/init.lua +++ b/init.lua @@ -124,9 +124,20 @@ require('lazy').setup({ changedelete = { text = '~' }, }, on_attach = function(bufnr) - vim.keymap.set('n', 'gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' }) - vim.keymap.set('n', 'gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' }) - vim.keymap.set('n', 'ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) + vim.keymap.set('n', 'hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git hunk' }) + + -- don't override the built-in and fugitive keymaps + local gs = package.loaded.gitsigns + vim.keymap.set({'n', 'v'}, ']c', function() + if vim.wo.diff then return ']c' end + vim.schedule(function() gs.next_hunk() end) + return '' + end, {expr=true, buffer = bufnr, desc = "Jump to next hunk"}) + vim.keymap.set({'n', 'v'}, '[c', function() + if vim.wo.diff then return '[c' end + vim.schedule(function() gs.prev_hunk() end) + return '' + end, {expr=true, buffer = bufnr, desc = "Jump to previous hunk"}) end, }, }, From a347bb401e53e3c89ff7cc484c44864af5edcae1 Mon Sep 17 00:00:00 2001 From: George Angelopoulos Date: Sun, 27 Aug 2023 06:48:22 +0300 Subject: [PATCH 100/137] treesitter: ensure 'javascript' installed along with typescript and tsx This parser is actually needed for some *JSX* parsing, and since typescript and tsx are already getting installed, it makes sense to also install the javascript parser. --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 1332c3b9..ad993ea7 100644 --- a/init.lua +++ b/init.lua @@ -313,7 +313,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', 'javascript', 'typescript', 'vimdoc', 'vim' }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, From ac9b167860479982feddf9795c24165d75f1847b Mon Sep 17 00:00:00 2001 From: Dilshod Temirkhodjaev Date: Mon, 4 Sep 2023 17:36:28 +0500 Subject: [PATCH 101/137] Add telescope search resume key binding --- init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/init.lua b/init.lua index ad993ea7..be651546 100644 --- a/init.lua +++ b/init.lua @@ -308,6 +308,7 @@ vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) +vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]resume' }) -- [[ Configure Treesitter ]] -- See `:help nvim-treesitter` From f3f6a595a27af4a1762d5623ca9e8ce49b02e915 Mon Sep 17 00:00:00 2001 From: Luca Saccarola Date: Tue, 5 Sep 2023 14:12:56 +0200 Subject: [PATCH 102/137] docs: restructure README --- README.md | 65 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 4a312bc9..963883d4 100644 --- a/README.md +++ b/README.md @@ -20,35 +20,52 @@ Distribution Alternatives: ### Installation -* Backup your previous configuration (if any exists) +> **NOTE** +> [Backup](#FAQ) your previous configuration (if any exists) -### 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\` (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. +Requirements: +* Make sure to review the readmes of the plugins if you are experiencing errors. In particular: + * [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers. +* See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native` -### Git Clone Installation -* From a terminal cd/dir to: - `~/.config/nvim` (Linux) - `~/.config/nvim` (MacOS) - `%userprofile%\AppData\Local\nvim\` (Windows) +Neovim's configurations are located under the following paths, depending on your OS: -* 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 lazy.nvim to download files and set up the basics. -* Once the setup is complete, restart Neovim. -* **You're ready to go!** +| OS | PATH | +| :- | :--- | +| Linux | `~/.config/nvim` | +| MacOS | `~/.config/nvim` | +| Windows | `%userprofile%\AppData\Local\nvim\` | -* (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\` (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 +#### Archive Installation -Additional system requirements: -- Make sure to review the readmes of the plugins if you are experiencing errors. In particular: - - [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers. -- See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native` +* On the home/landing page for the project find the green "`<> CODE`" button click it and select `Local > Download ZIP`. +* Extract the archive to the appropriate configuration path. +* 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 the configuration path and then run: + +```sh +git clone https://github.com/nvim-lua/kickstart.nvim.git ~/.config/nvim +# OR +gh repo clone nvim-lua/kickstart.nvim +``` + +### Post Installation + +Run the following command and then **you are ready to go**! + +```sh +nvim --headless "+Lazy! sync" +qa +``` + +### Recommended Optional + +[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo (so that you have your own copy that you can modify) and then installing you can install to your machine using the methods above. + +> **NOTE** +> Your fork's url will be something like this: `https://github.com//kickstart.nvim.git` ### Configuration And Extension From 24885f24831434425145ae5c998cc25f00ffdc52 Mon Sep 17 00:00:00 2001 From: Luca Saccarola Date: Thu, 7 Sep 2023 18:36:05 +0200 Subject: [PATCH 103/137] docs: remove archive installation --- README.md | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 963883d4..49fa0f31 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Distribution Alternatives: ### Installation -> **NOTE** +> **NOTE** > [Backup](#FAQ) your previous configuration (if any exists) Requirements: @@ -32,24 +32,17 @@ Neovim's configurations are located under the following paths, depending on your | OS | PATH | | :- | :--- | -| Linux | `~/.config/nvim` | -| MacOS | `~/.config/nvim` | +| Linux | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | +| MacOS | `$XDG_CONFIG_HOME/nvim`, '~/.config/nvim` | | Windows | `%userprofile%\AppData\Local\nvim\` | -#### Archive Installation - -* On the home/landing page for the project find the green "`<> CODE`" button click it and select `Local > Download ZIP`. -* Extract the archive to the appropriate configuration path. -* 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 the configuration path and then run: +Clone kickstart.nvim: ```sh -git clone https://github.com/nvim-lua/kickstart.nvim.git ~/.config/nvim -# OR -gh repo clone nvim-lua/kickstart.nvim +# on Linux and Mac +git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim +# on Windows +git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\ ``` ### Post Installation @@ -60,7 +53,7 @@ Run the following command and then **you are ready to go**! nvim --headless "+Lazy! sync" +qa ``` -### Recommended Optional +### Recommended Steps [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo (so that you have your own copy that you can modify) and then installing you can install to your machine using the methods above. From 8443853cfece1763a2cd9ef677fdf6e80a590bbd Mon Sep 17 00:00:00 2001 From: Christopher Gillis <771603+Chris-Gillis@users.noreply.github.com> Date: Sat, 23 Sep 2023 12:10:51 -0400 Subject: [PATCH 104/137] Remove extra "r" Search Resume description --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index ea330eb1..cec3084e 100644 --- a/init.lua +++ b/init.lua @@ -319,7 +319,7 @@ vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) -vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]resume' }) +vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) -- [[ Configure Treesitter ]] -- See `:help nvim-treesitter` From 0340f772007d8a2fcca0cb172c0fc9b17ec33ea3 Mon Sep 17 00:00:00 2001 From: tcld Date: Sun, 24 Sep 2023 10:24:33 +0200 Subject: [PATCH 105/137] Add documentation for custom which-key groups --- init.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/init.lua b/init.lua index cec3084e..6f8f7146 100644 --- a/init.lua +++ b/init.lua @@ -438,6 +438,17 @@ local on_attach = function(_, bufnr) end, { desc = 'Format current buffer with LSP' }) end +-- document existing key chains +require('which-key').register({ + ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, + ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, + ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, + ['h'] = { name = 'More git', _ = 'which_key_ignore' }, + ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, + ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, + ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, +}) + -- Enable the following language servers -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. -- From aff064f714a701a565332d1e8758ab317387c1c9 Mon Sep 17 00:00:00 2001 From: Anthony Fiddes <11233666+Anthony-Fiddes@users.noreply.github.com> Date: Wed, 27 Sep 2023 16:44:03 -0700 Subject: [PATCH 106/137] Remove lazy-lock.json from .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index ea93edad..d699e1d6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,3 @@ tags test.sh .luarc.json nvim -lazy-lock.json From 878ec12318c675caaa3055b60c54294206fda9fd Mon Sep 17 00:00:00 2001 From: Emmanuel Chucks <31349069+emmanuelchucks@users.noreply.github.com> Date: Thu, 28 Sep 2023 05:57:53 +0000 Subject: [PATCH 107/137] fix(init.lua): indent blankline v3 setup --- init.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index cec3084e..8ec8d54e 100644 --- a/init.lua +++ b/init.lua @@ -170,10 +170,12 @@ require('lazy').setup({ 'lukas-reineke/indent-blankline.nvim', -- Enable `lukas-reineke/indent-blankline.nvim` -- See `:help indent_blankline.txt` - opts = { - char = '┊', - show_trailing_blankline_indent = false, - }, + config = function() + require('ibl').setup { + char = '┊', + show_trailing_blankline_indent = false, + } + end, }, -- "gc" to comment visual regions/lines From 7a58588a92f3b0c7c0d8ff92ce6ff278f6092d93 Mon Sep 17 00:00:00 2001 From: Lukas Reineke Date: Thu, 28 Sep 2023 23:11:05 +0900 Subject: [PATCH 108/137] fix: fix indent-blankline config --- init.lua | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 8ec8d54e..3a00dea2 100644 --- a/init.lua +++ b/init.lua @@ -170,12 +170,8 @@ require('lazy').setup({ 'lukas-reineke/indent-blankline.nvim', -- Enable `lukas-reineke/indent-blankline.nvim` -- See `:help indent_blankline.txt` - config = function() - require('ibl').setup { - char = '┊', - show_trailing_blankline_indent = false, - } - end, + main = "ibl", + opts = {}, }, -- "gc" to comment visual regions/lines From 4d5f24d6c1ecd1c77aded7fc4e59a329d27509b8 Mon Sep 17 00:00:00 2001 From: Ashraf Michail Date: Sat, 30 Sep 2023 00:35:22 +0000 Subject: [PATCH 109/137] Defer Treesitter setup to improve startup time of nvim {filename} --- init.lua | 113 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 58 insertions(+), 55 deletions(-) diff --git a/init.lua b/init.lua index 52571130..e5bc576e 100644 --- a/init.lua +++ b/init.lua @@ -321,69 +321,72 @@ vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = -- [[ Configure Treesitter ]] -- 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', 'javascript', 'typescript', 'vimdoc', 'vim' }, - - -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) - auto_install = false, - - highlight = { enable = true }, - indent = { enable = true }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = '', - node_incremental = '', - scope_incremental = '', - node_decremental = '', - }, - }, - textobjects = { - select = { +-- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}' +vim.defer_fn(function() + 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', 'javascript', 'typescript', 'vimdoc', 'vim' }, + + -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) + auto_install = false, + + highlight = { enable = true }, + indent = { enable = true }, + incremental_selection = { enable = true, - lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim keymaps = { - -- You can use the capture groups defined in textobjects.scm - ['aa'] = '@parameter.outer', - ['ia'] = '@parameter.inner', - ['af'] = '@function.outer', - ['if'] = '@function.inner', - ['ac'] = '@class.outer', - ['ic'] = '@class.inner', + init_selection = '', + node_incremental = '', + scope_incremental = '', + node_decremental = '', }, }, - move = { - enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_next_start = { - [']m'] = '@function.outer', - [']]'] = '@class.outer', + textobjects = { + select = { + enable = true, + lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ['aa'] = '@parameter.outer', + ['ia'] = '@parameter.inner', + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + }, }, - goto_next_end = { - [']M'] = '@function.outer', - [']['] = '@class.outer', + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + [']m'] = '@function.outer', + [']]'] = '@class.outer', + }, + goto_next_end = { + [']M'] = '@function.outer', + [']['] = '@class.outer', + }, + goto_previous_start = { + ['[m'] = '@function.outer', + ['[['] = '@class.outer', + }, + goto_previous_end = { + ['[M'] = '@function.outer', + ['[]'] = '@class.outer', + }, }, - goto_previous_start = { - ['[m'] = '@function.outer', - ['[['] = '@class.outer', - }, - goto_previous_end = { - ['[M'] = '@function.outer', - ['[]'] = '@class.outer', + swap = { + enable = true, + swap_next = { + ['a'] = '@parameter.inner', + }, + swap_previous = { + ['A'] = '@parameter.inner', + }, }, }, - swap = { - enable = true, - swap_next = { - ['a'] = '@parameter.inner', - }, - swap_previous = { - ['A'] = '@parameter.inner', - }, - }, - }, -} + } +end, 0) -- Diagnostic keymaps vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) From 313bd75ca04cb2cef48a79ac3ad697a1b9a2daab Mon Sep 17 00:00:00 2001 From: Chris Patti Date: Sat, 30 Sep 2023 20:06:22 -0400 Subject: [PATCH 110/137] Fix git clone instruction - separate code blocks for Windows and UNIX. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 49fa0f31..4d27756c 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,10 @@ Clone kickstart.nvim: ```sh # on Linux and Mac git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim +``` + + +``` # on Windows git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\ ``` From 6ffc5a169f090b0b4359deb6deff0b99ab123679 Mon Sep 17 00:00:00 2001 From: Anthony Fiddes <11233666+Anthony-Fiddes@users.noreply.github.com> Date: Fri, 6 Oct 2023 16:25:57 -0700 Subject: [PATCH 111/137] Fix Mason setup issue and run stylua. --- init.lua | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/init.lua b/init.lua index e5bc576e..4438ca19 100644 --- a/init.lua +++ b/init.lua @@ -81,7 +81,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 @@ -128,16 +128,24 @@ require('lazy').setup({ -- don't override the built-in and fugitive keymaps local gs = package.loaded.gitsigns - vim.keymap.set({'n', 'v'}, ']c', function() - if vim.wo.diff then return ']c' end - vim.schedule(function() gs.next_hunk() end) + vim.keymap.set({ 'n', 'v' }, ']c', function() + if vim.wo.diff then + return ']c' + end + vim.schedule(function() + gs.next_hunk() + end) return '' - end, {expr=true, buffer = bufnr, desc = "Jump to next hunk"}) - vim.keymap.set({'n', 'v'}, '[c', function() - if vim.wo.diff then return '[c' end - vim.schedule(function() gs.prev_hunk() end) + end, { expr = true, buffer = bufnr, desc = 'Jump to next hunk' }) + vim.keymap.set({ 'n', 'v' }, '[c', function() + if vim.wo.diff then + return '[c' + end + vim.schedule(function() + gs.prev_hunk() + end) return '' - end, {expr=true, buffer = bufnr, desc = "Jump to previous hunk"}) + end, { expr = true, buffer = bufnr, desc = 'Jump to previous hunk' }) end, }, }, @@ -170,7 +178,7 @@ require('lazy').setup({ 'lukas-reineke/indent-blankline.nvim', -- Enable `lukas-reineke/indent-blankline.nvim` -- See `:help indent_blankline.txt` - main = "ibl", + main = 'ibl', opts = {}, }, @@ -326,10 +334,10 @@ vim.defer_fn(function() 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', 'javascript', 'typescript', 'vimdoc', 'vim' }, - + -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, - + highlight = { enable = true }, indent = { enable = true }, incremental_selection = { @@ -440,7 +448,7 @@ local on_attach = function(_, bufnr) end -- document existing key chains -require('which-key').register({ +require('which-key').register { ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, @@ -448,7 +456,7 @@ require('which-key').register({ ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, -}) +} -- Enable the following language servers -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. @@ -481,6 +489,11 @@ require('neodev').setup() local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) +-- mason-lspconfig requires that these setup functions are called in this order +-- before setting up the servers. +require('mason').setup() +require('mason-lspconfig').setup() + -- Ensure the servers above are installed local mason_lspconfig = require 'mason-lspconfig' @@ -496,7 +509,7 @@ mason_lspconfig.setup_handlers { settings = servers[server_name], filetypes = (servers[server_name] or {}).filetypes, } - end + end, } -- [[ Configure nvim-cmp ]] From 21b175d21b5ff07a7b5cf8e846cad1c31d20547c Mon Sep 17 00:00:00 2001 From: amtoine Date: Sat, 7 Oct 2023 13:49:47 +0200 Subject: [PATCH 112/137] remove spaces in empty lines --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index e5bc576e..5c8372a6 100644 --- a/init.lua +++ b/init.lua @@ -326,10 +326,10 @@ vim.defer_fn(function() 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', 'javascript', 'typescript', 'vimdoc', 'vim' }, - + -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, - + highlight = { enable = true }, indent = { enable = true }, incremental_selection = { From 36224daa1bfff3b2fe7067952f305111f99b356f Mon Sep 17 00:00:00 2001 From: Anthony Fiddes <11233666+Anthony-Fiddes@users.noreply.github.com> Date: Sat, 7 Oct 2023 16:14:26 -0700 Subject: [PATCH 113/137] Move mason setup up further This helps if a user needs to find a mason executable --- init.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index 4438ca19..11f55d05 100644 --- a/init.lua +++ b/init.lua @@ -458,6 +458,11 @@ require('which-key').register { ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, } +-- mason-lspconfig requires that these setup functions are called in this order +-- before setting up the servers. +require('mason').setup() +require('mason-lspconfig').setup() + -- Enable the following language servers -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. -- @@ -489,11 +494,6 @@ require('neodev').setup() local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) --- mason-lspconfig requires that these setup functions are called in this order --- before setting up the servers. -require('mason').setup() -require('mason-lspconfig').setup() - -- Ensure the servers above are installed local mason_lspconfig = require 'mason-lspconfig' From 01ed2525bbff69756cd867673dea4dd9e54dfdee Mon Sep 17 00:00:00 2001 From: Ashraf Michail Date: Tue, 3 Oct 2023 13:22:25 +0000 Subject: [PATCH 114/137] Fix bash errors --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 11f55d05..ee1f390e 100644 --- a/init.lua +++ b/init.lua @@ -333,7 +333,7 @@ vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = vim.defer_fn(function() 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', 'javascript', 'typescript', 'vimdoc', 'vim' }, + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, From c27b05467a80a36a2be757a84384ffba86221094 Mon Sep 17 00:00:00 2001 From: Pedro Santayana Date: Sat, 7 Oct 2023 22:34:24 -0300 Subject: [PATCH 115/137] docs: fix misstype on README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4d27756c..433a51de 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Neovim's configurations are located under the following paths, depending on your | OS | PATH | | :- | :--- | | Linux | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | -| MacOS | `$XDG_CONFIG_HOME/nvim`, '~/.config/nvim` | +| MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | | Windows | `%userprofile%\AppData\Local\nvim\` | Clone kickstart.nvim: From db7189f35c33f9b7e95a1602ff4d8dffe5cbf741 Mon Sep 17 00:00:00 2001 From: Alvaro-Kothe Date: Tue, 10 Oct 2023 19:57:49 -0300 Subject: [PATCH 116/137] Fix help for indent-blankline plugin Since version 3 `:help indent_blankline` no longer works. Replace it with `:help ibl`. --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index ee1f390e..fb080807 100644 --- a/init.lua +++ b/init.lua @@ -177,7 +177,7 @@ require('lazy').setup({ -- Add indentation guides even on blank lines 'lukas-reineke/indent-blankline.nvim', -- Enable `lukas-reineke/indent-blankline.nvim` - -- See `:help indent_blankline.txt` + -- See `:help ibl` main = 'ibl', opts = {}, }, From 5d8921990bf2fab9a1c9dc0d74bf1bbe1b6dc980 Mon Sep 17 00:00:00 2001 From: Theo P Date: Fri, 13 Oct 2023 16:21:10 +0900 Subject: [PATCH 117/137] feat(lsp): use Telescope builtin functions for LSP definition and type definition --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index fb080807..a7667ddc 100644 --- a/init.lua +++ b/init.lua @@ -422,10 +422,10 @@ local on_attach = function(_, bufnr) nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') - nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') + nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') + nmap('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') From 68b1981f0298f5b92b68acc00f42eda5702c4044 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Wed, 25 Oct 2023 21:46:24 +0200 Subject: [PATCH 118/137] Update README Post Installation steps Change the recommendation to just run nvim normally instead of the headless mode for the first run. This will show Lazy UI updating the plugins which would match what the video show and may be easier to understand what is going on thant the silent headless run. --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 433a51de..f8198270 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,15 @@ git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\L ### Post Installation -Run the following command and then **you are ready to go**! +Start Neovim + +```sh +nvim +``` + +The `Lazy` plugin manager will start automatically on the first run and install the configured plugins - as can be seen in the introduction video. After the installation is complete you can press `q` to close the `Lazy` UI and **you are ready to go**! Next time you run nvim `Lazy` will no longer show up. + +If you would prefer to hide this step and run the plugin sync from the command line, you can use: ```sh nvim --headless "+Lazy! sync" +qa From 0dd934ee017cdd52bc91b4e5dd9f4e4e31a5d98b Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Sat, 28 Oct 2023 23:33:10 +0200 Subject: [PATCH 119/137] README.md: add a note about NVIM_APPNAME in the FAQ section --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index f8198270..9652d708 100644 --- a/README.md +++ b/README.md @@ -149,6 +149,13 @@ Each PR, especially those which increase the line count, should have a descripti * You should back it up, then delete all files associated with it. * This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/` * You may also want to look at the [migration guide for lazy.nvim](https://github.com/folke/lazy.nvim#-migration-guide) +* Can I keep my existing configuration in parallel to kickstart? + * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` to maintain multiple configurations. For example you can install the kickstart configuration in `~/.config/nvim-kickstart` and create a script `~/bin/nvim-kickstart`: + ``` + #!/bin/sh + exec env NVIM_APPNAME=nvim-kickstart nvim "$@" + ``` + When you run Neovim with `nvim-kickstart` it will use the alternative config directory and the matching local directory: `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim distribution that you would like to try out. * What if I want to "uninstall" this configuration: * See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information * Are there any cool videos about this plugin? From 4d2cf48fb6b620a5b4ae30f6b2a0b3b521cdbce8 Mon Sep 17 00:00:00 2001 From: n-a11s Date: Fri, 3 Nov 2023 13:47:30 +0100 Subject: [PATCH 120/137] Update README.md Added information on where to install if you use Powershell in windows. Since CMD and Powershell work differently. `%userprofile%` only works for the CMD application. `$env:USERPROFILE` works in Powershell. --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9652d708..e2d9ea84 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,8 @@ Neovim's configurations are located under the following paths, depending on your | :- | :--- | | Linux | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | | MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | -| Windows | `%userprofile%\AppData\Local\nvim\` | +| Windows (cmd)| `%userprofile%\AppData\Local\nvim\` | +| Windows (powershell)| `$env:USERPROFILE\AppData\Local\nvim\` | Clone kickstart.nvim: @@ -45,10 +46,16 @@ git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HO ``` -# on Windows +# on Windows (cmd) git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\ ``` +``` +# on Windows (powershell) +git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\ +``` + + ### Post Installation Start Neovim From 1ad1ec250907acd6e1c593f9990eb61430aa7c74 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Fri, 3 Nov 2023 19:04:25 +0100 Subject: [PATCH 121/137] README.md: Added a FAQ: why is init.lua a single file --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 9652d708..1f8e6f40 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,16 @@ Each PR, especially those which increase the line count, should have a descripti * 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. +* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files? + * The main purpose of kickstart is to serve as a teaching tool and a reference + configuration that someone can easily `git clone` as a basis for their own. + As you progress in learning Neovim and Lua, you might consider splitting `init.lua` + into smaller parts. A fork of kickstart that does this while maintaining the exact + same functionality is available here: + * [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim) + * Discussions on this topic can be found here: + * [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218) + * [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473) ### Windows Installation From 0fda9af7c94a2c3687a5123a7cf254613de45a46 Mon Sep 17 00:00:00 2001 From: Sebastian Lara Menares Date: Mon, 6 Nov 2023 11:10:16 -0300 Subject: [PATCH 122/137] add Telescope live_grep on Git root --- init.lua | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index a7667ddc..a301a94e 100644 --- a/init.lua +++ b/init.lua @@ -308,6 +308,40 @@ require('telescope').setup { -- Enable telescope fzf native, if installed pcall(require('telescope').load_extension, 'fzf') +-- Telescope live_grep in git root +-- Function to find the git root directory based on the current buffer's path +local function find_git_root() + -- Use the current buffer's path as the starting point for the git search + local current_file = vim.api.nvim_buf_get_name(0) + -- If the buffer is not associated with a file, return nil + if current_file == "" then + print("Buffer is not associated with a file") + return nil + end + -- Extract the directory from the current file's path + local current_dir = vim.fn.fnamemodify(current_file, ":h") + -- Find the Git root directory from the current file's path + print("git -C " .. vim.fn.escape(current_dir, " ") .. " rev-parse --show-toplevel") + local git_root = vim.fn.systemlist("git -C " .. vim.fn.escape(current_dir, " ") .. " rev-parse --show-toplevel")[1] + if vim.v.shell_error ~= 0 then + print("Not a git repository") + return nil + end + return git_root +end + +-- Custom live_grep function to search in git root +local function live_grep_git_root() + local git_root = find_git_root() + if git_root then + require('telescope.builtin').live_grep({ + search_dirs = {git_root}, + }) + end +end + +vim.api.nvim_create_user_command('LiveGrepGitRoot', live_grep_git_root, {}) + -- See `:help telescope.builtin` vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) vim.keymap.set('n', '', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) @@ -323,7 +357,8 @@ vim.keymap.set('n', 'gf', require('telescope.builtin').git_files, { desc 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' }) -vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) +vim.keymap.set('n', 'sG', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) +vim.keymap.set('n', 'sg', ':LiveGrepGitRoot', { desc = '[S]earch by [G]rep on Git Root' }) vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) From 5ce4f38e1e9b62c7e2477b2e21af08ecac232bc5 Mon Sep 17 00:00:00 2001 From: Sebastian Lara Menares Date: Mon, 6 Nov 2023 15:29:09 -0300 Subject: [PATCH 123/137] change keymap to not disrupt existing users of Search by Grep --- init.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index a301a94e..b4b83051 100644 --- a/init.lua +++ b/init.lua @@ -321,7 +321,6 @@ local function find_git_root() -- Extract the directory from the current file's path local current_dir = vim.fn.fnamemodify(current_file, ":h") -- Find the Git root directory from the current file's path - print("git -C " .. vim.fn.escape(current_dir, " ") .. " rev-parse --show-toplevel") local git_root = vim.fn.systemlist("git -C " .. vim.fn.escape(current_dir, " ") .. " rev-parse --show-toplevel")[1] if vim.v.shell_error ~= 0 then print("Not a git repository") @@ -357,8 +356,8 @@ vim.keymap.set('n', 'gf', require('telescope.builtin').git_files, { desc 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' }) -vim.keymap.set('n', 'sG', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) -vim.keymap.set('n', 'sg', ':LiveGrepGitRoot', { desc = '[S]earch by [G]rep on Git Root' }) +vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) +vim.keymap.set('n', 'sG', ':LiveGrepGitRoot', { desc = '[S]earch by [G]rep on Git Root' }) vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) From 1d14453024dcb8e2025ba3a14d5c3f1daa384e63 Mon Sep 17 00:00:00 2001 From: Sebastian Lara Menares Date: Mon, 6 Nov 2023 22:29:05 -0300 Subject: [PATCH 124/137] Live Grep from Git root falls back to cwd on special buffers --- init.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index b4b83051..0976a461 100644 --- a/init.lua +++ b/init.lua @@ -313,18 +313,21 @@ pcall(require('telescope').load_extension, 'fzf') local function find_git_root() -- Use the current buffer's path as the starting point for the git search local current_file = vim.api.nvim_buf_get_name(0) + local current_dir + local cwd = vim.fn.getcwd() -- If the buffer is not associated with a file, return nil if current_file == "" then - print("Buffer is not associated with a file") - return nil + current_dir = cwd + else + -- Extract the directory from the current file's path + current_dir = vim.fn.fnamemodify(current_file, ":h") end - -- Extract the directory from the current file's path - local current_dir = vim.fn.fnamemodify(current_file, ":h") + -- Find the Git root directory from the current file's path local git_root = vim.fn.systemlist("git -C " .. vim.fn.escape(current_dir, " ") .. " rev-parse --show-toplevel")[1] if vim.v.shell_error ~= 0 then - print("Not a git repository") - return nil + print("Not a git repository. Searching on current working directory") + return cwd end return git_root end From f23484cf88197ac38574f4fd4965cc2c17263f20 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Tue, 7 Nov 2023 11:18:15 +0100 Subject: [PATCH 125/137] init.lua: move diagnostic keymaps together with other keymaps --- init.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 0976a461..225ad21a 100644 --- a/init.lua +++ b/init.lua @@ -281,6 +281,12 @@ vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) 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 }) +-- Diagnostic keymaps +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) +vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) + -- [[ Highlight on yank ]] -- See `:help vim.highlight.on_yank()` local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) @@ -433,12 +439,6 @@ vim.defer_fn(function() } end, 0) --- Diagnostic keymaps -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) -vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) - -- [[ Configure LSP ]] -- This function gets run when an LSP connects to a particular buffer. local on_attach = function(_, bufnr) From c8dd8e7e0cd5d3d1d3760eac908513de1be0b37c Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Tue, 7 Nov 2023 11:27:14 +0100 Subject: [PATCH 126/137] init.lua: minor edits of section comments for consistency --- init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 225ad21a..748e7f81 100644 --- a/init.lua +++ b/init.lua @@ -37,13 +37,14 @@ I hope you enjoy your Neovim journey, P.S. You can delete this when you're done too. It's your config now :) --]] + -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' --- Install package manager +-- [[ Install `lazy.nvim` plugin manager ]] -- https://github.com/folke/lazy.nvim -- `:help lazy.nvim.txt` for more info local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' @@ -59,6 +60,7 @@ if not vim.loop.fs_stat(lazypath) then end vim.opt.rtp:prepend(lazypath) +-- [[ Configure plugins ]] -- NOTE: Here is where you install your plugins. -- You can configure plugins using the `config` key. -- From af4f51b2cd6cfb2511d34adc99900110f4d3916b Mon Sep 17 00:00:00 2001 From: Shashwat Agrawal Date: Sat, 11 Nov 2023 20:31:05 +0530 Subject: [PATCH 127/137] fix(auto-completion): ensure first menu item is selected by default --- init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init.lua b/init.lua index 748e7f81..385b19a0 100644 --- a/init.lua +++ b/init.lua @@ -564,6 +564,9 @@ cmp.setup { luasnip.lsp_expand(args.body) end, }, + completion = { + completeopt = 'menu,menuone,noinsert' + }, mapping = cmp.mapping.preset.insert { [''] = cmp.mapping.select_next_item(), [''] = cmp.mapping.select_prev_item(), From 711e5976dd83f0bdb904e3d884375b79c89f0e2a Mon Sep 17 00:00:00 2001 From: j-hui Date: Mon, 13 Nov 2023 15:46:34 -0500 Subject: [PATCH 128/137] init.lua: remove 'legacy' tag from fidget.nvim --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 385b19a0..3a98da03 100644 --- a/init.lua +++ b/init.lua @@ -88,7 +88,7 @@ require('lazy').setup({ -- Useful status updates for LSP -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', tag = 'legacy', opts = {} }, + { 'j-hui/fidget.nvim', opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! 'folke/neodev.nvim', From ee9790b381416781063d0de6653b303f10ed89b0 Mon Sep 17 00:00:00 2001 From: Tommy Williams Date: Fri, 24 Nov 2023 09:55:19 -0700 Subject: [PATCH 129/137] option to reduce noisy Lua_LS's missing-fields warnings (#511) --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index 3a98da03..e7f1eec4 100644 --- a/init.lua +++ b/init.lua @@ -522,6 +522,8 @@ local servers = { Lua = { workspace = { checkThirdParty = false }, telemetry = { enable = false }, + -- NOTE: toggle below to ignore Lua_LS's noisy `missing-fields` warnings + -- diagnostics = { disable = { 'missing-fields' } }, }, }, } From 14cf319dbd63ef4bedf9cf219c3732c568718996 Mon Sep 17 00:00:00 2001 From: matt <55467261+mattwyd@users.noreply.github.com> Date: Wed, 29 Nov 2023 19:34:43 -0500 Subject: [PATCH 130/137] Update README.md (#520) --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7f54ce88..1979e9ec 100644 --- a/README.md +++ b/README.md @@ -39,19 +39,19 @@ Neovim's configurations are located under the following paths, depending on your Clone kickstart.nvim: -```sh # on Linux and Mac +```sh git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim ``` -``` # on Windows (cmd) +``` git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\ ``` -``` # on Windows (powershell) +``` git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\ ``` From afafc9ab194be254467b4cc8be049fc33fe27b14 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Thu, 30 Nov 2023 10:04:27 +0100 Subject: [PATCH 131/137] README.md: update install section formatting (#523) --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1979e9ec..36c13861 100644 --- a/README.md +++ b/README.md @@ -39,18 +39,17 @@ Neovim's configurations are located under the following paths, depending on your Clone kickstart.nvim: -# on Linux and Mac +- on Linux and Mac ```sh git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim ``` - -# on Windows (cmd) +- on Windows (cmd) ``` git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\ ``` -# on Windows (powershell) +- on Windows (powershell) ``` git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\ ``` From 39ae0829acea66175721fcf48695c7df6db040b9 Mon Sep 17 00:00:00 2001 From: Sudo <788991+wadkar@users.noreply.github.com> Date: Fri, 1 Dec 2023 07:30:55 +0900 Subject: [PATCH 132/137] Use alias instead of a wrapper script (#524) It is much easier to stick an alias statement in `~/.{z,ba}shrc` than create a script, invoke another instance of interpreter and then run neovim --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 36c13861..78ac6df0 100644 --- a/README.md +++ b/README.md @@ -156,12 +156,11 @@ Each PR, especially those which increase the line count, should have a descripti * This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/` * You may also want to look at the [migration guide for lazy.nvim](https://github.com/folke/lazy.nvim#-migration-guide) * Can I keep my existing configuration in parallel to kickstart? - * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` to maintain multiple configurations. For example you can install the kickstart configuration in `~/.config/nvim-kickstart` and create a script `~/bin/nvim-kickstart`: + * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` to maintain multiple configurations. For example you can install the kickstart configuration in `~/.config/nvim-kickstart` and create an alias: ``` - #!/bin/sh - exec env NVIM_APPNAME=nvim-kickstart nvim "$@" + alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim' ``` - When you run Neovim with `nvim-kickstart` it will use the alternative config directory and the matching local directory: `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim distribution that you would like to try out. + When you run Neovim using `nvim-kickstart` alias it will use the alternative config directory and the matching local directory `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim distribution that you would like to try out. * What if I want to "uninstall" this configuration: * See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information * Are there any cool videos about this plugin? From 3ca08acf0e9023b3f8b602a5db2dd00cebdcbfbc Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Sat, 2 Dec 2023 22:27:13 +0100 Subject: [PATCH 133/137] Add a github action on pull request to check lua formatting (#526) GitHub Action used: https://github.com/marketplace/actions/stylua This runs `stylua --check` on a PR and it will show success or failure. The suggested stylua changes can be inspected when clicking on the details. The PR can still be merged even if the check fails. --- .github/workflows/stylua.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/stylua.yml diff --git a/.github/workflows/stylua.yml b/.github/workflows/stylua.yml new file mode 100644 index 00000000..e189fe01 --- /dev/null +++ b/.github/workflows/stylua.yml @@ -0,0 +1,18 @@ +# Check Lua Formatting +name: Check Lua Formatting +on: pull_request + +jobs: + stylua-check: + name: Stylua Check + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v2 + - name: Stylua Check + uses: JohnnyMorganz/stylua-action@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + version: latest + args: --check . + From 12bd68e8b9bc98242084bce55236d2bf9fe299b1 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Sun, 3 Dec 2023 20:23:39 +0100 Subject: [PATCH 134/137] Run stylua (#525) --- init.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/init.lua b/init.lua index e7f1eec4..94f7cf4e 100644 --- a/init.lua +++ b/init.lua @@ -324,17 +324,17 @@ local function find_git_root() local current_dir local cwd = vim.fn.getcwd() -- If the buffer is not associated with a file, return nil - if current_file == "" then + if current_file == '' then current_dir = cwd else -- Extract the directory from the current file's path - current_dir = vim.fn.fnamemodify(current_file, ":h") + current_dir = vim.fn.fnamemodify(current_file, ':h') end -- Find the Git root directory from the current file's path - local git_root = vim.fn.systemlist("git -C " .. vim.fn.escape(current_dir, " ") .. " rev-parse --show-toplevel")[1] + local git_root = vim.fn.systemlist('git -C ' .. vim.fn.escape(current_dir, ' ') .. ' rev-parse --show-toplevel')[1] if vim.v.shell_error ~= 0 then - print("Not a git repository. Searching on current working directory") + print 'Not a git repository. Searching on current working directory' return cwd end return git_root @@ -344,9 +344,9 @@ end local function live_grep_git_root() local git_root = find_git_root() if git_root then - require('telescope.builtin').live_grep({ - search_dirs = {git_root}, - }) + require('telescope.builtin').live_grep { + search_dirs = { git_root }, + } end end @@ -567,7 +567,7 @@ cmp.setup { end, }, completion = { - completeopt = 'menu,menuone,noinsert' + completeopt = 'menu,menuone,noinsert', }, mapping = cmp.mapping.preset.insert { [''] = cmp.mapping.select_next_item(), From f8c8b08bc15b2bac590b3c397db3b466f7fb1d0b Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Mon, 4 Dec 2023 16:35:54 +0100 Subject: [PATCH 135/137] Add gitsigns recommended keymaps (#531) * Import gitsigns README.md recommended keymaps (and apply stylua) the previously added visual mode for ]c [c is kept. * Add gitsigns keymap descriptions --- init.lua | 59 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 8 deletions(-) diff --git a/init.lua b/init.lua index 94f7cf4e..76ddd45a 100644 --- a/init.lua +++ b/init.lua @@ -126,11 +126,16 @@ require('lazy').setup({ changedelete = { text = '~' }, }, on_attach = function(bufnr) - vim.keymap.set('n', 'hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git hunk' }) - - -- don't override the built-in and fugitive keymaps local gs = package.loaded.gitsigns - vim.keymap.set({ 'n', 'v' }, ']c', function() + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map({ 'n', 'v' }, ']c', function() if vim.wo.diff then return ']c' end @@ -138,8 +143,9 @@ require('lazy').setup({ gs.next_hunk() end) return '' - end, { expr = true, buffer = bufnr, desc = 'Jump to next hunk' }) - vim.keymap.set({ 'n', 'v' }, '[c', function() + end, { expr = true, desc = 'Jump to next hunk' }) + + map({ 'n', 'v' }, '[c', function() if vim.wo.diff then return '[c' end @@ -147,7 +153,37 @@ require('lazy').setup({ gs.prev_hunk() end) return '' - end, { expr = true, buffer = bufnr, desc = 'Jump to previous hunk' }) + end, { expr = true, desc = 'Jump to previous hunk' }) + + -- Actions + -- visual mode + map('v', 'hs', function() + gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'stage git hunk' }) + map('v', 'hr', function() + gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'reset git hunk' }) + -- normal mode + map('n', 'hs', gs.stage_hunk, { desc = 'git stage hunk' }) + map('n', 'hr', gs.reset_hunk, { desc = 'git reset hunk' }) + map('n', 'hS', gs.stage_buffer, { desc = 'git Stage buffer' }) + map('n', 'hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' }) + map('n', 'hR', gs.reset_buffer, { desc = 'git Reset buffer' }) + map('n', 'hp', gs.preview_hunk, { desc = 'preview git hunk' }) + map('n', 'hb', function() + gs.blame_line { full = false } + end, { desc = 'git blame line' }) + map('n', 'hd', gs.diffthis, { desc = 'git diff against index' }) + map('n', 'hD', function() + gs.diffthis '~' + end, { desc = 'git diff against last commit' }) + + -- Toggles + map('n', 'tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' }) + map('n', 'td', gs.toggle_deleted, { desc = 'toggle git show deleted' }) + + -- Text object + map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', { desc = 'select git hunk' }) end, }, }, @@ -491,11 +527,18 @@ require('which-key').register { ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, - ['h'] = { name = 'More git', _ = 'which_key_ignore' }, + ['h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' }, ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, + ['t'] = { name = '[T]oggle', _ = 'which_key_ignore' }, ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, } +-- register which-key VISUAL mode +-- required for visual hs (hunk stage) to work +require('which-key').register({ + [''] = { name = 'VISUAL ' }, + ['h'] = { 'Git [H]unk' }, +}, { mode = 'v' }) -- mason-lspconfig requires that these setup functions are called in this order -- before setting up the servers. From 3824342d107850dfe5b179d0a39e0d8fcd54411d Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Mon, 4 Dec 2023 16:45:01 +0100 Subject: [PATCH 136/137] Adds two essential telescope keymaps (#528) * Added keymap for select Telescope picker * Added keymap for search in all open files --- init.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/init.lua b/init.lua index 76ddd45a..36cc9a52 100644 --- a/init.lua +++ b/init.lua @@ -399,6 +399,14 @@ vim.keymap.set('n', '/', function() }) end, { desc = '[/] Fuzzily search in current buffer' }) +local function telescope_live_grep_open_files() + require('telescope.builtin').live_grep { + grep_open_files = true, + prompt_title = 'Live Grep in Open Files', + } +end +vim.keymap.set('n', 's/', telescope_live_grep_open_files, { desc = '[S]earch [/] in Open Files' }) +vim.keymap.set('n', 'ss', require('telescope.builtin').builtin, { desc = '[S]earch [S]elect Telescope' }) 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' }) From 76c5b1ec57f40d17ac787feb018817a802e24bb6 Mon Sep 17 00:00:00 2001 From: Shashwat Agrawal <72117025+ShashwatAgrawal20@users.noreply.github.com> Date: Fri, 8 Dec 2023 18:44:06 +0530 Subject: [PATCH 137/137] feat(cmp): path completion feature (#536) --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index 36cc9a52..cf4a3790 100644 --- a/init.lua +++ b/init.lua @@ -105,6 +105,7 @@ require('lazy').setup({ -- Adds LSP completion capabilities 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-path', -- Adds a number of user-friendly snippets 'rafamadriz/friendly-snippets', @@ -652,6 +653,7 @@ cmp.setup { sources = { { name = 'nvim_lsp' }, { name = 'luasnip' }, + { name = 'path' }, }, }