ciao
This commit is contained in:
parent
afd441c0f2
commit
87a251f269
@ -1,3 +1,4 @@
|
||||
require("kanopo.options")
|
||||
require("kanopo.lazy")
|
||||
require("kanopo.keymaps")
|
||||
require("kanopo.autocmds")
|
||||
require("kanopo.lazy")
|
||||
|
||||
35
nvim/lua/kanopo/keymaps.lua
Normal file
35
nvim/lua/kanopo/keymaps.lua
Normal file
@ -0,0 +1,35 @@
|
||||
-- Clear highlights on search when pressing <Esc> in normal mode
|
||||
-- See `:help hlsearch`
|
||||
vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<CR>")
|
||||
|
||||
-- Diagnostic keymaps
|
||||
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
|
||||
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
|
||||
-- is not what someone will guess without a bit more experience.
|
||||
--
|
||||
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
|
||||
-- or just use <C-\><C-n> to exit terminal mode
|
||||
vim.keymap.set("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
|
||||
|
||||
-- TIP: Disable arrow keys in normal mode
|
||||
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
||||
|
||||
-- Keybinds to make split navigation easier.
|
||||
-- Use CTRL+<hjkl> to switch between windows
|
||||
--
|
||||
-- See `:help wincmd` for a list of all window commands
|
||||
vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus to the left window" })
|
||||
vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus to the right window" })
|
||||
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" })
|
||||
|
||||
-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
|
||||
-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
|
||||
-- vim.keymap.set("n", "<C-S-l>", "<C-w>L", { desc = "Move window to the right" })
|
||||
-- vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" })
|
||||
-- vim.keymap.set("n", "<C-S-k>", "<C-w>K", { desc = "Move window to the upper" })
|
||||
@ -3,28 +3,34 @@ vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
-- UI and appearance
|
||||
vim.o.termguicolors = true -- 24-bit colors in TUI
|
||||
vim.o.cursorline = true -- highlight current line
|
||||
vim.o.number = true -- absolute line numbers
|
||||
vim.o.termguicolors = true -- 24-bit colors in TUI
|
||||
vim.o.cursorline = true -- highlight current line
|
||||
vim.o.number = true -- absolute line numbers
|
||||
vim.o.relativenumber = true -- relative line numbers
|
||||
vim.o.signcolumn = "yes" -- always show signcolumn
|
||||
vim.o.colorcolumn = "100" -- visual column guide
|
||||
vim.o.signcolumn = "yes" -- always show signcolumn
|
||||
vim.o.colorcolumn = "100" -- visual column guide
|
||||
vim.o.winborder = "rounded" -- default floating window border
|
||||
vim.o.cmdheight = 0 -- minimal command-line height (NVIM 0.10+)
|
||||
vim.o.conceallevel = 2 -- conceal in Markdown/jsonc when appropriate
|
||||
vim.o.foldlevel = 0 -- start with folds closed (Treesitter can open)
|
||||
vim.o.cmdheight = 0 -- minimal command-line height (NVIM 0.10+)
|
||||
vim.o.conceallevel = 2 -- conceal in Markdown/jsonc when appropriate
|
||||
vim.o.foldlevel = 0 -- start with folds closed (Treesitter can open)
|
||||
|
||||
-- Splits
|
||||
vim.o.splitright = true -- open vertical splits to the right
|
||||
vim.o.splitbelow = true -- open horizontal splits below
|
||||
|
||||
-- Editing behavior
|
||||
vim.o.wrap = false -- do not wrap lines by default
|
||||
vim.o.breakindent = true -- keep indentation on wrapped lines (if wrap is enabled later)
|
||||
vim.o.clipboard = "unnamedplus" -- use system clipboard
|
||||
vim.o.swapfile = false -- no swapfiles
|
||||
vim.o.undofile = true -- persistent undo
|
||||
vim.o.writebackup = false -- do not keep backup around
|
||||
vim.o.wrap = false -- do not wrap lines by default
|
||||
vim.o.breakindent = true -- keep indentation on wrapped lines (if wrap is enabled later)
|
||||
-- Sync clipboard between OS and Neovim.
|
||||
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
||||
-- Remove this option if you want your OS clipboard to remain independent.
|
||||
-- See `:help 'clipboard'`
|
||||
vim.schedule(function()
|
||||
vim.o.clipboard = "unnamedplus"
|
||||
end)
|
||||
vim.o.swapfile = false -- no swapfiles
|
||||
vim.o.undofile = true -- persistent undo
|
||||
vim.o.writebackup = false -- do not keep backup around
|
||||
|
||||
-- Tabs and indentation (2-space default; override per-filetype with autocmds)
|
||||
vim.o.expandtab = true
|
||||
@ -34,7 +40,7 @@ vim.o.shiftwidth = 2
|
||||
|
||||
-- Search
|
||||
vim.o.ignorecase = true -- case-insensitive
|
||||
vim.o.smartcase = true -- unless uppercase is used
|
||||
vim.o.smartcase = true -- unless uppercase is used
|
||||
|
||||
-- Completion UX (good defaults for omni and popup behavior)
|
||||
vim.o.completeopt = "menu,menuone,noinsert,noselect"
|
||||
@ -43,7 +49,7 @@ vim.o.shortmess = (vim.o.shortmess or "") .. "c" -- reduce completion messages
|
||||
-- Performance and input timing
|
||||
vim.o.timeoutlen = 300 -- mapped sequence timeout
|
||||
vim.o.updatetime = 250 -- faster CursorHold/diagnostic updates
|
||||
vim.o.scrolloff = 10 -- context lines around cursor
|
||||
vim.o.scrolloff = 10 -- context lines around cursor
|
||||
|
||||
-- Fonts/icons (used by statuslines/UIs)
|
||||
vim.g.have_nerd_font = true
|
||||
@ -75,13 +81,14 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
end,
|
||||
})
|
||||
|
||||
-- Spell checking (optional; example)
|
||||
-- vim.opt.spell = true
|
||||
-- vim.opt.spelllang = "en,it"
|
||||
-- local spell_dir = vim.fn.stdpath("data") .. "/spell"
|
||||
-- vim.opt.spellfile = {
|
||||
-- spell_dir .. "/en.utf-8.add",
|
||||
-- spell_dir .. "/it.utf-8.add",
|
||||
-- "~/.config/nvim/spell/en.proj.spl",
|
||||
-- "~/.config/nvim/spell/it.proj.spl",
|
||||
-- }
|
||||
vim.o.mouse = "a"
|
||||
|
||||
vim.o.showmode = false
|
||||
|
||||
vim.o.list = true
|
||||
vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
|
||||
|
||||
-- Preview substitutions live, as you type!
|
||||
vim.o.inccommand = "split"
|
||||
|
||||
vim.o.confirm = true
|
||||
|
||||
@ -1,26 +1,84 @@
|
||||
return {
|
||||
'saghen/blink.cmp',
|
||||
-- optional: provides snippets for the snippet source
|
||||
dependencies = { "L3MON4D3/LuaSnip", version = "v2.*" },
|
||||
version = '1.*',
|
||||
opts = {
|
||||
completion = {
|
||||
list = {
|
||||
selection = { preselect = false, auto_insert = false }
|
||||
}
|
||||
return { -- Autocompletion
|
||||
"saghen/blink.cmp",
|
||||
event = "VimEnter",
|
||||
version = "1.*",
|
||||
dependencies = {
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
version = "2.*",
|
||||
build = (function()
|
||||
if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then
|
||||
return
|
||||
end
|
||||
return "make install_jsregexp"
|
||||
end)(),
|
||||
dependencies = {
|
||||
-- `friendly-snippets` contains a variety of premade snippets.
|
||||
-- See the README about individual language/framework/plugin snippets:
|
||||
-- https://github.com/rafamadriz/friendly-snippets
|
||||
{
|
||||
"rafamadriz/friendly-snippets",
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end,
|
||||
},
|
||||
},
|
||||
opts = {},
|
||||
},
|
||||
signature = { enabled = true },
|
||||
snippets = { preset = "luasnip" },
|
||||
appearance = { nerd_font_variant = "mono" },
|
||||
"folke/lazydev.nvim",
|
||||
},
|
||||
--- @module 'blink.cmp'
|
||||
--- @type blink.cmp.Config
|
||||
opts = {
|
||||
keymap = {
|
||||
-- set to 'none' to disable the 'default' preset
|
||||
preset = "none",
|
||||
|
||||
["<C-k>"] = { "select_prev", "fallback" },
|
||||
["<C-j>"] = { "select_next", "fallback" },
|
||||
["<C-b>"] = { "scroll_documentation_up", "fallback" },
|
||||
["<C-f>"] = { "scroll_documentation_down", "fallback" },
|
||||
["<Tab>"] = { "snippet_forward", "fallback" },
|
||||
["<S-Tab>"] = { "snippet_backward", "fallback" },
|
||||
-- ["<S-Tab>"] = { "select_prev", "fallback" },
|
||||
-- ["<Tab>"] = { "select_next", "fallback" },
|
||||
|
||||
["<C-space>"] = { "show", "show_documentation", "hide_documentation" },
|
||||
["<CR>"] = { "select_and_accept", "fallback" },
|
||||
["<C-e>"] = { "hide", "fallback" },
|
||||
|
||||
["<C-s>"] = { "show_signature", "hide_signature", "fallback" },
|
||||
},
|
||||
|
||||
appearance = {
|
||||
nerd_font_variant = "mono",
|
||||
},
|
||||
|
||||
completion = {
|
||||
-- By default, you may press `<c-space>` to show the documentation.
|
||||
-- Optionally, set `auto_show = true` to show the documentation after a delay.
|
||||
documentation = { auto_show = false, auto_show_delay_ms = 500 },
|
||||
},
|
||||
|
||||
sources = {
|
||||
default = {
|
||||
"lsp",
|
||||
"path",
|
||||
"snippets",
|
||||
"buffer",
|
||||
default = { "lsp", "path", "snippets", "lazydev" },
|
||||
providers = {
|
||||
lazydev = { module = "lazydev.integrations.blink", score_offset = 100 },
|
||||
},
|
||||
},
|
||||
},
|
||||
opts_extend = { "sources.default" }
|
||||
|
||||
snippets = { preset = "luasnip" },
|
||||
|
||||
-- Blink.cmp includes an optional, recommended rust fuzzy matcher,
|
||||
-- which automatically downloads a prebuilt binary when enabled.
|
||||
--
|
||||
-- By default, we use the Lua implementation instead, but you may enable
|
||||
-- the rust implementation via `'prefer_rust_with_warning'`
|
||||
--
|
||||
-- See :h blink-cmp-config-fuzzy for more information
|
||||
fuzzy = { implementation = "lua" },
|
||||
|
||||
-- Shows a signature help window while you type arguments for a function
|
||||
signature = { enabled = true },
|
||||
},
|
||||
}
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
return {
|
||||
"j-hui/fidget.nvim",
|
||||
opts = {},
|
||||
}
|
||||
41
nvim/lua/kanopo/plugins/format.lua
Normal file
41
nvim/lua/kanopo/plugins/format.lua
Normal file
@ -0,0 +1,41 @@
|
||||
|
||||
return { -- Autoformat
|
||||
"stevearc/conform.nvim",
|
||||
event = { "BufWritePre" },
|
||||
cmd = { "ConformInfo" },
|
||||
keys = {
|
||||
{
|
||||
"<leader>f",
|
||||
function()
|
||||
require("conform").format({ async = true, lsp_format = "fallback" })
|
||||
end,
|
||||
mode = "",
|
||||
desc = "[F]ormat buffer",
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
notify_on_error = false,
|
||||
format_on_save = function(bufnr)
|
||||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
||||
-- have a well standardized coding style. You can add additional
|
||||
-- languages here or re-enable it for the disabled ones.
|
||||
local disable_filetypes = { c = true, cpp = true }
|
||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||
return nil
|
||||
else
|
||||
return {
|
||||
timeout_ms = 500,
|
||||
lsp_format = "fallback",
|
||||
}
|
||||
end
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
-- Conform can also run multiple formatters sequentially
|
||||
-- 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 },
|
||||
},
|
||||
},
|
||||
}
|
||||
13
nvim/lua/kanopo/plugins/lazy-dev.lua
Normal file
13
nvim/lua/kanopo/plugins/lazy-dev.lua
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
return {
|
||||
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
|
||||
-- used for completion, annotations and signatures of Neovim apis
|
||||
"folke/lazydev.nvim",
|
||||
ft = "lua",
|
||||
opts = {
|
||||
library = {
|
||||
-- Load luvit types when the `vim.uv` word is found
|
||||
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -1,110 +1,170 @@
|
||||
return {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
{ "mason-org/mason.nvim", opts = {} },
|
||||
"mason-org/mason-lspconfig.nvim",
|
||||
dependencies = {
|
||||
{ "mason-org/mason.nvim", opts = {} },
|
||||
"neovim/nvim-lspconfig",
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
version = "1.*",
|
||||
},
|
||||
-- Optional tools installer (safe to keep)
|
||||
{ "WhoIsSethDaniel/mason-tool-installer.nvim" },
|
||||
},
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
|
||||
-- Single place to edit servers/tools in the future
|
||||
lsp_servers = {
|
||||
"lua_ls",
|
||||
"ts_ls",
|
||||
"texlab",
|
||||
"marksman",
|
||||
"docker_compose_language_service",
|
||||
"dockerls",
|
||||
"tailwindcss",
|
||||
"cssls",
|
||||
"clangd",
|
||||
"rust_analyzer",
|
||||
-- "gopls",
|
||||
},
|
||||
tools = {
|
||||
"luacheck",
|
||||
"latexindent",
|
||||
"prettierd",
|
||||
},
|
||||
{ "j-hui/fidget.nvim", opts = {} },
|
||||
|
||||
opts = function(plugin)
|
||||
-- Pull arrays from the plugin spec so you edit only once
|
||||
return {
|
||||
ensure_installed = plugin.lsp_servers,
|
||||
automatic_enable = true, -- uses vim.lsp.enable()
|
||||
}
|
||||
end,
|
||||
|
||||
config = function(plugin, opts)
|
||||
-- Keymaps e on_attach condiviso (unchanged)
|
||||
local function on_attach(_, bufnr)
|
||||
vim.api.nvim_set_option_value("omnifunc", "v:lua.vim.lsp.omnifunc", { buf = bufnr })
|
||||
vim.api.nvim_set_option_value("tagfunc", "v:lua.vim.lsp.tagfunc", { buf = bufnr })
|
||||
|
||||
local function map(mode, lhs, rhs, desc)
|
||||
vim.keymap.set(mode, lhs, rhs, { buffer = bufnr, noremap = true, silent = true, desc = desc })
|
||||
end
|
||||
|
||||
local function tb(fn)
|
||||
return function()
|
||||
local ok, builtin = pcall(require, "telescope.builtin")
|
||||
if ok and builtin[fn] then
|
||||
builtin[fn]()
|
||||
else
|
||||
vim.notify("Telescope non disponibile", vim.log.levels.WARN)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
map("n", "gd", tb("lsp_definitions"), "Goto Definition (Telescope)")
|
||||
map("n", "gr", tb("lsp_references"), "Goto References (Telescope)")
|
||||
map("n", "gI", tb("lsp_implementations"), "Goto Implementations (Telescope)")
|
||||
map("n", "gt", tb("lsp_type_definitions"), "Goto Type Definitions (Telescope)")
|
||||
map("n", "K", vim.lsp.buf.hover, "Hover")
|
||||
map("n", "<leader>rn", vim.lsp.buf.rename, "Rename")
|
||||
map({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, "Code Action")
|
||||
map("n", "[d", vim.diagnostic.goto_prev, "Prev Diagnostic")
|
||||
map("n", "]d", vim.diagnostic.goto_next, "Next Diagnostic")
|
||||
map("n", "<leader>e", vim.diagnostic.open_float, "Line Diagnostics")
|
||||
|
||||
pcall(vim.lsp.inlay_hint.enable, true, { bufnr = bufnr })
|
||||
end
|
||||
|
||||
-- Capabilities da blink.cmp (unchanged)
|
||||
local ok_blink, blink = pcall(require, "blink.cmp")
|
||||
local capabilities = ok_blink and blink.get_lsp_capabilities() or nil
|
||||
|
||||
-- Config globale per tutti i server (unchanged)
|
||||
vim.lsp.config("*", {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
-- Mason core
|
||||
local ok_mason, mason = pcall(require, "mason")
|
||||
if ok_mason then
|
||||
mason.setup()
|
||||
end
|
||||
|
||||
-- mason-lspconfig v2: single setup using arrays from plugin spec
|
||||
local mlsp = require("mason-lspconfig")
|
||||
mlsp.setup(opts)
|
||||
|
||||
-- Optional: tools via mason-tool-installer using the same tools array
|
||||
local ok_mti, mti = pcall(require, "mason-tool-installer")
|
||||
if ok_mti and plugin.tools and #plugin.tools > 0 then
|
||||
mti.setup({
|
||||
ensure_installed = plugin.tools,
|
||||
run_on_start = true,
|
||||
start_delay = 3000,
|
||||
debounce_hours = 5,
|
||||
})
|
||||
end
|
||||
end,
|
||||
"saghen/blink.cmp",
|
||||
},
|
||||
config = function()
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
|
||||
callback = function(event)
|
||||
local map = function(keys, func, desc, mode)
|
||||
mode = mode or "n"
|
||||
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
|
||||
end
|
||||
|
||||
-- Rename the variable under your cursor.
|
||||
-- Most Language Servers support renaming across files, etc.
|
||||
map("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
|
||||
|
||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
||||
-- or a suggestion from your LSP for this to activate.
|
||||
map("<leader>ca", vim.lsp.buf.code_action, "[G]oto Code [A]ction", { "n", "x" })
|
||||
|
||||
-- Find references for the word under your cursor.
|
||||
map("<leader>gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
|
||||
|
||||
-- Jump to the implementation of the word under your cursor.
|
||||
-- Useful when your language has ways of declaring types without an actual implementation.
|
||||
map("<leader>gi", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation")
|
||||
|
||||
-- Jump to the definition of the word under your cursor.
|
||||
-- This is where a variable was first declared, or where a function is defined, etc.
|
||||
-- To jump back, press <C-t>.
|
||||
map("<leader>gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition")
|
||||
|
||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||
-- For example, in C this would take you to the header.
|
||||
map("<leader>gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
|
||||
|
||||
-- -- Fuzzy find all the symbols in your current document.
|
||||
-- -- Symbols are things like variables, functions, types, etc.
|
||||
-- map("gO", require("telescope.builtin").lsp_document_symbols, "Open Document Symbols")
|
||||
--
|
||||
-- -- Fuzzy find all the symbols in your current workspace.
|
||||
-- -- Similar to document symbols, except searches over your entire project.
|
||||
-- map("gW", require("telescope.builtin").lsp_dynamic_workspace_symbols, "Open Workspace Symbols")
|
||||
--
|
||||
-- -- Jump to the type of the word under your cursor.
|
||||
-- -- Useful when you're not sure what type a variable is and you want to see
|
||||
-- -- the definition of its *type*, not where it was *defined*.
|
||||
-- map("grt", require("telescope.builtin").lsp_type_definitions, "[G]oto [T]ype Definition")
|
||||
|
||||
map("<leader>e", vim.diagnostic.open_float, "Line Diagnostics")
|
||||
|
||||
-- The following code creates a keymap to toggle inlay hints in your
|
||||
-- code, if the language server you are using supports them
|
||||
--
|
||||
-- This may be unwanted, since they displace some of your code
|
||||
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
|
||||
map("<leader>th", function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf }))
|
||||
end, "[T]oggle Inlay [H]ints")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Diagnostic Config
|
||||
-- See :help vim.diagnostic.Opts
|
||||
vim.diagnostic.config({
|
||||
severity_sort = true,
|
||||
float = { border = "rounded", source = "if_many" },
|
||||
underline = { severity = vim.diagnostic.severity.ERROR },
|
||||
signs = vim.g.have_nerd_font and {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = " ",
|
||||
[vim.diagnostic.severity.WARN] = " ",
|
||||
[vim.diagnostic.severity.INFO] = " ",
|
||||
[vim.diagnostic.severity.HINT] = " ",
|
||||
},
|
||||
} or {},
|
||||
virtual_text = {
|
||||
source = "if_many",
|
||||
spacing = 2,
|
||||
format = function(diagnostic)
|
||||
local diagnostic_message = {
|
||||
[vim.diagnostic.severity.ERROR] = diagnostic.message,
|
||||
[vim.diagnostic.severity.WARN] = diagnostic.message,
|
||||
[vim.diagnostic.severity.INFO] = diagnostic.message,
|
||||
[vim.diagnostic.severity.HINT] = diagnostic.message,
|
||||
}
|
||||
return diagnostic_message[diagnostic.severity]
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
-- 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.
|
||||
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
|
||||
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
|
||||
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||
|
||||
-- Enable the following language servers
|
||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||
--
|
||||
-- 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 = {
|
||||
texlab = {},
|
||||
-- clangd = {},
|
||||
-- gopls = {},
|
||||
-- pyright = {},
|
||||
-- rust_analyzer = {},
|
||||
ts_ls = {},
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
||||
-- diagnostics = { disable = { 'missing-fields' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Ensure the servers and tools above are installed
|
||||
--
|
||||
-- To check the current status of installed tools and/or manually install
|
||||
-- other tools, you can run
|
||||
-- :Mason
|
||||
--
|
||||
-- You can press `g?` for help in this menu.
|
||||
--
|
||||
-- `mason` had to be setup earlier: to configure its options see the
|
||||
-- `dependencies` table for `nvim-lspconfig` above.
|
||||
--
|
||||
-- You can add other tools here that you want Mason to install
|
||||
-- for you, so that they are available from within Neovim.
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, {
|
||||
"stylua", -- Used to format Lua code
|
||||
})
|
||||
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
|
||||
automatic_installation = true,
|
||||
handlers = {
|
||||
function(server_name)
|
||||
local server = servers[server_name] or {}
|
||||
-- This handles overriding only values explicitly passed
|
||||
-- by the server configuration above. Useful when disabling
|
||||
-- certain features of an LSP (for example, turning off formatting for ts_ls)
|
||||
server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {})
|
||||
require("lspconfig")[server_name].setup(server)
|
||||
end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
@ -1,12 +1,49 @@
|
||||
return {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
tag = '0.1.8',
|
||||
return { -- Fuzzy Finder (files, lsp, etc)
|
||||
"nvim-telescope/telescope.nvim",
|
||||
event = "VimEnter",
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }
|
||||
"nvim-lua/plenary.nvim",
|
||||
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
|
||||
-- `build` is used to run some command when the plugin is installed/updated.
|
||||
-- This is only run then, not every time Neovim starts up.
|
||||
build = "make",
|
||||
|
||||
-- `cond` is a condition used to determine whether this plugin should be
|
||||
-- installed and loaded.
|
||||
cond = function()
|
||||
return vim.fn.executable("make") == 1
|
||||
end,
|
||||
},
|
||||
{ "nvim-telescope/telescope-ui-select.nvim" },
|
||||
|
||||
-- Useful for getting pretty icons, but requires a Nerd Font.
|
||||
{ "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font },
|
||||
},
|
||||
config = function()
|
||||
require('telescope').setup {
|
||||
-- Telescope is a fuzzy finder that comes with a lot of different things that
|
||||
-- it can fuzzy find! It's more than just a "file finder", it can search
|
||||
-- many different aspects of Neovim, your workspace, LSP, and more!
|
||||
--
|
||||
-- The easiest way to use Telescope, is to start by doing something like:
|
||||
-- :Telescope help_tags
|
||||
--
|
||||
-- After running this command, a window will open up and you're able to
|
||||
-- type in the prompt window. You'll see a list of `help_tags` options and
|
||||
-- a corresponding preview of the help.
|
||||
--
|
||||
-- Two important keymaps to use while in Telescope are:
|
||||
-- - Insert mode: <c-/>
|
||||
-- - Normal mode: ?
|
||||
--
|
||||
-- This opens a window that shows you all of the keymaps for the current
|
||||
-- Telescope picker. This is really useful to discover what Telescope can
|
||||
-- do as well as how to actually do it!
|
||||
|
||||
-- [[ Configure Telescope ]]
|
||||
-- See `:help telescope` and `:help telescope.setup()`
|
||||
require("telescope").setup({
|
||||
pickers = {
|
||||
find_files = {
|
||||
theme = "ivy",
|
||||
@ -20,20 +57,56 @@ return {
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown(),
|
||||
},
|
||||
fzf = {
|
||||
fuzzy = true,
|
||||
override_generic_sorter = true,
|
||||
override_file_sorter = true,
|
||||
case_mode = "ignore_case",
|
||||
}
|
||||
}
|
||||
}
|
||||
require('telescope').load_extension('fzf')
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Enable Telescope extensions if they are installed
|
||||
pcall(require("telescope").load_extension, "fzf")
|
||||
pcall(require("telescope").load_extension, "ui-select")
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<leader>sh", builtin.help_tags, { desc = "[S]earch [H]elp" })
|
||||
vim.keymap.set("n", "<leader>sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" })
|
||||
vim.keymap.set("n", "<leader>sf", builtin.find_files, { desc = "[S]earch [F]iles" })
|
||||
vim.keymap.set("n", "<leader>ss", builtin.builtin, { desc = "[S]earch [S]elect Telescope" })
|
||||
vim.keymap.set("n", "<leader>sw", builtin.grep_string, { desc = "[S]earch current [W]ord" })
|
||||
vim.keymap.set("n", "<leader>sg", builtin.live_grep, { desc = "[S]earch by [G]rep" })
|
||||
vim.keymap.set("n", "<leader>sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" })
|
||||
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" })
|
||||
|
||||
-- Slightly advanced example of overriding default behavior and theme
|
||||
vim.keymap.set("n", "<leader>/", function()
|
||||
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
||||
builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
}))
|
||||
end, { desc = "[/] Fuzzily search in current buffer" })
|
||||
|
||||
-- It's also possible to pass additional configuration options.
|
||||
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
||||
vim.keymap.set("n", "<leader>s/", function()
|
||||
builtin.live_grep({
|
||||
grep_open_files = true,
|
||||
prompt_title = "Live Grep in Open Files",
|
||||
})
|
||||
end, { desc = "[S]earch [/] in Open Files" })
|
||||
|
||||
-- Shortcut for searching your Neovim configuration files
|
||||
vim.keymap.set("n", "<leader>sn", function()
|
||||
builtin.find_files({ cwd = vim.fn.stdpath("config") })
|
||||
end, { desc = "[S]earch [N]eovim files" })
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "[F]ind [F]iles" },
|
||||
{ "<leader>fh", "<cmd>Telescope help_tags<cr>", desc = "[F]ind [H]elp" },
|
||||
{ "<leader>fd", "<cmd>Telescope diagnostics<cr>", desc = "[F]ind [D]iadgnostics" },
|
||||
{ "<leader>fg", "<cmd>Telescope live_grep<cr>", desc = "[F]ind [G]rep" },
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,14 +1,52 @@
|
||||
return {
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = true,
|
||||
keys = {
|
||||
{
|
||||
"<leader>?",
|
||||
function()
|
||||
require("which-key").show({ global = false })
|
||||
end,
|
||||
desc = "Buffer Local Keymaps (which-key)",
|
||||
return { -- Useful plugin to show you pending keybinds.
|
||||
"folke/which-key.nvim",
|
||||
event = "VimEnter", -- Sets the loading event to 'VimEnter'
|
||||
opts = {
|
||||
-- delay between pressing a key and opening which-key (milliseconds)
|
||||
-- this setting is independent of vim.o.timeoutlen
|
||||
delay = 0,
|
||||
icons = {
|
||||
-- set icon mappings to true if you have a Nerd Font
|
||||
mappings = vim.g.have_nerd_font,
|
||||
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
|
||||
-- default which-key.nvim defined Nerd Font icons, otherwise define a string table
|
||||
keys = vim.g.have_nerd_font and {} or {
|
||||
Up = "<Up> ",
|
||||
Down = "<Down> ",
|
||||
Left = "<Left> ",
|
||||
Right = "<Right> ",
|
||||
C = "<C-…> ",
|
||||
M = "<M-…> ",
|
||||
D = "<D-…> ",
|
||||
S = "<S-…> ",
|
||||
CR = "<CR> ",
|
||||
Esc = "<Esc> ",
|
||||
ScrollWheelDown = "<ScrollWheelDown> ",
|
||||
ScrollWheelUp = "<ScrollWheelUp> ",
|
||||
NL = "<NL> ",
|
||||
BS = "<BS> ",
|
||||
Space = "<Space> ",
|
||||
Tab = "<Tab> ",
|
||||
F1 = "<F1>",
|
||||
F2 = "<F2>",
|
||||
F3 = "<F3>",
|
||||
F4 = "<F4>",
|
||||
F5 = "<F5>",
|
||||
F6 = "<F6>",
|
||||
F7 = "<F7>",
|
||||
F8 = "<F8>",
|
||||
F9 = "<F9>",
|
||||
F10 = "<F10>",
|
||||
F11 = "<F11>",
|
||||
F12 = "<F12>",
|
||||
},
|
||||
},
|
||||
|
||||
-- Document existing key chains
|
||||
spec = {
|
||||
{ "<leader>s", group = "[S]earch" },
|
||||
{ "<leader>t", group = "[T]oggle" },
|
||||
{ "<leader>h", group = "Git [H]unk", mode = { "n", "v" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
1
nvim/main.tex
Normal file
1
nvim/main.tex
Normal file
@ -0,0 +1 @@
|
||||
\subsection{}
|
||||
@ -8,3 +8,5 @@ const Page = () => {
|
||||
|
||||
|
||||
|
||||
|
||||
rafce
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user