summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--init.lua3
-rw-r--r--lua/config/keymaps.lua17
-rw-r--r--lua/config/lazy.lua27
-rw-r--r--lua/config/options.lua25
-rw-r--r--lua/plugins/blink.lua20
-rw-r--r--lua/plugins/comment.lua5
-rw-r--r--lua/plugins/conform.lua20
-rw-r--r--lua/plugins/gruvbox.lua10
-rw-r--r--lua/plugins/lsp.lua24
-rw-r--r--lua/plugins/lualine.lua5
-rw-r--r--lua/plugins/snacks.lua11
-rw-r--r--lua/plugins/treesitter.lua11
13 files changed, 179 insertions, 0 deletions
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", "<C-h>", "<C-w>h")
+map("n", "<C-j>", "<C-w>j")
+map("n", "<C-k>", "<C-w>k")
+map("n", "<C-l>", "<C-w>l")
+
+-- clear highligths and command
+map("n", "<Esc>", "<cmd>nohlsearch<CR><cmd>echo<CR>")
+
+-- file explorer
+map("n", "-", "<cmd>Ex<CR>")
+
+-- copy and paste using the system clipboard
+map({"n", "v"}, "<leader>y", '"+y')
+map({"n", "v"}, "<leader>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 = {
+ {
+ "<leader>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", "<leader>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 = {
+ { "<leader>ff", function() Snacks.picker.files() end },
+ { "<leader>fb", function() Snacks.picker.buffers({ focus = "list" }) end },
+ { "<leader>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
+}