Skip to content

Instantly share code, notes, and snippets.

@am-kantox
Last active August 4, 2024 10:02
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"
-- 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-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" })
-- lvim.builtin.which_key.mappings["t"] = {
-- 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" },
-- }
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
-- require("mason").setup()
-- require("mason-lspconfig").setup({
-- ensure_installed = {},
-- automatic_installation = { exclude = { "elixirls" } }
-- })
lvim.plugins = {
{ 'shaunsingh/nord.nvim' },
{
"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 = true },
credo = { enable = true },
projectionist = { enable = true }
}
end,
dependencies = {
"nvim-lua/plenary.nvim",
},
},
{
"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,
},
-- {
-- "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" }
},
-- {
-- 'nvim-tree/nvim-tree.lua',
-- requires = {
-- 'nvim-tree/nvim-web-devicons', -- optional
-- 'antosha417/nvim-lsp-file-operations', -- LSP file operation handling
-- },
-- }
}
-- lvim.builtin.treesitter.rainbow.enable = true
lvim.builtin.telescope.on_config_done = function(telescope)
pcall(telescope.load_extension, "project")
pcall(telescope.load_extension, "yank_history")
-- 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