fix: continue cleaning up docs and config
This commit is contained in:
parent
7e54a4c5c8
commit
e79572c9e6
63
init.lua
63
init.lua
|
|
@ -171,7 +171,22 @@ vim.o.confirm = true
|
||||||
-- See `:help hlsearch`
|
-- See `:help hlsearch`
|
||||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||||
|
|
||||||
-- Diagnostic keymaps
|
-- Diagnostic Config & Keymaps
|
||||||
|
-- See :help vim.diagnostic.Opts
|
||||||
|
vim.diagnostic.config {
|
||||||
|
update_in_insert = false,
|
||||||
|
severity_sort = true,
|
||||||
|
float = { border = 'rounded', source = 'if_many' },
|
||||||
|
underline = { severity = vim.diagnostic.severity.ERROR },
|
||||||
|
|
||||||
|
-- Can switch between these as you prefer
|
||||||
|
virtual_text = true, -- Text shows up at the end of the line
|
||||||
|
virtual_lines = false, -- Teest shows up underneath the line, with virtual lines
|
||||||
|
|
||||||
|
-- Auto open the float, so you can easily read the errors when jumping with `[d` and `]d`
|
||||||
|
jump = { float = true },
|
||||||
|
}
|
||||||
|
|
||||||
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' })
|
||||||
|
|
||||||
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
||||||
|
|
@ -373,9 +388,7 @@ require('lazy').setup({
|
||||||
-- },
|
-- },
|
||||||
-- pickers = {}
|
-- pickers = {}
|
||||||
extensions = {
|
extensions = {
|
||||||
['ui-select'] = {
|
['ui-select'] = { require('telescope.themes').get_dropdown() },
|
||||||
require('telescope.themes').get_dropdown(),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -398,11 +411,7 @@ require('lazy').setup({
|
||||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||||
|
|
||||||
-- This runs on LSP attach per buffer (see main LSP attach function in 'neovim/nvim-lspconfig' config for more info,
|
-- This runs on LSP attach per buffer (see main LSP attach function in 'neovim/nvim-lspconfig' config for more info,
|
||||||
-- it is better explained there). This is a little bit redundant, but we can switch off telescope for an optional
|
-- it is better explained there). This allows easily switching between pickers if you prefer using something else!
|
||||||
-- picker like snacks more easily when the keymaps are defined in the plugin itself.
|
|
||||||
-- It sets up buffer-local keymaps, autocommands, and other LSP-related settings
|
|
||||||
-- whenever an LSP client attaches to a buffer.
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
group = vim.api.nvim_create_augroup('telescope-lsp-attach', { clear = true }),
|
group = vim.api.nvim_create_augroup('telescope-lsp-attach', { clear = true }),
|
||||||
callback = function(event)
|
callback = function(event)
|
||||||
|
|
@ -435,7 +444,7 @@ require('lazy').setup({
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Slightly advanced example of overriding default behavior and theme
|
-- Override default behavior and theme when searching
|
||||||
vim.keymap.set('n', '<leader>/', function()
|
vim.keymap.set('n', '<leader>/', function()
|
||||||
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
||||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||||
|
|
@ -472,7 +481,6 @@ require('lazy').setup({
|
||||||
-- Mason must be loaded before its dependents so we need to set it up here.
|
-- Mason must be loaded before its dependents so we need to set it up here.
|
||||||
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
|
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
|
||||||
{ 'mason-org/mason.nvim', opts = {} },
|
{ 'mason-org/mason.nvim', opts = {} },
|
||||||
'mason-org/mason-lspconfig.nvim',
|
|
||||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||||
|
|
||||||
-- Useful status updates for LSP.
|
-- Useful status updates for LSP.
|
||||||
|
|
@ -575,22 +583,6 @@ require('lazy').setup({
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Diagnostic Config
|
|
||||||
-- See :help vim.diagnostic.Opts
|
|
||||||
vim.diagnostic.config {
|
|
||||||
update_in_insert = false,
|
|
||||||
severity_sort = true,
|
|
||||||
float = { border = 'rounded', source = 'if_many' },
|
|
||||||
underline = { severity = vim.diagnostic.severity.ERROR },
|
|
||||||
|
|
||||||
-- Can switch between these as you prefer
|
|
||||||
virtual_text = true, -- Text shows up at the end of the line
|
|
||||||
virtual_lines = false, -- Teest shows up underneath the line, with virtual lines
|
|
||||||
|
|
||||||
-- Auto open the float, so you can easily read the errors when jumping with `[d` and `]d`
|
|
||||||
jump = { float = true },
|
|
||||||
}
|
|
||||||
|
|
||||||
-- LSP servers and clients are able to communicate to each other what features they support.
|
-- LSP servers and clients are able to communicate to each other what features they support.
|
||||||
-- By default, Neovim doesn't support everything that is in the LSP specification.
|
-- By default, Neovim doesn't support everything that is in the LSP specification.
|
||||||
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
|
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
|
||||||
|
|
@ -599,19 +591,12 @@ require('lazy').setup({
|
||||||
|
|
||||||
-- Enable the following language servers
|
-- Enable the following language servers
|
||||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||||
--
|
-- See `:help lsp-config` for information about keys and how to configure
|
||||||
-- Add any additional override configuration in the following tables. Available keys are:
|
|
||||||
-- - cmd (table): Override the default command used to start the server
|
|
||||||
-- - filetypes (table): Override the default list of associated filetypes for the server
|
|
||||||
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
|
|
||||||
-- - settings (table): Override the default settings passed when initializing the server.
|
|
||||||
-- 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 = {},
|
-- pyright = {},
|
||||||
-- rust_analyzer = {},
|
-- rust_analyzer = {},
|
||||||
-- ... 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:
|
-- Some languages (like typescript) have entire language plugins that can be useful:
|
||||||
-- https://github.com/pmizio/typescript-tools.nvim
|
-- https://github.com/pmizio/typescript-tools.nvim
|
||||||
|
|
@ -629,6 +614,7 @@ require('lazy').setup({
|
||||||
-- You can press `g?` for help in this menu.
|
-- You can press `g?` for help in this menu.
|
||||||
local ensure_installed = vim.tbl_keys(servers or {})
|
local ensure_installed = vim.tbl_keys(servers or {})
|
||||||
vim.list_extend(ensure_installed, {
|
vim.list_extend(ensure_installed, {
|
||||||
|
'lua_ls', -- Lua Language server
|
||||||
'stylua', -- Used to format Lua code
|
'stylua', -- Used to format Lua code
|
||||||
-- You can add other tools here that you want Mason to install
|
-- You can add other tools here that you want Mason to install
|
||||||
})
|
})
|
||||||
|
|
@ -641,6 +627,7 @@ require('lazy').setup({
|
||||||
vim.lsp.enable(name)
|
vim.lsp.enable(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Special Lua Config, as recommended by neovim help docs
|
||||||
vim.lsp.config('lua_ls', {
|
vim.lsp.config('lua_ls', {
|
||||||
on_init = function(client)
|
on_init = function(client)
|
||||||
if client.workspace_folders then
|
if client.workspace_folders then
|
||||||
|
|
@ -651,10 +638,7 @@ require('lazy').setup({
|
||||||
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
||||||
runtime = {
|
runtime = {
|
||||||
version = 'LuaJIT',
|
version = 'LuaJIT',
|
||||||
path = {
|
path = { 'lua/?.lua', 'lua/?/init.lua' },
|
||||||
'lua/?.lua',
|
|
||||||
'lua/?/init.lua',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
workspace = {
|
workspace = {
|
||||||
checkThirdParty = false,
|
checkThirdParty = false,
|
||||||
|
|
@ -864,6 +848,7 @@ require('lazy').setup({
|
||||||
-- Check out: https://github.com/nvim-mini/mini.nvim
|
-- Check out: https://github.com/nvim-mini/mini.nvim
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- Highlight, edit, and navigate code
|
{ -- Highlight, edit, and navigate code
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
config = function()
|
config = function()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue