Merge branch 'nvim-lua:master' into dev
This commit is contained in:
		
						commit
						cd5cf92f5b
					
				
							
								
								
									
										102
									
								
								README.md
								
								
								
								
							
							
						
						
									
										102
									
								
								README.md
								
								
								
								
							| 
						 | 
				
			
			@ -24,6 +24,7 @@ If you are experiencing issues, please make sure you have the latest versions.
 | 
			
		|||
External Requirements:
 | 
			
		||||
- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`)
 | 
			
		||||
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation)
 | 
			
		||||
- Clipboard tool (xclip/xsel/win32yank or other depending on platform)
 | 
			
		||||
- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons
 | 
			
		||||
  - if you have it set `vim.g.have_nerd_font` in `init.lua` to true
 | 
			
		||||
- Language Setup:
 | 
			
		||||
| 
						 | 
				
			
			@ -45,8 +46,8 @@ Neovim's configurations are located under the following paths, depending on your
 | 
			
		|||
| OS | PATH |
 | 
			
		||||
| :- | :--- |
 | 
			
		||||
| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
 | 
			
		||||
| Windows (cmd)| `%userprofile%\AppData\Local\nvim\` |
 | 
			
		||||
| Windows (powershell)| `$env:USERPROFILE\AppData\Local\nvim\` |
 | 
			
		||||
| Windows (cmd)| `%localappdata%\nvim\` |
 | 
			
		||||
| Windows (powershell)| `$env:LOCALAPPDATA\nvim\` |
 | 
			
		||||
 | 
			
		||||
#### Recommended Step
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -76,13 +77,13 @@ git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HO
 | 
			
		|||
If you're using `cmd.exe`:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\
 | 
			
		||||
git clone https://github.com/nvim-lua/kickstart.nvim.git %localappdata%\nvim\
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
If you're using `powershell.exe`
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\
 | 
			
		||||
git clone https://github.com/nvim-lua/kickstart.nvim.git $env:LOCALAPPDATA\nvim\
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
</details>
 | 
			
		||||
| 
						 | 
				
			
			@ -99,71 +100,10 @@ That's it! Lazy will install all the plugins you have. Use `:Lazy` to view
 | 
			
		|||
current plugin status. Hit `q` to close the window.
 | 
			
		||||
 | 
			
		||||
Read through the `init.lua` file in your configuration folder for more
 | 
			
		||||
information about extending and exploring Neovim.
 | 
			
		||||
information about extending and exploring Neovim. That also includes
 | 
			
		||||
examples of adding popularly requested plugins.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#### Examples of adding popularly requested plugins
 | 
			
		||||
 | 
			
		||||
NOTE: You'll need to uncomment the line in the init.lua that turns on loading custom plugins.
 | 
			
		||||
 | 
			
		||||
<details>
 | 
			
		||||
  <summary>Adding autopairs</summary>
 | 
			
		||||
 | 
			
		||||
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).
 | 
			
		||||
 | 
			
		||||
In the file: `lua/custom/plugins/autopairs.lua`, add:
 | 
			
		||||
 | 
			
		||||
```lua
 | 
			
		||||
-- File: lua/custom/plugins/autopairs.lua
 | 
			
		||||
 | 
			
		||||
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,
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
</details>
 | 
			
		||||
<details>
 | 
			
		||||
  <summary>Adding a file tree plugin</summary>
 | 
			
		||||
 | 
			
		||||
This will install the tree plugin and add the command `:Neotree` for you.
 | 
			
		||||
For more information, see the documentation at
 | 
			
		||||
[neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim).
 | 
			
		||||
 | 
			
		||||
In the file: `lua/custom/plugins/filetree.lua`, add:
 | 
			
		||||
 | 
			
		||||
```lua
 | 
			
		||||
-- File: lua/custom/plugins/filetree.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 ()
 | 
			
		||||
    require('neo-tree').setup {}
 | 
			
		||||
  end,
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
</details>
 | 
			
		||||
 | 
			
		||||
### Getting Started
 | 
			
		||||
 | 
			
		||||
[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o)
 | 
			
		||||
| 
						 | 
				
			
			@ -243,7 +183,7 @@ wsl --install
 | 
			
		|||
wsl
 | 
			
		||||
sudo add-apt-repository ppa:neovim-ppa/unstable -y
 | 
			
		||||
sudo apt update
 | 
			
		||||
sudo apt install make gcc ripgrep unzip neovim
 | 
			
		||||
sudo apt install make gcc ripgrep unzip git xclip neovim
 | 
			
		||||
```
 | 
			
		||||
</details>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -253,23 +193,37 @@ sudo apt install make gcc ripgrep unzip neovim
 | 
			
		|||
```
 | 
			
		||||
sudo add-apt-repository ppa:neovim-ppa/unstable -y
 | 
			
		||||
sudo apt update
 | 
			
		||||
sudo apt install make gcc ripgrep unzip git neovim
 | 
			
		||||
sudo apt install make gcc ripgrep unzip git xclip neovim
 | 
			
		||||
```
 | 
			
		||||
</details>
 | 
			
		||||
<details><summary>Debian Install Steps</summary>
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
sudo apt update
 | 
			
		||||
sudo apt install make gcc ripgrep unzip git
 | 
			
		||||
echo "deb https://deb.debian.org/debian unstable main" | sudo tee -a /etc/apt/sources.list
 | 
			
		||||
sudo apt update
 | 
			
		||||
sudo apt install -t unstable neovim
 | 
			
		||||
sudo apt install make gcc ripgrep unzip git xclip curl
 | 
			
		||||
 | 
			
		||||
# Now we install nvim
 | 
			
		||||
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz
 | 
			
		||||
sudo rm -rf /opt/nvim-linux64
 | 
			
		||||
sudo mkdir -p /opt/nvim-linux64
 | 
			
		||||
sudo chmod a+rX /opt/nvim-linux64
 | 
			
		||||
sudo tar -C /opt -xzf nvim-linux64.tar.gz
 | 
			
		||||
 | 
			
		||||
# make it available in /usr/local/bin, distro installs to /usr/bin
 | 
			
		||||
sudo ln -sf /opt/nvim-linux64/bin/nvim /usr/local/bin/
 | 
			
		||||
```
 | 
			
		||||
</details>
 | 
			
		||||
<details><summary>Fedora Install Steps</summary>
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
sudo dnf install -y gcc make git ripgrep fd-find neovim
 | 
			
		||||
sudo dnf install -y gcc make git ripgrep fd-find unzip neovim
 | 
			
		||||
```
 | 
			
		||||
</details>
 | 
			
		||||
 | 
			
		||||
<details><summary>Arch Install Steps</summary>
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim
 | 
			
		||||
