Skip to content

Instantly share code, notes, and snippets.

@hubertlepicki
Created January 16, 2024 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hubertlepicki/45e3ba9ea01ebecf880bf1e8549c0604 to your computer and use it in GitHub Desktop.
Save hubertlepicki/45e3ba9ea01ebecf880bf1e8549c0604 to your computer and use it in GitHub Desktop.
My LunarVim config.lua file
-- Read the docs: https://www.lunarvim.org/docs/configuration
-- Example configs: https://github.com/LunarVim/starter.lvim
-- Video Tutorials: https://www.youtube.com/watch?v=sFA9kX-Ud_c&list=PLhoH5vyxr6QqGu0i7tt_XoVK9v-KvZ3m6
-- Forum: https://www.reddit.com/r/lunarvim/
-- Discord: https://discord.com/invite/Xb9B4Ny
--
-- Additional NeoVim plugins:
--
-- Copilot plugins. Restart lvim and run `:Copilot auth`
lvim.plugins = {
{
"zbirenbaum/copilot.lua",
cmd = "Copilot",
event = "InsertEnter",
config = function()
require("copilot").setup({})
end,
},
{
"zbirenbaum/copilot-cmp",
config = function ()
require("copilot_cmp").setup({
suggestion = { enabled = false },
panel = { enabled = false }
})
end
}
}
-- remove the list of buffers in the buffer line. I only want to see there tabs.
lvim.builtin.bufferline.active = false
lvim.builtin.treesitter.ensure_installed = { "comment", "markdown_inline", "regex", "eex", "elixir", "heex", "surface", "erlang", "html", "graphql" }
-- Below config is required to prevent copilot overriding Tab with a suggestion
-- when you're just trying to indent!
local has_words_before = function()
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_text(0, line-1, 0, line-1, col, {})[1]:match("^%s*$") == nil
end
local on_tab = vim.schedule_wrap(function(fallback)
local cmp = require("cmp")
if cmp.visible() and has_words_before() then
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
else
fallback()
end
end)
lvim.builtin.cmp.mapping["<Tab>"] = on_tab
-- Trigger fuzzy file searcher with Ctrl+P
lvim.keys.normal_mode["<C-p>"] = function()
require("lvim.core.telescope.custom-finders").find_project_files { previewer = true }
end
-- fix the indent repeat not working when in visual mode selecting the text, hitting indent (>) and
-- then trying to repeat it with .
vim.keymap.set("v", "<", "<")
vim.keymap.set("v", ">", ">")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment