Merge branch 'nvim-lua:master' into master
This commit is contained in:
		
						commit
						7516d389e9
					
				| 
						 | 
					@ -2,4 +2,3 @@ tags
 | 
				
			||||||
test.sh
 | 
					test.sh
 | 
				
			||||||
.luarc.json
 | 
					.luarc.json
 | 
				
			||||||
nvim
 | 
					nvim
 | 
				
			||||||
lazy-lock.json
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										68
									
								
								README.md
								
								
								
								
							
							
						
						
									
										68
									
								
								README.md
								
								
								
								
							| 
						 | 
					@ -1,5 +1,7 @@
 | 
				
			||||||
# kickstart.nvim
 | 
					# kickstart.nvim
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					https://github.com/kdheepak/kickstart.nvim/assets/1813121/f3ff9a2b-c31f-44df-a4fa-8a0d7b17cf7b
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Introduction
 | 
					### Introduction
 | 
				
			||||||
 | 
					
 | 
				
			||||||
A starting point for Neovim that is:
 | 
					A starting point for Neovim that is:
 | 
				
			||||||
| 
						 | 
					@ -9,7 +11,7 @@ A starting point for Neovim that is:
 | 
				
			||||||
* Documented
 | 
					* Documented
 | 
				
			||||||
* Modular
 | 
					* 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.
 | 
					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.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,42 +20,56 @@ Distribution Alternatives:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Installation
 | 
					### Installation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Backup your previous configuration (if any exists)
 | 
					> **NOTE** 
 | 
				
			||||||
 | 
					> [Backup](#FAQ) your previous configuration (if any exists)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Archive Installation
 | 
					Requirements:
 | 
				
			||||||
* On the home/landing page for the project find the blue "<> CODE" button click it and select Local > Download ZIP.
 | 
					* Make sure to review the readmes of the plugins if you are experiencing errors. In particular:
 | 
				
			||||||
* Extract the archive to:
 | 
					  * [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers.
 | 
				
			||||||
  `~/.config/nvim` (Linux)
 | 
					* See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native`
 | 
				
			||||||
  `~/.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.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Git Clone Installation
 | 
					Neovim's configurations are located under the following paths, depending on your OS:
 | 
				
			||||||
* 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`
 | 
					| OS | PATH |
 | 
				
			||||||
* 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.
 | 
					| Linux | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
 | 
				
			||||||
* **You're ready to go!**
 | 
					| MacOS | `$XDG_CONFIG_HOME/nvim`, '~/.config/nvim` |
 | 
				
			||||||
 | 
					| Windows | `%userprofile%\AppData\Local\nvim\` |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* (Recommended/Optional) Fork this repo (so that you have your own copy that you can modify).
 | 
					Clone kickstart.nvim:
 | 
				
			||||||
* 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:
 | 
					```sh
 | 
				
			||||||
- Make sure to review the readmes of the plugins if you are experiencing errors. In particular:
 | 
					# on Linux and Mac
 | 
				
			||||||
  - [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers.
 | 
					git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
 | 
				
			||||||
- See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native`
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					# on Windows
 | 
				
			||||||
 | 
					git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\ 
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Post Installation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Run the following command and then **you are ready to go**!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```sh
 | 
				
			||||||
 | 
					nvim --headless "+Lazy! sync" +qa
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### 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.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> **NOTE**  
 | 
				
			||||||
 | 
					> Your fork's url will be something like this: `https://github.com/<your_github_username>/kickstart.nvim.git`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Configuration And Extension
 | 
					### Configuration And Extension
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Inside of your copy, feel free to modify any file you like! It's your copy!
 | 
					* 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.
 | 
					* 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:
 | 
					* 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 the line importing the `custom/plugins` directory in the `init.lua` file to enable this)
 | 
				
			||||||
  * Modify `init.lua` with additional plugins.
 | 
					  * Modify `init.lua` with additional plugins.
 | 
				
			||||||
  * Include the `lua/kickstart/plugins/*` files in your configuration.
 | 
					  * Include the `lua/kickstart/plugins/*` files in your configuration.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										205
									
								
								init.lua
								
								
								
								
							
							
						
						
									
										205
									
								
								init.lua
								
								
								
								
							| 
						 | 
					@ -17,7 +17,9 @@ Kickstart.nvim is a template for your own configuration.
 | 
				
			||||||
  a guide. One possible example:
 | 
					  a guide. One possible example:
 | 
				
			||||||
  - https://learnxinyminutes.com/docs/lua/
 | 
					  - https://learnxinyminutes.com/docs/lua/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  And then you can explore or search through `:help lua-guide`
 | 
					  And then you can explore or search through `:help lua-guide`
 | 
				
			||||||
 | 
					  - https://neovim.io/doc/user/lua-guide.html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Kickstart Guide:
 | 
					Kickstart Guide:
 | 
				
			||||||
| 
						 | 
					@ -79,7 +81,7 @@ require('lazy').setup({
 | 
				
			||||||
    'neovim/nvim-lspconfig',
 | 
					    'neovim/nvim-lspconfig',
 | 
				
			||||||
    dependencies = {
 | 
					    dependencies = {
 | 
				
			||||||
      -- Automatically install LSPs to stdpath for neovim
 | 
					      -- Automatically install LSPs to stdpath for neovim
 | 
				
			||||||
      { 'williamboman/mason.nvim', config = true },
 | 
					      'williamboman/mason.nvim',
 | 
				
			||||||
      'williamboman/mason-lspconfig.nvim',
 | 
					      'williamboman/mason-lspconfig.nvim',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      -- Useful status updates for LSP
 | 
					      -- Useful status updates for LSP
 | 
				
			||||||
| 
						 | 
					@ -110,7 +112,7 @@ require('lazy').setup({
 | 
				
			||||||
  -- Useful plugin to show you pending keybinds.
 | 
					  -- 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
 | 
					    -- Adds git related signs to the gutter, as well as utilities for managing changes
 | 
				
			||||||
    'lewis6991/gitsigns.nvim',
 | 
					    'lewis6991/gitsigns.nvim',
 | 
				
			||||||
    opts = {
 | 
					    opts = {
 | 
				
			||||||
      -- See `:help gitsigns.txt`
 | 
					      -- See `:help gitsigns.txt`
 | 
				
			||||||
| 
						 | 
					@ -122,9 +124,28 @@ require('lazy').setup({
 | 
				
			||||||
        changedelete = { text = '~' },
 | 
					        changedelete = { text = '~' },
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      on_attach = function(bufnr)
 | 
					      on_attach = function(bufnr)
 | 
				
			||||||
        vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
 | 
					        vim.keymap.set('n', '<leader>hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git hunk' })
 | 
				
			||||||
        vim.keymap.set('n', '<leader>gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' })
 | 
					
 | 
				
			||||||
        vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
 | 
					        -- 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 '<Ignore>'
 | 
				
			||||||
 | 
					        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 '<Ignore>'
 | 
				
			||||||
 | 
					        end, { expr = true, buffer = bufnr, desc = 'Jump to previous hunk' })
 | 
				
			||||||
      end,
 | 
					      end,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
| 
						 | 
					@ -157,29 +178,32 @@ require('lazy').setup({
 | 
				
			||||||
    'lukas-reineke/indent-blankline.nvim',
 | 
					    'lukas-reineke/indent-blankline.nvim',
 | 
				
			||||||
    -- Enable `lukas-reineke/indent-blankline.nvim`
 | 
					    -- Enable `lukas-reineke/indent-blankline.nvim`
 | 
				
			||||||
    -- See `:help indent_blankline.txt`
 | 
					    -- See `:help indent_blankline.txt`
 | 
				
			||||||
    opts = {
 | 
					    main = 'ibl',
 | 
				
			||||||
      char = '┊',
 | 
					    opts = {},
 | 
				
			||||||
      show_trailing_blankline_indent = false,
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  -- "gc" to comment visual regions/lines
 | 
					  -- "gc" to comment visual regions/lines
 | 
				
			||||||
  { 'numToStr/Comment.nvim', opts = {} },
 | 
					  { 'numToStr/Comment.nvim', opts = {} },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  -- Fuzzy Finder (files, lsp, etc)
 | 
					  -- 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',
 | 
					    'nvim-telescope/telescope.nvim',
 | 
				
			||||||
    -- NOTE: If you are having trouble with this installation,
 | 
					    branch = '0.1.x',
 | 
				
			||||||
    --       refer to the README for telescope-fzf-native for more instructions.
 | 
					    dependencies = {
 | 
				
			||||||
    build = 'make',
 | 
					      'nvim-lua/plenary.nvim',
 | 
				
			||||||
    cond = function()
 | 
					      -- Fuzzy Finder Algorithm which requires local dependencies to be built.
 | 
				
			||||||
      return vim.fn.executable 'make' == 1
 | 
					      -- Only load if `make` is available. Make sure you have the system
 | 
				
			||||||
    end,
 | 
					      -- 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,
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
| 
						 | 
					@ -197,12 +221,13 @@ require('lazy').setup({
 | 
				
			||||||
  -- require 'kickstart.plugins.autoformat',
 | 
					  -- require 'kickstart.plugins.autoformat',
 | 
				
			||||||
  -- require 'kickstart.plugins.debug',
 | 
					  -- 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
 | 
					  --    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.
 | 
					  --    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
 | 
					  --    For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
 | 
				
			||||||
  { import = 'custom.plugins' },
 | 
					  -- { import = 'custom.plugins' },
 | 
				
			||||||
}, {})
 | 
					}, {})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- [[ Setting options ]]
 | 
					-- [[ Setting options ]]
 | 
				
			||||||
| 
						 | 
					@ -238,7 +263,6 @@ vim.wo.signcolumn = 'yes'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- Decrease update time
 | 
					-- Decrease update time
 | 
				
			||||||
vim.o.updatetime = 250
 | 
					vim.o.updatetime = 250
 | 
				
			||||||
vim.o.timeout = true
 | 
					 | 
				
			||||||
vim.o.timeoutlen = 300
 | 
					vim.o.timeoutlen = 300
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- Set completeopt to have a better completion experience
 | 
					-- Set completeopt to have a better completion experience
 | 
				
			||||||
| 
						 | 
					@ -301,72 +325,76 @@ vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc
 | 
				
			||||||
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
 | 
					vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
 | 
				
			||||||
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
 | 
					vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
 | 
				
			||||||
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
 | 
					vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
 | 
				
			||||||
 | 
					vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- [[ Configure Treesitter ]]
 | 
					-- [[ Configure Treesitter ]]
 | 
				
			||||||
-- See `:help nvim-treesitter`
 | 
					-- See `:help nvim-treesitter`
 | 
				
			||||||
require('nvim-treesitter.configs').setup {
 | 
					-- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}'
 | 
				
			||||||
  -- Add languages to be installed here that you want installed for treesitter
 | 
					vim.defer_fn(function()
 | 
				
			||||||
  ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' },
 | 
					  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!)
 | 
					    -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
 | 
				
			||||||
  auto_install = false,
 | 
					    auto_install = false,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  highlight = { enable = true },
 | 
					    highlight = { enable = true },
 | 
				
			||||||
  indent = { enable = true },
 | 
					    indent = { enable = true },
 | 
				
			||||||
  incremental_selection = {
 | 
					    incremental_selection = {
 | 
				
			||||||
    enable = true,
 | 
					 | 
				
			||||||
    keymaps = {
 | 
					 | 
				
			||||||
      init_selection = '<c-space>',
 | 
					 | 
				
			||||||
      node_incremental = '<c-space>',
 | 
					 | 
				
			||||||
      scope_incremental = '<c-s>',
 | 
					 | 
				
			||||||
      node_decremental = '<M-space>',
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  textobjects = {
 | 
					 | 
				
			||||||
    select = {
 | 
					 | 
				
			||||||
      enable = true,
 | 
					      enable = true,
 | 
				
			||||||
      lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
 | 
					 | 
				
			||||||
      keymaps = {
 | 
					      keymaps = {
 | 
				
			||||||
        -- You can use the capture groups defined in textobjects.scm
 | 
					        init_selection = '<c-space>',
 | 
				
			||||||
        ['aa'] = '@parameter.outer',
 | 
					        node_incremental = '<c-space>',
 | 
				
			||||||
        ['ia'] = '@parameter.inner',
 | 
					        scope_incremental = '<c-s>',
 | 
				
			||||||
        ['af'] = '@function.outer',
 | 
					        node_decremental = '<M-space>',
 | 
				
			||||||
        ['if'] = '@function.inner',
 | 
					 | 
				
			||||||
        ['ac'] = '@class.outer',
 | 
					 | 
				
			||||||
        ['ic'] = '@class.inner',
 | 
					 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    move = {
 | 
					    textobjects = {
 | 
				
			||||||
      enable = true,
 | 
					      select = {
 | 
				
			||||||
      set_jumps = true, -- whether to set jumps in the jumplist
 | 
					        enable = true,
 | 
				
			||||||
      goto_next_start = {
 | 
					        lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
 | 
				
			||||||
        [']m'] = '@function.outer',
 | 
					        keymaps = {
 | 
				
			||||||
        [']]'] = '@class.outer',
 | 
					          -- 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 = {
 | 
					      move = {
 | 
				
			||||||
        [']M'] = '@function.outer',
 | 
					        enable = true,
 | 
				
			||||||
        [']['] = '@class.outer',
 | 
					        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 = {
 | 
					      swap = {
 | 
				
			||||||
        ['[m'] = '@function.outer',
 | 
					        enable = true,
 | 
				
			||||||
        ['[['] = '@class.outer',
 | 
					        swap_next = {
 | 
				
			||||||
      },
 | 
					          ['<leader>a'] = '@parameter.inner',
 | 
				
			||||||
      goto_previous_end = {
 | 
					        },
 | 
				
			||||||
        ['[M'] = '@function.outer',
 | 
					        swap_previous = {
 | 
				
			||||||
        ['[]'] = '@class.outer',
 | 
					          ['<leader>A'] = '@parameter.inner',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    swap = {
 | 
					  }
 | 
				
			||||||
      enable = true,
 | 
					end, 0)
 | 
				
			||||||
      swap_next = {
 | 
					 | 
				
			||||||
        ['<leader>a'] = '@parameter.inner',
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      swap_previous = {
 | 
					 | 
				
			||||||
        ['<leader>A'] = '@parameter.inner',
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- Diagnostic keymaps
 | 
					-- 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_prev, { desc = 'Go to previous diagnostic message' })
 | 
				
			||||||
| 
						 | 
					@ -396,7 +424,7 @@ local on_attach = function(_, bufnr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
 | 
					  nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
 | 
				
			||||||
  nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
 | 
					  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_implementations, '[G]oto [I]mplementation')
 | 
				
			||||||
  nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
 | 
					  nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
 | 
				
			||||||
  nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
 | 
					  nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
 | 
				
			||||||
  nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
 | 
					  nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
 | 
				
			||||||
| 
						 | 
					@ -419,17 +447,37 @@ local on_attach = function(_, bufnr)
 | 
				
			||||||
  end, { desc = 'Format current buffer with LSP' })
 | 
					  end, { desc = 'Format current buffer with LSP' })
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- 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>g'] = { name = '[G]it', _ = 'which_key_ignore' },
 | 
				
			||||||
 | 
					  ['<leader>h'] = { name = 'More git', _ = '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' },
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- 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
 | 
					-- Enable the following language servers
 | 
				
			||||||
--  Feel free to add/remove any LSPs that you want here. They will automatically be installed.
 | 
					--  Feel free to add/remove any LSPs that you want here. They will automatically be installed.
 | 
				
			||||||
--
 | 
					--
 | 
				
			||||||
--  Add any additional override configuration in the following tables. They will be passed to
 | 
					--  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.
 | 
					--  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 = {
 | 
					local servers = {
 | 
				
			||||||
  -- clangd = {},
 | 
					  -- clangd = {},
 | 
				
			||||||
  -- gopls = {},
 | 
					  -- gopls = {},
 | 
				
			||||||
  -- pyright = {},
 | 
					  -- pyright = {},
 | 
				
			||||||
  -- rust_analyzer = {},
 | 
					  -- rust_analyzer = {},
 | 
				
			||||||
  -- tsserver = {},
 | 
					  -- tsserver = {},
 | 
				
			||||||
 | 
					  -- html = { filetypes = { 'html', 'twig', 'hbs'} },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  lua_ls = {
 | 
					  lua_ls = {
 | 
				
			||||||
    Lua = {
 | 
					    Lua = {
 | 
				
			||||||
| 
						 | 
					@ -459,6 +507,7 @@ mason_lspconfig.setup_handlers {
 | 
				
			||||||
      capabilities = capabilities,
 | 
					      capabilities = capabilities,
 | 
				
			||||||
      on_attach = on_attach,
 | 
					      on_attach = on_attach,
 | 
				
			||||||
      settings = servers[server_name],
 | 
					      settings = servers[server_name],
 | 
				
			||||||
 | 
					      filetypes = (servers[server_name] or {}).filetypes,
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  end,
 | 
					  end,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue