Merge branch 'master' into patch-1

This commit is contained in:
Gilad Sher 2024-09-07 11:53:39 -04:00 committed by GitHub
commit 5f4d8471bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 340 additions and 11 deletions

View File

@ -18,4 +18,3 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --check .

View File

@ -231,3 +231,5 @@ sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim
```
</details>
=======
Then continue with the [Install Kickstart](#Install-Kickstart) step.

10
after/plugin/filetype.lua Normal file
View File

@ -0,0 +1,10 @@
local function set_filetype(pattern, filetype)
vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
pattern = pattern,
command = 'set filetype=' .. filetype,
})
end
set_filetype('.swcrc', 'json')
set_filetype('.prettierrc', 'json')
set_filetype('docker-compose.yml', 'yaml.docker-compose')

8
after/plugin/harpoon.lua Normal file
View File

@ -0,0 +1,8 @@
-- local mark = require("harpoon.mark")
-- local ui = require("harpoon.ui")
-- vim.keymap.set("n", "<leader>ah", mark.add_file)
-- vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
-- vim.keymap.set("n", "<C-h>", function() ui.nav_file(1) end)
-- vim.keymap.set("n", "<C-j>", function() ui.nav_file(2) end)
-- vim.keymap.set("n", "<C-k>", function() ui.nav_file(3) end)
-- vim.keymap.set("n", "<C-l>", function() ui.nav_file(4) end)

68
after/plugin/init.lua Normal file
View File

@ -0,0 +1,68 @@
vim.opt.relativenumber = true
vim.keymap.set('n', '<leader>pv', '<cmd>Ex<CR>')
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.smartindent = true
vim.opt.autoindent = true
vim.opt.expandtab = true
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.keymap.set('n', '<leader>y', '"+y')
vim.keymap.set('n', '<leader>gs', ':Git<CR>')
vim.keymap.set('n', '<leader>gp', ':Git pull<CR>')
vim.keymap.set('n', '<leader>gpsh', ':Git push<CR>')
vim.keymap.set('n', 'gh', '<cmd>diffget //2<CR>')
vim.keymap.set('n', 'gl', '<cmd>diffget //3<CR>')
-- LSP testing
local client_id = vim.lsp.start_client {
name = 'LSP Playground',
cmd = { '/home/gilad/dev/lsp-playground/main' },
on_attach = function() end,
}
if not client_id then
vim.notify "hey, you didn't do the client thing good"
return
end
vim.api.nvim_create_autocmd('FileType', {
pattern = 'markdown',
callback = function()
local success = vim.lsp.buf_attach_client(0, client_id)
if not success then
vim.notify 'failed to attach client'
end
end,
})
vim.api.nvim_create_autocmd('User', {
pattern = 'LazyDone',
callback = function()
local registry = require 'mason-registry'
registry.refresh(function()
local installed_packages = registry.get_installed_packages()
for i = 1, #installed_packages do
local pkg = installed_packages[i]
pkg:check_new_version(function(success, result)
if not success then
if result ~= 'Package is not outdated.' then
vim.notify('Failed to fetch pkg' .. pkg.spec.name .. ':' .. result)
end
goto continue
end
local install_handler = pkg:install { version = result.latest_version }
while install_handler:is_active() do
end
if install_handler:is_terminated() then
vim.notify('Failed to install pkg' .. pkg.spec.name)
end
if install_handler:isClosed() then
vim.notify('Successfully updated pkg' .. pkg.spec.name)
end
::continue::
end)
end
end)
end,
})

View File

@ -0,0 +1,6 @@
vim.cmd([[
augroup FormatAutogroup
autocmd!
autocmd BufWritePre *.js,*.jsx,*.ts,*.tsx,*.cjs,*.mjs,*.cts,*.mts Prettier
augroup END
]])

119
init.lua
View File

@ -102,7 +102,7 @@ vim.g.have_nerd_font = true
vim.opt.number = true
-- You can also add relative line numbers, to help with jumping.
-- Experiment for yourself to see if you like it!
-- vim.opt.relativenumber = true
vim.opt.relativenumber = true
-- Enable mouse mode, can be useful for resizing splits for example!
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
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
if vim.lsp.inlay_hint then
vim.keymap.set('n', '<leader>ih', function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled {})
end, { desc = 'Toggle [I]nlay [H]ints' })
end
-- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands`
@ -231,6 +237,10 @@ require('lazy').setup({
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
-- Git related plugins
'tpope/vim-fugitive',
'tpope/vim-rhubarb',
-- NOTE: Plugins can also be added by using a table,
-- with the first argument being the link and the following
-- keys can be used to configure plugin behavior/loading/etc.
@ -328,6 +338,14 @@ require('lazy').setup({
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
},
},
require('which-key').add {
{ '<leader>c', group = '[C]ode' },
{ '<leader>d', group = '[D]ocument]' },
{ '<leader>r', group = '[R]ename' },
{ '<leader>s', group = '[S]earch' },
{ '<leader>w', group = '[W]orkspace' },
}
end,
},
-- NOTE: Plugins can specify dependencies.
@ -357,6 +375,7 @@ require('lazy').setup({
end,
},
{ 'nvim-telescope/telescope-ui-select.nvim' },
{ 'nvim-telescope/telescope-file-browser.nvim' },
-- Useful for getting pretty icons, but requires a Nerd Font.
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
@ -403,6 +422,7 @@ require('lazy').setup({
-- Enable Telescope extensions if they are installed
pcall(require('telescope').load_extension, 'fzf')
pcall(require('telescope').load_extension, 'ui-select')
pcall(require('telescope').load_extension, 'file_browser')
-- See `:help telescope.builtin`
local builtin = require 'telescope.builtin'
@ -416,6 +436,7 @@ require('lazy').setup({
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '-', ':Telescope file_browser<CR>', { desc = 'Search the file browser [-]' })
-- Slightly advanced example of overriding default behavior and theme
vim.keymap.set('n', '<leader>/', function()
@ -459,6 +480,9 @@ require('lazy').setup({
{
-- Main LSP Configuration
'neovim/nvim-lspconfig',
opts = {
inlay_hints = { enabled = true },
},
dependencies = {
-- Automatically install LSPs and related tools to stdpath for Neovim
{ 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants
@ -615,16 +639,78 @@ require('lazy').setup({
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local servers = {
-- clangd = {},
-- gopls = {},
-- pyright = {},
-- rust_analyzer = {},
gopls = {
settings = {
gopls = {
gofumpt = true,
codelenses = {
gc_details = false,
generate = true,
regenerate_cgo = true,
run_govulncheck = true,
test = true,
tidy = true,
upgrade_dependency = true,
vendor = true,
},
hints = {
assignVariableTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true,
},
analyses = {
fieldalignment = true,
nilness = true,
unusedparams = true,
unusedwrite = true,
useany = true,
},
usePlaceholders = true,
completeUnimported = true,
staticcheck = true,
directoryFilters = { '-.git', '-.vscode', '-.idea', '-.vscode-test', '-node_modules' },
semanticTokens = true,
},
},
},
pyright = {},
rust_analyzer = {},
docker_compose_language_service = {},
dockerls = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
--
-- Some languages (like typescript) have entire language plugins that can be useful:
-- https://github.com/pmizio/typescript-tools.nvim
--
-- But for many setups, the LSP (`tsserver`) will work just fine
-- tsserver = {},
tsserver = {
javascript = {
inlayHints = {
includeInlayEnumMemberValueHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayFunctionParameterTypeHints = true,
includeInlayParameterNameHints = 'all',
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayVariableTypeHints = true,
},
},
typescript = {
inlayHints = {
includeInlayEnumMemberValueHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayFunctionParameterTypeHints = true,
includeInlayParameterNameHints = 'all',
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayVariableTypeHints = true,
},
},
},
--
lua_ls = {
@ -637,10 +723,14 @@ require('lazy').setup({
callSnippet = 'Replace',
},
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
-- diagnostics = { disable = { 'missing-fields' } },
diagnostics = { -- disable = { 'missing-fields' } },
globals = { 'vim' },
},
hint = { enable = true },
},
},
},
ols = {},
}
-- Ensure the servers and tools above are installed
@ -672,6 +762,7 @@ require('lazy').setup({
},
}
end,
checker = { enabled = true },
},
{ -- Autoformat
@ -712,7 +803,11 @@ require('lazy').setup({
-- python = { "isort", "black" },
--
-- You can use 'stop_after_first' to run the first available formatter from the list
-- javascript = { "prettierd", "prettier", stop_after_first = true },
-- You can use a sub-list to tell conform to run *until* a formatter
-- is found.
javascript = { { 'prettierd', 'prettier', stop_after_first = true } },
typescript = { { 'prettierd', 'prettier', stop_after_first = true } },
astro = { { 'prettierd', 'prettier', stop_after_first = true } },
},
},
},
@ -721,6 +816,7 @@ require('lazy').setup({
'hrsh7th/nvim-cmp',
event = 'InsertEnter',
dependencies = {
'nvim-neotest/nvim-nio',
-- Snippet Engine & its associated nvim-cmp source
{
'L3MON4D3/LuaSnip',
@ -795,7 +891,7 @@ require('lazy').setup({
-- Manually trigger a completion from nvim-cmp.
-- Generally you don't need this, because nvim-cmp will display
-- completions whenever it has completion options available.
['<C-Space>'] = cmp.mapping.complete {},
['<C-e>'] = cmp.mapping.complete {},
-- Think of <c-l> as moving to the right of your snippet expansion.
-- So if you have a snippet that's like:
@ -894,6 +990,9 @@ require('lazy').setup({
{ -- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
dependencies = {
{ 'nvim-treesitter/nvim-treesitter-context', opts = { enable = true, mode = 'topline', line_numbers = true } },
},
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
opts = {
@ -926,7 +1025,7 @@ require('lazy').setup({
-- Here are some example plugins that I've included in the Kickstart repository.
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
--
-- require 'kickstart.plugins.debug',
require 'kickstart.plugins.debug',
-- require 'kickstart.plugins.indent_line',
-- require 'kickstart.plugins.lint',
-- require 'kickstart.plugins.autopairs',
@ -938,7 +1037,7 @@ require('lazy').setup({
--
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
-- { import = 'custom.plugins' },
{ import = 'custom.plugins' },
}, {
ui = {
-- If you are using a Nerd Font: set icons to an empty table which will use the

50
lazy-lock.json Normal file
View File

@ -0,0 +1,50 @@
{
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"LuaSnip": { "branch": "master", "commit": "ce0a05ab4e2839e1c48d072c5236cce846a387bc" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conform.nvim": { "branch": "master", "commit": "310e2e95a4f832163f3f7a9fedebb1a4afc0db69" },
"copilot.vim": { "branch": "release", "commit": "25f73977033c597d530c7ab0e211d99b60927d2d" },
"fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" },
"gitsigns.nvim": { "branch": "main", "commit": "f4928ba14eb6c667786ac7d69927f6aee6719f1e" },
"go.nvim": { "branch": "master", "commit": "033344ddfa3cd5cfd55037903264b2bb86691619" },
"guihua.lua": { "branch": "master", "commit": "225db770e36aae6a1e9e3a65578095c8eb4038d3" },
"harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" },
"hydra.nvim": { "branch": "master", "commit": "55de54543d673824435930ecf533256eea2e565b" },
"lazy.nvim": { "branch": "main", "commit": "d731a6b005fd239e85e555bd57362382f6c1e461" },
"lualine.nvim": { "branch": "master", "commit": "544dd1583f9bb27b393f598475c89809c4d5e86b" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "37a336b653f8594df75c827ed589f1c91d91ff6c" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "4ba55f9755ebe8297d92c419b90a946123292ae6" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"mini.nvim": { "branch": "main", "commit": "f20d8cd3a116ef65f022797de064a044b217ff53" },
"multicursors.nvim": { "branch": "main", "commit": "782820896b1691ed664e4c24f1cd9793dcb33dfb" },
"neo-tree.nvim": { "branch": "main", "commit": "8c75e8a2949cd6cd35525799200a8d34471ee9eb" },
"nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" },
"nvim": { "branch": "main", "commit": "7946d1a195c66fed38b3e34f9fa8e0c5a2da0700" },
"nvim-autopairs": { "branch": "master", "commit": "78a4507bb9ffc9b00f11ae0ac48243d00cb9194d" },
"nvim-cmp": { "branch": "main", "commit": "d818fd0624205b34e14888358037fb6f5dc51234" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-dap": { "branch": "master", "commit": "6f79b822997f2e8a789c6034e147d42bc6706770" },
"nvim-dap-go": { "branch": "main", "commit": "3999f0744e80d2dba5775189fc7c7a5e9846053e" },
"nvim-dap-ui": { "branch": "master", "commit": "a5606bc5958db86f8d92803bea7400ee26a8d7e4" },
"nvim-lspconfig": { "branch": "master", "commit": "01e08d4bf1c35e5126b2ad5209725e4c552289ab" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-treesitter": { "branch": "master", "commit": "0d5e1214a5c386a168dc8e19d7da0ceb0e0bd6f2" },
"nvim-treesitter-context": { "branch": "master", "commit": "2aba92ceb1479485953007f4d5adf34d0b66917e" },
"nvim-ts-autotag": { "branch": "main", "commit": "1624866a1379fc1861797f0ed05899a9c1d2ff61" },
"nvim-web-devicons": { "branch": "master", "commit": "c0cfc1738361b5da1cd0a962dd6f774cc444f856" },
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
"telescope-file-browser.nvim": { "branch": "master", "commit": "a7ab9a957b17199183388c6f357d614fcaa508e5" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"todo-comments.nvim": { "branch": "main", "commit": "96fee098a90e7c09c9811aa7df71d773ba8b9b53" },
"tokyonight.nvim": { "branch": "main", "commit": "6adfcde66e8af2f22dd5d76060980abd8daa0df8" },
"vim-fugitive": { "branch": "master", "commit": "8c8cdf4405cb8bdb70dd9812a33bb52363a87dbc" },
"vim-prettier": { "branch": "master", "commit": "7dbdbb12c50a9f4ba72390cce2846248e4368fd0" },
"vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" },
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" },
"which-key.nvim": { "branch": "main", "commit": "bb4e82bdaff50a4a93867e4c90938d18e7615af6" }
}

View File

@ -0,0 +1,6 @@
return {
'windwp/nvim-ts-autotag',
config = function()
require('nvim-ts-autotag').setup()
end
}

View File

@ -0,0 +1,6 @@
return {
"windwp/nvim-autopairs",
config = function()
require("nvim-autopairs").setup {}
end,
}

View File

@ -0,0 +1,6 @@
return {
'norcalli/nvim-colorizer.lua',
config = function ()
require('colorizer').setup()
end
}

View File

@ -0,0 +1,3 @@
return {
'github/copilot.vim'
}

View File

@ -0,0 +1,15 @@
-- Unless you are still migrating, remove the deprecated commands from v1.x
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
return {
"nvim-neo-tree/neo-tree.nvim",
version = "*",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
},
config = function()
require('neo-tree').setup {}
end,
}

View File

@ -0,0 +1,14 @@
return {
'ray-x/go.nvim',
dependencies = { -- optional packages
'ray-x/guihua.lua',
'neovim/nvim-lspconfig',
'nvim-treesitter/nvim-treesitter',
},
config = function()
require('go').setup()
end,
event = { 'CmdlineEnter' },
ft = { 'go', 'gomod' },
build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries
}

View File

@ -0,0 +1,3 @@
return {
"ThePrimeagen/harpoon"
}

View File

@ -0,0 +1,7 @@
return {
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons', 'catppuccin/nvim' },
config = function()
require('lualine').setup { options = { theme = 'catppuccin' } }
end,
}

View File

@ -0,0 +1,23 @@
return {
'smoka7/multicursors.nvim',
event = 'VeryLazy',
dependencies = {
'smoka7/hydra.nvim',
},
opts = {},
cmd = { 'MCstart', 'MCvisual', 'MCclear', 'MCpattern', 'MCvisualPattern', 'MCunderCursor' },
keys = {
{
mode = { 'v', 'n' },
'<Leader>ms',
'<cmd>MCstart<cr>',
desc = 'Create a [M]ulti [S]election for selected text or word under the cursor',
},
{
mode = { 'v', 'n' },
'<Leader>mp',
'<cmd>MCpattern<cr>',
desc = 'Create a [M]ulti [P]attern selection in the current buffer',
},
},
}

View File

@ -0,0 +1,3 @@
return {
'prettier/vim-prettier'
}

View File

@ -64,6 +64,7 @@ return {
ensure_installed = {
-- Update this to ensure that you have the debuggers for the langs you want
'delve',
'chrome-debug-adapter',
},
}