diff --git a/README.md b/README.md index bf64153..d80d6a5 100644 --- a/README.md +++ b/README.md @@ -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" ``` @@ -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 diff --git a/lua/kickstart/plugins/conform.lua b/lua/kickstart/plugins/conform.lua index 9cba01a..476b80b 100644 --- a/lua/kickstart/plugins/conform.lua +++ b/lua/kickstart/plugins/conform.lua @@ -7,7 +7,7 @@ return { { '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 = { diff --git a/lua/kickstart/plugins/lspconfig.lua b/lua/kickstart/plugins/lspconfig.lua index c81bca1..c8c0a31 100644 --- a/lua/kickstart/plugins/lspconfig.lua +++ b/lua/kickstart/plugins/lspconfig.lua @@ -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('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') + map('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, diff --git a/lua/kickstart/plugins/treesitter.lua b/lua/kickstart/plugins/treesitter.lua index e41d336..73e88c0 100644 --- a/lua/kickstart/plugins/treesitter.lua +++ b/lua/kickstart/plugins/treesitter.lua @@ -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 diff --git a/lua/kickstart/plugins/which-key.lua b/lua/kickstart/plugins/which-key.lua index 66a2b4e..107cae1 100644 --- a/lua/kickstart/plugins/which-key.lua +++ b/lua/kickstart/plugins/which-key.lua @@ -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 = ' ', + Down = ' ', + Left = ' ', + Right = ' ', + C = ' ', + M = ' ', + D = ' ', + S = ' ', + CR = ' ', + Esc = ' ', + ScrollWheelDown = ' ', + ScrollWheelUp = ' ', + NL = ' ', + BS = ' ', + Space = ' ', + Tab = ' ', + F1 = '', + F2 = '', + F3 = '', + F4 = '', + F5 = '', + F6 = '', + F7 = '', + F8 = '', + F9 = '', + F10 = '', + F11 = '', + F12 = '', + }, + }, + -- Document existing key chains - require('which-key').add { + spec = { { 'c', group = '[C]ode-/[C]hange' }, + { 'c', group = '[C]ode', mode = { 'x' } }, { 'd', group = '[D]ocument' }, { 'r', group = '[R]ename' }, { 's', group = '[S]earch' }, @@ -34,8 +71,8 @@ return { { 'l', group = '[L]ist', mode = { 'n', 'v' } }, { 'f', group = '[F]ormat/[F]ile', mode = { 'n', 'v' } }, { 'o', group = '[O]verseer', mode = { 'n', 'v' } }, - } - end, + }, + }, }, } -- vim: ts=2 sts=2 sw=2 et diff --git a/lua/lazy-bootstrap.lua b/lua/lazy-bootstrap.lua index 9f80e1a..f83dda5 100644 --- a/lua/lazy-bootstrap.lua +++ b/lua/lazy-bootstrap.lua @@ -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',