```
 | 
			
		||||
</details>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										117
									
								
								init.lua
								
								
								
								
							
							
						
						
									
										117
									
								
								init.lua
								
								
								
								
							| 
						 | 
				
			
			@ -90,7 +90,7 @@ P.S. You can delete this when you're done too. It's your config now! :)
 | 
			
		|||
vim.g.mapleader = ' '
 | 
			
		||||
vim.g.maplocalleader = ' '
 | 
			
		||||
 | 
			
		||||
-- Set to true if you have a Nerd Font installed
 | 
			
		||||
-- Set to true if you have a Nerd Font installed and selected in the terminal
 | 
			
		||||
vim.g.have_nerd_font = false
 | 
			
		||||
 | 
			
		||||
-- [[ Setting options ]]
 | 
			
		||||
| 
						 | 
				
			
			@ -116,9 +116,12 @@ vim.opt.mouse = 'a'
 | 
			
		|||
vim.opt.showmode = false
 | 
			
		||||
 | 
			
		||||
-- Sync clipboard between OS and Neovim.
 | 
			
		||||
--  Schedule the setting after `UiEnter` because it can increase startup-time.
 | 
			
		||||
--  Remove this option if you want your OS clipboard to remain independent.
 | 
			
		||||
--  See `:help 'clipboard'`
 | 
			
		||||
vim.opt.clipboard = 'unnamedplus'
 | 
			
		||||
vim.schedule(function()
 | 
			
		||||
  vim.opt.clipboard = 'unnamedplus'
 | 
			
		||||
end)
 | 
			
		||||
 | 
			
		||||
-- Enable break indent
 | 
			
		||||
vim.opt.breakindent = true
 | 
			
		||||
| 
						 | 
				
			
			@ -162,17 +165,14 @@ vim.opt.scrolloff = 10
 | 
			
		|||
-- [[ Basic Keymaps ]]
 | 
			
		||||
--  See `:help vim.keymap.set()`
 | 
			
		||||
 | 
			
		||||
-- Set highlight on search, but clear on pressing <Esc> in normal mode
 | 
			
		||||
vim.opt.hlsearch = true
 | 
			
		||||
-- Clear highlights on search when pressing <Esc> in normal mode
 | 
			
		||||
--  See `:help hlsearch`
 | 
			
		||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
 | 
			
		||||
vim.keymap.set('n', ';', ':')
 | 
			
		||||
vim.keymap.set('i', 'jk', '<esc>')
 | 
			
		||||
vim.keymap.set('n', '<leader>la', '<cmd>Lazy<CR>')
 | 
			
		||||
 | 
			
		||||
-- Diagnostic keymaps
 | 
			
		||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
 | 
			
		||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
 | 
			
		||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
 | 
			
		||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
 | 
			
		||||
 | 
			
		||||
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
 | 
			
		||||
| 
						 | 
				
			
			@ -215,9 +215,12 @@ vim.api.nvim_create_autocmd('TextYankPost', {
 | 
			
		|||
-- [[ Install `lazy.nvim` plugin manager ]]
 | 
			
		||||
--    See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
 | 
			
		||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
 | 
			
		||||
if not vim.loop.fs_stat(lazypath) then
 | 
			
		||||
if not vim.uv.fs_stat(lazypath) then
 | 
			
		||||
  local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
 | 
			
		||||
  vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
 | 
			
		||||
  local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
 | 
			
		||||
  if vim.v.shell_error ~= 0 then
 | 
			
		||||
    error('Error cloning lazy.nvim:\n' .. out)
 | 
			
		||||
  end
 | 
			
		||||
end ---@diagnostic disable-next-line: undefined-field
 | 
			
		||||
vim.opt.rtp:prepend(lazypath)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -242,11 +245,6 @@ require('lazy').setup({
 | 
			
		|||
  --
 | 
			
		||||
  -- Use `opts = {}` to force a plugin to be loaded.
 | 
			
		||||
  --
 | 
			
		||||
  --  This is equivalent to:
 | 
			
		||||
  --    require('Comment').setup({})
 | 
			
		||||
 | 
			
		||||
  -- "gc" to comment visual regions/lines
 | 
			
		||||
  { 'numToStr/Comment.nvim', opts = {} },
 | 
			
		||||
 | 
			
		||||
  -- Here is a more advanced example where we pass configuration
 | 
			
		||||
  -- options to `gitsigns.nvim`. This is equivalent to the following Lua:
 | 
			
		||||
| 
						 | 
				
			
			@ -288,12 +286,14 @@ require('lazy').setup({
 | 
			
		|||
      require('which-key').setup()
 | 
			
		||||
 | 
			
		||||
      -- Document existing key chains
 | 
			
		||||
      require('which-key').register {
 | 
			
		||||
        ['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
 | 
			
		||||
        ['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
 | 
			
		||||
        ['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
 | 
			
		||||
        ['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
 | 
			
		||||
        ['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
 | 
			
		||||
      require('which-key').add {
 | 
			
		||||
        { '<leader>c', group = '[C]ode' },
 | 
			
		||||
        { '<leader>d', group = '[D]ocument' },
 | 
			
		||||
        { '<leader>r', group = '[R]ename' },
 | 
			
		||||
        { '<leader>s', group = '[S]earch' },
 | 
			
		||||
        { '<leader>w', group = '[W]orkspace' },
 | 
			
		||||
        { '<leader>t', group = '[T]oggle' },
 | 
			
		||||
        { '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
 | 
			
		||||
      }
 | 
			
		||||
    end,
 | 
			
		||||
  },
 | 
			
		||||
| 
						 | 
				
			
			@ -410,11 +410,26 @@ require('lazy').setup({
 | 
			
		|||
    end,
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  { -- LSP Configuration & Plugins
 | 
			
		||||
  -- LSP Plugins
 | 
			
		||||
  {
 | 
			
		||||
    -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
 | 
			
		||||
    -- used for completion, annotations and signatures of Neovim apis
 | 
			
		||||
    'folke/lazydev.nvim',
 | 
			
		||||
    ft = 'lua',
 | 
			
		||||
    opts = {
 | 
			
		||||
      library = {
 | 
			
		||||
        -- Load luvit types when the `vim.uv` word is found
 | 
			
		||||
        { path = 'luvit-meta/library', words = { 'vim%.uv' } },
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  { 'Bilal2453/luvit-meta', lazy = true },
 | 
			
		||||
  {
 | 
			
		||||
    -- Main LSP Configuration
 | 
			
		||||
    'neovim/nvim-lspconfig',
 | 
			
		||||
    dependencies = {
 | 
			
		||||
      -- Automatically install LSPs and related tools to stdpath for Neovim
 | 
			
		||||
      'williamboman/mason.nvim',
 | 
			
		||||
      { 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants
 | 
			
		||||
      'williamboman/mason-lspconfig.nvim',
 | 
			
		||||
      'WhoIsSethDaniel/mason-tool-installer.nvim',
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -422,9 +437,8 @@ require('lazy').setup({
 | 
			
		|||
      -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
 | 
			
		||||
      { 'j-hui/fidget.nvim', opts = {} },
 | 
			
		||||
 | 
			
		||||
      -- `neodev` configures Lua LSP for your Neovim config, runtime and plugins
 | 
			
		||||
      -- used for completion, annotations and signatures of Neovim apis
 | 
			
		||||
      { 'folke/neodev.nvim', opts = {} },
 | 
			
		||||
      -- Allows extra capabilities provided by nvim-cmp
 | 
			
		||||
      'hrsh7th/cmp-nvim-lsp',
 | 
			
		||||
    },
 | 
			
		||||
    config = function()
 | 
			
		||||
      -- Brief aside: **What is LSP?**
 | 
			
		||||
| 
						 | 
				
			
			@ -501,10 +515,6 @@ require('lazy').setup({
 | 
			
		|||
          -- or a suggestion from your LSP for this to activate.
 | 
			
		||||
          map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
 | 
			
		||||
 | 
			
		||||
          -- Opens a popup that displays documentation about the word under your cursor
 | 
			
		||||
          --  See `:help K` for why this keymap.
 | 
			
		||||
          map('K', vim.lsp.buf.hover, 'Hover Documentation')
 | 
			
		||||
 | 
			
		||||
          -- WARN: This is not Goto Definition, this is Goto Declaration.
 | 
			
		||||
          --  For example, in C this would take you to the header.
 | 
			
		||||
          map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
 | 
			
		||||
| 
						 | 
				
			
			@ -515,16 +525,37 @@ require('lazy').setup({
 | 
			
		|||
          --
 | 
			
		||||
          -- When you move your cursor, the highlights will be cleared (the second autocommand).
 | 
			
		||||
          local client = vim.lsp.get_client_by_id(event.data.client_id)
 | 
			
		||||
          if client and client.server_capabilities.documentHighlightProvider then
 | 
			
		||||
          if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
 | 
			
		||||
            local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
 | 
			
		||||
            vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
 | 
			
		||||
              buffer = event.buf,
 | 
			
		||||
              group = highlight_augroup,
 | 
			
		||||
              callback = vim.lsp.buf.document_highlight,
 | 
			
		||||
            })
 | 
			
		||||
 | 
			
		||||
            vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
 | 
			
		||||
              buffer = event.buf,
 | 
			
		||||
              group = highlight_augroup,
 | 
			
		||||
              callback = vim.lsp.buf.clear_references,
 | 
			
		||||
            })
 | 
			
		||||
 | 
			
		||||
            vim.api.nvim_create_autocmd('LspDetach', {
 | 
			
		||||
              group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
 | 
			
		||||
              callback = function(event2)
 | 
			
		||||
                vim.lsp.buf.clear_references()
 | 
			
		||||
                vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
 | 
			
		||||
              end,
 | 
			
		||||
            })
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          -- The following code creates a keymap to toggle inlay hints in your
 | 
			
		||||
          -- code, if the language server you are using supports them
 | 
			
		||||
          --
 | 
			
		||||
          -- This may be unwanted, since they displace some of your code
 | 
			
		||||
          if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
 | 
			
		||||
            map('<leader>th', function()
 | 
			
		||||
              vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
 | 
			
		||||
            end, '[T]oggle Inlay [H]ints')
 | 
			
		||||
          end
 | 
			
		||||
        end,
 | 
			
		||||
      })
 | 
			
		||||
| 
						 | 
				
			
			@ -608,7 +639,8 @@ require('lazy').setup({
 | 
			
		|||
 | 
			
		||||
  { -- Autoformat
 | 
			
		||||
    'stevearc/conform.nvim',
 | 
			
		||||
    lazy = false,
 | 
			
		||||
    event = { 'BufWritePre' },
 | 
			
		||||
    cmd = { 'ConformInfo' },
 | 
			
		||||
    keys = {
 | 
			
		||||
      {
 | 
			
		||||
        '<leader>f',
 | 
			
		||||
| 
						 | 
				
			
			@ -636,9 +668,8 @@ require('lazy').setup({
 | 
			
		|||
        -- Conform can also run multiple formatters sequentially
 | 
			
		||||
        -- python = { "isort", "black" },
 | 
			
		||||
        --
 | 
			
		||||
        -- You can use a sub-list to tell conform to run *until* a formatter
 | 
			
		||||
        -- is found.
 | 
			
		||||
        -- javascript = { { "prettierd", "prettier" } },
 | 
			
		||||
        -- You can use 'stop_after_first' to run the first available formatter from the list
 | 
			
		||||
        -- javascript = { "prettierd", "prettier", stop_after_first = true },
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
| 
						 | 
				
			
			@ -712,6 +743,12 @@ require('lazy').setup({
 | 
			
		|||
          --  This will expand snippets if the LSP sent a snippet.
 | 
			
		||||
          ['<C-y>'] = cmp.mapping.confirm { select = true },
 | 
			
		||||
 | 
			
		||||
          -- If you prefer more traditional completion keymaps,
 | 
			
		||||
          -- you can uncomment the following lines
 | 
			
		||||
          --['<CR>'] = cmp.mapping.confirm { select = true },
 | 
			
		||||
          --['<Tab>'] = cmp.mapping.select_next_item(),
 | 
			
		||||
          --['<S-Tab>'] = cmp.mapping.select_prev_item(),
 | 
			
		||||
 | 
			
		||||
          -- Manually trigger a completion from nvim-cmp.
 | 
			
		||||
          --  Generally you don't need this, because nvim-cmp will display
 | 
			
		||||
          --  completions whenever it has completion options available.
 | 
			
		||||
| 
						 | 
				
			
			@ -740,6 +777,11 @@ require('lazy').setup({
 | 
			
		|||
          --    https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
 | 
			
		||||
        },
 | 
			
		||||
        sources = {
 | 
			
		||||
          {
 | 
			
		||||
            name = 'lazydev',
 | 
			
		||||
            -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
 | 
			
		||||
            group_index = 0,
 | 
			
		||||
          },
 | 
			
		||||
          { name = 'nvim_lsp' },
 | 
			
		||||
          { name = 'luasnip' },
 | 
			
		||||
          { name = 'path' },
 | 
			
		||||
| 
						 | 
				
			
			@ -776,7 +818,7 @@ require('lazy').setup({
 | 
			
		|||
      --
 | 
			
		||||
      -- Examples:
 | 
			
		||||
      --  - va)  - [V]isually select [A]round [)]paren
 | 
			
		||||
      --  - yinq - [Y]ank [I]nside [N]ext [']quote
 | 
			
		||||
      --  - yinq - [Y]ank [I]nside [N]ext [Q]uote
 | 
			
		||||
      --  - ci'  - [C]hange [I]nside [']quote
 | 
			
		||||
      require('mini.ai').setup { n_lines = 500 }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -810,7 +852,7 @@ require('lazy').setup({
 | 
			
		|||
    'nvim-treesitter/nvim-treesitter',
 | 
			
		||||
    build = ':TSUpdate',
 | 
			
		||||
    opts = {
 | 
			
		||||
      ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' },
 | 
			
		||||
      ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
 | 
			
		||||
      -- Autoinstall languages that are not installed
 | 
			
		||||
      auto_install = true,
 | 
			
		||||
      highlight = {
 | 
			
		||||
| 
						 | 
				
			
			@ -849,6 +891,9 @@ require('lazy').setup({
 | 
			
		|||
  -- require 'kickstart.plugins.debug',
 | 
			
		||||
  -- require 'kickstart.plugins.indent_line',
 | 
			
		||||
  -- require 'kickstart.plugins.lint',
 | 
			
		||||
  -- require 'kickstart.plugins.autopairs',
 | 
			
		||||
  -- require 'kickstart.plugins.neo-tree',
 | 
			
		||||
  -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
 | 
			
		||||
 | 
			
		||||
  -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
 | 
			
		||||
  --    This is the easiest way to modularize your config.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,13 +6,13 @@
 | 
			
		|||
--]]
 | 
			
		||||
 | 
			
		||||
local check_version = function()
 | 
			
		||||
  local verstr = string.format('%s.%s.%s', vim.version().major, vim.version().minor, vim.version().patch)
 | 
			
		||||
  if not vim.version.cmp then
 | 
			
		||||
  local verstr = tostring(vim.version())
 | 
			
		||||
  if not vim.version.ge then
 | 
			
		||||
    vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
 | 
			
		||||
    return
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then
 | 
			
		||||
  if vim.version.ge(vim.version(), '0.10-dev') then
 | 
			
		||||
    vim.health.ok(string.format("Neovim version is: '%s'", verstr))
 | 
			
		||||
  else
 | 
			
		||||
    vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
-- autopairs
 | 
			
		||||
-- https://github.com/windwp/nvim-autopairs
 | 
			
		||||
 | 
			
		||||
return {
 | 
			
		||||
  'windwp/nvim-autopairs',
 | 
			
		||||
  event = 'InsertEnter',
 | 
			
		||||
  -- 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,
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -24,6 +24,28 @@ return {
 | 
			
		|||
    -- Add your own debuggers here
 | 
			
		||||
    'leoluz/nvim-dap-go',
 | 
			
		||||
  },
 | 
			
		||||
  keys = function(_, keys)
 | 
			
		||||
    local dap = require 'dap'
 | 
			
		||||
    local dapui = require 'dapui'
 | 
			
		||||
    return {
 | 
			
		||||
      -- Basic debugging keymaps, feel free to change to your liking!
 | 
			
		||||
      { '<F5>', dap.continue, desc = 'Debug: Start/Continue' },
 | 
			
		||||
      { '<F1>', dap.step_into, desc = 'Debug: Step Into' },
 | 
			
		||||
      { '<F2>', dap.step_over, desc = 'Debug: Step Over' },
 | 
			
		||||
      { '<F3>', dap.step_out, desc = 'Debug: Step Out' },
 | 
			
		||||
      { '<leader>b', dap.toggle_breakpoint, desc = 'Debug: Toggle Breakpoint' },
 | 
			
		||||
      {
 | 
			
		||||
        '<leader>B',
 | 
			
		||||
        function()
 | 
			
		||||
          dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
 | 
			
		||||
        end,
 | 
			
		||||
        desc = 'Debug: Set Breakpoint',
 | 
			
		||||
      },
 | 
			
		||||
      -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
 | 
			
		||||
      { '<F7>', dapui.toggle, desc = 'Debug: See last session result.' },
 | 
			
		||||
      unpack(keys),
 | 
			
		||||
    }
 | 
			
		||||
  end,
 | 
			
		||||
  config = function()
 | 
			
		||||
    local dap = require 'dap'
 | 
			
		||||
    local dapui = require 'dapui'
 | 
			
		||||
| 
						 | 
				
			
			@ -31,7 +53,7 @@ return {
 | 
			
		|||
    require('mason-nvim-dap').setup {
 | 
			
		||||
      -- Makes a best effort to setup the various debuggers with
 | 
			
		||||
      -- reasonable debug configurations
 | 
			
		||||
      automatic_setup = true,
 | 
			
		||||
      automatic_installation = true,
 | 
			
		||||
 | 
			
		||||
      -- You can provide additional configuration to the handlers,
 | 
			
		||||
      -- see mason-nvim-dap README for more information
 | 
			
		||||
| 
						 | 
				
			
			@ -45,16 +67,6 @@ return {
 | 
			
		|||
      },
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    -- Basic debugging keymaps, feel free to change to your liking!
 | 
			
		||||
    vim.keymap.set('n', '<F5>', dap.continue, { desc = 'Debug: Start/Continue' })
 | 
			
		||||
    vim.keymap.set('n', '<F1>', dap.step_into, { desc = 'Debug: Step Into' })
 | 
			
		||||
    vim.keymap.set('n', '<F2>', dap.step_over, { desc = 'Debug: Step Over' })
 | 
			
		||||
    vim.keymap.set('n', '<F3>', dap.step_out, { desc = 'Debug: Step Out' })
 | 
			
		||||
    vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' })
 | 
			
		||||
    vim.keymap.set('n', '<leader>B', function()
 | 
			
		||||
      dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
 | 
			
		||||
    end, { desc = 'Debug: Set Breakpoint' })
 | 
			
		||||
 | 
			
		||||
    -- Dap UI setup
 | 
			
		||||
    -- For more information, see |:help nvim-dap-ui|
 | 
			
		||||
    dapui.setup {
 | 
			
		||||
| 
						 | 
				
			
			@ -77,14 +89,17 @@ return {
 | 
			
		|||
      },
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
 | 
			
		||||
    vim.keymap.set('n', '<F7>', 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
 | 
			
		||||
 | 
			
		||||
    -- Install golang specific config
 | 
			
		||||
    require('dap-go').setup()
 | 
			
		||||
    require('dap-go').setup {
 | 
			
		||||
      delve = {
 | 
			
		||||
        -- On Windows delve must be run attached or it crashes.
 | 
			
		||||
        -- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
 | 
			
		||||
        detached = vim.fn.has 'win32' == 0,
 | 
			
		||||
      },
 | 
			
		||||
    }
 | 
			
		||||
  end,
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,61 @@
 | 
			
		|||
-- Adds git related signs to the gutter, as well as utilities for managing changes
 | 
			
		||||
-- NOTE: gitsigns is already included in init.lua but contains only the base
 | 
			
		||||
-- config. This will add also the recommended keymaps.
 | 
			
		||||
 | 
			
		||||
return {
 | 
			
		||||
  {
 | 
			
		||||
    'lewis6991/gitsigns.nvim',
 | 
			
		||||
    opts = {
 | 
			
		||||
      on_attach = function(bufnr)
 | 
			
		||||
        local gitsigns = require 'gitsigns'
 | 
			
		||||
 | 
			
		||||
        local function map(mode, l, r, opts)
 | 
			
		||||
          opts = opts or {}
 | 
			
		||||
          opts.buffer = bufnr
 | 
			
		||||
          vim.keymap.set(mode, l, r, opts)
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        -- Navigation
 | 
			
		||||
        map('n', ']c', function()
 | 
			
		||||
          if vim.wo.diff then
 | 
			
		||||
            vim.cmd.normal { ']c', bang = true }
 | 
			
		||||
          else
 | 
			
		||||
            gitsigns.nav_hunk 'next'
 | 
			
		||||
          end
 | 
			
		||||
        end, { desc = 'Jump to next git [c]hange' })
 | 
			
		||||
 | 
			
		||||
        map('n', '[c', function()
 | 
			
		||||
          if vim.wo.diff then
 | 
			
		||||
            vim.cmd.normal { '[c', bang = true }
 | 
			
		||||
          else
 | 
			
		||||
            gitsigns.nav_hunk 'prev'
 | 
			
		||||
          end
 | 
			
		||||
        end, { desc = 'Jump to previous git [c]hange' })
 | 
			
		||||
 | 
			
		||||
        -- Actions
 | 
			
		||||
        -- visual mode
 | 
			
		||||
        map('v', '<leader>hs', function()
 | 
			
		||||
          gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
 | 
			
		||||
        end, { desc = 'stage git hunk' })
 | 
			
		||||
        map('v', '<leader>hr', function()
 | 
			
		||||
          gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
 | 
			
		||||
        end, { desc = 'reset git hunk' })
 | 
			
		||||
        -- normal mode
 | 
			
		||||
        map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
 | 
			
		||||
        map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
 | 
			
		||||
        map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
 | 
			
		||||
        map('n', '<leader>hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' })
 | 
			
		||||
        map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
 | 
			
		||||
        map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
 | 
			
		||||
        map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
 | 
			
		||||
        map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
 | 
			
		||||
        map('n', '<leader>hD', function()
 | 
			
		||||
          gitsigns.diffthis '@'
 | 
			
		||||
        end, { desc = 'git [D]iff against last commit' })
 | 
			
		||||
        -- Toggles
 | 
			
		||||
        map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
 | 
			
		||||
        map('n', '<leader>tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' })
 | 
			
		||||
      end,
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -47,7 +47,7 @@ return {
 | 
			
		|||
      vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
 | 
			
		||||
        group = lint_augroup,
 | 
			
		||||
        callback = function()
 | 
			
		||||
          require('lint').try_lint()
 | 
			
		||||
          lint.try_lint()
 | 
			
		||||
        end,
 | 
			
		||||
      })
 | 
			
		||||
    end,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,25 @@
 | 
			
		|||
-- Neo-tree is a Neovim plugin to browse the file system
 | 
			
		||||
-- https://github.com/nvim-neo-tree/neo-tree.nvim
 | 
			
		||||
 | 
			
		||||
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',
 | 
			
		||||
  },
 | 
			
		||||
  cmd = 'Neotree',
 | 
			
		||||
  keys = {
 | 
			
		||||
    { '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal' },
 | 
			
		||||
  },
 | 
			
		||||
  opts = {
 | 
			
		||||
    filesystem = {
 | 
			
		||||
      window = {
 | 
			
		||||
        mappings = {
 | 
			
		||||
          ['\\'] = 'close_window',
 | 
			
		||||
        },
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue