Skip to content

Instantly share code, notes, and snippets.

@am-kantox
Last active April 11, 2025 15:45
Show Gist options
  • Save am-kantox/02afe6dcc0fed474d7c8d0e963b21336 to your computer and use it in GitHub Desktop.
Save am-kantox/02afe6dcc0fed474d7c8d0e963b21336 to your computer and use it in GitHub Desktop.
config.lua
-- 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
lvim.lsp.installer.setup.automatic_installation = false
lvim.format_on_save.enabled = true
lvim.colorscheme = "nord"
-- vim.opts.wrap = true
-- keymappings [view all the defaults by pressing <leader>Lk]
lvim.leader = "space"
lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
lvim.keys.normal_mode["<C-ы>"] = ":w<cr>"
lvim.keys.normal_mode["<C-f>"] = ":Telescope live_grep<CR>"
lvim.keys.normal_mode["<C-a>"] = ":Telescope live_grep<CR>"
lvim.keys.normal_mode["<C-o>"] = ":Telescope find_files<CR>"
lvim.keys.normal_mode["<C-b>"] = ":Telescope buffers<CR>"
lvim.keys.normal_mode["<C-k>"] = ":NvimTreeToggle<CR>"
lvim.keys.normal_mode["<C-t>"] = ":ToggleTerm<CR>"
-- lvim.keys.normal_mode["<C-p>"] = ":TranslateW<CR>"
lvim.keys.normal_mode["<C-p>"] = ":FuzzyOpen<CR>"
lvim.keys.normal_mode["<C-j>"] = ":BufferLineCycleNext<CR>"
lvim.keys.normal_mode["<C-h>"] = ":BufferLineCyclePrev<CR>"
lvim.keys.normal_mode["<C-l>"] = ":BufferKill<CR>"
lvim.keys.normal_mode["<C-ф>"] = ":startinsert<CR>"
vim.keymap.set({ "n", "x" }, "p", "<Plug>(YankyPutAfter)")
vim.keymap.set({ "n", "x" }, "P", "<Plug>(YankyPutBefore)")
vim.keymap.set({ "n", "x" }, "gp", "<Plug>(YankyGPutAfter)")
vim.keymap.set({ "n", "x" }, "gP", "<Plug>(YankyGPutBefore)")
lvim.keys.normal_mode["<C-e>"] = "<Plug>(YankyPreviousEntry)"
lvim.keys.normal_mode["<C-E>"] = "<Plug>(YankyNextEntry)"
lvim.keys.normal_mode["]p"] = "<Plug>(YankyPutIndentAfterLinewise)"
lvim.keys.normal_mode["[p"] = "<Plug>(YankyPutIndentBeforeLinewise)"
lvim.keys.normal_mode["]P"] = "<Plug>(YankyPutIndentAfterLinewise)"
lvim.keys.normal_mode["[P"] = "<Plug>(YankyPutIndentBeforeLinewise)"
lvim.keys.normal_mode[">p"] = "<Plug>(YankyPutIndentAfterShiftRight)"
lvim.keys.normal_mode["<p"] = "<Plug>(YankyPutIndentAfterShiftLeft)"
lvim.keys.normal_mode[">P"] = "<Plug>(YankyPutIndentBeforeShiftRight)"
lvim.keys.normal_mode["<P"] = "<Plug>(YankyPutIndentBeforeShiftLeft)"
lvim.keys.normal_mode["=p"] = "<Plug>(YankyPutAfterFilter)"
lvim.keys.normal_mode["=P"] = "<Plug>(YankyPutBeforeFilter)"
vim.keymap.set('n', '@q', ':bdelete<CR>', { desc = "Delete current buffer" })
vim.keymap.set('n', '@d', ':lua vim.diagnostic.open_float()<CR>', { desc = "Toggle Floating Diagnostics Window" })
vim.keymap.set('n', '@D', ':DiagWindowShow<CR>', { desc = "Toggle Diagnostics Window" })
vim.keymap.set('n', '@S', '<cmd>lua require("spectre").toggle()<CR>', { desc = "Toggle Spectre" })
vim.keymap.set({ 'n', 'v' }, '@ss', '<cmd>lua require("spectre").open_visual({select_word=true})<CR>',
{ desc = "Search current word" })
vim.keymap.set('n', '@sf', '<cmd>lua require("spectre").open_file_search({select_word=true})<CR>',
{ desc = "Search on current file" })
vim.keymap.set({ 'n', 'x' }, '@R', function() require('telescope').extensions.refactoring.refactors() end)
vim.keymap.set('i', '<C-`>', '<cmd>lua vim.lsp.scroll(4)<CR>', { desc = 'Scroll a pop-up down' })
lvim.builtin.which_key.mappings["d"] = {
name = "Diagnostics",
t = { "<cmd>TroubleToggle<cr>", "trouble" },
w = { "<cmd>TroubleToggle workspace_diagnostics<cr>", "workspace" },
d = { "<cmd>TroubleToggle document_diagnostics<cr>", "document" },
q = { "<cmd>TroubleToggle quickfix<cr>", "quickfix" },
l = { "<cmd>TroubleToggle loclist<cr>", "loclist" },
r = { "<cmd>TroubleToggle lsp_references<cr>", "references" },
}
lvim.builtin.which_key.mappings["t"] = {
name = "+Terminal",
f = { "<cmd>ToggleTerm<cr>", "Floating terminal" },
v = { "<cmd>2ToggleTerm size=30 direction=vertical<cr>", "Split vertical" },
h = { "<cmd>2ToggleTerm size=30 direction=horizontal<cr>", "Split horizontal" },
}
vim.api.nvim_set_keymap("n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "@h", "<cmd>lua vim.lsp.buf.hover()<CR>", { noremap = true, silent = true })
vim.cmd("nnoremap gpd <cmd>lua require('goto-preview').goto_preview_definition()<CR>")
vim.cmd("nnoremap gpi <cmd>lua require('goto-preview').goto_preview_implementation()<CR>")
vim.cmd("nnoremap gP <cmd>lua require('goto-preview').close_all_win()<CR>")
vim.g['gist_use_password_in_gitconfig'] = 1
lvim.lsp.installer.setup.ensure_installed = {}
-- [lexical] Add `elixirls` to `skipped_servers` list
-- vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "elixirls" })
-- [lexical] Remove `lexical` from `skipped_servers` list
-- lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server)
-- return server ~= "lexical"
-- end, lvim.lsp.automatic_configuration.skipped_servers)
local lspconfig = require("lspconfig")
local configs = require("lspconfig.configs")
-- [lexical]
-- local lexical_config = {
-- filetypes = { "elixir", "eelixir", "heex" },
-- cmd = { "/home/am/Proyectos/Elixir/lexical/_build/dev/package/lexical/bin/start_lexical.sh" },
-- settings = {},
-- }
-- if not configs.lexical then
-- configs.lexical = {
-- default_config = {
-- filetypes = lexical_config.filetypes,
-- cmd = lexical_config.cmd,
-- root_dir = function(fname)
-- return lspconfig.util.root_pattern("mix.exs", ".git")(fname) or vim.loop.os_homedir()
-- end,
-- -- optional settings
-- settings = lexical_config.settings,
-- },
-- }
-- end
-- lspconfig.lexical.setup({})
-- lspconfig.harper_ls.setup({
-- settings = {
-- ["harper-ls"] = {
-- linters = {
-- spell_check = true,
-- spelled_numbers = false,
-- an_a = true,
-- sentence_capitalization = true,
-- unclosed_quotes = true,
-- wrong_quotes = false,
-- long_sentences = true,
-- repeated_words = true,
-- spaces = true,
-- matcher = true,
-- correct_number_suffix = true,
-- number_suffix_capitalization = true,
-- multiple_sequential_pronouns = true,
-- linking_verbs = false,
-- avoid_curses = true,
-- terminating_conjunctions = true,
-- },
-- codeActions = {
-- forceStable = true
-- },
-- diagnosticSeverity = "hint" -- Can also be "information", "warning", or "error"
-- }
-- },
-- })
lvim.plugins = {
{ 'shaunsingh/nord.nvim' },
-- {
-- 'wfxr/minimap.vim',
-- build = "cargo install --locked code-minimap",
-- -- cmd = {"Minimap", "MinimapClose", "MinimapToggle", "MinimapRefresh", "MinimapUpdateHighlight"},
-- config = function()
-- vim.cmd("let g:minimap_width = 10")
-- vim.cmd("let g:minimap_auto_start = 1")
-- vim.cmd("let g:minimap_auto_start_win_enter = 1")
-- end,
-- },
{
"elixir-tools/elixir-tools.nvim",
-- version = "*",
event = { "BufReadPre", "BufNewFile" },
config = function()
local elixir = require("elixir")
local elixirls = require("elixir.elixirls")
elixir.setup {
elixirls = {
enable = true,
-- repo = "mhanberg/elixir-ls",
cmd = "/home/am/Proyectos/Other/elixir-ls/releases/language_server.sh",
settings = elixirls.settings {
enableTestLenses = true,
dialyzerEnabled = true,
fetchDeps = false,
suggestSpecs = false,
autoInsertRequiredAlias = false,
languageServerOverridePath = "/home/am/Proyectos/Other/elixir-ls/releases",
},
open_output_panel = { window = "float" },
on_attach = function(client, bufnr)
vim.keymap.set("n", "<space>fp", ":ElixirFromPipe<cr>", { buffer = true, noremap = true })
vim.keymap.set("n", "<space>tp", ":ElixirToPipe<cr>", { buffer = true, noremap = true })
vim.keymap.set("v", "<space>em", ":ElixirExpandMacro<cr>", { buffer = true, noremap = true })
vim.keymap.set("n", "@t", "<cmd>lua vim.lsp.codelens.run()<CR>", { buffer = true, noremap = true })
end,
},
nextls = { enable = false },
credo = { enable = true },
projectionist = { enable = true }
}
end,
dependencies = {
"nvim-lua/plenary.nvim",
},
},
{
"ThePrimeagen/refactoring.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
},
lazy = false,
config = function()
require("refactoring").setup({})
end,
},
{
"nvim-pack/nvim-spectre",
dependencies = {
"nvim-lua/plenary.nvim",
},
},
{ 'mg979/vim-visual-multi' },
{ 'chrisbra/unicode.vim' },
{ 'hkupty/iron.nvim' },
{ 'kdheepak/lazygit.nvim' },
{ 'wakatime/vim-wakatime' },
{ 'tpope/vim-unimpaired' },
{ 'tpope/vim-projectionist' },
{ 'hrsh7th/nvim-cmp' },
{ 'MattesGroeger/vim-bookmarks' },
{ 'wsdjeg/vim-fetch' },
{ 'jeffkreeftmeijer/vim-numbertoggle' },
{
"tpope/vim-fugitive",
cmd = {
"G",
"Git",
"Gdiffsplit",
"Gread",
"Gwrite",
"Ggrep",
"GMove",
"GDelete",
"GBrowse",
"GRemove",
"GRename",
"Glgrep",
"Gedit"
},
ft = { "fugitive" }
},
{
"mattn/vim-gist",
event = "BufRead",
dependencies = "mattn/webapi-vim",
},
{ "mrjones2014/nvim-ts-rainbow", },
{
"nvim-telescope/telescope-project.nvim",
event = "BufWinEnter",
init = function()
-- vim.cmd [[packadd telescope.nvim]]
end,
},
{
"rmagatti/goto-preview",
config = function()
require('goto-preview').setup {
width = 120, -- Width of the floating window
height = 25, -- Height of the floating window
default_mappings = false, -- Bind default mappings
debug = false, -- Print debug information
opacity = nil, -- 0-100 opacity level of the floating window where 100 is fully transparent.
post_open_hook = nil -- A function taking two arguments, a buffer and a window to be ran as a hook.
-- You can use "default_mappings = true" setup option
}
end,
},
{
"3rd/diagram.nvim",
dependencies = {
"3rd/image.nvim",
},
opts = { -- you can just pass {}, defaults below
renderer_options = {
mermaid = {
background = nil, -- nil | "transparent" | "white" | "#hex"
theme = nil, -- nil | "default" | "dark" | "forest" | "neutral"
scale = 1, -- nil | 1 (default) | 2 | 3 | ...
},
plantuml = {
charset = nil,
},
d2 = {
theme_id = nil,
dark_theme_id = nil,
scale = nil,
layout = nil,
sketch = nil,
},
}
},
},
{
"folke/trouble.nvim",
opts = {}, -- for default options, refer to the configuration section for custom setup.
cmd = "TroubleToggle",
keys = {
{
"<leader>xx",
"<cmd>Trouble diagnostics toggle<cr>",
desc = "Diagnostics (Trouble)",
},
{
"<leader>xX",
"<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
desc = "Buffer Diagnostics (Trouble)",
},
{
"<leader>cs",
"<cmd>Trouble symbols toggle focus=false<cr>",
desc = "Symbols (Trouble)",
},
{
"<leader>cl",
"<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
desc = "LSP Definitions / references / ... (Trouble)",
},
{
"<leader>xL",
"<cmd>Trouble loclist toggle<cr>",
desc = "Location List (Trouble)",
},
{
"<leader>xQ",
"<cmd>Trouble qflist toggle<cr>",
desc = "Quickfix List (Trouble)",
},
},
},
{ "cloudhead/neovim-fuzzy" },
{
"gbprod/yanky.nvim",
config = function()
require("yanky").setup({
{
ring = {
history_length = 1000,
storage = "shada",
storage_path = vim.fn.stdpath("data") .. "/databases/yanky.db", -- Only for sqlite storage
sync_with_numbered_registers = true,
cancel_event = "update",
ignore_registers = { "_" },
update_register_on_cycle = false,
},
picker = {
select = {
action = nil, -- nil to use default put action
},
telescope = {
use_default_mappings = true, -- if default mappings should be used
mappings = nil, -- nil to use default mappings or no mappings (see `use_default_mappings`)
},
},
system_clipboard = {
sync_with_ring = true,
},
preserve_cursor_position = {
enabled = true,
},
textobj = {
enabled = true,
},
},
highlight = {
on_put = true,
on_yank = true,
timer = 1500,
},
})
end,
},
{ "farmergreg/vim-lastplace" },
-- {
-- "folke/noice.nvim",
-- event = "VeryLazy",
-- config = function()
-- require("noice").setup({
-- lsp = {
-- -- override markdown rendering so that **cmp** and other plugins use **Treesitter**
-- override = {
-- ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
-- ["vim.lsp.util.stylize_markdown"] = true,
-- ["cmp.entry.get_documentation"] = true,
-- },
-- },
-- -- you can enable a preset for easier configuration
-- presets = {
-- bottom_search = true, -- use a classic bottom cmdline for search
-- command_palette = true, -- position the cmdline and popupmenu together
-- long_message_to_split = true, -- long messages will be sent to a split
-- inc_rename = false, -- enables an input dialog for inc-rename.nvim
-- lsp_doc_border = false, -- add a border to hover docs and signature help
-- },
-- })
-- end,
-- opts = {
-- -- add any options here
-- },
-- dependencies = {
-- -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
-- "MunifTanjim/nui.nvim",
-- -- OPTIONAL:
-- -- `nvim-notify` is only needed, if you want to use the notification view.
-- -- If not available, we use `mini` as the fallback
-- {
-- "rcarriga/nvim-notify",
-- config = function()
-- require("notify").setup {
-- stages = 'fade_in_slide_out',
-- background_colour = 'FloatShadow',
-- timeout = 500,
-- }
-- vim.notify = require('notify')
-- end
-- }
-- }
-- },
{
"cseickel/diagnostic-window.nvim",
dependencies = { "MunifTanjim/nui.nvim" }
},
-- {
-- "romgrk/nvim-treesitter-context",
-- config = function()
-- require("treesitter-context").setup {
-- enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
-- throttle = true, -- Throttles plugin updates (may improve performance)
-- max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
-- patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries.
-- -- For all filetypes
-- -- Note that setting an entry here replaces all other patterns for this entry.
-- -- By setting the 'default' entry below, you can control which nodes you want to
-- -- appear in the context window.
-- default = {
-- 'class',
-- 'function',
-- 'method',
-- },
-- },
-- }
-- end
-- },
}
lvim.builtin.treesitter.rainbow.enable = false
require("diagram").setup({
integrations = {
require("diagram.integrations.markdown"),
require("diagram.integrations.neorg"),
},
renderer_options = {
mermaid = {
theme = "forest",
},
plantuml = {
charset = "utf-8",
},
d2 = {
theme_id = 1,
},
},
})
lvim.builtin.telescope.on_config_done = function(telescope)
pcall(telescope.load_extension, "project")
pcall(telescope.load_extension, "yank_history")
-- load refactoring Telescope extension
pcall(telescope.load_extension, "refactoring")
-- pcall(telescope.load_extension, "frecency")
-- pcall(telescope.load_extension, "neoclip")
-- pcall(telescope.load_extension, "noice")
-- any other extensions loading
end
-- require("telescope").load_extension("yank_history")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment