ciao
This commit is contained in:
parent
28598c5e1d
commit
7e84c2f591
@ -1,8 +1,7 @@
|
|||||||
root = true
|
root = true
|
||||||
|
|
||||||
# Unix-style newlines with a newline ending every file
|
[*.lua]
|
||||||
[*]
|
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 4
|
indent_size = 2
|
||||||
|
|||||||
0
nvim/after/ftplugin/lua.lua
Normal file
0
nvim/after/ftplugin/lua.lua
Normal file
@ -1,17 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- vim.cmd.colorscheme("gruvbox")
|
|
||||||
-- vim.lsp.enable('lua_ls')
|
|
||||||
--
|
|
||||||
-- require("mason").setup()
|
|
||||||
-- require("mason-lspconfig").setup {
|
|
||||||
-- ensure_installed = { "lua_ls" }
|
|
||||||
-- }
|
|
||||||
-- local ls = require("luasnip")
|
|
||||||
-- ls.setup({
|
|
||||||
-- enable_autosnippets = true
|
|
||||||
-- })
|
|
||||||
require("kanopo.options")
|
require("kanopo.options")
|
||||||
require("kanopo.autocmds")
|
require("kanopo.autocmds")
|
||||||
require("kanopo.plugins")
|
require("kanopo.plugins")
|
||||||
|
|||||||
@ -33,3 +33,21 @@ vim.api.nvim_create_autocmd("BufReadPost", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
group = vim.api.nvim_create_augroup('my.lsp', {}),
|
||||||
|
callback = function(args)
|
||||||
|
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||||
|
-- Usually not needed if server supports "textDocument/willSaveWaitUntil".
|
||||||
|
if not client:supports_method('textDocument/willSaveWaitUntil')
|
||||||
|
and client:supports_method('textDocument/formatting') then
|
||||||
|
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||||
|
group = vim.api.nvim_create_augroup('my.lsp', { clear = false }),
|
||||||
|
buffer = args.buf,
|
||||||
|
callback = function()
|
||||||
|
vim.lsp.buf.format({ bufnr = args.buf, id = client.id, timeout_ms = 1000 })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|||||||
28
nvim/lua/kanopo/plugins/cmp.lua
Normal file
28
nvim/lua/kanopo/plugins/cmp.lua
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
vim.pack.add({
|
||||||
|
{ src = "https://github.com/saghen/blink.cmp", version = "1.*" },
|
||||||
|
{ src = "https://github.com/rafamadriz/friendly-snippets" }
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Load packs on startup (guard for nightlies without load)
|
||||||
|
vim.api.nvim_create_autocmd("VimEnter", {
|
||||||
|
once = true,
|
||||||
|
callback = function()
|
||||||
|
if vim.pack and vim.pack.load then pcall(vim.pack.load) end
|
||||||
|
|
||||||
|
-- Preload neogit module if available (optional)
|
||||||
|
pcall(function()
|
||||||
|
require("blink").setup({
|
||||||
|
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept):
|
||||||
|
-- 'super-tab' for mappings similar to vscode (tab to accept)
|
||||||
|
-- 'enter' for enter to accept
|
||||||
|
-- 'none' for no mappings
|
||||||
|
-- All presets have the following mappings:
|
||||||
|
-- C-space: Open menu or open docs if already open
|
||||||
|
-- C-n/C-p or Up/Down: Select next/previous item
|
||||||
|
-- C-e: Hide menu
|
||||||
|
-- C-k: Toggle signature help (if signature.enabled = true)
|
||||||
|
keymap = { preset = 'default' },
|
||||||
|
})
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
})
|
||||||
@ -1,8 +1,9 @@
|
|||||||
-- require("kanopo.plugins.lazydev")
|
require("kanopo.plugins.lazydev")
|
||||||
require("kanopo.plugins.oil")
|
require("kanopo.plugins.oil")
|
||||||
require("kanopo.plugins.theme")
|
require("kanopo.plugins.theme")
|
||||||
require("kanopo.plugins.treesitter")
|
require("kanopo.plugins.treesitter")
|
||||||
require("kanopo.plugins.telescope")
|
require("kanopo.plugins.telescope")
|
||||||
|
require("kanopo.plugins.cmp")
|
||||||
require("kanopo.plugins.lsp")
|
require("kanopo.plugins.lsp")
|
||||||
require("kanopo.plugins.which-key")
|
require("kanopo.plugins.which-key")
|
||||||
require("kanopo.plugins.git")
|
require("kanopo.plugins.git")
|
||||||
|
|||||||
@ -3,8 +3,10 @@ vim.pack.add({
|
|||||||
{ src = "https://github.com/mason-org/mason.nvim" },
|
{ src = "https://github.com/mason-org/mason.nvim" },
|
||||||
{ src = "https://github.com/mason-org/mason-lspconfig.nvim" },
|
{ src = "https://github.com/mason-org/mason-lspconfig.nvim" },
|
||||||
{ src = "https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim" }, -- optional for tools later
|
{ src = "https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim" }, -- optional for tools later
|
||||||
{ src = "https://github.com/L3MON4D3/LuaSnip" },
|
|
||||||
{ src = "https://github.com/rafamadriz/friendly-snippets" },
|
{ src = "https://github.com/saghen/blink.cmp", version = "1.*" },
|
||||||
|
-- { src = "https://github.com/L3MON4D3/LuaSnip" },
|
||||||
|
-- { src = "https://github.com/rafamadriz/friendly-snippets" },
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Load packs early (guard API)
|
-- Load packs early (guard API)
|
||||||
@ -58,6 +60,20 @@ do
|
|||||||
automatic_installation = true,
|
automatic_installation = true,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
local ok_ls, ls = pcall(require, "luasnip")
|
||||||
|
if ok_ls then
|
||||||
|
ls.config.set_config({
|
||||||
|
history = true,
|
||||||
|
enable_autosnippets = false,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Load VSCode-style snippets from friendly-snippets (and any other VSCode snippet dirs on rtp)
|
||||||
|
-- pcall(function()
|
||||||
|
-- require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
-- end)
|
||||||
|
|
||||||
|
-- Your Tab/Shift-Tab mappings...
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Shared on_attach: native omni + Telescope pickers
|
-- Shared on_attach: native omni + Telescope pickers
|
||||||
@ -69,22 +85,6 @@ local function on_attach(_, bufnr)
|
|||||||
vim.keymap.set(mode, lhs, rhs, { buffer = bufnr, noremap = true, silent = true, desc = desc })
|
vim.keymap.set(mode, lhs, rhs, { buffer = bufnr, noremap = true, silent = true, desc = desc })
|
||||||
end
|
end
|
||||||
|
|
||||||
local group = vim.api.nvim_create_augroup("LspFormatOnSave_" .. bufnr, { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
|
||||||
group = group,
|
|
||||||
buffer = bufnr,
|
|
||||||
callback = function()
|
|
||||||
-- Prefer synchronous formatting with timeout to avoid blocking too long
|
|
||||||
if vim.lsp.buf.format then
|
|
||||||
vim.lsp.buf.format({
|
|
||||||
async = false,
|
|
||||||
timeout_ms = 1500,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
desc = "LSP format before save",
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Telescope-powered LSP navigation (loads telescope.builtin on demand)
|
-- Telescope-powered LSP navigation (loads telescope.builtin on demand)
|
||||||
local function tb(fn)
|
local function tb(fn)
|
||||||
return function()
|
return function()
|
||||||
@ -117,74 +117,76 @@ local function on_attach(_, bufnr)
|
|||||||
pcall(vim.lsp.inlay_hint.enable, true, { bufnr = bufnr })
|
pcall(vim.lsp.inlay_hint.enable, true, { bufnr = bufnr })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Global LSP defaults
|
-- Global LSP defaults
|
||||||
vim.lsp.config("*", {
|
vim.lsp.config("*", {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = (function()
|
capabilities = require('blink.cmp').get_lsp_capabilities()
|
||||||
local caps = vim.lsp.protocol.make_client_capabilities()
|
-- capabilities = (function()
|
||||||
caps.textDocument = caps.textDocument or {}
|
-- local caps = vim.lsp.protocol.make_client_capabilities()
|
||||||
caps.textDocument.foldingRange = { dynamicRegistration = false, lineFoldingOnly = true }
|
-- caps.textDocument = caps.textDocument or {}
|
||||||
return caps
|
-- caps.textDocument.foldingRange = { dynamicRegistration = false, lineFoldingOnly = true }
|
||||||
end)(),
|
-- return caps
|
||||||
|
-- end)(),
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Server-specific tweaks
|
-- -- Server-specific tweaks
|
||||||
vim.lsp.config("lua_ls", {
|
-- vim.lsp.config("lua_ls", {
|
||||||
settings = {
|
-- settings = {
|
||||||
Lua = {
|
-- Lua = {
|
||||||
diagnostics = { globals = { "vim", "require" } },
|
-- diagnostics = { globals = { "vim", "require" } },
|
||||||
completion = { callSnippet = "Replace" },
|
-- completion = { callSnippet = "Replace" },
|
||||||
workspace = { checkThirdParty = false },
|
-- workspace = { checkThirdParty = false },
|
||||||
},
|
-- },
|
||||||
},
|
-- },
|
||||||
})
|
-- })
|
||||||
|
|
||||||
-- Enable servers (Neovim 0.11+)
|
-- Enable servers (Neovim 0.11+)
|
||||||
vim.lsp.enable(lsp_servers)
|
vim.lsp.enable(lsp_servers)
|
||||||
|
|
||||||
-- Trigger omni (like cmp.complete)
|
-- -- Trigger omni (like cmp.complete)
|
||||||
vim.keymap.set("i", "<C-Space>", function()
|
-- vim.keymap.set("i", "<C-Space>", function()
|
||||||
if vim.bo.omnifunc == "v:lua.vim.lsp.omnifunc" then
|
-- if vim.bo.omnifunc == "v:lua.vim.lsp.omnifunc" then
|
||||||
return vim.api.nvim_replace_termcodes("<C-x><C-o>", true, true, true)
|
-- return vim.api.nvim_replace_termcodes("<C-x><C-o>", true, true, true)
|
||||||
end
|
-- end
|
||||||
return ""
|
-- return ""
|
||||||
end, { expr = true, silent = true, desc = "Trigger omni-completion" })
|
-- end, { expr = true, silent = true, desc = "Trigger omni-completion" })
|
||||||
|
--
|
||||||
-- Navigate popup menu
|
-- -- Navigate popup menu
|
||||||
vim.keymap.set("i", "<C-j>", "<C-n>", { silent = true, desc = "Omni next item" })
|
-- vim.keymap.set("i", "<C-j>", "<C-n>", { silent = true, desc = "Omni next item" })
|
||||||
vim.keymap.set("i", "<C-k>", "<C-p>", { silent = true, desc = "Omni prev item" })
|
-- vim.keymap.set("i", "<C-k>", "<C-p>", { silent = true, desc = "Omni prev item" })
|
||||||
|
--
|
||||||
-- Enter to confirm when pum is visible, otherwise newline
|
-- -- Enter to confirm when pum is visible, otherwise newline
|
||||||
vim.keymap.set("i", "<CR>", function()
|
-- vim.keymap.set("i", "<CR>", function()
|
||||||
if vim.fn.pumvisible() == 1 then
|
-- if vim.fn.pumvisible() == 1 then
|
||||||
-- Confirm current selection; if none selected, accept first
|
-- -- Confirm current selection; if none selected, accept first
|
||||||
return vim.api.nvim_replace_termcodes("<C-y>", true, true, true)
|
-- return vim.api.nvim_replace_termcodes("<C-y>", true, true, true)
|
||||||
end
|
-- end
|
||||||
return vim.api.nvim_replace_termcodes("<CR>", true, true, true)
|
-- return vim.api.nvim_replace_termcodes("<CR>", true, true, true)
|
||||||
end, { expr = true, silent = true, desc = "Confirm completion or newline" })
|
-- end, { expr = true, silent = true, desc = "Confirm completion or newline" })
|
||||||
|
--
|
||||||
-- Requires your existing LuaSnip setup and mappings
|
-- -- Requires your existing LuaSnip setup and mappings
|
||||||
local ok_ls, ls = pcall(require, "luasnip")
|
-- local ok_ls, ls = pcall(require, "luasnip")
|
||||||
if ok_ls then
|
-- if ok_ls then
|
||||||
-- Tab: if menu visible, next item; else snippet expand/jump; else literal Tab
|
-- -- Tab: if menu visible, next item; else snippet expand/jump; else literal Tab
|
||||||
vim.keymap.set({ "i", "s" }, "<Tab>", function()
|
-- vim.keymap.set({ "i", "s" }, "<Tab>", function()
|
||||||
if vim.fn.pumvisible() == 1 then
|
-- if vim.fn.pumvisible() == 1 then
|
||||||
return vim.api.nvim_replace_termcodes("<C-n>", true, true, true)
|
-- return vim.api.nvim_replace_termcodes("<C-n>", true, true, true)
|
||||||
elseif ls.expand_or_jumpable() then
|
-- elseif ls.expand_or_jumpable() then
|
||||||
return "<Plug>luasnip-expand-or-jump"
|
-- return "<Plug>luasnip-expand-or-jump"
|
||||||
else
|
-- else
|
||||||
return "<Tab>"
|
-- return "<Tab>"
|
||||||
end
|
-- end
|
||||||
end, { expr = true, silent = true, desc = "Next item / Snippet jump / Tab" })
|
-- end, { expr = true, silent = true, desc = "Next item / Snippet jump / Tab" })
|
||||||
|
--
|
||||||
-- Shift-Tab: if menu visible, prev item; else snippet jump back; else literal
|
-- -- Shift-Tab: if menu visible, prev item; else snippet jump back; else literal
|
||||||
vim.keymap.set({ "i", "s" }, "<S-Tab>", function()
|
-- vim.keymap.set({ "i", "s" }, "<S-Tab>", function()
|
||||||
if vim.fn.pumvisible() == 1 then
|
-- if vim.fn.pumvisible() == 1 then
|
||||||
return vim.api.nvim_replace_termcodes("<C-p>", true, true, true)
|
-- return vim.api.nvim_replace_termcodes("<C-p>", true, true, true)
|
||||||
elseif ls.jumpable(-1) then
|
-- elseif ls.jumpable(-1) then
|
||||||
return "<Plug>luasnip-jump-prev"
|
-- return "<Plug>luasnip-jump-prev"
|
||||||
else
|
-- else
|
||||||
return "<S-Tab>"
|
-- return "<S-Tab>"
|
||||||
end
|
-- end
|
||||||
end, { expr = true, silent = true, desc = "Prev item / Snippet back / Shift-Tab" })
|
-- end, { expr = true, silent = true, desc = "Prev item / Snippet back / Shift-Tab" })
|
||||||
end
|
-- end
|
||||||
|
|||||||
@ -42,10 +42,12 @@ local function telescope_setup()
|
|||||||
telescope.setup({
|
telescope.setup({
|
||||||
pickers = {
|
pickers = {
|
||||||
find_files = {
|
find_files = {
|
||||||
|
theme = "ivy",
|
||||||
hidden = true,
|
hidden = true,
|
||||||
prompt_prefix = "🔍 ",
|
prompt_prefix = "🔍 ",
|
||||||
},
|
},
|
||||||
live_grep = {
|
live_grep = {
|
||||||
|
theme = "ivy",
|
||||||
hidden = true,
|
hidden = true,
|
||||||
prompt_prefix = "🔍 ",
|
prompt_prefix = "🔍 ",
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,6 +0,0 @@
|
|||||||
|
|
||||||
const ciao = () => {
|
|
||||||
console.log("ciao")
|
|
||||||
}
|
|
||||||
|
|
||||||
ciao()
|
|
||||||
Loading…
x
Reference in New Issue
Block a user