summaryrefslogtreecommitdiff
path: root/lua/config
diff options
context:
space:
mode:
authorRaymaekers Luca <luca@spacehb.net>2025-04-05 15:02:43 +0200
committerRaymaekers Luca <luca@spacehb.net>2025-04-05 15:20:16 +0200
commit19423cd7c17edae426c39e01683424089bc8c8c9 (patch)
tree52d9781a75fe7714392f7a931aece35b5126ede9 /lua/config
parent7870db20ff0594474daf7cab957cd936d4c246c7 (diff)
checkpoint
Diffstat (limited to 'lua/config')
-rw-r--r--lua/config/autocmds.lua20
-rw-r--r--lua/config/lazy.lua151
-rw-r--r--lua/config/lsp.lua160
-rw-r--r--lua/config/map.lua1
4 files changed, 1 insertions, 331 deletions
diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua
index f6033d6..1a4970b 100644
--- a/lua/config/autocmds.lua
+++ b/lua/config/autocmds.lua
@@ -33,14 +33,6 @@ autocmd("TermOpen", {
vim.keymap.set("t", "<Esc>", "<C-\\><C-n>", { noremap = true })
end,
})
--- -- close automatically when shell process exits
--- -- TODO: does not work
--- autocmd("TermClose", {
--- callback = function()
--- vim.cmd("bdelete")
--- end,
--- })
-vim.keymap.set("n", "!", "<cmd>sp<CR><cmd>term<CR>", { desc = "Open terminal" })
-- [[ preserve last position ]]
autocmd("BufReadPost", {
@@ -72,17 +64,5 @@ autocmd(
}
)
--- autocmd({ "BufNewFile", "BufRead" }, {
--- pattern = "*",
--- callback = function()
--- local output = vim.fn.system("git rev-parse --is-inside-work-tree")
--- if output == "true\n" then
--- vim.opt.signcolumn = "yes"
--- else
--- vim.opt.signcolumn = "no"
--- end
--- end,
--- })
-
-- Automatically resize panes
autocmd("VimResized", { pattern = "*", command = "wincmd =" })
diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua
index 1bd0b8a..4ced567 100644
--- a/lua/config/lazy.lua
+++ b/lua/config/lazy.lua
@@ -15,123 +15,8 @@ vim.opt.rtp:prepend(lazypath)
-- plugins installation and configuration
require("lazy").setup({
"echasnovski/mini.nvim",
- "tpope/vim-fugitive",
- "lewis6991/gitsigns.nvim",
"tpope/vim-vinegar",
- "tpope/vim-eunuch",
- -- "mg979/vim-visual-multi",
- {
- "brenton-leighton/multiple-cursors.nvim",
- version = "*", -- Use the latest tagged version
- opts = {
- custom_key_maps = {
- {
- "n",
- "<S-Tab>",
- function()
- require("multiple-cursors").align()
- end,
- },
- },
- },
- keys = {
- { "<C-j>", "<Cmd>MultipleCursorsAddDown<CR>", mode = { "n", "x" }, desc = "Add cursor and move down" },
- { "<C-k>", "<Cmd>MultipleCursorsAddUp<CR>", mode = { "n", "x" }, desc = "Add cursor and move up" },
-
- { "<C-Up>", "<Cmd>MultipleCursorsAddUp<CR>", mode = { "n", "i", "x" }, desc = "Add cursor and move up" },
- {
- "<C-Down>",
- "<Cmd>MultipleCursorsAddDown<CR>",
- mode = { "n", "i", "x" },
- desc = "Add cursor and move down",
- },
-
- {
- "<Leader>m",
- "<Cmd>MultipleCursorsAddVisualArea<CR>",
- mode = { "x" },
- desc = "Add cursors to the lines of the visual area",
- },
-
- { "<Leader>a", "<Cmd>MultipleCursorsAddMatches<CR>", mode = { "n", "x" }, desc = "Add cursors to cword" },
- {
- "<Leader>A",
- "<Cmd>MultipleCursorsAddMatchesV<CR>",
- mode = { "n", "x" },
- desc = "Add cursors to cword in previous area",
- },
-
- {
- "<Leader>d",
- "<Cmd>MultipleCursorsAddJumpNextMatch<CR>",
- mode = { "n", "x" },
- desc = "Add cursor and jump to next cword",
- },
- { "<Leader>D", "<Cmd>MultipleCursorsJumpNextMatch<CR>", mode = { "n", "x" }, desc = "Jump to next cword" },
-
- { "<Leader>l", "<Cmd>MultipleCursorsLock<CR>", mode = { "n", "x" }, desc = "Lock virtual cursors" },
- },
- },
- "jghauser/follow-md-links.nvim",
- "stevearc/conform.nvim",
"norcalli/nvim-colorizer.lua",
- "neovim/nvim-lspconfig",
- {
- "williamboman/mason.nvim",
- dependencies = {
- "williamboman/mason-lspconfig.nvim",
- -- for formatters and linters
- "WhoIsSethDaniel/mason-tool-installer.nvim",
- },
- config = function()
- require("mason").setup({
- ui = {
- border = "rounded",
- },
- })
- end,
- },
- {
- --snippets
- "L3MON4D3/LuaSnip",
- version = "v2.*",
- build = "make install_jsregexp",
- },
- -- "mfussenegger/nvim-lint",
- -- {
- -- "ray-x/lsp_signature.nvim",
- -- event = "LspAttach",
- -- },
- -- {
- -- "hrsh7th/nvim-cmp",
- -- dependencies = {
- -- "hrsh7th/cmp-nvim-lsp",
- -- "hrsh7th/cmp-path",
- -- "hrsh7th/cmp-buffer",
- -- "saadparwaiz1/cmp_luasnip",
- -- "onsails/lspkind.nvim",
- -- },
- -- event = { "InsertEnter", "CmdlineEnter" },
- -- },
- {
- "folke/which-key.nvim",
- event = "VeryLazy",
- opts = {
- win = {
- border = "rounded",
- },
- },
- keys = {
- {
- "<leader>?",
- function()
- require("which-key").show({ global = false })
- end,
- desc = "Buffer Local Keymaps (which-key)",
- },
- },
- },
-
{
"christoomey/vim-tmux-navigator",
cmd = {
@@ -151,29 +36,6 @@ require("lazy").setup({
},
{
- "ray-x/go.nvim",
- dependencies = { -- optional packages
- "ray-x/guihua.lua",
- "neovim/nvim-lspconfig",
- "nvim-treesitter/nvim-treesitter",
- },
- config = function()
- require("go").setup()
- end,
- event = { "CmdlineEnter" },
- ft = { "go", "gomod" },
- build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries
- },
-
- {
- "dstein64/vim-startuptime",
- cmd = "StartupTime",
- init = function()
- vim.g.startuptime_tries = 10
- end,
- },
-
- {
"gbprod/nord.nvim",
lazy = false,
priority = 1000,
@@ -220,19 +82,6 @@ require("lazy").setup({
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
},
- {
- "ThePrimeagen/harpoon",
- branch = "harpoon2",
- requires = { "nvim-lua/plenary.nvim", lazy = true },
- },
-
- -- DAP
- {
- {
- "mfussenegger/nvim-dap",
- },
- { "rcarriga/nvim-dap-ui", dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" } },
- },
}, {
-- lazy options
diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua
deleted file mode 100644
index 10235bf..0000000
--- a/lua/config/lsp.lua
+++ /dev/null
@@ -1,160 +0,0 @@
--- [[ Keybinds ]]
-local diagnostic = vim.diagnostic
-local lbuf = vim.lsp.buf
-local map = vim.keymap.set
-local builtin = require("telescope.builtin")
-
-map("n", " <cr>", lbuf.code_action, { desc = "Code actions" })
-map("n", "gd", lbuf.definition, { desc = "Definition" })
-map("i", "<C-k>", lbuf.hover)
-map("n", " lr", lbuf.rename, { desc = "Rename" })
-map("n", " li", builtin.lsp_implementations, { desc = "Implementation" })
-map("n", " ls", lbuf.signature_help, { desc = "Signature help" })
-map("n", " lh", lbuf.typehierarchy, { desc = "Type hierarchy" })
-map("n", " lf", lbuf.references, { desc = "References" })
-map("n", " ll", lbuf.document_symbol, { desc = "List symbols" })
-map("n", " lt", lbuf.type_definition, { desc = "Type definition" })
--- map("n", " lls", vim.lsp.handlers["workspace/symbol"])
-map("n", " lq", diagnostic.setqflist, { desc = "Diagnostic quickfix" })
-map("n", " >>", diagnostic.goto_next, { desc = "Diagnostic next" })
-map("n", " <<", diagnostic.goto_prev, { desc = "Diagnostic prev" })
-map("n", " <,", function()
- diagnostic.goto_next({ severity = diagnostic.ERROR })
-end, { desc = "Diagnostic next error" })
-map("n", " >.", function()
- diagnostic.goto_prev({ severity = diagnostic.ERROR })
-end, { desc = "Diagnostic prev error" })
-map("n", " vf", diagnostic.open_float, { desc = "Diagnostics open floating window" })
--- map("n", " ")
-
--- vim.lsp.inlay_hint(0, false)
-
--- [[ LSP Setups ]]
-
-local lspconfig = require("lspconfig")
-lspconfig.gopls.setup({})
--- lspconfig.clangd.setup({})
--- lspconfig.emmet_ls.setup({})
--- lspconfig.ts_ls.setup({})
--- lspconfig.powershell_es.setup({
--- cmd = {
--- "pwsh",
--- "-NoLog",
--- "-NoProfile",
--- "-Command",
--- "/home/aluc/.local/share/nvim/mason/packages/" ..
--- "powershell-editor-services/PowerShellEditorServices/Start-EditorServices.ps1",
--- },
--- })
--- lspconfig.lua_ls.setup({
--- -- with neovim support
--- on_init = function(client)
--- local path = client.workspace_folders[1].name
--- if vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc") then
--- return
--- end
---
--- client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
--- runtime = {
--- version = "LuaJIT",
--- },
--- -- Make the server aware of Neovim runtime files
--- workspace = {
--- checkThirdParty = false,
--- library = {
--- vim.env.VIMRUNTIME,
--- },
--- },
--- })
--- end,
--- settings = {
--- Lua = {},
--- },
--- })
-
--- rounded border around floating windows
-local _border = "rounded"
-vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
- border = _border,
-})
-vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
- border = _border,
-})
-vim.diagnostic.config({
- float = { border = _border },
-})
-
-local autocmd = vim.api.nvim_create_autocmd
-autocmd("LspAttach", {
- callback = function(args)
- local client = vim.lsp.get_client_by_id(args.data.client_id)
- if client == nil then
- return
- end
- if vim.tbl_contains({ "null-ls" }, client.name) then -- blacklist lsp
- return
- end
- end,
-})
-
-local ls = require("luasnip")
-
-local parse_snippet = ls.parser.parse_snippet
-
-map({ "i", "s" }, "<C-h>", function()
- if ls.expand_or_locally_jumpable() then
- ls.expand_or_jump()
- end
-end, { silent = true })
-map({ "i", "s" }, "<C-l>", function()
- if ls.locally_jumpable(-1) then
- ls.jump(-1)
- end
-end, { silent = true })
-map({ "i", "s" }, "<C-c>", function()
- if ls.choice_active() then
- ls.change_choice(1)
- end
-end, { silent = true })
-
-ls.config.set_config({
- history = true,
- -- Will update multiple nodes at the same time when in insert mode
- update_events = { "TextChanged", "TextChangedI" },
-})
-
-ls.add_snippets("go", {
- parse_snippet("main", "package main\n\nfunc main() {\n\t$0\n}"),
- parse_snippet("e", "if err != nil {\n\tpanic(err)$1\n}$0"),
- parse_snippet("ee", "if err != nil {\n\tfmt.Fprintln(os.Stderr, err)$1\n\tos.Exit(${2:1})\n}\n$0"),
- parse_snippet("eif", "if err := $1; err != nil {\n\tfmt.Println(err)$2\n}\n$0"),
- parse_snippet("pf", "fmt.Printf($0)"),
- parse_snippet("pl", "fmt.Println($0)"),
-})
-ls.add_snippets("sh", {
- parse_snippet("!", "#!/bin/sh\n$0"),
- parse_snippet("if", "if ${1:condition}; then\n\t$0\nfi"),
- parse_snippet("while", "while ${1:condition}; do\n\t$0\ndone"),
- parse_snippet("for", "for ${1:v} in ${2:list}; do\n\t$0\ndone"),
- parse_snippet("case", "case ${1:\\$var} in\n\t$0\nesac"),
-})
-ls.add_snippets("c", {
- parse_snippet("main", "int\nmain(int Argc, char *Args[])\n{\n\t$0\n\treturn 0;\n}"),
- parse_snippet(
- "uints",
- [[#include <stdint.h>
-typedef uint8_t u8;
-typedef uint16_t u16;
-typedef uint32_t u32;
-typedef uint64_t u64;
-typedef int8_t i8;
-typedef int16_t i16;
-typedef int32_t i32;
-typedef int64_t i64;
-typedef float f32;
-typedef double f64;
-]]
- ),
-})
-ls.add_snippets("typescript", { parse_snippet("cl", "console.log($0);") })
-ls.add_snippets("html", { parse_snippet("t", [[<$1>$0</$1>]]) })
diff --git a/lua/config/map.lua b/lua/config/map.lua
index 27c6bb9..fe0672c 100644
--- a/lua/config/map.lua
+++ b/lua/config/map.lua
@@ -38,6 +38,7 @@ map("n", " Q", "<cmd>qa!<cr>", { noremap = true })
map("n", " 1", "<cmd>%bd|e#<cr>", { noremap = true })
-- next tab
map("n", "+", "<cmd>tabe .<cr>", { noremap = true })
+map("n", "!", "<cmd>sp<CR><cmd>term<CR>", { desc = "Open terminal" })
-- better indenting
map("v", "<", "<gv")