Merge remote-tracking branch 'modular/master'

This commit is contained in:
Baipyrus 2024-03-17 14:34:39 +01:00
commit 1f144bb7fe
8 changed files with 103 additions and 94 deletions

View File

@ -83,10 +83,10 @@ current plugin status.
### FAQ ### FAQ
* What should I do if I already have a pre-existing neovim configuration? * 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. * You should back it up and then delete all associated files.
* This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/` or their windows counterparts in `AppData\Local\nvim-data` * This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/` or their windows counterparts in `AppData\Local\nvim-data`
* Can I keep my existing configuration in parallel to kickstart? * 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 an alias: * 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:
```sh ```sh
alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim' alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim'
``` ```
@ -111,7 +111,7 @@ winget install --accept-source-agreements chocolatey.chocolatey
``` ```
2. install all requirements using choco, exit previous cmd and 2. install all requirements using choco, exit previous cmd and
open a new one so that choco path is set, run in cmd as **admin**: open a new one so that choco path is set, and run in cmd as **admin**:
``` ```
choco install -y neovim git ripgrep wget fd unzip gzip mingw make choco install -y neovim git ripgrep wget fd unzip gzip mingw make
``` ```

View File

@ -15,6 +15,7 @@ return {
end end
return 'make install_jsregexp' return 'make install_jsregexp'
end)(), end)(),
dependencies = {},
}, },
'saadparwaiz1/cmp_luasnip', 'saadparwaiz1/cmp_luasnip',
@ -54,6 +55,10 @@ return {
-- Select the [p]revious item -- Select the [p]revious item
['<C-p>'] = cmp.mapping.select_prev_item(), ['<C-p>'] = cmp.mapping.select_prev_item(),
-- scroll the documentation window [b]ack / [f]orward
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
-- Accept ([y]es) the completion. -- Accept ([y]es) the completion.
-- This will auto-import if your LSP supports it. -- This will auto-import if your LSP supports it.
-- This will expand snippets if the LSP sent a snippet. -- This will expand snippets if the LSP sent a snippet.
@ -108,6 +113,9 @@ return {
luasnip.jump(-1) luasnip.jump(-1)
end end
end, { 'i', 's' }), end, { 'i', 's' }),
-- For more advanced luasnip keymaps (e.g. selecting choice nodes, expansion) see:
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
}, },
sources = { sources = {
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },

View File

@ -3,10 +3,16 @@ return {
'stevearc/conform.nvim', 'stevearc/conform.nvim',
opts = { opts = {
notify_on_error = false, notify_on_error = false,
format_on_save = { format_on_save = function(bufnr)
timeout_ms = 500, -- Disable "format_on_save lsp_fallback" for languages that don't
lsp_fallback = true, -- have a well standardized coding style. You can add additional
}, -- languages here or re-enable it for the disabled ones.
local disable_filetypes = { c = true, cpp = true }
return {
timeout_ms = 500,
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
}
end,
formatters_by_ft = { formatters_by_ft = {
lua = { 'stylua' }, lua = { 'stylua' },
-- Conform can also run multiple formatters sequentially -- Conform can also run multiple formatters sequentially

View File

@ -10,6 +10,10 @@ return {
-- Useful status updates for LSP. -- Useful status updates for LSP.
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
{ 'j-hui/fidget.nvim', opts = {} }, { '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 = {} },
}, },
config = function() config = function()
-- Brief Aside: **What is LSP?** -- Brief Aside: **What is LSP?**
@ -56,7 +60,7 @@ return {
-- Jump to the definition of the word under your cursor. -- Jump to the definition of the word under your cursor.
-- This is where a variable was first declared, or where a function is defined, etc. -- This is where a variable was first declared, or where a function is defined, etc.
-- To jump back, press <C-T>. -- To jump back, press <C-t>.
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
-- Find references for the word under your cursor. -- Find references for the word under your cursor.
@ -152,19 +156,6 @@ return {
-- capabilities = {}, -- capabilities = {},
settings = { settings = {
Lua = { Lua = {
runtime = { version = 'LuaJIT' },
workspace = {
checkThirdParty = false,
-- Tells lua_ls where to find all the Lua files that you have loaded
-- for your neovim configuration.
library = {
'${3rd}/luv/library',
unpack(vim.api.nvim_get_runtime_file('', true)),
},
-- If lua_ls is really slow on your computer, you can try this instead:
-- library = { vim.env.VIMRUNTIME },
},
telemetry = { enable = false },
completion = { completion = {
callSnippet = 'Replace', callSnippet = 'Replace',
}, },

View File

@ -5,9 +5,8 @@ return {
-- --
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme` -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`
'folke/tokyonight.nvim', 'folke/tokyonight.nvim',
lazy = false, -- make sure we load this during startup if it is your main colorscheme
priority = 1000, -- make sure to load this before all the other start plugins priority = 1000, -- make sure to load this before all the other start plugins
config = function() init = function()
-- Load the colorscheme here. -- Load the colorscheme here.
-- Like many other themes, this one has different styles, and you could load -- Like many other themes, this one has different styles, and you could load
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.

View File

@ -8,77 +8,82 @@ return {
'nvim-treesitter/nvim-treesitter-textobjects', 'nvim-treesitter/nvim-treesitter-textobjects',
}, },
build = ':TSUpdate', build = ':TSUpdate',
config = function() opts = {
ensure_installed = { 'lua', 'python', 'rust', 'javascript', 'typescript', 'vimdoc', 'vim', 'svelte', 'c_sharp' },
-- Autoinstall languages that are not installed
auto_install = true,
-- Enable autotags and -rename
autotag = {
enable = true,
enable_autocmd = true,
},
highlight = {
enable = true,
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
-- If you are experiencing weird indenting issues, add the language to
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
additional_vim_regex_highlighting = { 'ruby' },
},
indent = { enable = true, disable = { 'ruby' } },
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,
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',
},
},
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 = {
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
},
},
},
},
config = function(_, opts)
-- [[ Configure Treesitter ]] See `:help nvim-treesitter` -- [[ Configure Treesitter ]] See `:help nvim-treesitter`
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
require('nvim-treesitter.configs').setup { require('nvim-treesitter.configs').setup(opts)
ensure_installed = { 'lua', 'python', 'rust', 'javascript', 'typescript', 'vimdoc', 'vim', 'svelte', 'c_sharp' },
-- Autoinstall languages that are not installed
auto_install = false,
-- Enable autotags and -rename
autotag = {
enable = true,
enable_autocmd = true,
},
-- Install languages synchronously (only applied to `ensure_installed`)
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
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,
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',
},
},
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 = {
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
},
},
},
}
end, end,
}, },
} }

View File

@ -69,9 +69,6 @@ require('lazy').setup({
-- "gc" to comment visual regions/lines -- "gc" to comment visual regions/lines
{ 'numToStr/Comment.nvim', opts = {} }, { 'numToStr/Comment.nvim', opts = {} },
-- Setup neovim lua configuration
{ 'folke/neodev.nvim', opts = {} },
-- modular approach: using `require 'path/name'` will -- modular approach: using `require 'path/name'` will
-- include a plugin definition from file lua/path/name.lua -- include a plugin definition from file lua/path/name.lua

View File

@ -55,6 +55,9 @@ vim.opt.signcolumn = 'yes'
-- Decrease update time -- Decrease update time
vim.opt.updatetime = 250 vim.opt.updatetime = 250
-- Decrease mapped sequence wait time
-- Displays which-key popup sooner
vim.opt.timeoutlen = 300 vim.opt.timeoutlen = 300
-- Configure how new splits should be opened -- Configure how new splits should be opened