Skip to content

Commit ccfb7e2

Browse files
committed
Merge branch 'master' of github.com:palonkochongo/kickstart.nvim
2 parents ac376a6 + 34e7d29 commit ccfb7e2

File tree

3 files changed

+75
-26
lines changed

3 files changed

+75
-26
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: 66 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,22 @@ require('lazy').setup({
245245
-- with the first argument being the link and the following
246246
-- keys can be used to configure plugin behavior/loading/etc.
247247
--
248-
-- Use `opts = {}` to force a plugin to be loaded.
248+
-- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
249249
--
250250

251+
-- Alternatively, use `config = function() ... end` for full control over the configuration.
252+
-- If you prefer to call `setup` explicitly, use:
253+
-- {
254+
-- 'lewis6991/gitsigns.nvim',
255+
-- config = function()
256+
-- require('gitsigns').setup({
257+
-- -- Your gitsigns configuration here
258+
-- })
259+
-- end,
260+
-- }
261+
--
251262
-- Here is a more advanced example where we pass configuration
252-
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
253-
-- require('gitsigns').setup({ ... })
263+
-- options to `gitsigns.nvim`.
254264
--
255265
-- See `:help gitsigns` to understand what the configuration keys do
256266
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
@@ -571,13 +581,26 @@ require('lazy').setup({
571581
-- For example, in C this would take you to the header.
572582
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
573583

584+
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
585+
---@param client vim.lsp.Client
586+
---@param method vim.lsp.protocol.Method
587+
---@param bufnr? integer some lsp support methods only in specific files
588+
---@return boolean
589+
local function client_supports_method(client, method, bufnr)
590+
if vim.fn.has 'nvim-0.11' == 1 then
591+
return client:supports_method(method, bufnr)
592+
else
593+
return client.supports_method(method, { bufnr = bufnr })
594+
end
595+
end
596+
574597
-- The following two autocommands are used to highlight references of the
575598
-- word under your cursor when your cursor rests there for a little while.
576599
-- See `:help CursorHold` for information about when this is executed
577600
--
578601
-- When you move your cursor, the highlights will be cleared (the second autocommand).
579602
local client = vim.lsp.get_client_by_id(event.data.client_id)
580-
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
603+
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
581604
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
582605
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
583606
buffer = event.buf,
@@ -604,23 +627,42 @@ require('lazy').setup({
604627
-- code, if the language server you are using supports them
605628
--
606629
-- This may be unwanted, since they displace some of your code
607-
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
630+
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
608631
map('<leader>th', function()
609632
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
610633
end, '[T]oggle Inlay [H]ints')
611634
end
612635
end,
613636
})
614637

615-
-- Change diagnostic symbols in the sign column (gutter)
616-
-- if vim.g.have_nerd_font then
617-
-- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
618-
-- local diagnostic_signs = {}
619-
-- for type, icon in pairs(signs) do
620-
-- diagnostic_signs[vim.diagnostic.severity[type]] = icon
621-
-- end
622-
-- vim.diagnostic.config { signs = { text = diagnostic_signs } }
623-
-- end
638+
-- Diagnostic Config
639+
-- See :help vim.diagnostic.Opts
640+
vim.diagnostic.config {
641+
severity_sort = true,
642+
float = { border = 'rounded', source = 'if_many' },
643+
underline = { severity = vim.diagnostic.severity.ERROR },
644+
signs = vim.g.have_nerd_font and {
645+
text = {
646+
[vim.diagnostic.severity.ERROR] = '󰅚 ',
647+
[vim.diagnostic.severity.WARN] = '󰀪 ',
648+
[vim.diagnostic.severity.INFO] = '󰋽 ',
649+
[vim.diagnostic.severity.HINT] = '󰌶 ',
650+
},
651+
} or {},
652+
virtual_text = {
653+
source = 'if_many',
654+
spacing = 2,
655+
format = function(diagnostic)
656+
local diagnostic_message = {
657+
[vim.diagnostic.severity.ERROR] = diagnostic.message,
658+
[vim.diagnostic.severity.WARN] = diagnostic.message,
659+
[vim.diagnostic.severity.INFO] = diagnostic.message,
660+
[vim.diagnostic.severity.HINT] = diagnostic.message,
661+
}
662+
return diagnostic_message[diagnostic.severity]
663+
end,
664+
},
665+
}
624666

625667
-- LSP servers and clients are able to communicate to each other what features they support.
626668
-- By default, Neovim doesn't support everything that is in the LSP specification.
@@ -784,6 +826,7 @@ require('lazy').setup({
784826
-- into multiple repos for maintenance purposes.
785827
'hrsh7th/cmp-nvim-lsp',
786828
'hrsh7th/cmp-path',
829+
'hrsh7th/cmp-nvim-lsp-signature-help',
787830
},
788831
config = function()
789832
-- See `:help cmp`
@@ -860,6 +903,7 @@ require('lazy').setup({
860903
{ name = 'nvim_lsp' },
861904
{ name = 'luasnip' },
862905
{ name = 'path' },
906+
{ name = 'nvim_lsp_signature_help' },
863907
},
864908
}
865909
end,
@@ -872,14 +916,18 @@ require('lazy').setup({
872916
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
873917
'folke/tokyonight.nvim',
874918
priority = 1000, -- Make sure to load this before all the other start plugins.
875-
init = function()
919+
config = function()
920+
---@diagnostic disable-next-line: missing-fields
921+
require('tokyonight').setup {
922+
styles = {
923+
comments = { italic = false }, -- Disable italics in comments
924+
},
925+
}
926+
876927
-- Load the colorscheme here.
877928
-- Like many other themes, this one has different styles, and you could load
878929
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
879930
vim.cmd.colorscheme 'tokyonight-night'
880-
881-
-- You can configure highlights by doing something like:
882-
vim.cmd.hi 'Comment gui=none'
883931
end,
884932
},
885933

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)