Skip to content

Commit 4c0e494

Browse files
committed
Merge branch 'nvim-lua-master'
2 parents e17701b + 0c26bcb commit 4c0e494

3 files changed

Lines changed: 71 additions & 23 deletions

File tree

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ External Requirements:
2727
- Clipboard tool (xclip/xsel/win32yank or other depending on the platform)
2828
- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons
2929
- if you have it set `vim.g.have_nerd_font` in `init.lua` to true
30+
- Emoji fonts (Ubuntu only, and only if you want emoji!) `sudo apt install fonts-noto-color-emoji`
3031
- Language Setup:
3132
- If you want to write Typescript, you need `npm`
3233
- If you want to write Golang, you will need `go`
@@ -212,14 +213,14 @@ sudo apt update
212213
sudo apt install make gcc ripgrep unzip git xclip curl
213214
214215
# Now we install nvim
215-
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz
216-
sudo rm -rf /opt/nvim-linux64
217-
sudo mkdir -p /opt/nvim-linux64
218-
sudo chmod a+rX /opt/nvim-linux64
219-
sudo tar -C /opt -xzf nvim-linux64.tar.gz
216+
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz
217+
sudo rm -rf /opt/nvim-linux-x86_64
218+
sudo mkdir -p /opt/nvim-linux-x86_64
219+
sudo chmod a+rX /opt/nvim-linux-x86_64
220+
sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz
220221
221222
# make it available in /usr/local/bin, distro installs to /usr/bin
222-
sudo ln -sf /opt/nvim-linux64/bin/nvim /usr/local/bin/
223+
sudo ln -sf /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/
223224
```
224225
</details>
225226
<details><summary>Fedora Install Steps</summary>

init.lua

Lines changed: 62 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,22 @@ require('lazy').setup({
182182
-- with the first argument being the link and the following
183183
-- keys can be used to configure plugin behavior/loading/etc.
184184
--
185-
-- Use `opts = {}` to force a plugin to be loaded.
185+
-- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
186186
--
187187

188+
-- Alternatively, use `config = function() ... end` for full control over the configuration.
189+
-- If you prefer to call `setup` explicitly, use:
190+
-- {
191+
-- 'lewis6991/gitsigns.nvim',
192+
-- config = function()
193+
-- require('gitsigns').setup({
194+
-- -- Your gitsigns configuration here
195+
-- })
196+
-- end,
197+
-- }
198+
--
188199
-- Here is a more advanced example where we pass configuration
189-
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
190-
-- require('gitsigns').setup({ ... })
200+
-- options to `gitsigns.nvim`.
191201
--
192202
-- See `:help gitsigns` to understand what the configuration keys do
193203
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
@@ -516,13 +526,26 @@ require('lazy').setup({
516526
-- For example, in C this would take you to the header.
517527
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
518528

529+
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
530+
---@param client vim.lsp.Client
531+
---@param method vim.lsp.protocol.Method
532+
---@param bufnr? integer some lsp support methods only in specific files
533+
---@return boolean
534+
local function client_supports_method(client, method, bufnr)
535+
if vim.fn.has 'nvim-0.11' == 1 then
536+
return client:supports_method(method, bufnr)
537+
else
538+
return client.supports_method(method, { bufnr = bufnr })
539+
end
540+
end
541+
519542
-- The following two autocommands are used to highlight references of the
520543
-- word under your cursor when your cursor rests there for a little while.
521544
-- See `:help CursorHold` for information about when this is executed
522545
--
523546
-- When you move your cursor, the highlights will be cleared (the second autocommand).
524547
local client = vim.lsp.get_client_by_id(event.data.client_id)
525-
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
548+
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
526549
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
527550
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
528551
buffer = event.buf,
@@ -549,23 +572,42 @@ require('lazy').setup({
549572
-- code, if the language server you are using supports them
550573
--
551574
-- This may be unwanted, since they displace some of your code
552-
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
575+
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
553576
map('<leader>th', function()
554577
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
555578
end, '[T]oggle Inlay [H]ints')
556579
end
557580
end,
558581
})
559582

560-
-- Change diagnostic symbols in the sign column (gutter)
561-
-- if vim.g.have_nerd_font then
562-
-- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
563-
-- local diagnostic_signs = {}
564-
-- for type, icon in pairs(signs) do
565-
-- diagnostic_signs[vim.diagnostic.severity[type]] = icon
566-
-- end
567-
-- vim.diagnostic.config { signs = { text = diagnostic_signs } }
568-
-- end
583+
-- Diagnostic Config
584+
-- See :help vim.diagnostic.Opts
585+
vim.diagnostic.config {
586+
severity_sort = true,
587+
float = { border = 'rounded', source = 'if_many' },
588+
underline = { severity = vim.diagnostic.severity.ERROR },
589+
signs = vim.g.have_nerd_font and {
590+
text = {
591+
[vim.diagnostic.severity.ERROR] = '󰅚 ',
592+
[vim.diagnostic.severity.WARN] = '󰀪 ',
593+
[vim.diagnostic.severity.INFO] = '󰋽 ',
594+
[vim.diagnostic.severity.HINT] = '󰌶 ',
595+
},
596+
} or {},
597+
virtual_text = {
598+
source = 'if_many',
599+
spacing = 2,
600+
format = function(diagnostic)
601+
local diagnostic_message = {
602+
[vim.diagnostic.severity.ERROR] = diagnostic.message,
603+
[vim.diagnostic.severity.WARN] = diagnostic.message,
604+
[vim.diagnostic.severity.INFO] = diagnostic.message,
605+
[vim.diagnostic.severity.HINT] = diagnostic.message,
606+
}
607+
return diagnostic_message[diagnostic.severity]
608+
end,
609+
},
610+
}
569611

570612
-- LSP servers and clients are able to communicate to each other what features they support.
571613
-- By default, Neovim doesn't support everything that is in the LSP specification.
@@ -650,6 +692,8 @@ require('lazy').setup({
650692
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
651693

652694
require('mason-lspconfig').setup {
695+
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
696+
automatic_installation = false,
653697
handlers = {
654698
function(server_name)
655699
local server = servers[server_name] or {}
@@ -741,6 +785,7 @@ require('lazy').setup({
741785
-- into multiple repos for maintenance purposes.
742786
'hrsh7th/cmp-nvim-lsp',
743787
'hrsh7th/cmp-path',
788+
'hrsh7th/cmp-nvim-lsp-signature-help',
744789
},
745790
config = function()
746791
-- See `:help cmp`
@@ -817,6 +862,7 @@ require('lazy').setup({
817862
{ name = 'nvim_lsp' },
818863
{ name = 'luasnip' },
819864
{ name = 'path' },
865+
{ name = 'nvim_lsp_signature_help' },
820866
},
821867
}
822868
end,
@@ -829,7 +875,8 @@ require('lazy').setup({
829875
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
830876
'folke/tokyonight.nvim',
831877
priority = 1000, -- Make sure to load this before all the other start plugins.
832-
init = function()
878+
config = function()
879+
---@diagnostic disable-next-line: missing-fields
833880
require('tokyonight').setup {
834881
transparent = true,
835882
styles = {

lua/kickstart/plugins/gitsigns.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ return {
4444
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
4545
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
4646
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
47-
map('n', '<leader>hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' })
47+
map('n', '<leader>hu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' })
4848
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
4949
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
5050
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
@@ -54,7 +54,7 @@ return {
5454
end, { desc = 'git [D]iff against last commit' })
5555
-- Toggles
5656
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
57-
map('n', '<leader>tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' })
57+
map('n', '<leader>tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' })
5858
end,
5959
},
6060
},

0 commit comments

Comments
 (0)