feat: Adding config files
This commit is contained in:
@@ -0,0 +1,50 @@
|
|||||||
|
require("config.icons")
|
||||||
|
vim.o.number = true
|
||||||
|
vim.o.relativenumber = true
|
||||||
|
vim.o.tabstop = 4
|
||||||
|
vim.o.shiftwidth = 4
|
||||||
|
vim.o.expandtab = true
|
||||||
|
vim.o.smartindent = true
|
||||||
|
vim.o.wrap = false
|
||||||
|
vim.o.cursorline = true
|
||||||
|
vim.o.termguicolors = true
|
||||||
|
vim.cmd('syntax enable')
|
||||||
|
vim.cmd('filetype plugin indent on')
|
||||||
|
|
||||||
|
|
||||||
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
|
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||||
|
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||||
|
if vim.v.shell_error ~= 0 then
|
||||||
|
vim.api.nvim_echo({
|
||||||
|
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||||
|
{ out, "WarningMsg" },
|
||||||
|
{ "\nPress any key to exit..." },
|
||||||
|
}, true, {})
|
||||||
|
vim.fn.getchar()
|
||||||
|
os.exit(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
vim.g.maplocalleader = "\\"
|
||||||
|
|
||||||
|
-- Setup lazy.nvim
|
||||||
|
require("lazy").setup({
|
||||||
|
spec = {
|
||||||
|
-- import your plugins
|
||||||
|
{ import = "plugins" },
|
||||||
|
},
|
||||||
|
-- Configure any other settings here. See the documentation for more details.
|
||||||
|
-- colorscheme that will be used when installing plugins.
|
||||||
|
install = { colorscheme = { "habamax" } },
|
||||||
|
-- automatically check for plugin updates
|
||||||
|
checker = { enabled = false },
|
||||||
|
})
|
||||||
|
vim.cmd("colorscheme ashen")
|
||||||
|
-- You may call the load function as well
|
||||||
|
-- Do NOT call them both; they both do
|
||||||
|
-- the same thing!
|
||||||
|
require("ashen").load()
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
|
||||||
|
"ashen.nvim": { "branch": "main", "commit": "bfb04bd50b69d863469b2deb9fb361cf0d945ba7" },
|
||||||
|
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||||
|
"cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" },
|
||||||
|
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
|
||||||
|
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||||
|
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||||
|
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||||
|
"lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" },
|
||||||
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "2304ff65ecc8cb2afc2484de3e2ed9a407edf0b9" },
|
||||||
|
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
|
||||||
|
"mini.animate": { "branch": "main", "commit": "8ce6df739aa9d14c876bace722af28c3d09e9971" },
|
||||||
|
"nvim-cmp": { "branch": "main", "commit": "a7bcf1d88069fc67c9ace8a62ba480b8fe879025" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "ac98db2f9f06a56498ec890a96928774eae412c3" },
|
||||||
|
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||||
|
"nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" },
|
||||||
|
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||||
|
"snacks.nvim": { "branch": "main", "commit": "903bf3ffb25bcb4b01168e2d9ed4e9a3fa7434d4" },
|
||||||
|
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||||
|
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extras": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"news": {
|
||||||
|
"NEWS.md": "11866"
|
||||||
|
},
|
||||||
|
"version": 8
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
icons = {
|
||||||
|
misc = {
|
||||||
|
dots = "",
|
||||||
|
},
|
||||||
|
ft = {
|
||||||
|
octo = "",
|
||||||
|
},
|
||||||
|
dap = {
|
||||||
|
Stopped = { " ", "DiagnosticWarn", "DapStoppedLine" },
|
||||||
|
Breakpoint = " ",
|
||||||
|
BreakpointCondition = " ",
|
||||||
|
BreakpointRejected = { " ", "DiagnosticError" },
|
||||||
|
LogPoint = ".>",
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
Error = " ",
|
||||||
|
Warn = " ",
|
||||||
|
Hint = " ",
|
||||||
|
Info = " ",
|
||||||
|
},
|
||||||
|
git = {
|
||||||
|
added = " ",
|
||||||
|
modified = " ",
|
||||||
|
removed = " ",
|
||||||
|
},
|
||||||
|
kinds = {
|
||||||
|
Array = " ",
|
||||||
|
Boolean = " ",
|
||||||
|
Class = " ",
|
||||||
|
Codeium = " ",
|
||||||
|
Color = " ",
|
||||||
|
Control = " ",
|
||||||
|
Collapsed = " ",
|
||||||
|
Constant = " ",
|
||||||
|
Constructor = " ",
|
||||||
|
Copilot = " ",
|
||||||
|
Enum = " ",
|
||||||
|
EnumMember = " ",
|
||||||
|
Event = " ",
|
||||||
|
Field = " ",
|
||||||
|
File = " ",
|
||||||
|
Folder = " ",
|
||||||
|
Function = " ",
|
||||||
|
Interface = " ",
|
||||||
|
Key = " ",
|
||||||
|
Keyword = " ",
|
||||||
|
Method = " ",
|
||||||
|
Module = " ",
|
||||||
|
Namespace = " ",
|
||||||
|
Null = " ",
|
||||||
|
Number = " ",
|
||||||
|
Object = " ",
|
||||||
|
Operator = " ",
|
||||||
|
Package = " ",
|
||||||
|
Property = " ",
|
||||||
|
Reference = " ",
|
||||||
|
Snippet = " ",
|
||||||
|
String = " ",
|
||||||
|
Struct = " ",
|
||||||
|
TabNine = " ",
|
||||||
|
Text = " ",
|
||||||
|
TypeParameter = " ",
|
||||||
|
Unit = " ",
|
||||||
|
Value = " ",
|
||||||
|
Variable = " ",
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
-- lua/plugins/cmp.lua
|
||||||
|
return {
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
event = "InsertEnter",
|
||||||
|
dependencies = {
|
||||||
|
-- Fuente para autocompletado de LSP
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
-- Fuente para autocompletado de buffers
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
-- Fuente para autocompletado de rutas
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
|
-- Motor de snippets
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
-- Fuente de snippets para nvim-cmp
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local cmp = require("cmp")
|
||||||
|
local luasnip = require("luasnip")
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
-- Configura el motor de snippets
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
-- Fuentes de autocompletado
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "luasnip" },
|
||||||
|
{ name = "buffer" },
|
||||||
|
{ name = "path" },
|
||||||
|
}),
|
||||||
|
-- Atajos de teclado para el menú de autocompletado
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
["<C-k>"] = cmp.mapping.select_prev_item(), -- Moverse hacia arriba
|
||||||
|
["<C-j>"] = cmp.mapping.select_next_item(), -- Moverse hacia abajo
|
||||||
|
["<C-b>"] = cmp.mapping.scroll_docs(-4), -- Scroll en la documentación
|
||||||
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
["<C-Space>"] = cmp.mapping.complete(), -- Mostrar sugerencias
|
||||||
|
["<C-e>"] = cmp.mapping.abort(), -- Cerrar menú
|
||||||
|
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Aceptar sugerencia
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
return {
|
||||||
|
-- LSP Config
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
event = { "BufReadPost", "BufNewFile", "FileType" },
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/nvim-cmp", -- Completion framework
|
||||||
|
"hrsh7th/cmp-nvim-lsp", -- LSP source for nvim-cmp
|
||||||
|
"hrsh7th/cmp-buffer", -- Buffer source for nvim-cmp
|
||||||
|
"hrsh7th/cmp-path", -- Path source for nvim-cmp
|
||||||
|
"L3MON4D3/LuaSnip", -- Snippet engine
|
||||||
|
"saadparwaiz1/cmp_luasnip", -- Snippet completion
|
||||||
|
"rafamadriz/friendly-snippets", -- Snippet collection
|
||||||
|
"hrsh7th/cmp-nvim-lsp-signature-help", -- LSP signature help source
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
-- Diagnostic options with signs configured
|
||||||
|
vim.diagnostic.config({
|
||||||
|
-- virtual_text = false, -- Disable virtual text (optional)
|
||||||
|
virtual_text = {
|
||||||
|
spacing = 4,
|
||||||
|
source = "if_many",
|
||||||
|
prefix = "●",
|
||||||
|
-- this will set set the prefix to a function that returns the diagnostics icon based on the severity
|
||||||
|
-- this only works on a recent 0.10.0 build. Will be set to "●" when not supported
|
||||||
|
-- prefix = "icons",
|
||||||
|
},
|
||||||
|
signs = {
|
||||||
|
text = {
|
||||||
|
[vim.diagnostic.severity.ERROR] = icons.diagnostics.Error, -- Error icon
|
||||||
|
[vim.diagnostic.severity.WARN] = icons.diagnostics.Warn, -- Warning icon
|
||||||
|
[vim.diagnostic.severity.HINT] = icons.diagnostics.Hint, -- Hint icon
|
||||||
|
[vim.diagnostic.severity.INFO] = icons.diagnostics.Info, -- Info icon
|
||||||
|
},
|
||||||
|
},
|
||||||
|
update_in_insert = false,
|
||||||
|
severity_sort = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Key mappings for diagnostic navigation
|
||||||
|
vim.api.nvim_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>',
|
||||||
|
{ noremap = true, silent = true })
|
||||||
|
vim.api.nvim_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>',
|
||||||
|
{ noremap = true, silent = true })
|
||||||
|
-- vim.api.nvim_set_keymap('n', '<leader>e', '<cmd>lua vim.diagnostic.open_float()<CR>',
|
||||||
|
-- { noremap = true, silent = true })
|
||||||
|
vim.api.nvim_set_keymap('n', '<leader>q', '<cmd>lua vim.diagnostic.setloclist()<CR>',
|
||||||
|
{ noremap = true, silent = true })
|
||||||
|
|
||||||
|
-- Show floating diagnostics automatically on hover
|
||||||
|
vim.api.nvim_create_autocmd("CursorHold", {
|
||||||
|
callback = function()
|
||||||
|
vim.diagnostic.open_float(nil, { focusable = false })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Autocompletion configuration
|
||||||
|
local cmp = require('cmp')
|
||||||
|
local luasnip = require('luasnip')
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body) -- For `luasnip` users.
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = {
|
||||||
|
['<Down>'] = cmp.mapping.select_next_item(),
|
||||||
|
['<Up>'] = cmp.mapping.select_prev_item(),
|
||||||
|
['<C-e>'] = cmp.mapping.abort(),
|
||||||
|
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||||
|
},
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'luasnip' }, -- For luasnip users.
|
||||||
|
}, {
|
||||||
|
{ name = 'buffer' },
|
||||||
|
{ name = 'path' },
|
||||||
|
}),
|
||||||
|
completion = {
|
||||||
|
completeopt = "menu,menuone,noinsert" .. (true and "" or ",noselect"),
|
||||||
|
},
|
||||||
|
experimental = {
|
||||||
|
ghost_text = true
|
||||||
|
},
|
||||||
|
formatting = {
|
||||||
|
format = function(entry, item)
|
||||||
|
local icons = icons.kinds
|
||||||
|
if icons[item.kind] then
|
||||||
|
item.kind = icons[item.kind] .. item.kind
|
||||||
|
end
|
||||||
|
|
||||||
|
local widths = {
|
||||||
|
abbr = vim.g.cmp_widths and vim.g.cmp_widths.abbr or 40,
|
||||||
|
menu = vim.g.cmp_widths and vim.g.cmp_widths.menu or 30,
|
||||||
|
}
|
||||||
|
|
||||||
|
for key, width in pairs(widths) do
|
||||||
|
if item[key] and vim.fn.strdisplaywidth(item[key]) > width then
|
||||||
|
item[key] = vim.fn.strcharpart(item[key], 0, width - 1) .. "…"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return item
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use buffer source for `/` in command mode
|
||||||
|
cmp.setup.cmdline('/', {
|
||||||
|
sources = {
|
||||||
|
{ name = 'buffer' }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use cmdline & path source for `:` in command mode
|
||||||
|
cmp.setup.cmdline(':', {
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'path' }
|
||||||
|
}, {
|
||||||
|
{ name = 'cmdline' }
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Load snippets from friendly-snippets
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
return {
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
-- follow latest release.
|
||||||
|
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
|
||||||
|
-- install jsregexp (optional!).
|
||||||
|
build = "make install_jsregexp",
|
||||||
|
|
||||||
|
dependencies = { "rafamadriz/friendly-snippets" },
|
||||||
|
|
||||||
|
config = function()
|
||||||
|
local ls = require("luasnip")
|
||||||
|
ls.filetype_extend("javascript", { "jsdoc" })
|
||||||
|
ls.filetype_extend("java", { "javadoc" })
|
||||||
|
local s = ls.snippet
|
||||||
|
local i = ls.insert_node
|
||||||
|
local t = ls.text_node
|
||||||
|
|
||||||
|
-- these are my custom snippets for cpp problem solving
|
||||||
|
ls.add_snippets("cpp", {
|
||||||
|
-- GCD Function
|
||||||
|
s("gcd", {
|
||||||
|
t("long long gcd(long long a, long long b) { // NOLINT(misc-no-recursion)"), t({ "", "\t" }),
|
||||||
|
t("if (b == 0) return a;"), t({ "", "\t" }),
|
||||||
|
t("return gcd(b, a % b);"), t({ "", "}" }),
|
||||||
|
}),
|
||||||
|
|
||||||
|
-- LCM Function
|
||||||
|
s("lcm", {
|
||||||
|
t("long long lcm(long long a, long long b) {"), t({ "", "\t" }),
|
||||||
|
t("return (a * b) / gcd(a, b);"), t({ "", "}" }),
|
||||||
|
}),
|
||||||
|
|
||||||
|
-- isPrime Function
|
||||||
|
s("isPrime", {
|
||||||
|
t("bool isPrime(long long number) {"), t({ "", "\t" }),
|
||||||
|
t("if (number <= 1) return false;"), t({ "", "\t" }),
|
||||||
|
t("for (int i = 2; i * i <= number; ++i) {"), t({ "", "\t\t" }),
|
||||||
|
t("if (number % i == 0) return false;"), t({ "", "\t" }),
|
||||||
|
t("}"), t({ "", "\t" }),
|
||||||
|
t("return true;"), t({ "", "}" }),
|
||||||
|
}),
|
||||||
|
|
||||||
|
-- for loop
|
||||||
|
s("fori", {
|
||||||
|
t("for (int i = "), i(1), t("; i < "), i(2), t("; ++i) {"),
|
||||||
|
t({ "", "\t" }), i(0),
|
||||||
|
t({ "", "}" })
|
||||||
|
}),
|
||||||
|
|
||||||
|
-- for each
|
||||||
|
s("forin", {
|
||||||
|
t("for ("), i(1), t(" : "), i(2), t(" ){"),
|
||||||
|
t({ "", "\t" }), i(0),
|
||||||
|
t({ "", "}" })
|
||||||
|
}),
|
||||||
|
|
||||||
|
-- convertToBinaryString Function
|
||||||
|
s("convertToBinaryString", {
|
||||||
|
t("string convertToBinaryString(long long k) {"), t({ "", "\t" }),
|
||||||
|
t("string binaryString;"), t({ "", "" }),
|
||||||
|
t("\tif (k == 0) {"), t({ "", "\t\t" }),
|
||||||
|
t('binaryString = "0";'), t({ "", "\t" }),
|
||||||
|
t("} else {"), t({ "", "\t\t" }),
|
||||||
|
t("while (k > 0) {"), t({ "", "\t\t\t" }),
|
||||||
|
t("long long bit = k & 1;"), t({ "", "\t\t\t" }),
|
||||||
|
t('binaryString.insert(0, std::to_string(bit));'), t({ "", "\t\t\t" }),
|
||||||
|
t("k >>= 1;"), t({ "", "\t\t" }),
|
||||||
|
t("}"), t({ "", "\t" }),
|
||||||
|
t("}"), t({ "", "\t" }),
|
||||||
|
t("return binaryString;"), t({ "", "}" })
|
||||||
|
}),
|
||||||
|
|
||||||
|
-- nCr Function
|
||||||
|
s("nCr", {
|
||||||
|
t("long long nCr(long long n, long long r) {"), t({ "", "\t" }),
|
||||||
|
t("long long ans = 1;"), t({ "", "\t" }),
|
||||||
|
t("long long div = 1;"), t({ "", "\t" }),
|
||||||
|
t("for (long long i = r + 1; i <= n; i++) {"), t({ "", "\t\t" }),
|
||||||
|
t("ans = ans * i;"), t({ "", "\t\t" }),
|
||||||
|
t("ans /= div;"), t({ "", "\t\t" }),
|
||||||
|
t("div++;"), t({ "", "\t" }),
|
||||||
|
t("}"), t({ "", "\t" }),
|
||||||
|
t("return ans;"), t({ "", "}" })
|
||||||
|
}),
|
||||||
|
|
||||||
|
-- nPr Function
|
||||||
|
s("nPr", {
|
||||||
|
t("long long nPr(long long n, long long r) {"), t({ "", "\t" }),
|
||||||
|
t("long long ans = 1;"), t({ "", "\t" }),
|
||||||
|
t("for (long long i = (n - r) + 1; i <= n; i++) {"), t({ "", "\t\t" }),
|
||||||
|
t("ans *= i;"), t({ "", "\t\t" }),
|
||||||
|
t("ans %= mod;"), t({ "", "\t" }),
|
||||||
|
t("}"), t({ "", "\t" }),
|
||||||
|
t("return ans;"), t({ "", "}" })
|
||||||
|
}),
|
||||||
|
|
||||||
|
-- fact Function
|
||||||
|
s("fact", {
|
||||||
|
t("long long fact(long long n) { // NOLINT(misc-no-recursion)"), t({ "", "\t" }),
|
||||||
|
t("if (n <= 1) return 1;"), t({ "", "\t" }),
|
||||||
|
t("return (n % mod * fact(n - 1) % mod) % mod;"), t({ "", "}" })
|
||||||
|
}),
|
||||||
|
|
||||||
|
-- convertToBaseK Function
|
||||||
|
s("convertToBaseK", {
|
||||||
|
t("string convertToBaseK(long long n, int k) {"), t({ "", "\t" }),
|
||||||
|
t("string result;"), t({ "", "\t" }),
|
||||||
|
t("while (n > 0) {"), t({ "", "\t\t" }),
|
||||||
|
t("long long remainder = n % k;"), t({ "", "\t\t" }),
|
||||||
|
t("result.insert(0, to_string(remainder));"), t({ "", "\t\t" }),
|
||||||
|
t("n /= k;"), t({ "", "\t" }),
|
||||||
|
t("}"), t({ "", "\t" }),
|
||||||
|
t("return result;"), t({ "", "}" })
|
||||||
|
}),
|
||||||
|
|
||||||
|
-- sieve function
|
||||||
|
s("sieve", {
|
||||||
|
t({
|
||||||
|
"void sieve(ll n) {",
|
||||||
|
" low.assign(n + 1, 0);",
|
||||||
|
"",
|
||||||
|
" for (int i = 2; i <= n; ++i) {",
|
||||||
|
" if (!low[i]) {",
|
||||||
|
" low[i] = i;",
|
||||||
|
" pr.push_back(i);",
|
||||||
|
" }",
|
||||||
|
"",
|
||||||
|
" for (int &j: pr) {",
|
||||||
|
" if (j > low[i] || i * j > n) break;",
|
||||||
|
" low[j * i] = j;",
|
||||||
|
" }",
|
||||||
|
" }",
|
||||||
|
"}",
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
ls.add_snippets("c", {
|
||||||
|
s("get_current_time_ms", {
|
||||||
|
t({
|
||||||
|
"long long get_current_time_ms() {",
|
||||||
|
" struct timeval tv;",
|
||||||
|
" gettimeofday(&tv, NULL);",
|
||||||
|
" return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);",
|
||||||
|
"}",
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
return {
|
||||||
|
-- Mason for managing LSP servers
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
config = function()
|
||||||
|
require("mason").setup()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
dependencies = { "neovim/nvim-lspconfig" },
|
||||||
|
config = function()
|
||||||
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
|
|
||||||
|
require("mason-lspconfig").setup({
|
||||||
|
ensure_installed = { "gopls"}, -- Add more LSP servers you need
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
return {
|
||||||
|
"nvim-mini/mini.animate",
|
||||||
|
event = "VeryLazy",
|
||||||
|
cond = vim.g.neovide == nil,
|
||||||
|
opts = function(_, opts)
|
||||||
|
-- don't use animate when scrolling with the mouse
|
||||||
|
local mouse_scrolled = false
|
||||||
|
for _, scroll in ipairs({ "Up", "Down" }) do
|
||||||
|
local key = "<ScrollWheel" .. scroll .. ">"
|
||||||
|
vim.keymap.set({ "", "i" }, key, function()
|
||||||
|
mouse_scrolled = true
|
||||||
|
return key
|
||||||
|
end, { expr = true })
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = "grug-far",
|
||||||
|
callback = function()
|
||||||
|
vim.b.minianimate_disable = true
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
Snacks.toggle({
|
||||||
|
name = "Mini Animate",
|
||||||
|
get = function()
|
||||||
|
return not vim.g.minianimate_disable
|
||||||
|
end,
|
||||||
|
set = function(state)
|
||||||
|
vim.g.minianimate_disable = not state
|
||||||
|
end,
|
||||||
|
}):map("<leader>ua")
|
||||||
|
|
||||||
|
local animate = require("mini.animate")
|
||||||
|
return vim.tbl_deep_extend("force", opts, {
|
||||||
|
resize = {
|
||||||
|
timing = animate.gen_timing.linear({ duration = 50, unit = "total" }),
|
||||||
|
},
|
||||||
|
scroll = {
|
||||||
|
timing = animate.gen_timing.linear({ duration = 150, unit = "total" }),
|
||||||
|
subscroll = animate.gen_subscroll.equal({
|
||||||
|
predicate = function(total_scroll)
|
||||||
|
if mouse_scrolled then
|
||||||
|
mouse_scrolled = false
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return total_scroll > 1
|
||||||
|
end,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
return { "nvim-tree/nvim-web-devicons", opts = {} }
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
return { "folke/snacks.nvim", opts = { dashboard = { enabled = false } } }
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
'nvim-telescope/telescope.nvim',
|
||||||
|
tag = '0.1.8',
|
||||||
|
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||||
|
config = function()
|
||||||
|
require('telescope').setup({
|
||||||
|
defaults = {
|
||||||
|
vimgrep_arguments = {
|
||||||
|
'rg',
|
||||||
|
'--color=never',
|
||||||
|
'--no-heading',
|
||||||
|
'--with-filename',
|
||||||
|
'--line-number',
|
||||||
|
'--column',
|
||||||
|
'--smart-case',
|
||||||
|
'--no-ignore', -- Include files ignored by .gitignore
|
||||||
|
'--hidden', -- Include hidden files
|
||||||
|
'--glob', '!target/', -- Exclude the `target/` directory
|
||||||
|
'--binary', -- Ignore all binary files
|
||||||
|
},
|
||||||
|
},
|
||||||
|
pickers = {
|
||||||
|
find_files = {
|
||||||
|
find_command = { 'rg', '--files', '--hidden', '--no-ignore', '--glob', '!target/', '--binary' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
extensions = {
|
||||||
|
themes = require('telescope.themes').get_dropdown({}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Keymap to bring up the colorscheme picker
|
||||||
|
vim.keymap.set('n', '<leader>uC', function()
|
||||||
|
require('telescope.builtin').colorscheme({
|
||||||
|
enable_preview = true, -- Shows preview of the colorschemes
|
||||||
|
})
|
||||||
|
end, { noremap = true, silent = true })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'nvim-telescope/telescope-ui-select.nvim',
|
||||||
|
config = function()
|
||||||
|
require("telescope").setup({
|
||||||
|
extensions = {
|
||||||
|
["ui-select"] = {
|
||||||
|
require("telescope.themes").get_dropdown {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
require("telescope").load_extension("ui-select")
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
return {
|
||||||
|
"ficcdaf/ashen.nvim",
|
||||||
|
-- optional but recommended,
|
||||||
|
-- pin to the latest stable release:
|
||||||
|
--tag = "*",
|
||||||
|
lazy = false,
|
||||||
|
priority = 1000,
|
||||||
|
-- configuration is optional!
|
||||||
|
opts = {
|
||||||
|
-- your settings here
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
return {
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
build = ':TSUpdate', -- Automatically update parsers on update
|
||||||
|
config = function()
|
||||||
|
require('nvim-treesitter.configs').setup {
|
||||||
|
ensure_installed = { "lua", "javascript", "python", "bash", "java", "c", "markdown", "go" }, -- Add other languages as needed
|
||||||
|
highlight = { enable = true }, -- Enable syntax highlighting using Tree-sitter
|
||||||
|
indent = { enable = true }, -- Enable indentation based on Tree-sitter
|
||||||
|
-- You can add other Tree-sitter modules here as needed
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user