From 9e69e3554ee1dd56f055423de09a0a575fbe73b0 Mon Sep 17 00:00:00 2001 From: Marek Muzyka Date: Fri, 14 Nov 2025 19:26:59 +0100 Subject: Basic config --- .gitignore | 1 + init.lua | 3 +++ lua/config/keymaps.lua | 17 +++++++++++++++++ lua/config/lazy.lua | 27 +++++++++++++++++++++++++++ lua/config/options.lua | 25 +++++++++++++++++++++++++ lua/plugins/blink.lua | 20 ++++++++++++++++++++ lua/plugins/comment.lua | 5 +++++ lua/plugins/conform.lua | 20 ++++++++++++++++++++ lua/plugins/gruvbox.lua | 10 ++++++++++ lua/plugins/lsp.lua | 24 ++++++++++++++++++++++++ lua/plugins/lualine.lua | 5 +++++ lua/plugins/snacks.lua | 11 +++++++++++ lua/plugins/treesitter.lua | 11 +++++++++++ 13 files changed, 179 insertions(+) create mode 100644 .gitignore create mode 100644 init.lua create mode 100644 lua/config/keymaps.lua create mode 100644 lua/config/lazy.lua create mode 100644 lua/config/options.lua create mode 100644 lua/plugins/blink.lua create mode 100644 lua/plugins/comment.lua create mode 100644 lua/plugins/conform.lua create mode 100644 lua/plugins/gruvbox.lua create mode 100644 lua/plugins/lsp.lua create mode 100644 lua/plugins/lualine.lua create mode 100644 lua/plugins/snacks.lua create mode 100644 lua/plugins/treesitter.lua diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e033bc6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +lazy-lock.json diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..865ca51 --- /dev/null +++ b/init.lua @@ -0,0 +1,3 @@ +require("config.options") +require("config.keymaps") +require("config.lazy") diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua new file mode 100644 index 0000000..af9a88e --- /dev/null +++ b/lua/config/keymaps.lua @@ -0,0 +1,17 @@ +local map = vim.keymap.set + +-- move between windows +map("n", "", "h") +map("n", "", "j") +map("n", "", "k") +map("n", "", "l") + +-- clear highligths and command +map("n", "", "nohlsearchecho") + +-- file explorer +map("n", "-", "Ex") + +-- copy and paste using the system clipboard +map({"n", "v"}, "y", '"+y') +map({"n", "v"}, "p", '"+p') diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..f82efed --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,27 @@ +-- Bootstrap lazy.nvim +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) + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + install = { colorscheme = { "gruvbox" } }, + change_detection = { notify = false }, + ui = { border = "rounded" } +}) diff --git a/lua/config/options.lua b/lua/config/options.lua new file mode 100644 index 0000000..00ebeff --- /dev/null +++ b/lua/config/options.lua @@ -0,0 +1,25 @@ +vim.g.mapleader = " " + +local opt = vim.opt + +opt.expandtab = true +opt.tabstop = 2 +opt.shiftwidth = 0 + +opt.nu = true +opt.rnu = true +opt.signcolumn = "yes" + +opt.splitright = true +opt.splitbelow = true + +opt.showmode = false + +opt.winborder = "rounded" + +opt.virtualedit = "block" + +-- netrw config +vim.g.netrw_banner = 0 + +vim.diagnostic.config({ virtual_text = true }) diff --git a/lua/plugins/blink.lua b/lua/plugins/blink.lua new file mode 100644 index 0000000..cb26c56 --- /dev/null +++ b/lua/plugins/blink.lua @@ -0,0 +1,20 @@ +return { + { + "saghen/blink.cmp", + version = "*", + opts = { + keymap = { preset = "default" }, + appearance = { + use_nvim_cmp_as_default = true, + nerd_font_variant = 'mono' + }, + completion = { + accept = { auto_brackets = { enabled = false } }, + menu = { border = "none" } + }, + cmdline = { + enabled = false + } + } + } +} diff --git a/lua/plugins/comment.lua b/lua/plugins/comment.lua new file mode 100644 index 0000000..b9d7f3c --- /dev/null +++ b/lua/plugins/comment.lua @@ -0,0 +1,5 @@ +return { + "folke/ts-comments.nvim", + opts = {}, + event = "VeryLazy" +} diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua new file mode 100644 index 0000000..a7db2fb --- /dev/null +++ b/lua/plugins/conform.lua @@ -0,0 +1,20 @@ +return { + "stevearc/conform.nvim", + keys = { + { + "cf", + function() + require("conform").format({ async = true }) + end, + mode = "", + desc = "Format buffer", + }, + }, + opts = { + formatters_by_ft = { + cpp = { "clang-format" }, + ocaml = { "ocamlformat" }, + python = { "black" } + }, + } +} diff --git a/lua/plugins/gruvbox.lua b/lua/plugins/gruvbox.lua new file mode 100644 index 0000000..a366335 --- /dev/null +++ b/lua/plugins/gruvbox.lua @@ -0,0 +1,10 @@ +return { + "ellisonleao/gruvbox.nvim", + lazy = false, + priority = 1000, + opts = { transparent_mode = true }, + config = function(_, opts) + require("gruvbox").setup(opts) + vim.cmd.colorscheme("gruvbox") + end +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 0000000..e0340bd --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,24 @@ +return { + "neovim/nvim-lspconfig", + opts = { + servers = { + clangd = {}, + ocamllsp = {}, + pylsp = {} + } + }, + config = function(_, opts) + local lspconfig = require("lspconfig") + local on_attach = function(client, bufnr) + local opts = { buffer = bufnr } + vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) + vim.keymap.set("n", "cr", vim.lsp.buf.rename, opts) + end + for server, config in pairs(opts.servers) do + config.on_attach = on_attach + config.capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities) + vim.lsp.config(server, config) + vim.lsp.enable(server) + end + end +} diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua new file mode 100644 index 0000000..4c5111f --- /dev/null +++ b/lua/plugins/lualine.lua @@ -0,0 +1,5 @@ +return { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + opts = {} +} diff --git a/lua/plugins/snacks.lua b/lua/plugins/snacks.lua new file mode 100644 index 0000000..25848cd --- /dev/null +++ b/lua/plugins/snacks.lua @@ -0,0 +1,11 @@ +return { + "folke/snacks.nvim", + opts = { + picker = {} + }, + keys = { + { "ff", function() Snacks.picker.files() end }, + { "fb", function() Snacks.picker.buffers({ focus = "list" }) end }, + { "fc", function() Snacks.picker.files({ cwd = vim.fn.stdpath("config") }) end } + } +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..d42aca5 --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,11 @@ +return { + "nvim-treesitter/nvim-treesitter", + config = function() + require"nvim-treesitter.configs".setup({ + ensure_installed = { "cpp", "ocaml", "python" }, + highlight = { + enable = true, + } + }) + end +} -- cgit v1.2.3