summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua138
1 files changed, 138 insertions, 0 deletions
diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..08fbd5d
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,138 @@
+vim.loader.enable(true)
+
+vim.g.mapleader = " "
+vim.g.maplocalleader = ","
+
+vim.g.clipboard = "osc52"
+
+vim.g.loaded_2html_plugin = true
+vim.g.loaded_fzf = 1 -- installed by arch
+vim.g.loaded_gzip = 1
+vim.g.loaded_matchit = 1
+vim.g.loaded_netrw = 1
+vim.g.loaded_netrwPlugin = 1
+vim.g.loaded_tarPlugin = 1
+vim.g.loaded_tutor_mode_plugin = 1
+vim.g.loaded_zipPlugin = 1
+vim.g.loaded_zipPlugin = 1
+
+vim.g.loaded_node_provider = 0
+vim.g.loaded_perl_provider = 0
+vim.g.loaded_python3_provider = 0
+vim.g.loaded_ruby_provider = 0
+
+vim.g.my_treesitter_langs = {
+ "bash",
+ "c",
+ "cpp",
+ "css",
+ "diff",
+ "html",
+ "latex",
+ "lua",
+ "markdown",
+ "markdown_inline",
+ "python",
+ "rust",
+ "scss",
+ "vim",
+ "vimdoc",
+ "yaml",
+ "zig",
+}
+
+vim.api.nvim_create_autocmd("PackChanged", {
+ callback = function(ev)
+ -- only trigger on install or update
+ if not vim.tbl_contains({ "install", "update" }, ev.data.kind) then
+ return
+ end
+
+ local name, active = ev.data.spec.name, ev.data.active
+ if name == "nvim-treesitter" then
+ if not active then vim.cmd.packadd("nvim-treesitter") end
+ local nts = require("nvim-treesitter")
+ nts.install(vim.g.my_treesitter_langs, { summary = true })
+ nts.update(nil, { summary = true })
+ elseif name == "blink.cmp" then
+ if not active then vim.cmd.packadd("blink.cmp") end
+ require("mo.blink").build_rust()
+ end
+ end,
+})
+
+vim.pack.add({
+ "https://github.com/nvim-treesitter/nvim-treesitter",
+ "https://github.com/saghen/blink.cmp",
+ -- "https://github.com/MeanderingProgrammer/render-markdown.nvim",
+}, { load = false })
+
+vim.pack.add({
+ "https://github.com/ibhagwan/fzf-lua",
+}, {
+ load = function()
+ vim.api.nvim_create_user_command("FzfLua", function(data)
+ vim.api.nvim_del_user_command("FzfLua")
+ vim.cmd([[packadd fzf-lua]])
+ require("mo.fzf")
+ vim.cmd("FzfLua " .. data.args)
+ end, { nargs = "?" })
+ end,
+})
+
+vim.pack.add({
+ "https://github.com/neovim/nvim-lspconfig",
+
+ "https://github.com/moreka/alacritty.nvim",
+
+ "https://github.com/tpope/vim-fugitive",
+ "https://github.com/tpope/vim-surround",
+
+ "https://github.com/stevearc/quicker.nvim",
+ "https://github.com/stevearc/conform.nvim",
+
+ "https://github.com/stevearc/oil.nvim",
+
+ "https://github.com/nvim-mini/mini.nvim",
+
+ "https://github.com/lervag/vimtex",
+})
+
+vim.api.nvim_create_autocmd("ColorScheme", {
+ group = vim.api.nvim_create_augroup("init_config", {}),
+ callback = function()
+ for _, group in ipairs(vim.fn.getcompletion("@lsp", "highlight")) do
+ vim.api.nvim_set_hl(0, group, {})
+ end
+ end,
+})
+
+if vim.env.VIM_LIGHT == "1" then
+ vim.cmd.colorscheme("habarena")
+else
+ vim.cmd.colorscheme("notsoquiet")
+ vim.o.cursorlineopt = "number"
+end
+
+require("vim._extui").enable({})
+
+vim.lsp.config("*", {
+ on_attach = function(client, _)
+ -- NOTE: for nvim-cmp
+ -- vim.cmd([[packadd cmp-nvim-lsp]])
+ -- client.capabilities = require("cmp_nvim_lsp").default_capabilities()
+
+ -- NOTE: for blink.cmp
+ client.capabilities =
+ require("blink.cmp").get_lsp_capabilities(client.capabilities, true)
+ end,
+})
+
+vim.lsp.enable({
+ -- "clangd",
+ "emmylua_ls",
+ "jsonls",
+ -- "qmlls",
+ "rust_analyzer",
+ -- "ty",
+})