|
|
@ -91,7 +91,7 @@ vim.g.mapleader = ' '
|
|
|
|
vim.g.maplocalleader = ' '
|
|
|
|
vim.g.maplocalleader = ' '
|
|
|
|
|
|
|
|
|
|
|
|
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
|
|
|
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
|
|
|
vim.g.have_nerd_font = false
|
|
|
|
vim.g.have_nerd_font = true
|
|
|
|
|
|
|
|
|
|
|
|
-- [[ Setting options ]]
|
|
|
|
-- [[ Setting options ]]
|
|
|
|
-- See `:help vim.opt`
|
|
|
|
-- See `:help vim.opt`
|
|
|
@ -162,8 +162,8 @@ vim.opt.hlsearch = true
|
|
|
|
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
|
|
|
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
|
|
|
|
|
|
|
|
|
|
|
-- Diagnostic keymaps
|
|
|
|
-- Diagnostic keymaps
|
|
|
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
|
|
|
|
vim.keymap.set('n', '<leader>qq', '<CMD>q!<CR>', { desc = 'Quit all without close' })
|
|
|
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
|
|
|
|
vim.keymap.set('n', '<C-s>', '<CMD>w<CR>', { desc = 'Save a file' })
|
|
|
|
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
|
|
|
|
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
|
|
|
|
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
|
|
|
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
|
|
|
|
|
|
|
|
|
|
@ -209,37 +209,46 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
|
|
|
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
|
|
|
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
|
|
|
if not vim.loop.fs_stat(lazypath) then
|
|
|
|
if not vim.loop.fs_stat(lazypath) then
|
|
|
|
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
|
|
|
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
|
|
|
|
|
|
|
vim.cmd 'set expandtab'
|
|
|
|
|
|
|
|
vim.cmd 'set tabstop=2'
|
|
|
|
|
|
|
|
vim.cmd 'set softtabstop=2'
|
|
|
|
|
|
|
|
vim.cmd 'set shiftwidth=2'
|
|
|
|
vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
|
|
|
vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
|
|
|
end ---@diagnostic disable-next-line: undefined-field
|
|
|
|
end ---@diagnostic disable-next-line: undefined-field
|
|
|
|
vim.opt.rtp:prepend(lazypath)
|
|
|
|
vim.opt.rtp:prepend(lazypath)
|
|
|
|
|
|
|
|
|
|
|
|
-- [[ Configure and install plugins ]]
|
|
|
|
vim.cmd 'set expandtab'
|
|
|
|
|
|
|
|
vim.cmd 'set tabstop=2'
|
|
|
|
|
|
|
|
vim.cmd 'set softtabstop=2'
|
|
|
|
|
|
|
|
vim.cmd 'set shiftwidth=2'
|
|
|
|
--
|
|
|
|
--
|
|
|
|
-- To check the current status of your plugins, run
|
|
|
|
|
|
|
|
-- :Lazy
|
|
|
|
|
|
|
|
--
|
|
|
|
|
|
|
|
-- You can press `?` in this menu for help. Use `:q` to close the window
|
|
|
|
|
|
|
|
--
|
|
|
|
|
|
|
|
-- To update plugins you can run
|
|
|
|
|
|
|
|
-- :Lazy update
|
|
|
|
|
|
|
|
--
|
|
|
|
|
|
|
|
-- NOTE: Here is where you install your plugins.
|
|
|
|
|
|
|
|
require('lazy').setup({
|
|
|
|
require('lazy').setup({
|
|
|
|
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
|
|
|
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
|
|
|
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
|
|
|
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
|
|
|
|
|
|
|
|
|
|
|
-- 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.
|
|
|
|
|
|
|
|
--
|
|
|
|
|
|
|
|
-- Use `opts = {}` to force a plugin to be loaded.
|
|
|
|
|
|
|
|
--
|
|
|
|
|
|
|
|
-- This is equivalent to:
|
|
|
|
|
|
|
|
-- require('Comment').setup({})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- "gc" to comment visual regions/lines
|
|
|
|
-- "gc" to comment visual regions/lines
|
|
|
|
{ 'numToStr/Comment.nvim', opts = {} },
|
|
|
|
{ 'numToStr/Comment.nvim', opts = {} },
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
'nvimtools/none-ls.nvim',
|
|
|
|
|
|
|
|
optional = true,
|
|
|
|
|
|
|
|
dependencies = {
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
'williamboman/mason.nvim',
|
|
|
|
|
|
|
|
opts = function(_, opts)
|
|
|
|
|
|
|
|
opts.ensure_installed = opts.ensure_installed or {}
|
|
|
|
|
|
|
|
vim.list_extend(opts.ensure_installed, { 'gomodifytags', 'impl' })
|
|
|
|
|
|
|
|
end,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
opts = function(_, opts)
|
|
|
|
|
|
|
|
local nls = require 'null-ls'
|
|
|
|
|
|
|
|
opts.sources = vim.list_extend(opts.sources or {}, {
|
|
|
|
|
|
|
|
nls.builtins.code_actions.gomodifytags,
|
|
|
|
|
|
|
|
nls.builtins.code_actions.impl,
|
|
|
|
|
|
|
|
nls.builtins.formatting.goimports,
|
|
|
|
|
|
|
|
nls.builtins.formatting.gofumpt,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
end,
|
|
|
|
|
|
|
|
},
|
|
|
|
-- Here is a more advanced example where we pass configuration
|
|
|
|
-- Here is a more advanced example where we pass configuration
|
|
|
|
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
|
|
|
|
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
|
|
|
|
-- require('gitsigns').setup({ ... })
|
|
|
|
-- require('gitsigns').setup({ ... })
|
|
|
@ -257,7 +266,6 @@ require('lazy').setup({
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
|
|
|
|
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
|
|
|
|
--
|
|
|
|
--
|
|
|
|
-- This is often very useful to both group configuration, as well as handle
|
|
|
|
-- This is often very useful to both group configuration, as well as handle
|
|
|
@ -566,18 +574,40 @@ require('lazy').setup({
|
|
|
|
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
|
|
|
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
|
|
|
local servers = {
|
|
|
|
local servers = {
|
|
|
|
-- clangd = {},
|
|
|
|
-- clangd = {},
|
|
|
|
-- gopls = {},
|
|
|
|
gopls = {
|
|
|
|
-- pyright = {},
|
|
|
|
gofumpt = true,
|
|
|
|
-- rust_analyzer = {},
|
|
|
|
codelenses = {
|
|
|
|
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
|
|
|
gc_details = false,
|
|
|
|
--
|
|
|
|
generate = true,
|
|
|
|
-- Some languages (like typescript) have entire language plugins that can be useful:
|
|
|
|
regenerate_cgo = true,
|
|
|
|
-- https://github.com/pmizio/typescript-tools.nvim
|
|
|
|
run_govulncheck = true,
|
|
|
|
--
|
|
|
|
test = true,
|
|
|
|
-- But for many setups, the LSP (`tsserver`) will work just fine
|
|
|
|
tidy = true,
|
|
|
|
-- tsserver = {},
|
|
|
|
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,
|
|
|
|
|
|
|
|
},
|
|
|
|
lua_ls = {
|
|
|
|
lua_ls = {
|
|
|
|
-- cmd = {...},
|
|
|
|
-- cmd = {...},
|
|
|
|
-- filetypes = { ...},
|
|
|
|
-- filetypes = { ...},
|
|
|
@ -652,6 +682,7 @@ require('lazy').setup({
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
formatters_by_ft = {
|
|
|
|
formatters_by_ft = {
|
|
|
|
lua = { 'stylua' },
|
|
|
|
lua = { 'stylua' },
|
|
|
|
|
|
|
|
go = { 'gofmt', 'goimports', 'golines' },
|
|
|
|
-- Conform can also run multiple formatters sequentially
|
|
|
|
-- Conform can also run multiple formatters sequentially
|
|
|
|
-- python = { "isort", "black" },
|
|
|
|
-- python = { "isort", "black" },
|
|
|
|
--
|
|
|
|
--
|
|
|
@ -835,7 +866,20 @@ require('lazy').setup({
|
|
|
|
'nvim-treesitter/nvim-treesitter',
|
|
|
|
'nvim-treesitter/nvim-treesitter',
|
|
|
|
build = ':TSUpdate',
|
|
|
|
build = ':TSUpdate',
|
|
|
|
opts = {
|
|
|
|
opts = {
|
|
|
|
ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' },
|
|
|
|
ensure_installed = {
|
|
|
|
|
|
|
|
'bash',
|
|
|
|
|
|
|
|
'c',
|
|
|
|
|
|
|
|
'html',
|
|
|
|
|
|
|
|
'lua',
|
|
|
|
|
|
|
|
'luadoc',
|
|
|
|
|
|
|
|
'markdown',
|
|
|
|
|
|
|
|
'vim',
|
|
|
|
|
|
|
|
'vimdoc',
|
|
|
|
|
|
|
|
'go',
|
|
|
|
|
|
|
|
'gomod',
|
|
|
|
|
|
|
|
'gowork',
|
|
|
|
|
|
|
|
'gosum',
|
|
|
|
|
|
|
|
},
|
|
|
|
-- Autoinstall languages that are not installed
|
|
|
|
-- Autoinstall languages that are not installed
|
|
|
|
auto_install = true,
|
|
|
|
auto_install = true,
|
|
|
|
highlight = {
|
|
|
|
highlight = {
|
|
|
|