Merge branch 'master' into patch-1
This commit is contained in:
commit
5f4d8471bb
19 changed files with 340 additions and 11 deletions
119
init.lua
119
init.lua
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue