summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--after/ftplugin/go.lua3
-rw-r--r--after/ftplugin/html.lua3
-rw-r--r--after/ftplugin/lua.lua3
-rw-r--r--after/ftplugin/markdown.lua2
-rw-r--r--after/ftplugin/nix.lua3
-rw-r--r--after/ftplugin/sh.lua3
-rw-r--r--after/ftplugin/text.lua2
-rw-r--r--after/ftplugin/zig.lua2
-rw-r--r--init.lua1
-rw-r--r--lazy-lock.json20
-rw-r--r--lua/custom/lazy.lua20
-rw-r--r--lua/custom/plugins/cmp.lua41
-rw-r--r--lua/custom/plugins/colorscheme.lua15
-rw-r--r--lua/custom/plugins/lsp.lua35
-rw-r--r--lua/custom/plugins/mini.lua7
-rw-r--r--lua/custom/plugins/oil.lua13
-rw-r--r--lua/custom/plugins/pairs.lua7
-rw-r--r--lua/custom/plugins/telescope.lua17
-rw-r--r--lua/custom/plugins/treesitter.lua17
-rw-r--r--lua/custom/plugins/undotree.lua6
-rw-r--r--lua/custom/plugins/zenmode.lua30
-rw-r--r--plugin/autocmd.lua13
-rw-r--r--plugin/keymaps.lua19
-rw-r--r--plugin/options.lua37
24 files changed, 319 insertions, 0 deletions
diff --git a/after/ftplugin/go.lua b/after/ftplugin/go.lua
new file mode 100644
index 0000000..753f08f
--- /dev/null
+++ b/after/ftplugin/go.lua
@@ -0,0 +1,3 @@
+vim.opt_local.shiftwidth = 4
+vim.opt_local.tabstop = 4
+vim.opt_local.expandtab = false
diff --git a/after/ftplugin/html.lua b/after/ftplugin/html.lua
new file mode 100644
index 0000000..78c5eeb
--- /dev/null
+++ b/after/ftplugin/html.lua
@@ -0,0 +1,3 @@
+vim.opt_local.shiftwidth = 2
+vim.opt_local.tabstop = 2
+vim.opt_local.expandtab = true
diff --git a/after/ftplugin/lua.lua b/after/ftplugin/lua.lua
new file mode 100644
index 0000000..78c5eeb
--- /dev/null
+++ b/after/ftplugin/lua.lua
@@ -0,0 +1,3 @@
+vim.opt_local.shiftwidth = 2
+vim.opt_local.tabstop = 2
+vim.opt_local.expandtab = true
diff --git a/after/ftplugin/markdown.lua b/after/ftplugin/markdown.lua
new file mode 100644
index 0000000..9e5828c
--- /dev/null
+++ b/after/ftplugin/markdown.lua
@@ -0,0 +1,2 @@
+vim.opt_local.spell = true
+vim.opt_local.textwidth = 79
diff --git a/after/ftplugin/nix.lua b/after/ftplugin/nix.lua
new file mode 100644
index 0000000..78c5eeb
--- /dev/null
+++ b/after/ftplugin/nix.lua
@@ -0,0 +1,3 @@
+vim.opt_local.shiftwidth = 2
+vim.opt_local.tabstop = 2
+vim.opt_local.expandtab = true
diff --git a/after/ftplugin/sh.lua b/after/ftplugin/sh.lua
new file mode 100644
index 0000000..78c5eeb
--- /dev/null
+++ b/after/ftplugin/sh.lua
@@ -0,0 +1,3 @@
+vim.opt_local.shiftwidth = 2
+vim.opt_local.tabstop = 2
+vim.opt_local.expandtab = true
diff --git a/after/ftplugin/text.lua b/after/ftplugin/text.lua
new file mode 100644
index 0000000..9e5828c
--- /dev/null
+++ b/after/ftplugin/text.lua
@@ -0,0 +1,2 @@
+vim.opt_local.spell = true
+vim.opt_local.textwidth = 79
diff --git a/after/ftplugin/zig.lua b/after/ftplugin/zig.lua
new file mode 100644
index 0000000..d217b58
--- /dev/null
+++ b/after/ftplugin/zig.lua
@@ -0,0 +1,2 @@
+vim.g.zig_fmt_parse_on_errors = 0
+vim.g.zig_fmt_autosave = 0
diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..6027699
--- /dev/null
+++ b/init.lua
@@ -0,0 +1 @@
+require("custom.lazy")
diff --git a/lazy-lock.json b/lazy-lock.json
new file mode 100644
index 0000000..1b0e82c
--- /dev/null
+++ b/lazy-lock.json
@@ -0,0 +1,20 @@
+{
+ "LuaSnip": { "branch": "master", "commit": "0f7bbce41ea152a94d12aea286f2ce98e63c0f58" },
+ "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
+ "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
+ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
+ "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
+ "lazy.nvim": { "branch": "main", "commit": "56ead98e05bb37a4ec28930a54d836d033cf00f2" },
+ "mini.nvim": { "branch": "main", "commit": "ccfc6300a5c17387f2899f979ecc04f942bee2a0" },
+ "neovim": { "branch": "main", "commit": "07a887a7bef4aacea8c7caebaf8cbf808cdc7a8e" },
+ "nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" },
+ "nvim-cmp": { "branch": "main", "commit": "be7bd4c5f860c79da97af3a26d489af50babfd4b" },
+ "nvim-lspconfig": { "branch": "master", "commit": "c646154d6e4db9b2979eeb517d0b817ad00c9c47" },
+ "nvim-treesitter": { "branch": "master", "commit": "efb2e9c607cab1e4f7171493b7c6f63bd39073fc" },
+ "nvim-web-devicons": { "branch": "master", "commit": "f09be61d05bebcba85bb47be1931322d51b95644" },
+ "oil.nvim": { "branch": "master", "commit": "99ce32f4a2ecf76263b72fcc31efb163faa1a941" },
+ "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
+ "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
+ "undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" },
+ "zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" }
+}
diff --git a/lua/custom/lazy.lua b/lua/custom/lazy.lua
new file mode 100644
index 0000000..4b4046d
--- /dev/null
+++ b/lua/custom/lazy.lua
@@ -0,0 +1,20 @@
+vim.g.mapleader = " "
+vim.g.maplocalleader = " "
+
+local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
+if not (vim.uv or vim.loop).fs_stat(lazypath) then
+ vim.fn.system({
+ "git",
+ "clone",
+ "--filter=blob:none",
+ "--branch=stable",
+ "https://github.com/folke/lazy.nvim.git",
+ lazypath,
+ })
+end
+
+vim.opt.rtp:prepend(lazypath)
+
+require("lazy").setup({ import = "custom/plugins" }, {
+ change_detection = { notify = false },
+})
diff --git a/lua/custom/plugins/cmp.lua b/lua/custom/plugins/cmp.lua
new file mode 100644
index 0000000..b092f65
--- /dev/null
+++ b/lua/custom/plugins/cmp.lua
@@ -0,0 +1,41 @@
+return {
+ "hrsh7th/nvim-cmp",
+ dependencies = {
+ "hrsh7th/cmp-nvim-lsp",
+ "hrsh7th/cmp-buffer",
+ "hrsh7th/cmp-path",
+ "L3MON4D3/LuaSnip",
+ "saadparwaiz1/cmp_luasnip",
+ },
+ lazy = false,
+ config = function()
+ vim.opt.completeopt = { "menu", "menuone", "noselect" }
+ vim.opt.shortmess:append("c")
+
+ local cmp = require("cmp")
+ cmp.setup({
+ preselect = cmp.PreselectMode.Item,
+
+ sources = {
+ { name = "nvim_lsp" },
+ { name = "luasnip" },
+ { name = "path" },
+ { name = "buffer" },
+ },
+
+ mapping = {
+ ["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
+ ["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
+ ["<C-y>"] = cmp.mapping.confirm({
+ behavior = cmp.SelectBehavior.Insert,
+ select = true,
+ }),
+ ["<Tab>"] = nil,
+ ["<S-Tab>"] = nil,
+ ["<CR>"] = nil,
+ },
+
+ snippet = { expand = function(args) vim.snippet.expand(args.body) end },
+ })
+ end,
+}
diff --git a/lua/custom/plugins/colorscheme.lua b/lua/custom/plugins/colorscheme.lua
new file mode 100644
index 0000000..1d1370e
--- /dev/null
+++ b/lua/custom/plugins/colorscheme.lua
@@ -0,0 +1,15 @@
+return {
+ "rose-pine/neovim",
+ config = function()
+ require("rose-pine").setup({
+ dim_inactive_windows = true,
+ styles = {
+ bold = true,
+ italic = false,
+ transparency = true,
+ },
+ })
+
+ vim.cmd.colorscheme("rose-pine")
+ end,
+}
diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua
new file mode 100644
index 0000000..256b460
--- /dev/null
+++ b/lua/custom/plugins/lsp.lua
@@ -0,0 +1,35 @@
+return {
+ "neovim/nvim-lspconfig",
+ config = function()
+ local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
+
+ local on_attach = function(client, bufnr)
+ local opts = { buffer = bufnr, noremap = true, silent = true }
+
+ if client.server_capabilities.inlayHintProvider then
+ vim.lsp.inlay_hint.enable(true)
+ end
+
+ vim.diagnostic.config({ virtual_text = true })
+
+ vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
+ vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
+ vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
+ end
+
+ local lspc = require("lspconfig")
+ local servers = {
+ "clangd",
+ "gopls",
+ "hls",
+ "nixd",
+ "pylsp",
+ "rust_analyzer",
+ "zls",
+ }
+
+ for _, s in ipairs(servers) do
+ lspc[s].setup({ on_attach = on_attach, capabilities = capabilities })
+ end
+ end,
+}
diff --git a/lua/custom/plugins/mini.lua b/lua/custom/plugins/mini.lua
new file mode 100644
index 0000000..084cb02
--- /dev/null
+++ b/lua/custom/plugins/mini.lua
@@ -0,0 +1,7 @@
+return {
+ "echasnovski/mini.nvim",
+ config = function()
+ require("mini.ai").setup()
+ require("mini.surround").setup()
+ end,
+}
diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua
new file mode 100644
index 0000000..32950fa
--- /dev/null
+++ b/lua/custom/plugins/oil.lua
@@ -0,0 +1,13 @@
+return {
+ "stevearc/oil.nvim",
+ dependencies = { "nvim-tree/nvim-web-devicons" },
+ config = function()
+ require("oil").setup({
+ default_file_explorer = true,
+ skip_confirm_for_simple_edits = true,
+ view_options = { show_hidden = true },
+ })
+
+ vim.keymap.set("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" })
+ end,
+}
diff --git a/lua/custom/plugins/pairs.lua b/lua/custom/plugins/pairs.lua
new file mode 100644
index 0000000..637b524
--- /dev/null
+++ b/lua/custom/plugins/pairs.lua
@@ -0,0 +1,7 @@
+return {
+ "windwp/nvim-autopairs",
+ event = "InsertEnter",
+ config = function()
+ require("nvim-autopairs").setup({ map_c_h = true })
+ end,
+}
diff --git a/lua/custom/plugins/telescope.lua b/lua/custom/plugins/telescope.lua
new file mode 100644
index 0000000..8593110
--- /dev/null
+++ b/lua/custom/plugins/telescope.lua
@@ -0,0 +1,17 @@
+return {
+ "nvim-telescope/telescope.nvim",
+ tag = "0.1.8",
+ dependencies = {
+ "nvim-lua/plenary.nvim",
+ },
+ config = function()
+ require("telescope").setup({})
+
+ local builtin = require("telescope.builtin")
+ vim.keymap.set("n", "<leader>sf", builtin.find_files, { desc = "[s]earch [f]iles" })
+ vim.keymap.set("n", "<leader>sg", builtin.live_grep, { desc = "[s]earch by [g]rep" })
+ vim.keymap.set("n", "<leader>sw", builtin.grep_string, { desc = "[s]earch current [w]ord" })
+ vim.keymap.set("n", "<leader>sb", builtin.buffers, { desc = "[s]earch [b]uffers" })
+ vim.keymap.set("n", "<leader>sh", builtin.help_tags, { desc = "[s]earch [h]elp" })
+ end,
+}
diff --git a/lua/custom/plugins/treesitter.lua b/lua/custom/plugins/treesitter.lua
new file mode 100644
index 0000000..3de7c04
--- /dev/null
+++ b/lua/custom/plugins/treesitter.lua
@@ -0,0 +1,17 @@
+return {
+ "nvim-treesitter/nvim-treesitter",
+ build = ":TSUpdate",
+ lazy = false,
+ config = function()
+ require("nvim-treesitter.configs").setup({
+ ensure_installed = { "nix", "lua", "bash" },
+ auto_install = true,
+ sync_install = false,
+ indent = { enable = true },
+ highlight = {
+ enable = true,
+ additional_vim_regex_highlighting = false,
+ },
+ })
+ end,
+}
diff --git a/lua/custom/plugins/undotree.lua b/lua/custom/plugins/undotree.lua
new file mode 100644
index 0000000..fe71c5a
--- /dev/null
+++ b/lua/custom/plugins/undotree.lua
@@ -0,0 +1,6 @@
+return {
+ "mbbill/undotree",
+ config = function()
+ vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
+ end,
+}
diff --git a/lua/custom/plugins/zenmode.lua b/lua/custom/plugins/zenmode.lua
new file mode 100644
index 0000000..7f4cc88
--- /dev/null
+++ b/lua/custom/plugins/zenmode.lua
@@ -0,0 +1,30 @@
+return {
+ "folke/zen-mode.nvim",
+ config = function()
+ vim.keymap.set("n", "<leader>zz", function()
+ require("zen-mode").setup({
+ window = {
+ width = 80,
+ options = {
+ signcolumn = "no",
+ number = false,
+ relativenumber = false,
+ wrap = true,
+ linebreak = true,
+ cursorline = false,
+ colorcolumn = "0",
+ },
+ },
+ plugins = {
+ gitsigns = { enabled = false },
+ options = {
+ enabled = true,
+ ruler = false,
+ showcmd = false,
+ },
+ },
+ })
+ require("zen-mode").toggle()
+ end)
+ end,
+}
diff --git a/plugin/autocmd.lua b/plugin/autocmd.lua
new file mode 100644
index 0000000..21b5f9f
--- /dev/null
+++ b/plugin/autocmd.lua
@@ -0,0 +1,13 @@
+local autocmd = vim.api.nvim_create_autocmd
+
+autocmd({ "TextYankPost" }, {
+ pattern = "*",
+ callback = function()
+ vim.highlight.on_yank({
+ higroup = "IncSearch",
+ timeout = 50,
+ })
+ end,
+})
+
+autocmd({ "BufWritePre" }, { pattern = "*", command = [[%s/\s\+$//e]] })
diff --git a/plugin/keymaps.lua b/plugin/keymaps.lua
new file mode 100644
index 0000000..62b6051
--- /dev/null
+++ b/plugin/keymaps.lua
@@ -0,0 +1,19 @@
+vim.keymap.set("n", "n", "nzzzv")
+vim.keymap.set("n", "N", "Nzzzv")
+vim.keymap.set("n", "J", "mzJ`z")
+vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
+vim.keymap.set("v", "K", ":m '>-2<CR>gv=gv")
+vim.keymap.set("n", "<C-d>", "<C-d>zz")
+vim.keymap.set("n", "<C-u>", "<C-u>zz")
+vim.keymap.set({ "n", "v" }, "<leader>d", [["_d]])
+vim.keymap.set("n", "<leader>f", vim.lsp.buf.format)
+vim.keymap.set("x", "<leader>p", [["_dP]])
+vim.keymap.set("n", "<leader>hh", ":help<Space>")
+vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
+vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
+vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]])
+vim.keymap.set("n", "<leader>Y", [["+Y]])
+vim.keymap.set("n", "<up>", "<C-w><up>")
+vim.keymap.set("n", "<down>", "<C-w><down>")
+vim.keymap.set("n", "<left>", "<C-w><left>")
+vim.keymap.set("n", "<right>", "<C-w><right>")
diff --git a/plugin/options.lua b/plugin/options.lua
new file mode 100644
index 0000000..c349c3a
--- /dev/null
+++ b/plugin/options.lua
@@ -0,0 +1,37 @@
+vim.opt.showcmd = true
+vim.opt.scrolloff = 8
+vim.opt.updatetime = 50
+
+vim.opt.number = true
+vim.opt.relativenumber = true
+
+vim.opt.shiftwidth = 4
+vim.opt.tabstop = 4
+vim.opt.expandtab = true
+vim.opt.smartindent = true
+
+vim.opt.wrap = false
+vim.opt.linebreak = false
+
+vim.opt.smartcase = true
+vim.opt.ignorecase = true
+vim.opt.hlsearch = false
+vim.opt.incsearch = true
+
+vim.opt.foldmethod = "syntax"
+vim.opt.foldlevel = 99
+
+vim.opt.signcolumn = "yes"
+vim.opt.colorcolumn = "80"
+vim.opt.cursorline = true
+vim.opt.cursorlineopt = "number"
+
+vim.opt.termguicolors = true
+vim.opt.isfname:append("@-@")
+
+vim.opt.swapfile = false
+vim.opt.backup = false
+vim.opt.undofile = true
+vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
+
+vim.opt.mouse = "va"