Move modules folders

This commit is contained in:
Filippo Berto 2025-09-11 14:00:31 +02:00
parent 914909009c
commit c1101e7b45
Signed by: bertof
GPG key ID: 9DBF7E6A1D2CE9ED
183 changed files with 327 additions and 327 deletions

View file

@ -0,0 +1,37 @@
local cmp = require("cmp")
local luasnip = require("luasnip")
cmp.setup({
completion = {
completeopt = "menu,menuone,preview,noselect"
},
snippet = { -- configura how nvim-cmp interacts with snippet engine
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<Up>"] = cmp.mapping.select_prev_item(), -- previous suggestion
["<Down>"] = cmp.mapping.select_next_item(), -- next suggestion
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
["<C-e>"] = cmp.mapping.abort(), -- close cmpletion window
["<CR>"] = cmp.mapping.confirm({ select = false })
}),
-- sources for autocompletion
sources = cmp.config.sources({
{ name = "nvim_lsp" }, -- nvim_lsp
{ name = "luasnip" }, -- snippets
{ name = "buffer" }, -- text within current buffer
{ name = "path" }, -- file system paths
}),
})
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
cmp.event:on(
'confirm_done',
cmp_autopairs.on_confirm_done()
)

View file

@ -0,0 +1,98 @@
local lspconfig = require('lspconfig')
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local lsp_format = require("lsp-format")
-- Keymaps
local keymap = vim.keymap
local opts = { noremap = true, silent = true }
local on_attach = function(client, bufnr)
opts.buffer = bufnr
lsp_format.on_attach(client, bufrn)
opts.desc = "Show LSP references"
keymap.set("n", "gR", "<cmd>Telescope lsp_references<CR>", opts)
opts.desc = "Go to declaration"
keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
opts.desc = "Go to definition"
keymap.set("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts)
opts.desc = "Show LSP implementations"
keymap.set("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts)
opts.desc = "Show LSP type definitions"
keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<CR>", opts)
opts.desc = "See available code actions"
keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts)
opts.desc = "Smart rename"
keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
opts.desc = "Smart show diagnostics"
keymap.set("n", "<leader>D", "<cmd>Telescope diagnostics", opts)
opts.desc = "Smart show buffer diagnostics"
keymap.set("n", "<leader>D", "<cmd>Telescope diagnostics bufnr=0<CR>", opts)
opts.desc = "Smart show line diagnostics"
keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts)
opts.desc = "Go to previous diagnostic"
keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
opts.desc = "Go to next diagnostic"
keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
opts.desc = "Show documentation for what is under cursor"
keymap.set("n", "K", vim.lsp.buf.hover, opts)
opts.desc = "Restart LSP"
keymap.set("n", "<leader>rs", ":LspRestart<CR>", opts)
end
-- Change the Diagnostic symbols in the sign column (gutter)
-- (not in youtube nvim video)
local signs = { Error = "", Warn = "", Hint = "󰠠 ", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
end
-- LSP configuration
lspconfig["html"].setup { capabilities = capabilities, on_attach = on_attach}
lspconfig["gopls"].setup { capabilities = capabilities, on_attach = on_attach}
lspconfig["pylsp"].setup { capabilities = capabilities, on_attach = on_attach}
lspconfig["nil_ls"].setup { capabilities = capabilities, on_attach = on_attach, settings = {
["nil"] = {
formatting = { command = { "nixpkgs-fmt" } },
autoEvalInputs = true
}
}}
lspconfig["rust_analyzer"].setup { capabilities = capabilities, on_attach = on_attach}
lspconfig["texlab"].setup { capabilities = capabilities, on_attach = on_attach, settings = {
texlab = {
formatterLineLength = 0,
bibtexFormatter = "latexindent",
latexindent = { modifyLineBreaks = false },
chktex = { onEdit = true },
}
}}
lspconfig["clangd"].setup { capabilities = capabilities, on_attach = on_attach}
lspconfig["marksman"].setup { capabilities = capabilities, on_attach = on_attach}
lspconfig["yamlls"].setup { capabilities = capabilities, on_attach = on_attach, settings = {
yaml = {
keyOrdering = false,
schemas = {
["https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json"] = "*gitlab-ci*.{yml,yaml}",
["https://json.schemastore.org/ansible-playbook"] = "*play*.{yml,yaml}",
["https://json.schemastore.org/ansible-stable-2.9"] = "roles/tasks/*.{yml,yaml}",
["https://json.schemastore.org/chart"] = "Chart.{yml,yaml}",
["https://json.schemastore.org/dependabot-v2"] = ".github/dependabot.{yml,yaml}",
["https://json.schemastore.org/github-action"] = ".github/action.{yml,yaml}",
["https://json.schemastore.org/github-workflow"] = ".github/workflows/*",
["https://json.schemastore.org/hugo"] = "hugo.{yml,yaml,toml}",
["https://json.schemastore.org/kustomization"] = "kustomization.{yml,yaml}",
["https://json.schemastore.org/prettierrc"] = ".prettierrc.{yml,yaml}",
["https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json"] = "*api*.{yml,yaml}",
["https://raw.githubusercontent.com/argoproj/argo-workflows/master/api/jsonschema/schema.json"] = "*flow*.{yml,yaml}",
["https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json"] = "*docker-compose*.{yml,yaml}",
["kubernetes"] = "*.yaml",
}
}
}}
lspconfig["pylsp"].setup({
capabilities = capabilities,
on_attach = on_attach,
})
-- lspconfig["cmake-language-server"].setup { capabilities = capabilities, on_attach = on_attach}
-- lspconfig["vscode-css-language-server"].setup { capabilities = capabilities, on_attach = on_attach}

View file

@ -0,0 +1,150 @@
{
"Thesis structure": {
"prefix": "thesis structure",
"body": [
"## Introduction",
"",
"- Def. problema",
"- Motivations",
"- Thesis/Research questions",
"",
"## Background",
"",
"- Basic information required to understand the research",
"- Related work (similar works, pubblications)",
"",
"## Methodology",
"",
"- How do i test the thesis",
"",
"## Experiments",
"",
"- I do the experiments and verify the thesis (I try to disprove it)",
"",
"## Discussion",
"",
"- Comments on the obtained results",
"",
"## Conclusioni",
"",
"- Summary of the contents",
"- Remarks on future works",
""
],
"description": "Thesis structure"
},
"Person": {
"prefix": "person",
"body": [
"---",
"aliases: []",
"type: person",
"relationship: []",
"email: ${2:email}",
"---",
"",
"# ${1:example}",
"",
"- **Email**: ${2:email}"
],
"description": "Person"
},
"Thesis student": {
"prefix": "thesis student",
"body": [
"---",
"type: person",
"email: ${2:email}",
"relationships: [thesis_student]",
"supervisor: ${4:supervisor}",
"cosupervisors: [Filippo Berto]",
"thesis: ${3:thesis title}",
"---",
"",
"# ${1:name}",
"",
"- **Email**: ${2:example}",
"- **Thesis**: [[${3:thesis title}]]",
"- **Supervisor**: [[${4:supervisor}]]",
"- **Co-supervisor**: [Filippo Berto]"
],
"description": "Thesis student"
},
"Thesis": {
"prefix": "thesis",
"body": [
"---",
"type: thesis",
"title: ${1:title}",
"grade: ${2:grade}",
"supervisor: ${3:supervisor}",
"cosupervisors: [Filippo Berto]",
"tags: [${4:example}]",
"---",
"",
"# ${1:title}",
"",
"- **Supervisor**: [[${2:supervisor}]]",
"- **Co-supervisor**: [[Filippo Berto]]",
"- **Grade**: ${3:grade}",
"",
"**Main points**:"
],
"description": "Thesis"
},
"Meeting": {
"prefix": "meeting",
"body": [
"---",
"type: meeting",
"people: [Filippo Berto, ${2:people}]",
"date: $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE",
"topic: ${1:title}",
"---",
"",
"# ${1:title}",
"",
"## Step 1",
"",
"## Step 2"
],
"description": "Meeting"
},
"Note of the day": {
"prefix": "note of the day",
"body": [
"---",
"date: $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE",
"---",
"",
"# ${1:title}",
"",
"## Step 1",
"",
"## Step 2"
],
"description": "Note of the day"
},
"Paper review": {
"prefix": "paper review",
"body": [
"# Paper review: ${1:title}",
"",
"## Notes",
"",
"${1:notes}",
"",
"## Overall evaluation",
"",
"${2:evaluation}",
"",
"## Comments",
"",
"${3:comments}",
"",
"## Confidential remarks",
"",
"${4:confidential remarks}"
]
}
}

View file

@ -0,0 +1,17 @@
{
"name": "personal-snippets",
"engines": {
"vscode": "^1.11.0"
},
"contributes": {
"snippets": [
{
"language": [
"markdown",
"rmd"
],
"path": "./markdown.json"
}
]
}
}

View file

@ -0,0 +1,27 @@
local telescope = require("telescope")
local actions = require("telescope.actions")
telescope.setup({
defaults = {
mappings = {
i = {
["<C-k>"] = actions.move_selection_previous, -- move to prev result
["<C-j>"] = actions.move_selection_next, -- move to next result
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
}
}
}
})
telescope.load_extension("fzf");
local keymap = vim.keymap
keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>", { desc = "Fuzzy find files in cwd" })
keymap.set("n", "<leader>fr", "<cmd>Telescope oldfiles<cr>", { desc = "Fuzzy find recent files" })
keymap.set("n", "<leader>fs", "<cmd>Telescope live_grep<cr>", { desc = "Find string in cwd" })
keymap.set("n", "<leader>fS", "<cmd>Telescope lsp_document_symbols<cr>", { desc = "Find symbols in document" })
keymap.set("n", "<leader>fc", "<cmd>Telescope grep_string<cr>", { desc = "Fuzzy string under cursor in cwd" })
keymap.set("n", "<leader>b", "<cmd>Telescope buffers<cr>", { desc = "Fuzzy search buffer names" })
keymap.set("n", "<leader>s", "<cmd>Telescope treesitter<cr>", { desc = "Fuzzy search treesitter symbols" })