Skip to content

Commit 71710f9

Browse files
Merge remote-tracking branch 'upstream/master' into nvim-lua-master
2 parents 7f00d7a + 34e7d29 commit 71710f9

File tree

3 files changed

+77
-23
lines changed

3 files changed

+77
-23
lines changed

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: 68 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,22 @@ require('lazy').setup({
234234
-- with the first argument being the link and the following
235235
-- keys can be used to configure plugin behavior/loading/etc.
236236
--
237-
-- Use `opts = {}` to force a plugin to be loaded.
237+
-- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
238238
--
239239

240+
-- Alternatively, use `config = function() ... end` for full control over the configuration.
241+
-- If you prefer to call `setup` explicitly, use:
242+
-- {
243+
-- 'lewis6991/gitsigns.nvim',
244+
-- config = function()
245+
-- require('gitsigns').setup({
246+
-- -- Your gitsigns configuration here
247+
-- })
248+
-- end,
249+
-- }
250+
--
240251
-- Here is a more advanced example where we pass configuration
241-
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
242-
-- require('gitsigns').setup({ ... })
252+
-- options to `gitsigns.nvim`.
243253
--
244254
-- See `:help gitsigns` to understand what the configuration keys do
245255
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
@@ -548,13 +558,26 @@ require('lazy').setup({
548558
-- For example, in C this would take you to the header.
549559
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
550560

561+
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
562+
---@param client vim.lsp.Client
563+
---@param method vim.lsp.protocol.Method
564+
---@param bufnr? integer some lsp support methods only in specific files
565+
---@return boolean
566+
local function client_supports_method(client, method, bufnr)
567+
if vim.fn.has 'nvim-0.11' == 1 then
568+
return client:supports_method(method, bufnr)
569+
else
570+
return client.supports_method(method, { bufnr = bufnr })
571+
end
572+
end
573+
551574
-- The following two autocommands are used to highlight references of the
552575
-- word under your cursor when your cursor rests there for a little while.
553576
-- See `:help CursorHold` for information about when this is executed
554577
--
555578
-- When you move your cursor, the highlights will be cleared (the second autocommand).
556579
local client = vim.lsp.get_client_by_id(event.data.client_id)
557-
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
580+
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
558581
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
559582
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
560583
buffer = event.buf,
@@ -581,23 +604,42 @@ require('lazy').setup({
581604
-- code, if the language server you are using supports them
582605
--
583606
-- This may be unwanted, since they displace some of your code
584-
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
607+
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
585608
map('<leader>th', function()
586609
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
587610
end, '[T]oggle Inlay [H]ints')
588611
end
589612
end,
590613
})
591614

592-
-- Change diagnostic symbols in the sign column (gutter)
593-
-- if vim.g.have_nerd_font then
594-
-- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
595-
-- local diagnostic_signs = {}
596-
-- for type, icon in pairs(signs) do
597-
-- diagnostic_signs[vim.diagnostic.severity[type]] = icon
598-
-- end
599-
-- vim.diagnostic.config { signs = { text = diagnostic_signs } }
600-
-- end
615+
-- Diagnostic Config
616+
-- See :help vim.diagnostic.Opts
617+
vim.diagnostic.config {
618+
severity_sort = true,
619+
float = { border = 'rounded', source = 'if_many' },
620+
underline = { severity = vim.diagnostic.severity.ERROR },
621+
signs = vim.g.have_nerd_font and {
622+
text = {
623+
[vim.diagnostic.severity.ERROR] = '󰅚 ',
624+
[vim.diagnostic.severity.WARN] = '󰀪 ',
625+
[vim.diagnostic.severity.INFO] = '󰋽 ',
626+
[vim.diagnostic.severity.HINT] = '󰌶 ',
627+
},
628+
} or {},
629+
virtual_text = {
630+
source = 'if_many',
631+
spacing = 2,
632+
format = function(diagnostic)
633+
local diagnostic_message = {
634+
[vim.diagnostic.severity.ERROR] = diagnostic.message,
635+
[vim.diagnostic.severity.WARN] = diagnostic.message,
636+
[vim.diagnostic.severity.INFO] = diagnostic.message,
637+
[vim.diagnostic.severity.HINT] = diagnostic.message,
638+
}
639+
return diagnostic_message[diagnostic.severity]
640+
end,
641+
},
642+
}
601643

602644
-- LSP servers and clients are able to communicate to each other what features they support.
603645
-- By default, Neovim doesn't support everything that is in the LSP specification.
@@ -665,6 +707,8 @@ require('lazy').setup({
665707
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
666708

667709
require('mason-lspconfig').setup {
710+
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
711+
automatic_installation = false,
668712
handlers = {
669713
function(server_name)
670714
local server = servers[server_name] or {}
@@ -757,6 +801,7 @@ require('lazy').setup({
757801
-- into multiple repos for maintenance purposes.
758802
'hrsh7th/cmp-nvim-lsp',
759803
'hrsh7th/cmp-path',
804+
'hrsh7th/cmp-nvim-lsp-signature-help',
760805
},
761806
config = function()
762807
-- See `:help cmp`
@@ -833,6 +878,7 @@ require('lazy').setup({
833878
{ name = 'nvim_lsp' },
834879
{ name = 'luasnip' },
835880
{ name = 'path' },
881+
{ name = 'nvim_lsp_signature_help' },
836882
},
837883
}
838884
end,
@@ -847,7 +893,14 @@ require('lazy').setup({
847893
--'oxfist/night-owl.nvim',
848894
lazy = false,
849895
priority = 1000, -- Make sure to load this before all the other start plugins.
850-
init = function()
896+
config = function()
897+
---@diagnostic disable-next-line: missing-fields
898+
require('tokyonight').setup {
899+
styles = {
900+
comments = { italic = false }, -- Disable italics in comments
901+
},
902+
}
903+
851904
-- Load the colorscheme here.
852905
-- Like many other themes, this one has different styles, and you could load
853906
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.

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)