diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fdddb29 --- /dev/null +++ b/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..e861b68 --- /dev/null +++ b/init.lua @@ -0,0 +1,37 @@ +vim.g.base46_cache = vim.fn.stdpath "data" .. "/base46/" +vim.g.mapleader = " " + +-- bootstrap lazy and all plugins +local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" + +if not vim.uv.fs_stat(lazypath) then + local repo = "https://github.com/folke/lazy.nvim.git" + vim.fn.system { "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath } +end + +vim.opt.rtp:prepend(lazypath) + +local lazy_config = require "configs.lazy" + +-- load plugins +require("lazy").setup({ + { + "NvChad/NvChad", + lazy = false, + branch = "v2.5", + import = "nvchad.plugins", + }, + + { import = "plugins" }, +}, lazy_config) + +-- load theme +dofile(vim.g.base46_cache .. "defaults") +dofile(vim.g.base46_cache .. "statusline") + +require "options" +require "autocmds" + +vim.schedule(function() + require "mappings" +end) diff --git a/lazy-lock.json b/lazy-lock.json index 6110bf9..a242e2c 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -23,7 +23,7 @@ "nvim-treesitter": { "branch": "main", "commit": "5cb05e1b0fa3c469958a2b26f36b3fe930af221c" }, "nvim-web-devicons": { "branch": "master", "commit": "737cf6c657898d0c697311d79d361288a1343d50" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, - "snacks.nvim": { "branch": "main", "commit": "9912042fc8bca2209105526ac7534e9a0c2071b2" }, + "telescope.nvim": { "branch": "master", "commit": "40aedd8a68c78a656a10a8d62d80c54af59420fb" }, "ui": { "branch": "v3.0", "commit": "cb75908a86720172594b30de147272c1b3a7f452" }, "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, "volt": { "branch": "main", "commit": "620de1321f275ec9d80028c68d1b88b409c0c8b1" }, diff --git a/lua/autocmds.lua b/lua/autocmds.lua new file mode 100644 index 0000000..d2db0bb --- /dev/null +++ b/lua/autocmds.lua @@ -0,0 +1 @@ +require "nvchad.autocmds" diff --git a/lua/chadrc.lua b/lua/chadrc.lua new file mode 100644 index 0000000..0907cc7 --- /dev/null +++ b/lua/chadrc.lua @@ -0,0 +1,34 @@ +-- This file needs to have same structure as nvconfig.lua +-- https://github.com/NvChad/ui/blob/v3.0/lua/nvconfig.lua +-- Please read that file to know all available options :( + +---@type ChadrcConfig +local M = {} +-- ui = { +-- statusline = { +-- separator_style = "arrow", +-- theme = "vscode" +-- } +-- } +-- } + + +M.base46 = { + theme = "wombat", + + -- hl_override = { + -- Comment = { italic = true }, + -- ["@comment"] = { italic = true }, + -- }, +} + +-- M.nvdash = { load_on_startup = true } + +M.ui = { + statusline = { + separator_style = "block", + -- theme = "vscode_colored" + } +} + +return M diff --git a/lua/configs/conform.lua b/lua/configs/conform.lua new file mode 100644 index 0000000..35ba6cf --- /dev/null +++ b/lua/configs/conform.lua @@ -0,0 +1,15 @@ +local options = { + formatters_by_ft = { + lua = { "stylua" }, + -- css = { "prettier" }, + -- html = { "prettier" }, + }, + + -- format_on_save = { + -- -- These options will be passed to conform.format() + -- timeout_ms = 500, + -- lsp_fallback = true, + -- }, +} + +return options diff --git a/lua/configs/lazy.lua b/lua/configs/lazy.lua new file mode 100644 index 0000000..cd170bd --- /dev/null +++ b/lua/configs/lazy.lua @@ -0,0 +1,47 @@ +return { + defaults = { lazy = true }, + install = { colorscheme = { "nvchad" } }, + + ui = { + icons = { + ft = "", + lazy = "󰂠 ", + loaded = "", + not_loaded = "", + }, + }, + + performance = { + rtp = { + disabled_plugins = { + "2html_plugin", + "tohtml", + "getscript", + "getscriptPlugin", + "gzip", + "logipat", + "netrw", + "netrwPlugin", + "netrwSettings", + "netrwFileHandlers", + "matchit", + "tar", + "tarPlugin", + "rrhelper", + "spellfile_plugin", + "vimball", + "vimballPlugin", + "zip", + "zipPlugin", + "tutor", + "rplugin", + "syntax", + "synmenu", + "optwin", + "compiler", + "bugreport", + "ftplugin", + }, + }, + }, +} diff --git a/lua/configs/lspconfig.lua b/lua/configs/lspconfig.lua new file mode 100644 index 0000000..1ced2ab --- /dev/null +++ b/lua/configs/lspconfig.lua @@ -0,0 +1,18 @@ +require("nvchad.configs.lspconfig").defaults() + +local servers = { "html", "cssls" } +vim.lsp.enable(servers) + +-- vim.lsp.elixirls.setup({ +-- cmd = { "elixir-ls" }, -- Path to the elixir-ls executable +-- filetypes = { "elixir", "eelixir" }, -- Filetypes associated with Elixir +-- settings = { +-- elixirLS = { +-- dialyzerEnabled = true, +-- fetchDeps = true, +-- enableTestLenses = true, +-- }, +-- } +-- }) + +-- read :h vim.lsp.config for changing options of lsp servers diff --git a/lua/mappings.lua b/lua/mappings.lua new file mode 100644 index 0000000..dea258e --- /dev/null +++ b/lua/mappings.lua @@ -0,0 +1,89 @@ +require "nvchad.mappings" + +-- add yours here + +local map = vim.keymap.set + +-- map("n", ";", ":", { desc = "CMD enter command mode" }) +map("i", "jk", "") + +-- map({ "n", "i", "v" }, "", " w ") + +-- Insert mode: paste from OS without autopairing +map("i", "", "", { desc = "paste from OS without autopairing" }) + +-- Window management +map("n", "wv", "v", { desc = "Split vertical" }) +map("n", "ws", "s", { desc = "Split horizontal" }) +map("n", "wo", "o", { desc = "Maximize split" }) +map("n", "wc", "c", { desc = "Close split" }) +map("n", "wx", "c", { desc = "Close split" }) +map("n", "w=", "=", { desc = "Even splits" }) +map("n", "h", "h", { desc = "Focus left split" }) +map("n", "j", "j", { desc = "Focus lower split" }) +map("n", "k", "k", { desc = "Focus upper split" }) +map("n", "l", "l", { desc = "Focus right split" }) + +-- File operations +map("n", "ee", ':e =expand("%:p:h" . "/" )', { desc = "Copy relative path to file" }) +map("n", "er", ":!echo -n % | pbcopy", { desc = "Copy absolute path to file" }) +map("n", "gn", ":Telescope resume", { desc = "Resume telescope" }) +map("n", "eu", '!!python -c "import uuid; print(uuid.uuid4())"', { desc = "Drop fresh uuid4" }) + +-- Clipboard operations +map("n", "", '"+y', { desc = "Copy to OS clipboard" }) + +-- Save +map("n", ",,", ":w", { desc = "Save" }) +map("n", " ", ":w", { desc = "Save" }) + +-- NvimTree Toggle +map("n", "n", " NvimTreeToggle ", { desc = "Toggle NvimTree" }) + +-- Toggle line numbers +map("n", "N", " set nu! ", { desc = "Toggle line number" }) + +-- Buffer operations +map("n", "x", "bdelete", { desc = "Close Buffer and window" }) +map("n", "X", "bdelete!", { desc = "Close Buffer and window!" }) +map("n", "c", "Bdelete", { desc = "Close Buffer" }) +map("n", "b", " Telescope buffers ", { desc = "Find buffers" }) + +-- Git operations +map("n", "gb", "Gitsigns blame", { desc = "Git blame" }) +map("n", "gB", "Gitsigns blame_line", { desc = "Git blame line" }) +map("n", "gu", "diffget //2", { desc = "Select left in conflict" }) +map("n", "gh", "diffget //3", { desc = "Select right in conflict" }) + +-- Floating diagnostics +map("n", "ge", function() + vim.diagnostic.open_float({ border = "rounded" }) +end, { desc = "Floating diagnostic" }) + +-- Buffer navigation +map("n", ",z", ":bnext", { desc = "Next buffer" }) +map("n", ",v", ":bprevious", { desc = "Previous buffer" }) +map("n", "z", function() + require("nvchad.tabufline").tabuflineNext() +end, { desc = "Goto next buffer" }) +map("n", "v", function() + require("nvchad.tabufline").tabuflinePrev() +end, { desc = "Goto prev buffer" }) + +-- Neotest commands +map("n", "tl", ":Neotest run last", { desc = "Neotest Run Last" }) +map("n", "ts", ":Neotest summary", { desc = "Neotest Summary" }) +map("n", "to", ":Neotest output", { desc = "Neotest Output" }) +map("n", "ta", ":Neotest output-panel", { desc = "Neotest Output Panel" }) + +-- Visual Mode +map("v", ">", ">gv", { desc = "Indent" }) +map("v", "", '"+y', { desc = "Copy to OS clipboard" }) + +-- LSP +map("n", "ls", ":LspInfo", { desc = "Show LSP info" }) +map("n", "go", vim.lsp.buf.format, { desc = "LSP formatting" }) +map("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" }) +map("n", "gr", vim.lsp.buf.references, { desc = "Find references" }) +map("n", "rn", vim.lsp.buf.rename, { desc = "Rename symbol" }) + diff --git a/lua/options.lua b/lua/options.lua new file mode 100644 index 0000000..ecc05c4 --- /dev/null +++ b/lua/options.lua @@ -0,0 +1,9 @@ +require "nvchad.options" + +-- add yours here! + +-- local o = vim.o +-- o.cursorlineopt ='both' -- to enable cursorline! + +vim.g.lua_snippets_path = { vim.fn.stdpath "config" .. "/snippets" } + diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua new file mode 100644 index 0000000..3ce6e39 --- /dev/null +++ b/lua/plugins/init.lua @@ -0,0 +1,74 @@ +return { + { + "stevearc/conform.nvim", + -- event = 'BufWritePre', -- uncomment for format on save + opts = require "configs.conform", + }, + + { + "neovim/nvim-lspconfig", + config = function() + require "configs.lspconfig" + end, + }, + + { + "elixir-tools/elixir-tools.nvim", + version = "*", + event = { "BufReadPre", "BufNewFile" }, + config = function() + local elixir = require "elixir" + local elixirls = require "elixir.elixirls" + + elixir.setup { + nextls = { enable = true }, + credo = {}, + elixirls = { + enable = true, + settings = elixirls.settings { + dialyzerEnabled = false, + enableTestLenses = false, + }, + on_attach = function(client, bufnr) + vim.keymap.set("n", "fp", ":ElixirFromPipe", { buffer = true, noremap = true }) + vim.keymap.set("n", "tp", ":ElixirToPipe", { buffer = true, noremap = true }) + vim.keymap.set("v", "em", ":ElixirExpandMacro", { buffer = true, noremap = true }) + end, + }, + } + end, + dependencies = { + "nvim-lua/plenary.nvim", + }, + }, + + { "tpope/vim-surround", lazy = false }, + { "famiu/bufdelete.nvim", lazy = false }, + + { + "lewis6991/gitsigns.nvim", + config = function(_, opts) + require("gitsigns").setup(opts) + end, + }, + + { + "lukas-reineke/indent-blankline.nvim", + enabled = false, + }, + + + + -- test new blink + -- { import = "nvchad.blink.lazyspec" }, + + -- { + -- "nvim-treesitter/nvim-treesitter", + -- opts = { + -- ensure_installed = { + -- "vim", "lua", "vimdoc", + -- "html", "css" + -- }, + -- }, + -- }, +} diff --git a/snippets/elixir.lua b/snippets/elixir.lua new file mode 100644 index 0000000..621980d --- /dev/null +++ b/snippets/elixir.lua @@ -0,0 +1,13 @@ +-- https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md +local ls = require "luasnip" +local s = ls.snippet +local t = ls.text_node +local i = ls.insert_node + +return { + s("iip", { + t '|> IO.inspect(label: "', + i(1, "label"), + t '")', + }), +}