Merge remote-tracking branch 'modular/master'

This commit is contained in:
Baipyrus 2024-10-17 10:53:43 +02:00
commit 444b87fd8b
6 changed files with 62 additions and 22 deletions

View File

@ -58,13 +58,13 @@ git clone https://github.com/Baipyrus/nvim-config.git "${XDG_CONFIG_HOME:-$HOME/
If you're using `cmd.exe`:
```bat
git clone https://github.com/Baipyrus/nvim-config.git %localappdata%\nvim\
git clone https://github.com/Baipyrus/nvim-config.git "%localappdata%\nvim\"
```
If you're using `powershell.exe`
```pwsh
git clone https://github.com/Baipyrus/nvim-config.git $env:LOCALAPPDATA\nvim\
git clone https://github.com/Baipyrus/nvim-config.git "${env:LOCALAPPDATA}\nvim"
```
</details>
@ -103,7 +103,7 @@ current plugin status. Hit `q` to close the window.
You can apply both of these approaches 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
* See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information
### Install Recipes

View File

@ -7,7 +7,7 @@ return {
{
'<leader>fb',
function()
require('conform').format { async = true, lsp_fallback = true }
require('conform').format { async = true, lsp_format = 'fallback' }
end,
mode = '',
desc = '[F]ormat [B]uffer',
@ -20,9 +20,15 @@ return {
-- 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, php = true }
local lsp_format_opt
if disable_filetypes[vim.bo[bufnr].filetype] then
lsp_format_opt = 'never'
else
lsp_format_opt = 'fallback'
end
return {
timeout_ms = 500,
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
lsp_format = lsp_format_opt,
}
end,
formatters_by_ft = {

View File

@ -67,8 +67,9 @@ return {
--
-- 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 map = function(keys, func, desc)
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
local map = function(keys, func, desc, mode)
mode = mode or 'n'
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
end
-- Jump to the definition of the word under your cursor.
@ -105,7 +106,7 @@ return {
-- Execute a code action, usually your cursor needs to be on top of an error
-- or a suggestion from your LSP for this to activate.
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
-- Opens a popup that displays documentation about the word under your cursor
-- See `:help K` for why this keymap.
@ -179,9 +180,9 @@ return {
rust_analyzer = {},
tailwindcss = {},
omnisharp = {},
tsserver = {},
pyright = {},
svelte = {},
ts_ls = {},
gopls = {},
intelephense = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
@ -233,7 +234,7 @@ return {
local server = servers[server_name] or {}
-- This handles overriding only values explicitly passed
-- by the server configuration above. Useful when disabling
-- certain features of an LSP (for example, turning off formatting for tsserver)
-- certain features of an LSP (for example, turning off formatting for ts_ls)
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
require('lspconfig')[server_name].setup(server)
end,

View File

@ -6,6 +6,8 @@ return {
'nvim-treesitter/nvim-treesitter-textobjects',
},
build = ':TSUpdate',
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
opts = {
ensure_installed = {
-- kickstart
@ -103,12 +105,6 @@ return {
},
},
},
config = function(_, opts)
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
---@diagnostic disable-next-line: missing-fields
require('nvim-treesitter.configs').setup(opts)
end,
},
}
-- vim: ts=2 sts=2 sw=2 et

View File

@ -17,11 +17,48 @@ return {
{ -- Useful plugin to show you pending keybinds.
'folke/which-key.nvim',
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
config = function() -- This is the function that runs, AFTER loading
require('which-key').setup()
opts = {
icons = {
-- set icon mappings to true if you have a Nerd Font
mappings = vim.g.have_nerd_font,
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
-- default whick-key.nvim defined Nerd Font icons, otherwise define a string table
keys = vim.g.have_nerd_font and {} or {
Up = '<Up> ',
Down = '<Down> ',
Left = '<Left> ',
Right = '<Right> ',
C = '<C-…> ',
M = '<M-…> ',
D = '<D-…> ',
S = '<S-…> ',
CR = '<CR> ',
Esc = '<Esc> ',
ScrollWheelDown = '<ScrollWheelDown> ',
ScrollWheelUp = '<ScrollWheelUp> ',
NL = '<NL> ',
BS = '<BS> ',
Space = '<Space> ',
Tab = '<Tab> ',
F1 = '<F1>',
F2 = '<F2>',
F3 = '<F3>',
F4 = '<F4>',
F5 = '<F5>',
F6 = '<F6>',
F7 = '<F7>',
F8 = '<F8>',
F9 = '<F9>',
F10 = '<F10>',
F11 = '<F11>',
F12 = '<F12>',
},
},
-- Document existing key chains
require('which-key').add {
spec = {
{ '<leader>c', group = '[C]ode-/[C]hange' },
{ '<leader>c', group = '[C]ode', mode = { 'x' } },
{ '<leader>d', group = '[D]ocument' },
{ '<leader>r', group = '[R]ename' },
{ '<leader>s', group = '[S]earch' },
@ -34,8 +71,8 @@ return {
{ '<leader>l', group = '[L]ist', mode = { 'n', 'v' } },
{ '<leader>f', group = '[F]ormat/[F]ile', mode = { 'n', 'v' } },
{ '<leader>o', group = '[O]verseer', mode = { 'n', 'v' } },
}
end,
},
},
},
}
-- vim: ts=2 sts=2 sw=2 et

View File

@ -1,7 +1,7 @@
-- [[ 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.uv.fs_stat(lazypath) then
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
local out = vim.fn.system {
'git',