Skip to content

Commit 5f4d847

Browse files
authored
Merge branch 'master' into patch-1
2 parents a153490 + 6f27eee commit 5f4d847

File tree

19 files changed

+340
-11
lines changed

19 files changed

+340
-11
lines changed

.github/workflows/stylua.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,3 @@ jobs:
1818
token: ${{ secrets.GITHUB_TOKEN }}
1919
version: latest
2020
args: --check .
21-

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,5 @@ sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim
231231
```
232232
</details>
233233

234+
=======
235+
Then continue with the [Install Kickstart](#Install-Kickstart) step.

after/plugin/filetype.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
local function set_filetype(pattern, filetype)
2+
vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
3+
pattern = pattern,
4+
command = 'set filetype=' .. filetype,
5+
})
6+
end
7+
8+
set_filetype('.swcrc', 'json')
9+
set_filetype('.prettierrc', 'json')
10+
set_filetype('docker-compose.yml', 'yaml.docker-compose')

after/plugin/harpoon.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- local mark = require("harpoon.mark")
2+
-- local ui = require("harpoon.ui")
3+
-- vim.keymap.set("n", "<leader>ah", mark.add_file)
4+
-- vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
5+
-- vim.keymap.set("n", "<C-h>", function() ui.nav_file(1) end)
6+
-- vim.keymap.set("n", "<C-j>", function() ui.nav_file(2) end)
7+
-- vim.keymap.set("n", "<C-k>", function() ui.nav_file(3) end)
8+
-- vim.keymap.set("n", "<C-l>", function() ui.nav_file(4) end)

after/plugin/init.lua

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
vim.opt.relativenumber = true
2+
vim.keymap.set('n', '<leader>pv', '<cmd>Ex<CR>')
3+
vim.opt.ignorecase = true
4+
vim.opt.smartcase = true
5+
vim.opt.smartindent = true
6+
vim.opt.autoindent = true
7+
vim.opt.expandtab = true
8+
vim.opt.tabstop = 2
9+
vim.opt.shiftwidth = 2
10+
vim.keymap.set('n', '<leader>y', '"+y')
11+
vim.keymap.set('n', '<leader>gs', ':Git<CR>')
12+
vim.keymap.set('n', '<leader>gp', ':Git pull<CR>')
13+
vim.keymap.set('n', '<leader>gpsh', ':Git push<CR>')
14+
vim.keymap.set('n', 'gh', '<cmd>diffget //2<CR>')
15+
vim.keymap.set('n', 'gl', '<cmd>diffget //3<CR>')
16+
17+
-- LSP testing
18+
local client_id = vim.lsp.start_client {
19+
name = 'LSP Playground',
20+
cmd = { '/home/gilad/dev/lsp-playground/main' },
21+
on_attach = function() end,
22+
}
23+
24+
if not client_id then
25+
vim.notify "hey, you didn't do the client thing good"
26+
return
27+
end
28+
29+
vim.api.nvim_create_autocmd('FileType', {
30+
pattern = 'markdown',
31+
callback = function()
32+
local success = vim.lsp.buf_attach_client(0, client_id)
33+
if not success then
34+
vim.notify 'failed to attach client'
35+
end
36+
end,
37+
})
38+
39+
vim.api.nvim_create_autocmd('User', {
40+
pattern = 'LazyDone',
41+
callback = function()
42+
local registry = require 'mason-registry'
43+
registry.refresh(function()
44+
local installed_packages = registry.get_installed_packages()
45+
for i = 1, #installed_packages do
46+
local pkg = installed_packages[i]
47+
pkg:check_new_version(function(success, result)
48+
if not success then
49+
if result ~= 'Package is not outdated.' then
50+
vim.notify('Failed to fetch pkg' .. pkg.spec.name .. ':' .. result)
51+
end
52+
goto continue
53+
end
54+
local install_handler = pkg:install { version = result.latest_version }
55+
while install_handler:is_active() do
56+
end
57+
if install_handler:is_terminated() then
58+
vim.notify('Failed to install pkg' .. pkg.spec.name)
59+
end
60+
if install_handler:isClosed() then
61+
vim.notify('Successfully updated pkg' .. pkg.spec.name)
62+
end
63+
::continue::
64+
end)
65+
end
66+
end)
67+
end,
68+
})

after/plugin/prettier.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
vim.cmd([[
2+
augroup FormatAutogroup
3+
autocmd!
4+
autocmd BufWritePre *.js,*.jsx,*.ts,*.tsx,*.cjs,*.mjs,*.cts,*.mts Prettier
5+
augroup END
6+
]])

init.lua

Lines changed: 109 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ vim.g.have_nerd_font = true
102102
vim.opt.number = true
103103
-- You can also add relative line numbers, to help with jumping.
104104
-- Experiment for yourself to see if you like it!
105-
-- vim.opt.relativenumber = true
105+
vim.opt.relativenumber = true
106106

107107
-- Enable mouse mode, can be useful for resizing splits for example!
108108
vim.opt.mouse = 'a'
@@ -190,6 +190,12 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
190190
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
191191
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
192192

193+
if vim.lsp.inlay_hint then
194+
vim.keymap.set('n', '<leader>ih', function()
195+
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled {})
196+
end, { desc = 'Toggle [I]nlay [H]ints' })
197+
end
198+
193199
-- [[ Basic Autocommands ]]
194200
-- See `:help lua-guide-autocommands`
195201

@@ -231,6 +237,10 @@ require('lazy').setup({
231237
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
232238
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
233239

240+
-- Git related plugins
241+
'tpope/vim-fugitive',
242+
'tpope/vim-rhubarb',
243+
234244
-- NOTE: Plugins can also be added by using a table,
235245
-- with the first argument being the link and the following
236246
-- keys can be used to configure plugin behavior/loading/etc.
@@ -328,6 +338,14 @@ require('lazy').setup({
328338
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
329339
},
330340
},
341+
require('which-key').add {
342+
{ '<leader>c', group = '[C]ode' },
343+
{ '<leader>d', group = '[D]ocument]' },
344+
{ '<leader>r', group = '[R]ename' },
345+
{ '<leader>s', group = '[S]earch' },
346+
{ '<leader>w', group = '[W]orkspace' },
347+
}
348+
end,
331349
},
332350

333351
-- NOTE: Plugins can specify dependencies.
@@ -357,6 +375,7 @@ require('lazy').setup({
357375
end,
358376
},
359377
{ 'nvim-telescope/telescope-ui-select.nvim' },
378+
{ 'nvim-telescope/telescope-file-browser.nvim' },
360379

361380
-- Useful for getting pretty icons, but requires a Nerd Font.
362381
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
@@ -403,6 +422,7 @@ require('lazy').setup({
403422
-- Enable Telescope extensions if they are installed
404423
pcall(require('telescope').load_extension, 'fzf')
405424
pcall(require('telescope').load_extension, 'ui-select')
425+
pcall(require('telescope').load_extension, 'file_browser')
406426

407427
-- See `:help telescope.builtin`
408428
local builtin = require 'telescope.builtin'
@@ -416,6 +436,7 @@ require('lazy').setup({
416436
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
417437
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
418438
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
439+
vim.keymap.set('n', '-', ':Telescope file_browser<CR>', { desc = 'Search the file browser [-]' })
419440

420441
-- Slightly advanced example of overriding default behavior and theme
421442
vim.keymap.set('n', '<leader>/', function()
@@ -459,6 +480,9 @@ require('lazy').setup({
459480
{
460481
-- Main LSP Configuration
461482
'neovim/nvim-lspconfig',
483+
opts = {
484+
inlay_hints = { enabled = true },
485+
},
462486
dependencies = {
463487
-- Automatically install LSPs and related tools to stdpath for Neovim
464488
{ 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants
@@ -615,16 +639,78 @@ require('lazy').setup({
615639
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
616640
local servers = {
617641
-- clangd = {},
618-
-- gopls = {},
619-
-- pyright = {},
620-
-- rust_analyzer = {},
642+
gopls = {
643+
settings = {
644+
gopls = {
645+
gofumpt = true,
646+
codelenses = {
647+
gc_details = false,
648+
generate = true,
649+
regenerate_cgo = true,
650+
run_govulncheck = true,
651+
test = true,
652+
tidy = true,
653+
upgrade_dependency = true,
654+
vendor = true,
655+
},
656+
hints = {
657+
assignVariableTypes = true,
658+
compositeLiteralFields = true,
659+
compositeLiteralTypes = true,
660+
constantValues = true,
661+
functionTypeParameters = true,
662+
parameterNames = true,
663+
rangeVariableTypes = true,
664+
},
665+
analyses = {
666+
fieldalignment = true,
667+
nilness = true,
668+
unusedparams = true,
669+
unusedwrite = true,
670+
useany = true,
671+
},
672+
usePlaceholders = true,
673+
completeUnimported = true,
674+
staticcheck = true,
675+
directoryFilters = { '-.git', '-.vscode', '-.idea', '-.vscode-test', '-node_modules' },
676+
semanticTokens = true,
677+
},
678+
},
679+
},
680+
pyright = {},
681+
rust_analyzer = {},
682+
docker_compose_language_service = {},
683+
dockerls = {},
621684
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
622685
--
623686
-- Some languages (like typescript) have entire language plugins that can be useful:
624687
-- https://github.com/pmizio/typescript-tools.nvim
625688
--
626689
-- But for many setups, the LSP (`tsserver`) will work just fine
627-
-- tsserver = {},
690+
tsserver = {
691+
javascript = {
692+
inlayHints = {
693+
includeInlayEnumMemberValueHints = true,
694+
includeInlayFunctionLikeReturnTypeHints = true,
695+
includeInlayFunctionParameterTypeHints = true,
696+
includeInlayParameterNameHints = 'all',
697+
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
698+
includeInlayPropertyDeclarationTypeHints = true,
699+
includeInlayVariableTypeHints = true,
700+
},
701+
},
702+
typescript = {
703+
inlayHints = {
704+
includeInlayEnumMemberValueHints = true,
705+
includeInlayFunctionLikeReturnTypeHints = true,
706+
includeInlayFunctionParameterTypeHints = true,
707+
includeInlayParameterNameHints = 'all',
708+
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
709+
includeInlayPropertyDeclarationTypeHints = true,
710+
includeInlayVariableTypeHints = true,
711+
},
712+
},
713+
},
628714
--
629715

630716
lua_ls = {
@@ -637,10 +723,14 @@ require('lazy').setup({
637723
callSnippet = 'Replace',
638724
},
639725
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
640-
-- diagnostics = { disable = { 'missing-fields' } },
726+
diagnostics = { -- disable = { 'missing-fields' } },
727+
globals = { 'vim' },
728+
},
729+
hint = { enable = true },
641730
},
642731
},
643732
},
733+
ols = {},
644734
}
645735

646736
-- Ensure the servers and tools above are installed
@@ -672,6 +762,7 @@ require('lazy').setup({
672762
},
673763
}
674764
end,
765+
checker = { enabled = true },
675766
},
676767

677768
{ -- Autoformat
@@ -712,7 +803,11 @@ require('lazy').setup({
712803
-- python = { "isort", "black" },
713804
--
714805
-- You can use 'stop_after_first' to run the first available formatter from the list
715-
-- javascript = { "prettierd", "prettier", stop_after_first = true },
806+
-- You can use a sub-list to tell conform to run *until* a formatter
807+
-- is found.
808+
javascript = { { 'prettierd', 'prettier', stop_after_first = true } },
809+
typescript = { { 'prettierd', 'prettier', stop_after_first = true } },
810+
astro = { { 'prettierd', 'prettier', stop_after_first = true } },
716811
},
717812
},
718813
},
@@ -721,6 +816,7 @@ require('lazy').setup({
721816
'hrsh7th/nvim-cmp',
722817
event = 'InsertEnter',
723818
dependencies = {
819+
'nvim-neotest/nvim-nio',
724820
-- Snippet Engine & its associated nvim-cmp source
725821
{
726822
'L3MON4D3/LuaSnip',
@@ -795,7 +891,7 @@ require('lazy').setup({
795891
-- Manually trigger a completion from nvim-cmp.
796892
-- Generally you don't need this, because nvim-cmp will display
797893
-- completions whenever it has completion options available.
798-
['<C-Space>'] = cmp.mapping.complete {},
894+
['<C-e>'] = cmp.mapping.complete {},
799895

800896
-- Think of <c-l> as moving to the right of your snippet expansion.
801897
-- So if you have a snippet that's like:
@@ -894,6 +990,9 @@ require('lazy').setup({
894990
{ -- Highlight, edit, and navigate code
895991
'nvim-treesitter/nvim-treesitter',
896992
build = ':TSUpdate',
993+
dependencies = {
994+
{ 'nvim-treesitter/nvim-treesitter-context', opts = { enable = true, mode = 'topline', line_numbers = true } },
995+
},
897996
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
898997
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
899998
opts = {
@@ -926,7 +1025,7 @@ require('lazy').setup({
9261025
-- Here are some example plugins that I've included in the Kickstart repository.
9271026
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
9281027
--
929-
-- require 'kickstart.plugins.debug',
1028+
require 'kickstart.plugins.debug',
9301029
-- require 'kickstart.plugins.indent_line',
9311030
-- require 'kickstart.plugins.lint',
9321031
-- require 'kickstart.plugins.autopairs',
@@ -938,7 +1037,7 @@ require('lazy').setup({
9381037
--
9391038
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
9401039
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
941-
-- { import = 'custom.plugins' },
1040+
{ import = 'custom.plugins' },
9421041
}, {
9431042
ui = {
9441043
-- If you are using a Nerd Font: set icons to an empty table which will use the

0 commit comments

Comments
 (0)